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