1 |
commit: 3ac5240a9bfb25fcccf86bc529769454f63b38e9 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 9 12:54:16 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 9 12:54:16 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3ac5240a |
7 |
|
8 |
Linux patch 4.9.250 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1249_linux-4.9.250.patch | 1255 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1259 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index bfcfe3d..85b0ad7 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1039,6 +1039,10 @@ Patch: 1248_linux-4.9.249.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.9.249 |
23 |
|
24 |
+Patch: 1249_linux-4.9.250.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.9.250 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1249_linux-4.9.250.patch b/1249_linux-4.9.250.patch |
33 |
new file mode 100644 |
34 |
index 0000000..5b8f84c |
35 |
--- /dev/null |
36 |
+++ b/1249_linux-4.9.250.patch |
37 |
@@ -0,0 +1,1255 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index ef1c9929cdcc7..525d7ec7249d6 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 9 |
45 |
+-SUBLEVEL = 249 |
46 |
++SUBLEVEL = 250 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Roaring Lionus |
49 |
+ |
50 |
+diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c |
51 |
+index 47fb336741d43..e26552708a281 100644 |
52 |
+--- a/arch/powerpc/sysdev/mpic_msgr.c |
53 |
++++ b/arch/powerpc/sysdev/mpic_msgr.c |
54 |
+@@ -196,7 +196,7 @@ static int mpic_msgr_probe(struct platform_device *dev) |
55 |
+ |
56 |
+ /* IO map the message register block. */ |
57 |
+ of_address_to_resource(np, 0, &rsrc); |
58 |
+- msgr_block_addr = ioremap(rsrc.start, resource_size(&rsrc)); |
59 |
++ msgr_block_addr = devm_ioremap(&dev->dev, rsrc.start, resource_size(&rsrc)); |
60 |
+ if (!msgr_block_addr) { |
61 |
+ dev_err(&dev->dev, "Failed to iomap MPIC message registers"); |
62 |
+ return -EFAULT; |
63 |
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S |
64 |
+index 10ecfba43dff0..c864245fa119d 100644 |
65 |
+--- a/arch/x86/entry/entry_64.S |
66 |
++++ b/arch/x86/entry/entry_64.S |
67 |
+@@ -58,7 +58,7 @@ ENDPROC(native_usergs_sysret64) |
68 |
+ |
69 |
+ .macro TRACE_IRQS_IRETQ |
70 |
+ #ifdef CONFIG_TRACE_IRQFLAGS |
71 |
+- bt $9, EFLAGS(%rsp) /* interrupts off? */ |
72 |
++ btl $9, EFLAGS(%rsp) /* interrupts off? */ |
73 |
+ jnc 1f |
74 |
+ TRACE_IRQS_ON |
75 |
+ 1: |
76 |
+diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c |
77 |
+index 9a4ac6fd262ac..27c9d7a5b4dee 100644 |
78 |
+--- a/drivers/block/xen-blkback/xenbus.c |
79 |
++++ b/drivers/block/xen-blkback/xenbus.c |
80 |
+@@ -646,7 +646,8 @@ static int xen_blkbk_probe(struct xenbus_device *dev, |
81 |
+ /* setup back pointer */ |
82 |
+ be->blkif->be = be; |
83 |
+ |
84 |
+- err = xenbus_watch_pathfmt(dev, &be->backend_watch, backend_changed, |
85 |
++ err = xenbus_watch_pathfmt(dev, &be->backend_watch, NULL, |
86 |
++ backend_changed, |
87 |
+ "%s/%s", dev->nodename, "physical-device"); |
88 |
+ if (err) |
89 |
+ goto fail; |
90 |
+diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c |
91 |
+index 5fb571d031537..93c5040c64541 100644 |
92 |
+--- a/drivers/iio/imu/bmi160/bmi160_core.c |
93 |
++++ b/drivers/iio/imu/bmi160/bmi160_core.c |
94 |
+@@ -110,6 +110,13 @@ enum bmi160_sensor_type { |
95 |
+ |
96 |
+ struct bmi160_data { |
97 |
+ struct regmap *regmap; |
98 |
++ /* |
99 |
++ * Ensure natural alignment for timestamp if present. |
100 |
++ * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts. |
101 |
++ * If fewer channels are enabled, less space may be needed, as |
102 |
++ * long as the timestamp is still aligned to 8 bytes. |
103 |
++ */ |
104 |
++ __le16 buf[12] __aligned(8); |
105 |
+ }; |
106 |
+ |
107 |
+ const struct regmap_config bmi160_regmap_config = { |
108 |
+@@ -385,7 +392,6 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) |
109 |
+ struct iio_poll_func *pf = p; |
110 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
111 |
+ struct bmi160_data *data = iio_priv(indio_dev); |
112 |
+- s16 buf[16]; /* 3 sens x 3 axis x s16 + 3 x s16 pad + 4 x s16 tstamp */ |
113 |
+ int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L; |
114 |
+ __le16 sample; |
115 |
+ |
116 |
+@@ -395,10 +401,10 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) |
117 |
+ &sample, sizeof(__le16)); |
118 |
+ if (ret < 0) |
119 |
+ goto done; |
120 |
+- buf[j++] = sample; |
121 |
++ data->buf[j++] = sample; |
122 |
+ } |
123 |
+ |
124 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, |
125 |
++ iio_push_to_buffers_with_timestamp(indio_dev, data->buf, |
126 |
+ iio_get_time_ns(indio_dev)); |
127 |
+ done: |
128 |
+ iio_trigger_notify_done(indio_dev->trig); |
129 |
+diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c |
130 |
+index b4f643fb3b1ed..d523bc51ff265 100644 |
131 |
+--- a/drivers/iio/magnetometer/mag3110.c |
132 |
++++ b/drivers/iio/magnetometer/mag3110.c |
133 |
+@@ -52,6 +52,12 @@ struct mag3110_data { |
134 |
+ struct i2c_client *client; |
135 |
+ struct mutex lock; |
136 |
+ u8 ctrl_reg1; |
137 |
++ /* Ensure natural alignment of timestamp */ |
138 |
++ struct { |
139 |
++ __be16 channels[3]; |
140 |
++ u8 temperature; |
141 |
++ s64 ts __aligned(8); |
142 |
++ } scan; |
143 |
+ }; |
144 |
+ |
145 |
+ static int mag3110_request(struct mag3110_data *data) |
146 |
+@@ -262,10 +268,9 @@ static irqreturn_t mag3110_trigger_handler(int irq, void *p) |
147 |
+ struct iio_poll_func *pf = p; |
148 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
149 |
+ struct mag3110_data *data = iio_priv(indio_dev); |
150 |
+- u8 buffer[16]; /* 3 16-bit channels + 1 byte temp + padding + ts */ |
151 |
+ int ret; |
152 |
+ |
153 |
+- ret = mag3110_read(data, (__be16 *) buffer); |
154 |
++ ret = mag3110_read(data, data->scan.channels); |
155 |
+ if (ret < 0) |
156 |
+ goto done; |
157 |
+ |
158 |
+@@ -274,10 +279,10 @@ static irqreturn_t mag3110_trigger_handler(int irq, void *p) |
159 |
+ MAG3110_DIE_TEMP); |
160 |
+ if (ret < 0) |
161 |
+ goto done; |
162 |
+- buffer[6] = ret; |
163 |
++ data->scan.temperature = ret; |
164 |
+ } |
165 |
+ |
166 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
167 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
168 |
+ iio_get_time_ns(indio_dev)); |
169 |
+ |
170 |
+ done: |
171 |
+diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c |
172 |
+index 993bb7a72985f..170a177653c9f 100644 |
173 |
+--- a/drivers/media/usb/dvb-usb/gp8psk.c |
174 |
++++ b/drivers/media/usb/dvb-usb/gp8psk.c |
175 |
+@@ -186,7 +186,7 @@ out_rel_fw: |
176 |
+ |
177 |
+ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) |
178 |
+ { |
179 |
+- u8 status, buf; |
180 |
++ u8 status = 0, buf; |
181 |
+ int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); |
182 |
+ |
183 |
+ if (onoff) { |
184 |
+diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c |
185 |
+index b9da2c6cc9818..0bdfa90ea6cda 100644 |
186 |
+--- a/drivers/misc/vmw_vmci/vmci_context.c |
187 |
++++ b/drivers/misc/vmw_vmci/vmci_context.c |
188 |
+@@ -750,7 +750,7 @@ static int vmci_ctx_get_chkpt_doorbells(struct vmci_ctx *context, |
189 |
+ return VMCI_ERROR_MORE_DATA; |
190 |
+ } |
191 |
+ |
192 |
+- dbells = kmalloc(data_size, GFP_ATOMIC); |
193 |
++ dbells = kzalloc(data_size, GFP_ATOMIC); |
194 |
+ if (!dbells) |
195 |
+ return VMCI_ERROR_NO_MEM; |
196 |
+ |
197 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c |
198 |
+index b89596c18b41a..313b5d9fd08ed 100644 |
199 |
+--- a/drivers/net/wireless/marvell/mwifiex/join.c |
200 |
++++ b/drivers/net/wireless/marvell/mwifiex/join.c |
201 |
+@@ -877,6 +877,8 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, |
202 |
+ |
203 |
+ memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN); |
204 |
+ |
205 |
++ if (req_ssid->ssid_len > IEEE80211_MAX_SSID_LEN) |
206 |
++ req_ssid->ssid_len = IEEE80211_MAX_SSID_LEN; |
207 |
+ memcpy(adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len); |
208 |
+ |
209 |
+ mwifiex_dbg(adapter, INFO, "info: ADHOC_S_CMD: SSID = %s\n", |
210 |
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c |
211 |
+index b44f37fff8903..78788402edd8b 100644 |
212 |
+--- a/drivers/net/xen-netback/xenbus.c |
213 |
++++ b/drivers/net/xen-netback/xenbus.c |
214 |
+@@ -770,12 +770,14 @@ static int xen_register_credit_watch(struct xenbus_device *dev, |
215 |
+ return -ENOMEM; |
216 |
+ snprintf(node, maxlen, "%s/rate", dev->nodename); |
217 |
+ vif->credit_watch.node = node; |
218 |
++ vif->credit_watch.will_handle = NULL; |
219 |
+ vif->credit_watch.callback = xen_net_rate_changed; |
220 |
+ err = register_xenbus_watch(&vif->credit_watch); |
221 |
+ if (err) { |
222 |
+ pr_err("Failed to set watcher %s\n", vif->credit_watch.node); |
223 |
+ kfree(node); |
224 |
+ vif->credit_watch.node = NULL; |
225 |
++ vif->credit_watch.will_handle = NULL; |
226 |
+ vif->credit_watch.callback = NULL; |
227 |
+ } |
228 |
+ return err; |
229 |
+@@ -1038,7 +1040,7 @@ static void connect(struct backend_info *be) |
230 |
+ xenvif_carrier_on(be->vif); |
231 |
+ |
232 |
+ unregister_hotplug_status_watch(be); |
233 |
+- err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, |
234 |
++ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL, |
235 |
+ hotplug_status_changed, |
236 |
+ "%s/%s", dev->nodename, "hotplug-status"); |
237 |
+ if (!err) |
238 |
+diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c |
239 |
+index 0569c15fddfe4..2002684a68b3c 100644 |
240 |
+--- a/drivers/s390/block/dasd_alias.c |
241 |
++++ b/drivers/s390/block/dasd_alias.c |
242 |
+@@ -461,11 +461,19 @@ static int read_unit_address_configuration(struct dasd_device *device, |
243 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
244 |
+ |
245 |
+ rc = dasd_sleep_on(cqr); |
246 |
+- if (rc && !suborder_not_supported(cqr)) { |
247 |
++ if (!rc) |
248 |
++ goto out; |
249 |
++ |
250 |
++ if (suborder_not_supported(cqr)) { |
251 |
++ /* suborder not supported or device unusable for IO */ |
252 |
++ rc = -EOPNOTSUPP; |
253 |
++ } else { |
254 |
++ /* IO failed but should be retried */ |
255 |
+ spin_lock_irqsave(&lcu->lock, flags); |
256 |
+ lcu->flags |= NEED_UAC_UPDATE; |
257 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
258 |
+ } |
259 |
++out: |
260 |
+ dasd_kfree_request(cqr, cqr->memdev); |
261 |
+ return rc; |
262 |
+ } |
263 |
+diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c |
264 |
+index 7ab3235febfc9..4aa6fe834091e 100644 |
265 |
+--- a/drivers/usb/serial/digi_acceleport.c |
266 |
++++ b/drivers/usb/serial/digi_acceleport.c |
267 |
+@@ -23,7 +23,6 @@ |
268 |
+ #include <linux/tty_flip.h> |
269 |
+ #include <linux/module.h> |
270 |
+ #include <linux/spinlock.h> |
271 |
+-#include <linux/workqueue.h> |
272 |
+ #include <linux/uaccess.h> |
273 |
+ #include <linux/usb.h> |
274 |
+ #include <linux/wait.h> |
275 |
+@@ -201,14 +200,12 @@ struct digi_port { |
276 |
+ int dp_throttle_restart; |
277 |
+ wait_queue_head_t dp_flush_wait; |
278 |
+ wait_queue_head_t dp_close_wait; /* wait queue for close */ |
279 |
+- struct work_struct dp_wakeup_work; |
280 |
+ struct usb_serial_port *dp_port; |
281 |
+ }; |
282 |
+ |
283 |
+ |
284 |
+ /* Local Function Declarations */ |
285 |
+ |
286 |
+-static void digi_wakeup_write_lock(struct work_struct *work); |
287 |
+ static int digi_write_oob_command(struct usb_serial_port *port, |
288 |
+ unsigned char *buf, int count, int interruptible); |
289 |
+ static int digi_write_inb_command(struct usb_serial_port *port, |
290 |
+@@ -355,26 +352,6 @@ __releases(lock) |
291 |
+ return timeout; |
292 |
+ } |
293 |
+ |
294 |
+- |
295 |
+-/* |
296 |
+- * Digi Wakeup Write |
297 |
+- * |
298 |
+- * Wake up port, line discipline, and tty processes sleeping |
299 |
+- * on writes. |
300 |
+- */ |
301 |
+- |
302 |
+-static void digi_wakeup_write_lock(struct work_struct *work) |
303 |
+-{ |
304 |
+- struct digi_port *priv = |
305 |
+- container_of(work, struct digi_port, dp_wakeup_work); |
306 |
+- struct usb_serial_port *port = priv->dp_port; |
307 |
+- unsigned long flags; |
308 |
+- |
309 |
+- spin_lock_irqsave(&priv->dp_port_lock, flags); |
310 |
+- tty_port_tty_wakeup(&port->port); |
311 |
+- spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
312 |
+-} |
313 |
+- |
314 |
+ /* |
315 |
+ * Digi Write OOB Command |
316 |
+ * |
317 |
+@@ -985,6 +962,7 @@ static void digi_write_bulk_callback(struct urb *urb) |
318 |
+ struct digi_serial *serial_priv; |
319 |
+ int ret = 0; |
320 |
+ int status = urb->status; |
321 |
++ bool wakeup; |
322 |
+ |
323 |
+ /* port and serial sanity check */ |
324 |
+ if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
325 |
+@@ -1011,6 +989,7 @@ static void digi_write_bulk_callback(struct urb *urb) |
326 |
+ } |
327 |
+ |
328 |
+ /* try to send any buffered data on this port */ |
329 |
++ wakeup = true; |
330 |
+ spin_lock(&priv->dp_port_lock); |
331 |
+ priv->dp_write_urb_in_use = 0; |
332 |
+ if (priv->dp_out_buf_len > 0) { |
333 |
+@@ -1026,19 +1005,18 @@ static void digi_write_bulk_callback(struct urb *urb) |
334 |
+ if (ret == 0) { |
335 |
+ priv->dp_write_urb_in_use = 1; |
336 |
+ priv->dp_out_buf_len = 0; |
337 |
++ wakeup = false; |
338 |
+ } |
339 |
+ } |
340 |
+- /* wake up processes sleeping on writes immediately */ |
341 |
+- tty_port_tty_wakeup(&port->port); |
342 |
+- /* also queue up a wakeup at scheduler time, in case we */ |
343 |
+- /* lost the race in write_chan(). */ |
344 |
+- schedule_work(&priv->dp_wakeup_work); |
345 |
+- |
346 |
+ spin_unlock(&priv->dp_port_lock); |
347 |
++ |
348 |
+ if (ret && ret != -EPERM) |
349 |
+ dev_err_console(port, |
350 |
+ "%s: usb_submit_urb failed, ret=%d, port=%d\n", |
351 |
+ __func__, ret, priv->dp_port_num); |
352 |
++ |
353 |
++ if (wakeup) |
354 |
++ tty_port_tty_wakeup(&port->port); |
355 |
+ } |
356 |
+ |
357 |
+ static int digi_write_room(struct tty_struct *tty) |
358 |
+@@ -1238,7 +1216,6 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num) |
359 |
+ init_waitqueue_head(&priv->dp_transmit_idle_wait); |
360 |
+ init_waitqueue_head(&priv->dp_flush_wait); |
361 |
+ init_waitqueue_head(&priv->dp_close_wait); |
362 |
+- INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
363 |
+ priv->dp_port = port; |
364 |
+ |
365 |
+ init_waitqueue_head(&port->write_wait); |
366 |
+@@ -1524,13 +1501,14 @@ static int digi_read_oob_callback(struct urb *urb) |
367 |
+ rts = C_CRTSCTS(tty); |
368 |
+ |
369 |
+ if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
370 |
++ bool wakeup = false; |
371 |
++ |
372 |
+ spin_lock(&priv->dp_port_lock); |
373 |
+ /* convert from digi flags to termiox flags */ |
374 |
+ if (val & DIGI_READ_INPUT_SIGNALS_CTS) { |
375 |
+ priv->dp_modem_signals |= TIOCM_CTS; |
376 |
+- /* port must be open to use tty struct */ |
377 |
+ if (rts) |
378 |
+- tty_port_tty_wakeup(&port->port); |
379 |
++ wakeup = true; |
380 |
+ } else { |
381 |
+ priv->dp_modem_signals &= ~TIOCM_CTS; |
382 |
+ /* port must be open to use tty struct */ |
383 |
+@@ -1549,6 +1527,9 @@ static int digi_read_oob_callback(struct urb *urb) |
384 |
+ priv->dp_modem_signals &= ~TIOCM_CD; |
385 |
+ |
386 |
+ spin_unlock(&priv->dp_port_lock); |
387 |
++ |
388 |
++ if (wakeup) |
389 |
++ tty_port_tty_wakeup(&port->port); |
390 |
+ } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) { |
391 |
+ spin_lock(&priv->dp_port_lock); |
392 |
+ priv->dp_transmit_idle = 1; |
393 |
+diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
394 |
+index f9a3da02c631b..62fa5340c9652 100644 |
395 |
+--- a/drivers/vfio/pci/vfio_pci.c |
396 |
++++ b/drivers/vfio/pci/vfio_pci.c |
397 |
+@@ -118,8 +118,6 @@ static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev) |
398 |
+ int bar; |
399 |
+ struct vfio_pci_dummy_resource *dummy_res; |
400 |
+ |
401 |
+- INIT_LIST_HEAD(&vdev->dummy_resources_list); |
402 |
+- |
403 |
+ for (bar = PCI_STD_RESOURCES; bar <= PCI_STD_RESOURCE_END; bar++) { |
404 |
+ res = vdev->pdev->resource + bar; |
405 |
+ |
406 |
+@@ -1547,7 +1545,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
407 |
+ vdev->irq_type = VFIO_PCI_NUM_IRQS; |
408 |
+ mutex_init(&vdev->igate); |
409 |
+ spin_lock_init(&vdev->irqlock); |
410 |
+- |
411 |
++ INIT_LIST_HEAD(&vdev->dummy_resources_list); |
412 |
+ mutex_init(&vdev->vma_lock); |
413 |
+ INIT_LIST_HEAD(&vdev->vma_list); |
414 |
+ init_rwsem(&vdev->memory_lock); |
415 |
+diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c |
416 |
+index f33eb40cb4148..36ec99cff507b 100644 |
417 |
+--- a/drivers/xen/xen-pciback/xenbus.c |
418 |
++++ b/drivers/xen/xen-pciback/xenbus.c |
419 |
+@@ -689,7 +689,7 @@ static int xen_pcibk_xenbus_probe(struct xenbus_device *dev, |
420 |
+ |
421 |
+ /* watch the backend node for backend configuration information */ |
422 |
+ err = xenbus_watch_path(dev, dev->nodename, &pdev->be_watch, |
423 |
+- xen_pcibk_be_watch); |
424 |
++ NULL, xen_pcibk_be_watch); |
425 |
+ if (err) |
426 |
+ goto out; |
427 |
+ |
428 |
+diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c |
429 |
+index 266f446ba331c..8bbd887ca422b 100644 |
430 |
+--- a/drivers/xen/xenbus/xenbus_client.c |
431 |
++++ b/drivers/xen/xenbus/xenbus_client.c |
432 |
+@@ -114,18 +114,22 @@ EXPORT_SYMBOL_GPL(xenbus_strstate); |
433 |
+ */ |
434 |
+ int xenbus_watch_path(struct xenbus_device *dev, const char *path, |
435 |
+ struct xenbus_watch *watch, |
436 |
++ bool (*will_handle)(struct xenbus_watch *, |
437 |
++ const char **, unsigned int), |
438 |
+ void (*callback)(struct xenbus_watch *, |
439 |
+ const char **, unsigned int)) |
440 |
+ { |
441 |
+ int err; |
442 |
+ |
443 |
+ watch->node = path; |
444 |
++ watch->will_handle = will_handle; |
445 |
+ watch->callback = callback; |
446 |
+ |
447 |
+ err = register_xenbus_watch(watch); |
448 |
+ |
449 |
+ if (err) { |
450 |
+ watch->node = NULL; |
451 |
++ watch->will_handle = NULL; |
452 |
+ watch->callback = NULL; |
453 |
+ xenbus_dev_fatal(dev, err, "adding watch on %s", path); |
454 |
+ } |
455 |
+@@ -152,6 +156,8 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path); |
456 |
+ */ |
457 |
+ int xenbus_watch_pathfmt(struct xenbus_device *dev, |
458 |
+ struct xenbus_watch *watch, |
459 |
++ bool (*will_handle)(struct xenbus_watch *, |
460 |
++ const char **, unsigned int), |
461 |
+ void (*callback)(struct xenbus_watch *, |
462 |
+ const char **, unsigned int), |
463 |
+ const char *pathfmt, ...) |
464 |
+@@ -168,7 +174,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev, |
465 |
+ xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch"); |
466 |
+ return -ENOMEM; |
467 |
+ } |
468 |
+- err = xenbus_watch_path(dev, path, watch, callback); |
469 |
++ err = xenbus_watch_path(dev, path, watch, will_handle, callback); |
470 |
+ |
471 |
+ if (err) |
472 |
+ kfree(path); |
473 |
+diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c |
474 |
+index c2d447687e33f..ba7590d75985e 100644 |
475 |
+--- a/drivers/xen/xenbus/xenbus_probe.c |
476 |
++++ b/drivers/xen/xenbus/xenbus_probe.c |
477 |
+@@ -137,6 +137,7 @@ static int watch_otherend(struct xenbus_device *dev) |
478 |
+ container_of(dev->dev.bus, struct xen_bus_type, bus); |
479 |
+ |
480 |
+ return xenbus_watch_pathfmt(dev, &dev->otherend_watch, |
481 |
++ bus->otherend_will_handle, |
482 |
+ bus->otherend_changed, |
483 |
+ "%s/%s", dev->otherend, "state"); |
484 |
+ } |
485 |
+diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h |
486 |
+index c9ec7ca1f7ab6..2c394c6ba605c 100644 |
487 |
+--- a/drivers/xen/xenbus/xenbus_probe.h |
488 |
++++ b/drivers/xen/xenbus/xenbus_probe.h |
489 |
+@@ -42,6 +42,8 @@ struct xen_bus_type { |
490 |
+ int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); |
491 |
+ int (*probe)(struct xen_bus_type *bus, const char *type, |
492 |
+ const char *dir); |
493 |
++ bool (*otherend_will_handle)(struct xenbus_watch *watch, |
494 |
++ const char **vec, unsigned int len); |
495 |
+ void (*otherend_changed)(struct xenbus_watch *watch, const char **vec, |
496 |
+ unsigned int len); |
497 |
+ struct bus_type bus; |
498 |
+diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c |
499 |
+index 04f7f85a5edf8..597c0b0384542 100644 |
500 |
+--- a/drivers/xen/xenbus/xenbus_probe_backend.c |
501 |
++++ b/drivers/xen/xenbus/xenbus_probe_backend.c |
502 |
+@@ -181,6 +181,12 @@ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type, |
503 |
+ return err; |
504 |
+ } |
505 |
+ |
506 |
++static bool frontend_will_handle(struct xenbus_watch *watch, |
507 |
++ const char **vec, unsigned int len) |
508 |
++{ |
509 |
++ return watch->nr_pending == 0; |
510 |
++} |
511 |
++ |
512 |
+ static void frontend_changed(struct xenbus_watch *watch, |
513 |
+ const char **vec, unsigned int len) |
514 |
+ { |
515 |
+@@ -192,6 +198,7 @@ static struct xen_bus_type xenbus_backend = { |
516 |
+ .levels = 3, /* backend/type/<frontend>/<id> */ |
517 |
+ .get_bus_id = backend_bus_id, |
518 |
+ .probe = xenbus_probe_backend, |
519 |
++ .otherend_will_handle = frontend_will_handle, |
520 |
+ .otherend_changed = frontend_changed, |
521 |
+ .bus = { |
522 |
+ .name = "xen-backend", |
523 |
+diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c |
524 |
+index 22f7cd711c579..88b4436371064 100644 |
525 |
+--- a/drivers/xen/xenbus/xenbus_xs.c |
526 |
++++ b/drivers/xen/xenbus/xenbus_xs.c |
527 |
+@@ -699,6 +699,8 @@ int register_xenbus_watch(struct xenbus_watch *watch) |
528 |
+ |
529 |
+ sprintf(token, "%lX", (long)watch); |
530 |
+ |
531 |
++ watch->nr_pending = 0; |
532 |
++ |
533 |
+ down_read(&xs_state.watch_mutex); |
534 |
+ |
535 |
+ spin_lock(&watches_lock); |
536 |
+@@ -748,12 +750,15 @@ void unregister_xenbus_watch(struct xenbus_watch *watch) |
537 |
+ |
538 |
+ /* Cancel pending watch events. */ |
539 |
+ spin_lock(&watch_events_lock); |
540 |
+- list_for_each_entry_safe(msg, tmp, &watch_events, list) { |
541 |
+- if (msg->u.watch.handle != watch) |
542 |
+- continue; |
543 |
+- list_del(&msg->list); |
544 |
+- kfree(msg->u.watch.vec); |
545 |
+- kfree(msg); |
546 |
++ if (watch->nr_pending) { |
547 |
++ list_for_each_entry_safe(msg, tmp, &watch_events, list) { |
548 |
++ if (msg->u.watch.handle != watch) |
549 |
++ continue; |
550 |
++ list_del(&msg->list); |
551 |
++ kfree(msg->u.watch.vec); |
552 |
++ kfree(msg); |
553 |
++ } |
554 |
++ watch->nr_pending = 0; |
555 |
+ } |
556 |
+ spin_unlock(&watch_events_lock); |
557 |
+ |
558 |
+@@ -800,7 +805,6 @@ void xs_suspend_cancel(void) |
559 |
+ |
560 |
+ static int xenwatch_thread(void *unused) |
561 |
+ { |
562 |
+- struct list_head *ent; |
563 |
+ struct xs_stored_msg *msg; |
564 |
+ |
565 |
+ for (;;) { |
566 |
+@@ -813,13 +817,15 @@ static int xenwatch_thread(void *unused) |
567 |
+ mutex_lock(&xenwatch_mutex); |
568 |
+ |
569 |
+ spin_lock(&watch_events_lock); |
570 |
+- ent = watch_events.next; |
571 |
+- if (ent != &watch_events) |
572 |
+- list_del(ent); |
573 |
++ msg = list_first_entry_or_null(&watch_events, |
574 |
++ struct xs_stored_msg, list); |
575 |
++ if (msg) { |
576 |
++ list_del(&msg->list); |
577 |
++ msg->u.watch.handle->nr_pending--; |
578 |
++ } |
579 |
+ spin_unlock(&watch_events_lock); |
580 |
+ |
581 |
+- if (ent != &watch_events) { |
582 |
+- msg = list_entry(ent, struct xs_stored_msg, list); |
583 |
++ if (msg) { |
584 |
+ msg->u.watch.handle->callback( |
585 |
+ msg->u.watch.handle, |
586 |
+ (const char **)msg->u.watch.vec, |
587 |
+@@ -901,9 +907,15 @@ static int process_msg(void) |
588 |
+ spin_lock(&watches_lock); |
589 |
+ msg->u.watch.handle = find_watch( |
590 |
+ msg->u.watch.vec[XS_WATCH_TOKEN]); |
591 |
+- if (msg->u.watch.handle != NULL) { |
592 |
++ if (msg->u.watch.handle != NULL && |
593 |
++ (!msg->u.watch.handle->will_handle || |
594 |
++ msg->u.watch.handle->will_handle( |
595 |
++ msg->u.watch.handle, |
596 |
++ (const char **)msg->u.watch.vec, |
597 |
++ msg->u.watch.vec_size))) { |
598 |
+ spin_lock(&watch_events_lock); |
599 |
+ list_add_tail(&msg->list, &watch_events); |
600 |
++ msg->u.watch.handle->nr_pending++; |
601 |
+ wake_up(&watch_events_waitq); |
602 |
+ spin_unlock(&watch_events_lock); |
603 |
+ } else { |
604 |
+diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c |
605 |
+index 0738972e8d3f0..ecd9887b0d1fe 100644 |
606 |
+--- a/fs/quota/quota_tree.c |
607 |
++++ b/fs/quota/quota_tree.c |
608 |
+@@ -61,7 +61,7 @@ static ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) |
609 |
+ |
610 |
+ memset(buf, 0, info->dqi_usable_bs); |
611 |
+ return sb->s_op->quota_read(sb, info->dqi_type, buf, |
612 |
+- info->dqi_usable_bs, blk << info->dqi_blocksize_bits); |
613 |
++ info->dqi_usable_bs, (loff_t)blk << info->dqi_blocksize_bits); |
614 |
+ } |
615 |
+ |
616 |
+ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) |
617 |
+@@ -70,7 +70,7 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) |
618 |
+ ssize_t ret; |
619 |
+ |
620 |
+ ret = sb->s_op->quota_write(sb, info->dqi_type, buf, |
621 |
+- info->dqi_usable_bs, blk << info->dqi_blocksize_bits); |
622 |
++ info->dqi_usable_bs, (loff_t)blk << info->dqi_blocksize_bits); |
623 |
+ if (ret != info->dqi_usable_bs) { |
624 |
+ quota_error(sb, "dquota write failed"); |
625 |
+ if (ret >= 0) |
626 |
+@@ -283,7 +283,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, |
627 |
+ blk); |
628 |
+ goto out_buf; |
629 |
+ } |
630 |
+- dquot->dq_off = (blk << info->dqi_blocksize_bits) + |
631 |
++ dquot->dq_off = ((loff_t)blk << info->dqi_blocksize_bits) + |
632 |
+ sizeof(struct qt_disk_dqdbheader) + |
633 |
+ i * info->dqi_entry_size; |
634 |
+ kfree(buf); |
635 |
+@@ -558,7 +558,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, |
636 |
+ ret = -EIO; |
637 |
+ goto out_buf; |
638 |
+ } else { |
639 |
+- ret = (blk << info->dqi_blocksize_bits) + sizeof(struct |
640 |
++ ret = ((loff_t)blk << info->dqi_blocksize_bits) + sizeof(struct |
641 |
+ qt_disk_dqdbheader) + i * info->dqi_entry_size; |
642 |
+ } |
643 |
+ out_buf: |
644 |
+diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c |
645 |
+index 5f5fff0688776..25b2aed9af0b3 100644 |
646 |
+--- a/fs/reiserfs/stree.c |
647 |
++++ b/fs/reiserfs/stree.c |
648 |
+@@ -453,6 +453,12 @@ static int is_leaf(char *buf, int blocksize, struct buffer_head *bh) |
649 |
+ "(second one): %h", ih); |
650 |
+ return 0; |
651 |
+ } |
652 |
++ if (is_direntry_le_ih(ih) && (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE))) { |
653 |
++ reiserfs_warning(NULL, "reiserfs-5093", |
654 |
++ "item entry count seems wrong %h", |
655 |
++ ih); |
656 |
++ return 0; |
657 |
++ } |
658 |
+ prev_location = ih_location(ih); |
659 |
+ } |
660 |
+ |
661 |
+diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h |
662 |
+index 8e9e288b08c13..05d86addeaf1e 100644 |
663 |
+--- a/include/linux/kdev_t.h |
664 |
++++ b/include/linux/kdev_t.h |
665 |
+@@ -20,61 +20,61 @@ |
666 |
+ }) |
667 |
+ |
668 |
+ /* acceptable for old filesystems */ |
669 |
+-static inline bool old_valid_dev(dev_t dev) |
670 |
++static __always_inline bool old_valid_dev(dev_t dev) |
671 |
+ { |
672 |
+ return MAJOR(dev) < 256 && MINOR(dev) < 256; |
673 |
+ } |
674 |
+ |
675 |
+-static inline u16 old_encode_dev(dev_t dev) |
676 |
++static __always_inline u16 old_encode_dev(dev_t dev) |
677 |
+ { |
678 |
+ return (MAJOR(dev) << 8) | MINOR(dev); |
679 |
+ } |
680 |
+ |
681 |
+-static inline dev_t old_decode_dev(u16 val) |
682 |
++static __always_inline dev_t old_decode_dev(u16 val) |
683 |
+ { |
684 |
+ return MKDEV((val >> 8) & 255, val & 255); |
685 |
+ } |
686 |
+ |
687 |
+-static inline u32 new_encode_dev(dev_t dev) |
688 |
++static __always_inline u32 new_encode_dev(dev_t dev) |
689 |
+ { |
690 |
+ unsigned major = MAJOR(dev); |
691 |
+ unsigned minor = MINOR(dev); |
692 |
+ return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); |
693 |
+ } |
694 |
+ |
695 |
+-static inline dev_t new_decode_dev(u32 dev) |
696 |
++static __always_inline dev_t new_decode_dev(u32 dev) |
697 |
+ { |
698 |
+ unsigned major = (dev & 0xfff00) >> 8; |
699 |
+ unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); |
700 |
+ return MKDEV(major, minor); |
701 |
+ } |
702 |
+ |
703 |
+-static inline u64 huge_encode_dev(dev_t dev) |
704 |
++static __always_inline u64 huge_encode_dev(dev_t dev) |
705 |
+ { |
706 |
+ return new_encode_dev(dev); |
707 |
+ } |
708 |
+ |
709 |
+-static inline dev_t huge_decode_dev(u64 dev) |
710 |
++static __always_inline dev_t huge_decode_dev(u64 dev) |
711 |
+ { |
712 |
+ return new_decode_dev(dev); |
713 |
+ } |
714 |
+ |
715 |
+-static inline int sysv_valid_dev(dev_t dev) |
716 |
++static __always_inline int sysv_valid_dev(dev_t dev) |
717 |
+ { |
718 |
+ return MAJOR(dev) < (1<<14) && MINOR(dev) < (1<<18); |
719 |
+ } |
720 |
+ |
721 |
+-static inline u32 sysv_encode_dev(dev_t dev) |
722 |
++static __always_inline u32 sysv_encode_dev(dev_t dev) |
723 |
+ { |
724 |
+ return MINOR(dev) | (MAJOR(dev) << 18); |
725 |
+ } |
726 |
+ |
727 |
+-static inline unsigned sysv_major(u32 dev) |
728 |
++static __always_inline unsigned sysv_major(u32 dev) |
729 |
+ { |
730 |
+ return (dev >> 18) & 0x3fff; |
731 |
+ } |
732 |
+ |
733 |
+-static inline unsigned sysv_minor(u32 dev) |
734 |
++static __always_inline unsigned sysv_minor(u32 dev) |
735 |
+ { |
736 |
+ return dev & 0x3ffff; |
737 |
+ } |
738 |
+diff --git a/include/linux/of.h b/include/linux/of.h |
739 |
+index 56d83c2a6bbbf..b5cb6024d5902 100644 |
740 |
+--- a/include/linux/of.h |
741 |
++++ b/include/linux/of.h |
742 |
+@@ -1132,6 +1132,7 @@ static inline int of_get_available_child_count(const struct device_node *np) |
743 |
+ #define _OF_DECLARE(table, name, compat, fn, fn_type) \ |
744 |
+ static const struct of_device_id __of_table_##name \ |
745 |
+ __used __section(__##table##_of_table) \ |
746 |
++ __aligned(__alignof__(struct of_device_id)) \ |
747 |
+ = { .compatible = compat, \ |
748 |
+ .data = (fn == (fn_type)NULL) ? fn : fn } |
749 |
+ #else |
750 |
+diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h |
751 |
+index c872bfd25e139..03c3e1869be7e 100644 |
752 |
+--- a/include/uapi/linux/const.h |
753 |
++++ b/include/uapi/linux/const.h |
754 |
+@@ -24,4 +24,9 @@ |
755 |
+ #define _BITUL(x) (_AC(1,UL) << (x)) |
756 |
+ #define _BITULL(x) (_AC(1,ULL) << (x)) |
757 |
+ |
758 |
++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) |
759 |
++#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) |
760 |
++ |
761 |
++#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
762 |
++ |
763 |
+ #endif /* !(_LINUX_CONST_H) */ |
764 |
+diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h |
765 |
+index 5dd3332ebc66a..e7e4e672d9a88 100644 |
766 |
+--- a/include/uapi/linux/ethtool.h |
767 |
++++ b/include/uapi/linux/ethtool.h |
768 |
+@@ -13,7 +13,7 @@ |
769 |
+ #ifndef _UAPI_LINUX_ETHTOOL_H |
770 |
+ #define _UAPI_LINUX_ETHTOOL_H |
771 |
+ |
772 |
+-#include <linux/kernel.h> |
773 |
++#include <linux/const.h> |
774 |
+ #include <linux/types.h> |
775 |
+ #include <linux/if_ether.h> |
776 |
+ |
777 |
+diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h |
778 |
+index 466073f0ce469..6e8db547fbd09 100644 |
779 |
+--- a/include/uapi/linux/kernel.h |
780 |
++++ b/include/uapi/linux/kernel.h |
781 |
+@@ -2,13 +2,6 @@ |
782 |
+ #define _UAPI_LINUX_KERNEL_H |
783 |
+ |
784 |
+ #include <linux/sysinfo.h> |
785 |
+- |
786 |
+-/* |
787 |
+- * 'kernel.h' contains some often-used function prototypes etc |
788 |
+- */ |
789 |
+-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) |
790 |
+-#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) |
791 |
+- |
792 |
+-#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
793 |
++#include <linux/const.h> |
794 |
+ |
795 |
+ #endif /* _UAPI_LINUX_KERNEL_H */ |
796 |
+diff --git a/include/uapi/linux/lightnvm.h b/include/uapi/linux/lightnvm.h |
797 |
+index 774a43128a7aa..fd18dcf76ec63 100644 |
798 |
+--- a/include/uapi/linux/lightnvm.h |
799 |
++++ b/include/uapi/linux/lightnvm.h |
800 |
+@@ -20,7 +20,7 @@ |
801 |
+ #define _UAPI_LINUX_LIGHTNVM_H |
802 |
+ |
803 |
+ #ifdef __KERNEL__ |
804 |
+-#include <linux/kernel.h> |
805 |
++#include <linux/const.h> |
806 |
+ #include <linux/ioctl.h> |
807 |
+ #else /* __KERNEL__ */ |
808 |
+ #include <stdio.h> |
809 |
+diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h |
810 |
+index ed57211487689..54543bca1b796 100644 |
811 |
+--- a/include/uapi/linux/mroute6.h |
812 |
++++ b/include/uapi/linux/mroute6.h |
813 |
+@@ -1,7 +1,7 @@ |
814 |
+ #ifndef _UAPI__LINUX_MROUTE6_H |
815 |
+ #define _UAPI__LINUX_MROUTE6_H |
816 |
+ |
817 |
+-#include <linux/kernel.h> |
818 |
++#include <linux/const.h> |
819 |
+ #include <linux/types.h> |
820 |
+ #include <linux/sockios.h> |
821 |
+ #include <linux/in6.h> /* For struct sockaddr_in6. */ |
822 |
+diff --git a/include/uapi/linux/netfilter/x_tables.h b/include/uapi/linux/netfilter/x_tables.h |
823 |
+index c36969b915334..8f40c2fe0ed48 100644 |
824 |
+--- a/include/uapi/linux/netfilter/x_tables.h |
825 |
++++ b/include/uapi/linux/netfilter/x_tables.h |
826 |
+@@ -1,6 +1,6 @@ |
827 |
+ #ifndef _UAPI_X_TABLES_H |
828 |
+ #define _UAPI_X_TABLES_H |
829 |
+-#include <linux/kernel.h> |
830 |
++#include <linux/const.h> |
831 |
+ #include <linux/types.h> |
832 |
+ |
833 |
+ #define XT_FUNCTION_MAXNAMELEN 30 |
834 |
+diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h |
835 |
+index 0dba4e4ed2be2..b5b4fd791fc81 100644 |
836 |
+--- a/include/uapi/linux/netlink.h |
837 |
++++ b/include/uapi/linux/netlink.h |
838 |
+@@ -1,7 +1,7 @@ |
839 |
+ #ifndef _UAPI__LINUX_NETLINK_H |
840 |
+ #define _UAPI__LINUX_NETLINK_H |
841 |
+ |
842 |
+-#include <linux/kernel.h> |
843 |
++#include <linux/const.h> |
844 |
+ #include <linux/socket.h> /* for __kernel_sa_family_t */ |
845 |
+ #include <linux/types.h> |
846 |
+ |
847 |
+diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h |
848 |
+index d2b12152e358f..954bd77326df5 100644 |
849 |
+--- a/include/uapi/linux/sysctl.h |
850 |
++++ b/include/uapi/linux/sysctl.h |
851 |
+@@ -22,7 +22,7 @@ |
852 |
+ #ifndef _UAPI_LINUX_SYSCTL_H |
853 |
+ #define _UAPI_LINUX_SYSCTL_H |
854 |
+ |
855 |
+-#include <linux/kernel.h> |
856 |
++#include <linux/const.h> |
857 |
+ #include <linux/types.h> |
858 |
+ #include <linux/compiler.h> |
859 |
+ |
860 |
+diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h |
861 |
+index 32b944b7cebd1..ed9e7e3307b75 100644 |
862 |
+--- a/include/xen/xenbus.h |
863 |
++++ b/include/xen/xenbus.h |
864 |
+@@ -58,6 +58,15 @@ struct xenbus_watch |
865 |
+ /* Path being watched. */ |
866 |
+ const char *node; |
867 |
+ |
868 |
++ unsigned int nr_pending; |
869 |
++ |
870 |
++ /* |
871 |
++ * Called just before enqueing new event while a spinlock is held. |
872 |
++ * The event will be discarded if this callback returns false. |
873 |
++ */ |
874 |
++ bool (*will_handle)(struct xenbus_watch *, |
875 |
++ const char **vec, unsigned int len); |
876 |
++ |
877 |
+ /* Callback (executed in a process context with no locks held). */ |
878 |
+ void (*callback)(struct xenbus_watch *, |
879 |
+ const char **vec, unsigned int len); |
880 |
+@@ -194,10 +203,14 @@ void xenbus_suspend_cancel(void); |
881 |
+ |
882 |
+ int xenbus_watch_path(struct xenbus_device *dev, const char *path, |
883 |
+ struct xenbus_watch *watch, |
884 |
++ bool (*will_handle)(struct xenbus_watch *, |
885 |
++ const char **, unsigned int), |
886 |
+ void (*callback)(struct xenbus_watch *, |
887 |
+ const char **, unsigned int)); |
888 |
+-__printf(4, 5) |
889 |
++__printf(5, 6) |
890 |
+ int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch, |
891 |
++ bool (*will_handle)(struct xenbus_watch *, |
892 |
++ const char **, unsigned int), |
893 |
+ void (*callback)(struct xenbus_watch *, |
894 |
+ const char **, unsigned int), |
895 |
+ const char *pathfmt, ...); |
896 |
+diff --git a/kernel/module.c b/kernel/module.c |
897 |
+index 9cb1437151ae7..0219301b6109c 100644 |
898 |
+--- a/kernel/module.c |
899 |
++++ b/kernel/module.c |
900 |
+@@ -1762,7 +1762,6 @@ static int mod_sysfs_init(struct module *mod) |
901 |
+ if (err) |
902 |
+ mod_kobject_put(mod); |
903 |
+ |
904 |
+- /* delay uevent until full sysfs population */ |
905 |
+ out: |
906 |
+ return err; |
907 |
+ } |
908 |
+@@ -1796,7 +1795,6 @@ static int mod_sysfs_setup(struct module *mod, |
909 |
+ add_sect_attrs(mod, info); |
910 |
+ add_notes_attrs(mod, info); |
911 |
+ |
912 |
+- kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD); |
913 |
+ return 0; |
914 |
+ |
915 |
+ out_unreg_param: |
916 |
+@@ -3427,6 +3425,9 @@ static noinline int do_init_module(struct module *mod) |
917 |
+ blocking_notifier_call_chain(&module_notify_list, |
918 |
+ MODULE_STATE_LIVE, mod); |
919 |
+ |
920 |
++ /* Delay uevent until module has finished its init routine */ |
921 |
++ kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD); |
922 |
++ |
923 |
+ /* |
924 |
+ * We need to finish all async code before the module init sequence |
925 |
+ * is done. This has potential to deadlock. For example, a newly |
926 |
+@@ -3738,6 +3739,7 @@ static int load_module(struct load_info *info, const char __user *uargs, |
927 |
+ MODULE_STATE_GOING, mod); |
928 |
+ klp_module_going(mod); |
929 |
+ bug_cleanup: |
930 |
++ mod->state = MODULE_STATE_GOING; |
931 |
+ /* module_bug_cleanup needs module_mutex protection */ |
932 |
+ mutex_lock(&module_mutex); |
933 |
+ module_bug_cleanup(mod); |
934 |
+diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c |
935 |
+index 58929622de0ea..fa4987827cda3 100644 |
936 |
+--- a/net/ipv6/datagram.c |
937 |
++++ b/net/ipv6/datagram.c |
938 |
+@@ -145,10 +145,12 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, |
939 |
+ struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; |
940 |
+ struct inet_sock *inet = inet_sk(sk); |
941 |
+ struct ipv6_pinfo *np = inet6_sk(sk); |
942 |
+- struct in6_addr *daddr; |
943 |
++ struct in6_addr *daddr, old_daddr; |
944 |
++ __be32 fl6_flowlabel = 0; |
945 |
++ __be32 old_fl6_flowlabel; |
946 |
++ __be32 old_dport; |
947 |
+ int addr_type; |
948 |
+ int err; |
949 |
+- __be32 fl6_flowlabel = 0; |
950 |
+ |
951 |
+ if (usin->sin6_family == AF_INET) { |
952 |
+ if (__ipv6_only_sock(sk)) |
953 |
+@@ -238,9 +240,13 @@ ipv4_connected: |
954 |
+ } |
955 |
+ } |
956 |
+ |
957 |
++ /* save the current peer information before updating it */ |
958 |
++ old_daddr = sk->sk_v6_daddr; |
959 |
++ old_fl6_flowlabel = np->flow_label; |
960 |
++ old_dport = inet->inet_dport; |
961 |
++ |
962 |
+ sk->sk_v6_daddr = *daddr; |
963 |
+ np->flow_label = fl6_flowlabel; |
964 |
+- |
965 |
+ inet->inet_dport = usin->sin6_port; |
966 |
+ |
967 |
+ /* |
968 |
+@@ -249,8 +255,15 @@ ipv4_connected: |
969 |
+ */ |
970 |
+ |
971 |
+ err = ip6_datagram_dst_update(sk, true); |
972 |
+- if (err) |
973 |
++ if (err) { |
974 |
++ /* Restore the socket peer info, to keep it consistent with |
975 |
++ * the old socket state |
976 |
++ */ |
977 |
++ sk->sk_v6_daddr = old_daddr; |
978 |
++ np->flow_label = old_fl6_flowlabel; |
979 |
++ inet->inet_dport = old_dport; |
980 |
+ goto out; |
981 |
++ } |
982 |
+ |
983 |
+ sk->sk_state = TCP_ESTABLISHED; |
984 |
+ sk_set_txhash(sk); |
985 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
986 |
+index a8f575bf9b7c6..15f8bd0364c24 100644 |
987 |
+--- a/net/l2tp/l2tp_core.c |
988 |
++++ b/net/l2tp/l2tp_core.c |
989 |
+@@ -112,6 +112,13 @@ struct l2tp_net { |
990 |
+ spinlock_t l2tp_session_hlist_lock; |
991 |
+ }; |
992 |
+ |
993 |
++#if IS_ENABLED(CONFIG_IPV6) |
994 |
++static bool l2tp_sk_is_v6(struct sock *sk) |
995 |
++{ |
996 |
++ return sk->sk_family == PF_INET6 && |
997 |
++ !ipv6_addr_v4mapped(&sk->sk_v6_daddr); |
998 |
++} |
999 |
++#endif |
1000 |
+ |
1001 |
+ static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) |
1002 |
+ { |
1003 |
+@@ -1136,7 +1143,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, |
1004 |
+ skb->ignore_df = 1; |
1005 |
+ skb_dst_drop(skb); |
1006 |
+ #if IS_ENABLED(CONFIG_IPV6) |
1007 |
+- if (tunnel->sock->sk_family == PF_INET6 && !tunnel->v4mapped) |
1008 |
++ if (l2tp_sk_is_v6(tunnel->sock)) |
1009 |
+ error = inet6_csk_xmit(tunnel->sock, skb, NULL); |
1010 |
+ else |
1011 |
+ #endif |
1012 |
+@@ -1199,6 +1206,15 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len |
1013 |
+ goto out_unlock; |
1014 |
+ } |
1015 |
+ |
1016 |
++ /* The user-space may change the connection status for the user-space |
1017 |
++ * provided socket at run time: we must check it under the socket lock |
1018 |
++ */ |
1019 |
++ if (tunnel->fd >= 0 && sk->sk_state != TCP_ESTABLISHED) { |
1020 |
++ kfree_skb(skb); |
1021 |
++ ret = NET_XMIT_DROP; |
1022 |
++ goto out_unlock; |
1023 |
++ } |
1024 |
++ |
1025 |
+ inet = inet_sk(sk); |
1026 |
+ fl = &inet->cork.fl; |
1027 |
+ switch (tunnel->encap) { |
1028 |
+@@ -1214,7 +1230,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len |
1029 |
+ |
1030 |
+ /* Calculate UDP checksum if configured to do so */ |
1031 |
+ #if IS_ENABLED(CONFIG_IPV6) |
1032 |
+- if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) |
1033 |
++ if (l2tp_sk_is_v6(sk)) |
1034 |
+ udp6_set_csum(udp_get_no_check6_tx(sk), |
1035 |
+ skb, &inet6_sk(sk)->saddr, |
1036 |
+ &sk->sk_v6_daddr, udp_len); |
1037 |
+@@ -1620,24 +1636,6 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 |
1038 |
+ if (cfg != NULL) |
1039 |
+ tunnel->debug = cfg->debug; |
1040 |
+ |
1041 |
+-#if IS_ENABLED(CONFIG_IPV6) |
1042 |
+- if (sk->sk_family == PF_INET6) { |
1043 |
+- struct ipv6_pinfo *np = inet6_sk(sk); |
1044 |
+- |
1045 |
+- if (ipv6_addr_v4mapped(&np->saddr) && |
1046 |
+- ipv6_addr_v4mapped(&sk->sk_v6_daddr)) { |
1047 |
+- struct inet_sock *inet = inet_sk(sk); |
1048 |
+- |
1049 |
+- tunnel->v4mapped = true; |
1050 |
+- inet->inet_saddr = np->saddr.s6_addr32[3]; |
1051 |
+- inet->inet_rcv_saddr = sk->sk_v6_rcv_saddr.s6_addr32[3]; |
1052 |
+- inet->inet_daddr = sk->sk_v6_daddr.s6_addr32[3]; |
1053 |
+- } else { |
1054 |
+- tunnel->v4mapped = false; |
1055 |
+- } |
1056 |
+- } |
1057 |
+-#endif |
1058 |
+- |
1059 |
+ /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
1060 |
+ tunnel->encap = encap; |
1061 |
+ if (encap == L2TP_ENCAPTYPE_UDP) { |
1062 |
+diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h |
1063 |
+index 2b9b6fb67ae90..57c1810f1a329 100644 |
1064 |
+--- a/net/l2tp/l2tp_core.h |
1065 |
++++ b/net/l2tp/l2tp_core.h |
1066 |
+@@ -191,9 +191,6 @@ struct l2tp_tunnel { |
1067 |
+ struct sock *sock; /* Parent socket */ |
1068 |
+ int fd; /* Parent fd, if tunnel socket |
1069 |
+ * was created by userspace */ |
1070 |
+-#if IS_ENABLED(CONFIG_IPV6) |
1071 |
+- bool v4mapped; |
1072 |
+-#endif |
1073 |
+ |
1074 |
+ struct work_struct del_work; |
1075 |
+ |
1076 |
+diff --git a/sound/core/seq/seq_queue.h b/sound/core/seq/seq_queue.h |
1077 |
+index 719093489a2c4..7909cf6040e3d 100644 |
1078 |
+--- a/sound/core/seq/seq_queue.h |
1079 |
++++ b/sound/core/seq/seq_queue.h |
1080 |
+@@ -40,10 +40,10 @@ struct snd_seq_queue { |
1081 |
+ |
1082 |
+ struct snd_seq_timer *timer; /* time keeper for this queue */ |
1083 |
+ int owner; /* client that 'owns' the timer */ |
1084 |
+- unsigned int locked:1, /* timer is only accesibble by owner if set */ |
1085 |
+- klocked:1, /* kernel lock (after START) */ |
1086 |
+- check_again:1, |
1087 |
+- check_blocked:1; |
1088 |
++ bool locked; /* timer is only accesibble by owner if set */ |
1089 |
++ bool klocked; /* kernel lock (after START) */ |
1090 |
++ bool check_again; /* concurrent access happened during check */ |
1091 |
++ bool check_blocked; /* queue being checked */ |
1092 |
+ |
1093 |
+ unsigned int flags; /* status flags */ |
1094 |
+ unsigned int info_flags; /* info for sync */ |
1095 |
+diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
1096 |
+index bf7593f234f65..c599730c7a3fc 100644 |
1097 |
+--- a/sound/pci/hda/patch_ca0132.c |
1098 |
++++ b/sound/pci/hda/patch_ca0132.c |
1099 |
+@@ -4443,11 +4443,10 @@ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
1100 |
+ /* Delay enabling the HP amp, to let the mic-detection |
1101 |
+ * state machine run. |
1102 |
+ */ |
1103 |
+- cancel_delayed_work(&spec->unsol_hp_work); |
1104 |
+- schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); |
1105 |
+ tbl = snd_hda_jack_tbl_get(codec, cb->nid); |
1106 |
+ if (tbl) |
1107 |
+ tbl->block_report = 1; |
1108 |
++ schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); |
1109 |
+ } |
1110 |
+ |
1111 |
+ static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
1112 |
+@@ -4625,12 +4624,25 @@ static void ca0132_free(struct hda_codec *codec) |
1113 |
+ kfree(codec->spec); |
1114 |
+ } |
1115 |
+ |
1116 |
++#ifdef CONFIG_PM |
1117 |
++static int ca0132_suspend(struct hda_codec *codec) |
1118 |
++{ |
1119 |
++ struct ca0132_spec *spec = codec->spec; |
1120 |
++ |
1121 |
++ cancel_delayed_work_sync(&spec->unsol_hp_work); |
1122 |
++ return 0; |
1123 |
++} |
1124 |
++#endif |
1125 |
++ |
1126 |
+ static const struct hda_codec_ops ca0132_patch_ops = { |
1127 |
+ .build_controls = ca0132_build_controls, |
1128 |
+ .build_pcms = ca0132_build_pcms, |
1129 |
+ .init = ca0132_init, |
1130 |
+ .free = ca0132_free, |
1131 |
+ .unsol_event = snd_hda_jack_unsol_event, |
1132 |
++#ifdef CONFIG_PM |
1133 |
++ .suspend = ca0132_suspend, |
1134 |
++#endif |
1135 |
+ }; |
1136 |
+ |
1137 |
+ static void ca0132_config(struct hda_codec *codec) |
1138 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1139 |
+index 73acdd43bdc93..720de648510dc 100644 |
1140 |
+--- a/sound/pci/hda/patch_realtek.c |
1141 |
++++ b/sound/pci/hda/patch_realtek.c |
1142 |
+@@ -330,9 +330,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
1143 |
+ case 0x10ec0225: |
1144 |
+ case 0x10ec0233: |
1145 |
+ case 0x10ec0235: |
1146 |
+- case 0x10ec0236: |
1147 |
+ case 0x10ec0255: |
1148 |
+- case 0x10ec0256: |
1149 |
+ case 0x10ec0257: |
1150 |
+ case 0x10ec0282: |
1151 |
+ case 0x10ec0283: |
1152 |
+@@ -343,6 +341,11 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
1153 |
+ case 0x10ec0299: |
1154 |
+ alc_update_coef_idx(codec, 0x10, 1<<9, 0); |
1155 |
+ break; |
1156 |
++ case 0x10ec0236: |
1157 |
++ case 0x10ec0256: |
1158 |
++ alc_write_coef_idx(codec, 0x36, 0x5757); |
1159 |
++ alc_update_coef_idx(codec, 0x10, 1<<9, 0); |
1160 |
++ break; |
1161 |
+ case 0x10ec0285: |
1162 |
+ case 0x10ec0293: |
1163 |
+ alc_update_coef_idx(codec, 0xa, 1<<13, 0); |
1164 |
+@@ -4896,6 +4899,7 @@ enum { |
1165 |
+ ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
1166 |
+ ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
1167 |
+ ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
1168 |
++ ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, |
1169 |
+ ALC269_FIXUP_HEADSET_MODE, |
1170 |
+ ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, |
1171 |
+ ALC269_FIXUP_ASPIRE_HEADSET_MIC, |
1172 |
+@@ -5199,6 +5203,16 @@ static const struct hda_fixup alc269_fixups[] = { |
1173 |
+ .chained = true, |
1174 |
+ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC |
1175 |
+ }, |
1176 |
++ [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = { |
1177 |
++ .type = HDA_FIXUP_PINS, |
1178 |
++ .v.pins = (const struct hda_pintbl[]) { |
1179 |
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
1180 |
++ { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ |
1181 |
++ { } |
1182 |
++ }, |
1183 |
++ .chained = true, |
1184 |
++ .chain_id = ALC269_FIXUP_HEADSET_MODE |
1185 |
++ }, |
1186 |
+ [ALC269_FIXUP_HEADSET_MODE] = { |
1187 |
+ .type = HDA_FIXUP_FUNC, |
1188 |
+ .v.func = alc_fixup_headset_mode, |
1189 |
+@@ -6183,7 +6197,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
1190 |
+ {0x12, 0x90a60120}, |
1191 |
+ {0x14, 0x90170110}, |
1192 |
+ {0x21, 0x0321101f}), |
1193 |
+- SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, |
1194 |
++ SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, |
1195 |
+ {0x12, 0xb7a60130}, |
1196 |
+ {0x14, 0x90170110}, |
1197 |
+ {0x21, 0x04211020}), |
1198 |
+@@ -6267,6 +6281,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
1199 |
+ {0x17, 0x90170110}, |
1200 |
+ {0x1a, 0x03011020}, |
1201 |
+ {0x21, 0x03211030}), |
1202 |
++ SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, |
1203 |
++ ALC225_STANDARD_PINS, |
1204 |
++ {0x12, 0xb7a60130}, |
1205 |
++ {0x13, 0xb8a60140}, |
1206 |
++ {0x17, 0x90170110}), |
1207 |
+ {} |
1208 |
+ }; |
1209 |
+ |
1210 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
1211 |
+index 95d02e25a3133..35594b3cd7c4e 100644 |
1212 |
+--- a/sound/usb/pcm.c |
1213 |
++++ b/sound/usb/pcm.c |
1214 |
+@@ -324,6 +324,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, |
1215 |
+ struct usb_host_interface *alts; |
1216 |
+ struct usb_interface *iface; |
1217 |
+ unsigned int ep; |
1218 |
++ unsigned int ifnum; |
1219 |
+ |
1220 |
+ /* Implicit feedback sync EPs consumers are always playback EPs */ |
1221 |
+ if (subs->direction != SNDRV_PCM_STREAM_PLAYBACK) |
1222 |
+@@ -334,44 +335,23 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, |
1223 |
+ case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ |
1224 |
+ case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */ |
1225 |
+ ep = 0x81; |
1226 |
+- iface = usb_ifnum_to_if(dev, 3); |
1227 |
+- |
1228 |
+- if (!iface || iface->num_altsetting == 0) |
1229 |
+- return -EINVAL; |
1230 |
+- |
1231 |
+- alts = &iface->altsetting[1]; |
1232 |
+- goto add_sync_ep; |
1233 |
+- break; |
1234 |
++ ifnum = 3; |
1235 |
++ goto add_sync_ep_from_ifnum; |
1236 |
+ case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */ |
1237 |
+ case USB_ID(0x0763, 0x2081): |
1238 |
+ ep = 0x81; |
1239 |
+- iface = usb_ifnum_to_if(dev, 2); |
1240 |
+- |
1241 |
+- if (!iface || iface->num_altsetting == 0) |
1242 |
+- return -EINVAL; |
1243 |
+- |
1244 |
+- alts = &iface->altsetting[1]; |
1245 |
+- goto add_sync_ep; |
1246 |
+- case USB_ID(0x2466, 0x8003): |
1247 |
++ ifnum = 2; |
1248 |
++ goto add_sync_ep_from_ifnum; |
1249 |
++ case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */ |
1250 |
+ ep = 0x86; |
1251 |
+- iface = usb_ifnum_to_if(dev, 2); |
1252 |
+- |
1253 |
+- if (!iface || iface->num_altsetting == 0) |
1254 |
+- return -EINVAL; |
1255 |
+- |
1256 |
+- alts = &iface->altsetting[1]; |
1257 |
+- goto add_sync_ep; |
1258 |
+- case USB_ID(0x1397, 0x0002): |
1259 |
++ ifnum = 2; |
1260 |
++ goto add_sync_ep_from_ifnum; |
1261 |
++ case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ |
1262 |
+ ep = 0x81; |
1263 |
+- iface = usb_ifnum_to_if(dev, 1); |
1264 |
+- |
1265 |
+- if (!iface || iface->num_altsetting == 0) |
1266 |
+- return -EINVAL; |
1267 |
+- |
1268 |
+- alts = &iface->altsetting[1]; |
1269 |
+- goto add_sync_ep; |
1270 |
+- |
1271 |
++ ifnum = 1; |
1272 |
++ goto add_sync_ep_from_ifnum; |
1273 |
+ } |
1274 |
++ |
1275 |
+ if (attr == USB_ENDPOINT_SYNC_ASYNC && |
1276 |
+ altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && |
1277 |
+ altsd->bInterfaceProtocol == 2 && |
1278 |
+@@ -386,6 +366,14 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, |
1279 |
+ /* No quirk */ |
1280 |
+ return 0; |
1281 |
+ |
1282 |
++add_sync_ep_from_ifnum: |
1283 |
++ iface = usb_ifnum_to_if(dev, ifnum); |
1284 |
++ |
1285 |
++ if (!iface || iface->num_altsetting < 2) |
1286 |
++ return -EINVAL; |
1287 |
++ |
1288 |
++ alts = &iface->altsetting[1]; |
1289 |
++ |
1290 |
+ add_sync_ep: |
1291 |
+ subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip, |
1292 |
+ alts, ep, !subs->direction, |