Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0157-5.4.58-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3609 - (show annotations) (download)
Fri Aug 14 07:37:20 2020 UTC (3 years, 9 months ago) by niro
File size: 93671 byte(s)
-linux-5.4.58
1 diff --git a/Makefile b/Makefile
2 index dd753ef637fd..29948bc4a0d2 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 57
10 +SUBLEVEL = 58
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
15 index b68eeff77806..6db06f58deed 100644
16 --- a/arch/powerpc/include/asm/kasan.h
17 +++ b/arch/powerpc/include/asm/kasan.h
18 @@ -27,9 +27,11 @@
19
20 #ifdef CONFIG_KASAN
21 void kasan_early_init(void);
22 +void kasan_mmu_init(void);
23 void kasan_init(void);
24 #else
25 static inline void kasan_init(void) { }
26 +static inline void kasan_mmu_init(void) { }
27 #endif
28
29 #endif /* __ASSEMBLY */
30 diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
31 index 68f7446193d1..b04896a88d79 100644
32 --- a/arch/powerpc/mm/init_32.c
33 +++ b/arch/powerpc/mm/init_32.c
34 @@ -175,6 +175,8 @@ void __init MMU_init(void)
35 btext_unmap();
36 #endif
37
38 + kasan_mmu_init();
39 +
40 setup_kup();
41
42 /* Shortly after that, the entire linear mapping will be available */
43 diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c
44 index b01d4b72eccf..1cfe57b51d7e 100644
45 --- a/arch/powerpc/mm/kasan/kasan_init_32.c
46 +++ b/arch/powerpc/mm/kasan/kasan_init_32.c
47 @@ -129,7 +129,7 @@ static void __init kasan_remap_early_shadow_ro(void)
48 flush_tlb_kernel_range(KASAN_SHADOW_START, KASAN_SHADOW_END);
49 }
50
51 -static void __init kasan_mmu_init(void)
52 +void __init kasan_mmu_init(void)
53 {
54 int ret;
55 struct memblock_region *reg;
56 @@ -156,8 +156,6 @@ static void __init kasan_mmu_init(void)
57
58 void __init kasan_init(void)
59 {
60 - kasan_mmu_init();
61 -
62 kasan_remap_early_shadow_ro();
63
64 clear_page(kasan_early_shadow_page);
65 diff --git a/drivers/android/binder.c b/drivers/android/binder.c
66 index 5e6586af21b7..110dd4c2977f 100644
67 --- a/drivers/android/binder.c
68 +++ b/drivers/android/binder.c
69 @@ -2984,6 +2984,12 @@ static void binder_transaction(struct binder_proc *proc,
70 goto err_dead_binder;
71 }
72 e->to_node = target_node->debug_id;
73 + if (WARN_ON(proc == target_proc)) {
74 + return_error = BR_FAILED_REPLY;
75 + return_error_param = -EINVAL;
76 + return_error_line = __LINE__;
77 + goto err_invalid_target_handle;
78 + }
79 if (security_binder_transaction(proc->tsk,
80 target_proc->tsk) < 0) {
81 return_error = BR_FAILED_REPLY;
82 @@ -3637,10 +3643,17 @@ static int binder_thread_write(struct binder_proc *proc,
83 struct binder_node *ctx_mgr_node;
84 mutex_lock(&context->context_mgr_node_lock);
85 ctx_mgr_node = context->binder_context_mgr_node;
86 - if (ctx_mgr_node)
87 + if (ctx_mgr_node) {
88 + if (ctx_mgr_node->proc == proc) {
89 + binder_user_error("%d:%d context manager tried to acquire desc 0\n",
90 + proc->pid, thread->pid);
91 + mutex_unlock(&context->context_mgr_node_lock);
92 + return -EINVAL;
93 + }
94 ret = binder_inc_ref_for_node(
95 proc, ctx_mgr_node,
96 strong, NULL, &rdata);
97 + }
98 mutex_unlock(&context->context_mgr_node_lock);
99 }
100 if (ret)
101 diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
102 index d9fd70280482..7f814da3c2d0 100644
103 --- a/drivers/atm/atmtcp.c
104 +++ b/drivers/atm/atmtcp.c
105 @@ -433,9 +433,15 @@ static int atmtcp_remove_persistent(int itf)
106 return -EMEDIUMTYPE;
107 }
108 dev_data = PRIV(dev);
109 - if (!dev_data->persist) return 0;
110 + if (!dev_data->persist) {
111 + atm_dev_put(dev);
112 + return 0;
113 + }
114 dev_data->persist = 0;
115 - if (PRIV(dev)->vcc) return 0;
116 + if (PRIV(dev)->vcc) {
117 + atm_dev_put(dev);
118 + return 0;
119 + }
120 kfree(dev_data);
121 atm_dev_put(dev);
122 atm_dev_deregister(dev);
123 diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
124 index 039e0f91dba8..6945c3c96637 100644
125 --- a/drivers/firmware/qemu_fw_cfg.c
126 +++ b/drivers/firmware/qemu_fw_cfg.c
127 @@ -605,8 +605,10 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
128 /* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */
129 err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype,
130 fw_cfg_sel_ko, "%d", entry->select);
131 - if (err)
132 - goto err_register;
133 + if (err) {
134 + kobject_put(&entry->kobj);
135 + return err;
136 + }
137
138 /* add raw binary content access */
139 err = sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw);
140 @@ -622,7 +624,6 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
141
142 err_add_raw:
143 kobject_del(&entry->kobj);
144 -err_register:
145 kfree(entry);
146 return err;
147 }
148 diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
149 index 02a9c1ed165b..fa50ab2523d4 100644
150 --- a/drivers/gpu/drm/bochs/bochs_kms.c
151 +++ b/drivers/gpu/drm/bochs/bochs_kms.c
152 @@ -194,6 +194,7 @@ int bochs_kms_init(struct bochs_device *bochs)
153 bochs->dev->mode_config.preferred_depth = 24;
154 bochs->dev->mode_config.prefer_shadow = 0;
155 bochs->dev->mode_config.prefer_shadow_fbdev = 1;
156 + bochs->dev->mode_config.fbdev_use_iomem = true;
157 bochs->dev->mode_config.quirk_addfb_prefer_host_byte_order = true;
158
159 bochs->dev->mode_config.funcs = &bochs_mode_funcs;
160 diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
161 index 8d193a58363d..6b8502bcf0fd 100644
162 --- a/drivers/gpu/drm/drm_fb_helper.c
163 +++ b/drivers/gpu/drm/drm_fb_helper.c
164 @@ -390,7 +390,11 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
165 unsigned int y;
166
167 for (y = clip->y1; y < clip->y2; y++) {
168 - memcpy(dst, src, len);
169 + if (!fb_helper->dev->mode_config.fbdev_use_iomem)
170 + memcpy(dst, src, len);
171 + else
172 + memcpy_toio((void __iomem *)dst, src, len);
173 +
174 src += fb->pitches[0];
175 dst += fb->pitches[0];
176 }
177 diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
178 index f439f0a5b43a..5cf2381f667e 100644
179 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
180 +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
181 @@ -315,7 +315,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
182 struct nouveau_framebuffer *fb;
183 struct nouveau_channel *chan;
184 struct nouveau_bo *nvbo;
185 - struct drm_mode_fb_cmd2 mode_cmd;
186 + struct drm_mode_fb_cmd2 mode_cmd = {};
187 int ret;
188
189 mode_cmd.width = sizes->surface_width;
190 @@ -592,6 +592,7 @@ fini:
191 drm_fb_helper_fini(&fbcon->helper);
192 free:
193 kfree(fbcon);
194 + drm->fbcon = NULL;
195 return ret;
196 }
197
198 diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
199 index c8296d5e74c3..501c43c5851d 100644
200 --- a/drivers/hv/channel_mgmt.c
201 +++ b/drivers/hv/channel_mgmt.c
202 @@ -1354,6 +1354,8 @@ channel_message_table[CHANNELMSG_COUNT] = {
203 { CHANNELMSG_19, 0, NULL },
204 { CHANNELMSG_20, 0, NULL },
205 { CHANNELMSG_TL_CONNECT_REQUEST, 0, NULL },
206 + { CHANNELMSG_22, 0, NULL },
207 + { CHANNELMSG_TL_CONNECT_RESULT, 0, NULL },
208 };
209
210 /*
211 @@ -1365,25 +1367,16 @@ void vmbus_onmessage(void *context)
212 {
213 struct hv_message *msg = context;
214 struct vmbus_channel_message_header *hdr;
215 - int size;
216
217 hdr = (struct vmbus_channel_message_header *)msg->u.payload;
218 - size = msg->header.payload_size;
219
220 trace_vmbus_on_message(hdr);
221
222 - if (hdr->msgtype >= CHANNELMSG_COUNT) {
223 - pr_err("Received invalid channel message type %d size %d\n",
224 - hdr->msgtype, size);
225 - print_hex_dump_bytes("", DUMP_PREFIX_NONE,
226 - (unsigned char *)msg->u.payload, size);
227 - return;
228 - }
229 -
230 - if (channel_message_table[hdr->msgtype].message_handler)
231 - channel_message_table[hdr->msgtype].message_handler(hdr);
232 - else
233 - pr_err("Unhandled channel message type %d\n", hdr->msgtype);
234 + /*
235 + * vmbus_on_msg_dpc() makes sure the hdr->msgtype here can not go
236 + * out of bound and the message_handler pointer can not be NULL.
237 + */
238 + channel_message_table[hdr->msgtype].message_handler(hdr);
239 }
240
241 /*
242 diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
243 index 160ff640485b..24c38e44ed3b 100644
244 --- a/drivers/hv/vmbus_drv.c
245 +++ b/drivers/hv/vmbus_drv.c
246 @@ -1073,6 +1073,10 @@ void vmbus_on_msg_dpc(unsigned long data)
247 }
248
249 entry = &channel_message_table[hdr->msgtype];
250 +
251 + if (!entry->message_handler)
252 + goto msg_handled;
253 +
254 if (entry->handler_type == VMHT_BLOCKING) {
255 ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
256 if (ctx == NULL)
257 diff --git a/drivers/i2c/i2c-core-slave.c b/drivers/i2c/i2c-core-slave.c
258 index 5427f047faf0..1589179d5eb9 100644
259 --- a/drivers/i2c/i2c-core-slave.c
260 +++ b/drivers/i2c/i2c-core-slave.c
261 @@ -18,10 +18,8 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
262 {
263 int ret;
264
265 - if (!client || !slave_cb) {
266 - WARN(1, "insufficient data\n");
267 + if (WARN(IS_ERR_OR_NULL(client) || !slave_cb, "insufficient data\n"))
268 return -EINVAL;
269 - }
270
271 if (!(client->flags & I2C_CLIENT_SLAVE))
272 dev_warn(&client->dev, "%s: client slave flag not set. You might see address collisions\n",
273 @@ -60,6 +58,9 @@ int i2c_slave_unregister(struct i2c_client *client)
274 {
275 int ret;
276
277 + if (IS_ERR_OR_NULL(client))
278 + return -EINVAL;
279 +
280 if (!client->adapter->algo->unreg_slave) {
281 dev_err(&client->dev, "%s: not supported by adapter\n", __func__);
282 return -EOPNOTSUPP;
283 diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
284 index b3044c9a8120..465c3755cf2e 100644
285 --- a/drivers/leds/leds-88pm860x.c
286 +++ b/drivers/leds/leds-88pm860x.c
287 @@ -203,21 +203,33 @@ static int pm860x_led_probe(struct platform_device *pdev)
288 data->cdev.brightness_set_blocking = pm860x_led_set;
289 mutex_init(&data->lock);
290
291 - ret = devm_led_classdev_register(chip->dev, &data->cdev);
292 + ret = led_classdev_register(chip->dev, &data->cdev);
293 if (ret < 0) {
294 dev_err(&pdev->dev, "Failed to register LED: %d\n", ret);
295 return ret;
296 }
297 pm860x_led_set(&data->cdev, 0);
298 +
299 + platform_set_drvdata(pdev, data);
300 +
301 return 0;
302 }
303
304 +static int pm860x_led_remove(struct platform_device *pdev)
305 +{
306 + struct pm860x_led *data = platform_get_drvdata(pdev);
307 +
308 + led_classdev_unregister(&data->cdev);
309 +
310 + return 0;
311 +}
312
313 static struct platform_driver pm860x_led_driver = {
314 .driver = {
315 .name = "88pm860x-led",
316 },
317 .probe = pm860x_led_probe,
318 + .remove = pm860x_led_remove,
319 };
320
321 module_platform_driver(pm860x_led_driver);
322 diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
323 index ed1b303f699f..2b5fb00438a2 100644
324 --- a/drivers/leds/leds-da903x.c
325 +++ b/drivers/leds/leds-da903x.c
326 @@ -110,12 +110,23 @@ static int da903x_led_probe(struct platform_device *pdev)
327 led->flags = pdata->flags;
328 led->master = pdev->dev.parent;
329
330 - ret = devm_led_classdev_register(led->master, &led->cdev);
331 + ret = led_classdev_register(led->master, &led->cdev);
332 if (ret) {
333 dev_err(&pdev->dev, "failed to register LED %d\n", id);
334 return ret;
335 }
336
337 + platform_set_drvdata(pdev, led);
338 +
339 + return 0;
340 +}
341 +
342 +static int da903x_led_remove(struct platform_device *pdev)
343 +{
344 + struct da903x_led *led = platform_get_drvdata(pdev);
345 +
346 + led_classdev_unregister(&led->cdev);
347 +
348 return 0;
349 }
350
351 @@ -124,6 +135,7 @@ static struct platform_driver da903x_led_driver = {
352 .name = "da903x-led",
353 },
354 .probe = da903x_led_probe,
355 + .remove = da903x_led_remove,
356 };
357
358 module_platform_driver(da903x_led_driver);
359 diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c
360 index 9504ad405aef..b3edee703193 100644
361 --- a/drivers/leds/leds-lm3533.c
362 +++ b/drivers/leds/leds-lm3533.c
363 @@ -694,7 +694,7 @@ static int lm3533_led_probe(struct platform_device *pdev)
364
365 platform_set_drvdata(pdev, led);
366
367 - ret = devm_led_classdev_register(pdev->dev.parent, &led->cdev);
368 + ret = led_classdev_register(pdev->dev.parent, &led->cdev);
369 if (ret) {
370 dev_err(&pdev->dev, "failed to register LED %d\n", pdev->id);
371 return ret;
372 @@ -704,13 +704,18 @@ static int lm3533_led_probe(struct platform_device *pdev)
373
374 ret = lm3533_led_setup(led, pdata);
375 if (ret)
376 - return ret;
377 + goto err_deregister;
378
379 ret = lm3533_ctrlbank_enable(&led->cb);
380 if (ret)
381 - return ret;
382 + goto err_deregister;
383
384 return 0;
385 +
386 +err_deregister:
387 + led_classdev_unregister(&led->cdev);
388 +
389 + return ret;
390 }
391
392 static int lm3533_led_remove(struct platform_device *pdev)
393 @@ -720,6 +725,7 @@ static int lm3533_led_remove(struct platform_device *pdev)
394 dev_dbg(&pdev->dev, "%s\n", __func__);
395
396 lm3533_ctrlbank_disable(&led->cb);
397 + led_classdev_unregister(&led->cdev);
398
399 return 0;
400 }
401 diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c
402 index 836b60c9a2b8..db842eeb7ca2 100644
403 --- a/drivers/leds/leds-lm36274.c
404 +++ b/drivers/leds/leds-lm36274.c
405 @@ -133,7 +133,7 @@ static int lm36274_probe(struct platform_device *pdev)
406 lm36274_data->pdev = pdev;
407 lm36274_data->dev = lmu->dev;
408 lm36274_data->regmap = lmu->regmap;
409 - dev_set_drvdata(&pdev->dev, lm36274_data);
410 + platform_set_drvdata(pdev, lm36274_data);
411
412 ret = lm36274_parse_dt(lm36274_data);
413 if (ret) {
414 @@ -147,8 +147,16 @@ static int lm36274_probe(struct platform_device *pdev)
415 return ret;
416 }
417
418 - return devm_led_classdev_register(lm36274_data->dev,
419 - &lm36274_data->led_dev);
420 + return led_classdev_register(lm36274_data->dev, &lm36274_data->led_dev);
421 +}
422 +
423 +static int lm36274_remove(struct platform_device *pdev)
424 +{
425 + struct lm36274 *lm36274_data = platform_get_drvdata(pdev);
426 +
427 + led_classdev_unregister(&lm36274_data->led_dev);
428 +
429 + return 0;
430 }
431
432 static const struct of_device_id of_lm36274_leds_match[] = {
433 @@ -159,6 +167,7 @@ MODULE_DEVICE_TABLE(of, of_lm36274_leds_match);
434
435 static struct platform_driver lm36274_driver = {
436 .probe = lm36274_probe,
437 + .remove = lm36274_remove,
438 .driver = {
439 .name = "lm36274-leds",
440 },
441 diff --git a/drivers/leds/leds-wm831x-status.c b/drivers/leds/leds-wm831x-status.c
442 index 082df7f1dd90..67f4235cb28a 100644
443 --- a/drivers/leds/leds-wm831x-status.c
444 +++ b/drivers/leds/leds-wm831x-status.c
445 @@ -269,12 +269,23 @@ static int wm831x_status_probe(struct platform_device *pdev)
446 drvdata->cdev.blink_set = wm831x_status_blink_set;
447 drvdata->cdev.groups = wm831x_status_groups;
448
449 - ret = devm_led_classdev_register(wm831x->dev, &drvdata->cdev);
450 + ret = led_classdev_register(wm831x->dev, &drvdata->cdev);
451 if (ret < 0) {
452 dev_err(&pdev->dev, "Failed to register LED: %d\n", ret);
453 return ret;
454 }
455
456 + platform_set_drvdata(pdev, drvdata);
457 +
458 + return 0;
459 +}
460 +
461 +static int wm831x_status_remove(struct platform_device *pdev)
462 +{
463 + struct wm831x_status *drvdata = platform_get_drvdata(pdev);
464 +
465 + led_classdev_unregister(&drvdata->cdev);
466 +
467 return 0;
468 }
469
470 @@ -283,6 +294,7 @@ static struct platform_driver wm831x_status_driver = {
471 .name = "wm831x-status",
472 },
473 .probe = wm831x_status_probe,
474 + .remove = wm831x_status_remove,
475 };
476
477 module_platform_driver(wm831x_status_driver);
478 diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
479 index 975aed94f06c..48832f9b215c 100644
480 --- a/drivers/mtd/mtdchar.c
481 +++ b/drivers/mtd/mtdchar.c
482 @@ -354,9 +354,6 @@ static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd,
483 uint32_t retlen;
484 int ret = 0;
485
486 - if (!(file->f_mode & FMODE_WRITE))
487 - return -EPERM;
488 -
489 if (length > 4096)
490 return -EINVAL;
491
492 @@ -641,6 +638,48 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
493
494 pr_debug("MTD_ioctl\n");
495
496 + /*
497 + * Check the file mode to require "dangerous" commands to have write
498 + * permissions.
499 + */
500 + switch (cmd) {
501 + /* "safe" commands */
502 + case MEMGETREGIONCOUNT:
503 + case MEMGETREGIONINFO:
504 + case MEMGETINFO:
505 + case MEMREADOOB:
506 + case MEMREADOOB64:
507 + case MEMLOCK:
508 + case MEMUNLOCK:
509 + case MEMISLOCKED:
510 + case MEMGETOOBSEL:
511 + case MEMGETBADBLOCK:
512 + case MEMSETBADBLOCK:
513 + case OTPSELECT:
514 + case OTPGETREGIONCOUNT:
515 + case OTPGETREGIONINFO:
516 + case OTPLOCK:
517 + case ECCGETLAYOUT:
518 + case ECCGETSTATS:
519 + case MTDFILEMODE:
520 + case BLKPG:
521 + case BLKRRPART:
522 + break;
523 +
524 + /* "dangerous" commands */
525 + case MEMERASE:
526 + case MEMERASE64:
527 + case MEMWRITEOOB:
528 + case MEMWRITEOOB64:
529 + case MEMWRITE:
530 + if (!(file->f_mode & FMODE_WRITE))
531 + return -EPERM;
532 + break;
533 +
534 + default:
535 + return -ENOTTY;
536 + }
537 +
538 switch (cmd) {
539 case MEMGETREGIONCOUNT:
540 if (copy_to_user(argp, &(mtd->numeraseregions), sizeof(int)))
541 @@ -688,9 +727,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
542 {
543 struct erase_info *erase;
544
545 - if(!(file->f_mode & FMODE_WRITE))
546 - return -EPERM;
547 -
548 erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL);
549 if (!erase)
550 ret = -ENOMEM;
551 @@ -983,9 +1019,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
552 ret = 0;
553 break;
554 }
555 -
556 - default:
557 - ret = -ENOTTY;
558 }
559
560 return ret;
561 @@ -1029,6 +1062,11 @@ static long mtdchar_compat_ioctl(struct file *file, unsigned int cmd,
562 struct mtd_oob_buf32 buf;
563 struct mtd_oob_buf32 __user *buf_user = argp;
564
565 + if (!(file->f_mode & FMODE_WRITE)) {
566 + ret = -EPERM;
567 + break;
568 + }
569 +
570 if (copy_from_user(&buf, argp, sizeof(buf)))
571 ret = -EFAULT;
572 else
573 diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
574 index 40a44dcb3d9b..f414f5651dbd 100644
575 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
576 +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
577 @@ -2047,11 +2047,11 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
578 /* Save message data locally to prevent them from
579 * being overwritten by next ndo_set_rx_mode call().
580 */
581 - spin_lock(&nic->rx_mode_wq_lock);
582 + spin_lock_bh(&nic->rx_mode_wq_lock);
583 mode = vf_work->mode;
584 mc = vf_work->mc;
585 vf_work->mc = NULL;
586 - spin_unlock(&nic->rx_mode_wq_lock);
587 + spin_unlock_bh(&nic->rx_mode_wq_lock);
588
589 __nicvf_set_rx_mode_task(mode, mc, nic);
590 }
591 diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
592 index 3177dd8ede8e..7a248cc1055a 100644
593 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
594 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
595 @@ -2090,7 +2090,7 @@ close:
596 free:
597 fsl_mc_object_free(dpcon);
598
599 - return NULL;
600 + return ERR_PTR(err);
601 }
602
603 static void free_dpcon(struct dpaa2_eth_priv *priv,
604 @@ -2114,8 +2114,8 @@ alloc_channel(struct dpaa2_eth_priv *priv)
605 return NULL;
606
607 channel->dpcon = setup_dpcon(priv);
608 - if (IS_ERR_OR_NULL(channel->dpcon)) {
609 - err = PTR_ERR_OR_ZERO(channel->dpcon);
610 + if (IS_ERR(channel->dpcon)) {
611 + err = PTR_ERR(channel->dpcon);
612 goto err_setup;
613 }
614
615 diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
616 index ed7e667d7eb2..3e41b20ed8eb 100644
617 --- a/drivers/net/ethernet/intel/igb/igb_main.c
618 +++ b/drivers/net/ethernet/intel/igb/igb_main.c
619 @@ -6194,9 +6194,18 @@ static void igb_reset_task(struct work_struct *work)
620 struct igb_adapter *adapter;
621 adapter = container_of(work, struct igb_adapter, reset_task);
622
623 + rtnl_lock();
624 + /* If we're already down or resetting, just bail */
625 + if (test_bit(__IGB_DOWN, &adapter->state) ||
626 + test_bit(__IGB_RESETTING, &adapter->state)) {
627 + rtnl_unlock();
628 + return;
629 + }
630 +
631 igb_dump(adapter);
632 netdev_err(adapter->netdev, "Reset adapter\n");
633 igb_reinit_locked(adapter);
634 + rtnl_unlock();
635 }
636
637 /**
638 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
639 index 997dc811382a..d01b3a1b40f4 100644
640 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
641 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
642 @@ -171,11 +171,21 @@ static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth,
643 return 0;
644 }
645
646 -static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, int speed)
647 +static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth,
648 + phy_interface_t interface, int speed)
649 {
650 u32 val;
651 int ret;
652
653 + if (interface == PHY_INTERFACE_MODE_TRGMII) {
654 + mtk_w32(eth, TRGMII_MODE, INTF_MODE);
655 + val = 500000000;
656 + ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val);
657 + if (ret)
658 + dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret);
659 + return;
660 + }
661 +
662 val = (speed == SPEED_1000) ?
663 INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100;
664 mtk_w32(eth, val, INTF_MODE);
665 @@ -262,10 +272,9 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
666 state->interface))
667 goto err_phy;
668 } else {
669 - if (state->interface !=
670 - PHY_INTERFACE_MODE_TRGMII)
671 - mtk_gmac0_rgmii_adjust(mac->hw,
672 - state->speed);
673 + mtk_gmac0_rgmii_adjust(mac->hw,
674 + state->interface,
675 + state->speed);
676
677 /* mt7623_pad_clk_setup */
678 for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
679 @@ -2869,6 +2878,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
680 eth->netdev[id]->irq = eth->irq[0];
681 eth->netdev[id]->dev.of_node = np;
682
683 + eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN;
684 +
685 return 0;
686
687 free_netdev:
688 diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
689 index ca16ae8c8332..24bb721a12bc 100644
690 --- a/drivers/net/hyperv/netvsc_drv.c
691 +++ b/drivers/net/hyperv/netvsc_drv.c
692 @@ -531,12 +531,13 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
693 u32 hash;
694 struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT];
695
696 - /* if VF is present and up then redirect packets
697 - * already called with rcu_read_lock_bh
698 + /* If VF is present and up then redirect packets to it.
699 + * Skip the VF if it is marked down or has no carrier.
700 + * If netpoll is in uses, then VF can not be used either.
701 */
702 vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev);
703 if (vf_netdev && netif_running(vf_netdev) &&
704 - !netpoll_tx_running(net))
705 + netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net))
706 return netvsc_vf_xmit(net, vf_netdev, skb);
707
708 /* We will atmost need two pages to describe the rndis
709 diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
710 index 66a8b835aa94..7449b97a3c89 100644
711 --- a/drivers/net/usb/hso.c
712 +++ b/drivers/net/usb/hso.c
713 @@ -2260,12 +2260,14 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
714
715 minor = get_free_serial_index();
716 if (minor < 0)
717 - goto exit;
718 + goto exit2;
719
720 /* register our minor number */
721 serial->parent->dev = tty_port_register_device_attr(&serial->port,
722 tty_drv, minor, &serial->parent->interface->dev,
723 serial->parent, hso_serial_dev_groups);
724 + if (IS_ERR(serial->parent->dev))
725 + goto exit2;
726
727 /* fill in specific data for later use */
728 serial->minor = minor;
729 @@ -2310,6 +2312,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
730 return 0;
731 exit:
732 hso_serial_tty_unregister(serial);
733 +exit2:
734 hso_serial_common_free(serial);
735 return -1;
736 }
737 diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
738 index 1da99abc6ed1..71cc5b63d8ce 100644
739 --- a/drivers/net/usb/lan78xx.c
740 +++ b/drivers/net/usb/lan78xx.c
741 @@ -377,10 +377,6 @@ struct lan78xx_net {
742 struct tasklet_struct bh;
743 struct delayed_work wq;
744
745 - struct usb_host_endpoint *ep_blkin;
746 - struct usb_host_endpoint *ep_blkout;
747 - struct usb_host_endpoint *ep_intr;
748 -
749 int msg_enable;
750
751 struct urb *urb_intr;
752 @@ -2868,78 +2864,12 @@ lan78xx_start_xmit(struct sk_buff *skb, struct net_device *net)
753 return NETDEV_TX_OK;
754 }
755
756 -static int
757 -lan78xx_get_endpoints(struct lan78xx_net *dev, struct usb_interface *intf)
758 -{
759 - int tmp;
760 - struct usb_host_interface *alt = NULL;
761 - struct usb_host_endpoint *in = NULL, *out = NULL;
762 - struct usb_host_endpoint *status = NULL;
763 -
764 - for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
765 - unsigned ep;
766 -
767 - in = NULL;
768 - out = NULL;
769 - status = NULL;
770 - alt = intf->altsetting + tmp;
771 -
772 - for (ep = 0; ep < alt->desc.bNumEndpoints; ep++) {
773 - struct usb_host_endpoint *e;
774 - int intr = 0;
775 -
776 - e = alt->endpoint + ep;
777 - switch (e->desc.bmAttributes) {
778 - case USB_ENDPOINT_XFER_INT:
779 - if (!usb_endpoint_dir_in(&e->desc))
780 - continue;
781 - intr = 1;
782 - /* FALLTHROUGH */
783 - case USB_ENDPOINT_XFER_BULK:
784 - break;
785 - default:
786 - continue;
787 - }
788 - if (usb_endpoint_dir_in(&e->desc)) {
789 - if (!intr && !in)
790 - in = e;
791 - else if (intr && !status)
792 - status = e;
793 - } else {
794 - if (!out)
795 - out = e;
796 - }
797 - }
798 - if (in && out)
799 - break;
800 - }
801 - if (!alt || !in || !out)
802 - return -EINVAL;
803 -
804 - dev->pipe_in = usb_rcvbulkpipe(dev->udev,
805 - in->desc.bEndpointAddress &
806 - USB_ENDPOINT_NUMBER_MASK);
807 - dev->pipe_out = usb_sndbulkpipe(dev->udev,
808 - out->desc.bEndpointAddress &
809 - USB_ENDPOINT_NUMBER_MASK);
810 - dev->ep_intr = status;
811 -
812 - return 0;
813 -}
814 -
815 static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
816 {
817 struct lan78xx_priv *pdata = NULL;
818 int ret;
819 int i;
820
821 - ret = lan78xx_get_endpoints(dev, intf);
822 - if (ret) {
823 - netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n",
824 - ret);
825 - return ret;
826 - }
827 -
828 dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL);
829
830 pdata = (struct lan78xx_priv *)(dev->data[0]);
831 @@ -3708,6 +3638,7 @@ static void lan78xx_stat_monitor(struct timer_list *t)
832 static int lan78xx_probe(struct usb_interface *intf,
833 const struct usb_device_id *id)
834 {
835 + struct usb_host_endpoint *ep_blkin, *ep_blkout, *ep_intr;
836 struct lan78xx_net *dev;
837 struct net_device *netdev;
838 struct usb_device *udev;
839 @@ -3756,6 +3687,34 @@ static int lan78xx_probe(struct usb_interface *intf,
840
841 mutex_init(&dev->stats.access_lock);
842
843 + if (intf->cur_altsetting->desc.bNumEndpoints < 3) {
844 + ret = -ENODEV;
845 + goto out2;
846 + }
847 +
848 + dev->pipe_in = usb_rcvbulkpipe(udev, BULK_IN_PIPE);
849 + ep_blkin = usb_pipe_endpoint(udev, dev->pipe_in);
850 + if (!ep_blkin || !usb_endpoint_is_bulk_in(&ep_blkin->desc)) {
851 + ret = -ENODEV;
852 + goto out2;
853 + }
854 +
855 + dev->pipe_out = usb_sndbulkpipe(udev, BULK_OUT_PIPE);
856 + ep_blkout = usb_pipe_endpoint(udev, dev->pipe_out);
857 + if (!ep_blkout || !usb_endpoint_is_bulk_out(&ep_blkout->desc)) {
858 + ret = -ENODEV;
859 + goto out2;
860 + }
861 +
862 + ep_intr = &intf->cur_altsetting->endpoint[2];
863 + if (!usb_endpoint_is_int_in(&ep_intr->desc)) {
864 + ret = -ENODEV;
865 + goto out2;
866 + }
867 +
868 + dev->pipe_intr = usb_rcvintpipe(dev->udev,
869 + usb_endpoint_num(&ep_intr->desc));
870 +
871 ret = lan78xx_bind(dev, intf);
872 if (ret < 0)
873 goto out2;
874 @@ -3767,23 +3726,7 @@ static int lan78xx_probe(struct usb_interface *intf,
875 netdev->max_mtu = MAX_SINGLE_PACKET_SIZE;
876 netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER);
877
878 - if (intf->cur_altsetting->desc.bNumEndpoints < 3) {
879 - ret = -ENODEV;
880 - goto out3;
881 - }
882 -
883 - dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0;
884 - dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1;
885 - dev->ep_intr = (intf->cur_altsetting)->endpoint + 2;
886 -
887 - dev->pipe_in = usb_rcvbulkpipe(udev, BULK_IN_PIPE);
888 - dev->pipe_out = usb_sndbulkpipe(udev, BULK_OUT_PIPE);
889 -
890 - dev->pipe_intr = usb_rcvintpipe(dev->udev,
891 - dev->ep_intr->desc.bEndpointAddress &
892 - USB_ENDPOINT_NUMBER_MASK);
893 - period = dev->ep_intr->desc.bInterval;
894 -
895 + period = ep_intr->desc.bInterval;
896 maxp = usb_maxpacket(dev->udev, dev->pipe_intr, 0);
897 buf = kmalloc(maxp, GFP_KERNEL);
898 if (buf) {
899 diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
900 index b49b6f0cee50..f9edc76580d9 100644
901 --- a/drivers/net/vxlan.c
902 +++ b/drivers/net/vxlan.c
903 @@ -1225,6 +1225,7 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
904 for (h = 0; h < FDB_HASH_SIZE; ++h) {
905 struct vxlan_fdb *f;
906
907 + rcu_read_lock();
908 hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) {
909 struct vxlan_rdst *rd;
910
911 @@ -1237,12 +1238,15 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
912 cb->nlh->nlmsg_seq,
913 RTM_NEWNEIGH,
914 NLM_F_MULTI, rd);
915 - if (err < 0)
916 + if (err < 0) {
917 + rcu_read_unlock();
918 goto out;
919 + }
920 skip:
921 *idx += 1;
922 }
923 }
924 + rcu_read_unlock();
925 }
926 out:
927 return err;
928 @@ -2546,7 +2550,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
929 ndst = &rt->dst;
930 skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM);
931
932 - tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
933 + tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
934 ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
935 err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr),
936 vni, md, flags, udp_sum);
937 @@ -2586,7 +2590,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
938
939 skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM);
940
941 - tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
942 + tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
943 ttl = ttl ? : ip6_dst_hoplimit(ndst);
944 skb_scrub_packet(skb, xnet);
945 err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),
946 diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
947 index a13cae190196..ee7669f23cff 100644
948 --- a/drivers/nvme/host/pci.c
949 +++ b/drivers/nvme/host/pci.c
950 @@ -3140,6 +3140,8 @@ static const struct pci_device_id nvme_id_table[] = {
951 { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */
952 .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
953 NVME_QUIRK_IGNORE_DEV_SUBNQN, },
954 + { PCI_DEVICE(0x1c5c, 0x1504), /* SK Hynix PC400 */
955 + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
956 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
957 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
958 .driver_data = NVME_QUIRK_SINGLE_VECTOR },
959 diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
960 index ac93f5a0398e..b71e753419c2 100644
961 --- a/drivers/pci/controller/pci-tegra.c
962 +++ b/drivers/pci/controller/pci-tegra.c
963 @@ -181,13 +181,6 @@
964
965 #define AFI_PEXBIAS_CTRL_0 0x168
966
967 -#define RP_PRIV_XP_DL 0x00000494
968 -#define RP_PRIV_XP_DL_GEN2_UPD_FC_TSHOLD (0x1ff << 1)
969 -
970 -#define RP_RX_HDR_LIMIT 0x00000e00
971 -#define RP_RX_HDR_LIMIT_PW_MASK (0xff << 8)
972 -#define RP_RX_HDR_LIMIT_PW (0x0e << 8)
973 -
974 #define RP_ECTL_2_R1 0x00000e84
975 #define RP_ECTL_2_R1_RX_CTLE_1C_MASK 0xffff
976
977 @@ -323,7 +316,6 @@ struct tegra_pcie_soc {
978 bool program_uphy;
979 bool update_clamp_threshold;
980 bool program_deskew_time;
981 - bool raw_violation_fixup;
982 bool update_fc_timer;
983 bool has_cache_bars;
984 struct {
985 @@ -669,23 +661,6 @@ static void tegra_pcie_apply_sw_fixup(struct tegra_pcie_port *port)
986 writel(value, port->base + RP_VEND_CTL0);
987 }
988
989 - /* Fixup for read after write violation. */
990 - if (soc->raw_violation_fixup) {
991 - value = readl(port->base + RP_RX_HDR_LIMIT);
992 - value &= ~RP_RX_HDR_LIMIT_PW_MASK;
993 - value |= RP_RX_HDR_LIMIT_PW;
994 - writel(value, port->base + RP_RX_HDR_LIMIT);
995 -
996 - value = readl(port->base + RP_PRIV_XP_DL);
997 - value |= RP_PRIV_XP_DL_GEN2_UPD_FC_TSHOLD;
998 - writel(value, port->base + RP_PRIV_XP_DL);
999 -
1000 - value = readl(port->base + RP_VEND_XP);
1001 - value &= ~RP_VEND_XP_UPDATE_FC_THRESHOLD_MASK;
1002 - value |= soc->update_fc_threshold;
1003 - writel(value, port->base + RP_VEND_XP);
1004 - }
1005 -
1006 if (soc->update_fc_timer) {
1007 value = readl(port->base + RP_VEND_XP);
1008 value &= ~RP_VEND_XP_UPDATE_FC_THRESHOLD_MASK;
1009 @@ -2511,7 +2486,6 @@ static const struct tegra_pcie_soc tegra20_pcie = {
1010 .program_uphy = true,
1011 .update_clamp_threshold = false,
1012 .program_deskew_time = false,
1013 - .raw_violation_fixup = false,
1014 .update_fc_timer = false,
1015 .has_cache_bars = true,
1016 .ectl.enable = false,
1017 @@ -2541,7 +2515,6 @@ static const struct tegra_pcie_soc tegra30_pcie = {
1018 .program_uphy = true,
1019 .update_clamp_threshold = false,
1020 .program_deskew_time = false,
1021 - .raw_violation_fixup = false,
1022 .update_fc_timer = false,
1023 .has_cache_bars = false,
1024 .ectl.enable = false,
1025 @@ -2554,8 +2527,6 @@ static const struct tegra_pcie_soc tegra124_pcie = {
1026 .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
1027 .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
1028 .pads_refclk_cfg0 = 0x44ac44ac,
1029 - /* FC threshold is bit[25:18] */
1030 - .update_fc_threshold = 0x03fc0000,
1031 .has_pex_clkreq_en = true,
1032 .has_pex_bias_ctrl = true,
1033 .has_intr_prsnt_sense = true,
1034 @@ -2565,7 +2536,6 @@ static const struct tegra_pcie_soc tegra124_pcie = {
1035 .program_uphy = true,
1036 .update_clamp_threshold = true,
1037 .program_deskew_time = false,
1038 - .raw_violation_fixup = true,
1039 .update_fc_timer = false,
1040 .has_cache_bars = false,
1041 .ectl.enable = false,
1042 @@ -2589,7 +2559,6 @@ static const struct tegra_pcie_soc tegra210_pcie = {
1043 .program_uphy = true,
1044 .update_clamp_threshold = true,
1045 .program_deskew_time = true,
1046 - .raw_violation_fixup = false,
1047 .update_fc_timer = true,
1048 .has_cache_bars = false,
1049 .ectl = {
1050 @@ -2631,7 +2600,6 @@ static const struct tegra_pcie_soc tegra186_pcie = {
1051 .program_uphy = false,
1052 .update_clamp_threshold = false,
1053 .program_deskew_time = false,
1054 - .raw_violation_fixup = false,
1055 .update_fc_timer = false,
1056 .has_cache_bars = false,
1057 .ectl.enable = false,
1058 diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
1059 index c6695354b123..19b0cc5ea33f 100644
1060 --- a/drivers/staging/android/ashmem.c
1061 +++ b/drivers/staging/android/ashmem.c
1062 @@ -95,6 +95,15 @@ static DEFINE_MUTEX(ashmem_mutex);
1063 static struct kmem_cache *ashmem_area_cachep __read_mostly;
1064 static struct kmem_cache *ashmem_range_cachep __read_mostly;
1065
1066 +/*
1067 + * A separate lockdep class for the backing shmem inodes to resolve the lockdep
1068 + * warning about the race between kswapd taking fs_reclaim before inode_lock
1069 + * and write syscall taking inode_lock and then fs_reclaim.
1070 + * Note that such race is impossible because ashmem does not support write
1071 + * syscalls operating on the backing shmem.
1072 + */
1073 +static struct lock_class_key backing_shmem_inode_class;
1074 +
1075 static inline unsigned long range_size(struct ashmem_range *range)
1076 {
1077 return range->pgend - range->pgstart + 1;
1078 @@ -396,6 +405,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
1079 if (!asma->file) {
1080 char *name = ASHMEM_NAME_DEF;
1081 struct file *vmfile;
1082 + struct inode *inode;
1083
1084 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
1085 name = asma->name;
1086 @@ -407,6 +417,8 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
1087 goto out;
1088 }
1089 vmfile->f_mode |= FMODE_LSEEK;
1090 + inode = file_inode(vmfile);
1091 + lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
1092 asma->file = vmfile;
1093 /*
1094 * override mmap operation of the vmfile so that it can't be
1095 diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c
1096 index 1ec3b237212e..7cee7b4d5270 100644
1097 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
1098 +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
1099 @@ -1729,9 +1729,11 @@ int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_
1100 if ((ndisauthmode == Ndis802_11AuthModeWPA) ||
1101 (ndisauthmode == Ndis802_11AuthModeWPAPSK))
1102 authmode = _WPA_IE_ID_;
1103 - if ((ndisauthmode == Ndis802_11AuthModeWPA2) ||
1104 + else if ((ndisauthmode == Ndis802_11AuthModeWPA2) ||
1105 (ndisauthmode == Ndis802_11AuthModeWPA2PSK))
1106 authmode = _WPA2_IE_ID_;
1107 + else
1108 + authmode = 0x0;
1109
1110 if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
1111 memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len);
1112 diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
1113 index 40145c0338e4..42c0a3c947f1 100644
1114 --- a/drivers/staging/rtl8712/hal_init.c
1115 +++ b/drivers/staging/rtl8712/hal_init.c
1116 @@ -33,7 +33,6 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
1117 {
1118 struct _adapter *adapter = context;
1119
1120 - complete(&adapter->rtl8712_fw_ready);
1121 if (!firmware) {
1122 struct usb_device *udev = adapter->dvobjpriv.pusbdev;
1123 struct usb_interface *usb_intf = adapter->pusb_intf;
1124 @@ -41,11 +40,13 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
1125 dev_err(&udev->dev, "r8712u: Firmware request failed\n");
1126 usb_put_dev(udev);
1127 usb_set_intfdata(usb_intf, NULL);
1128 + complete(&adapter->rtl8712_fw_ready);
1129 return;
1130 }
1131 adapter->fw = firmware;
1132 /* firmware available - start netdev */
1133 register_netdev(adapter->pnetdev);
1134 + complete(&adapter->rtl8712_fw_ready);
1135 }
1136
1137 static const char firmware_file[] = "rtlwifi/rtl8712u.bin";
1138 diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
1139 index a87562f632a7..2fcd65260f4c 100644
1140 --- a/drivers/staging/rtl8712/usb_intf.c
1141 +++ b/drivers/staging/rtl8712/usb_intf.c
1142 @@ -595,13 +595,17 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
1143 if (pnetdev) {
1144 struct _adapter *padapter = netdev_priv(pnetdev);
1145
1146 - usb_set_intfdata(pusb_intf, NULL);
1147 - release_firmware(padapter->fw);
1148 /* never exit with a firmware callback pending */
1149 wait_for_completion(&padapter->rtl8712_fw_ready);
1150 + pnetdev = usb_get_intfdata(pusb_intf);
1151 + usb_set_intfdata(pusb_intf, NULL);
1152 + if (!pnetdev)
1153 + goto firmware_load_fail;
1154 + release_firmware(padapter->fw);
1155 if (drvpriv.drv_registered)
1156 padapter->surprise_removed = true;
1157 - unregister_netdev(pnetdev); /* will call netdev_close() */
1158 + if (pnetdev->reg_state != NETREG_UNINITIALIZED)
1159 + unregister_netdev(pnetdev); /* will call netdev_close() */
1160 flush_scheduled_work();
1161 udelay(1);
1162 /* Stop driver mlme relation timer */
1163 @@ -614,6 +618,7 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
1164 */
1165 usb_put_dev(udev);
1166 }
1167 +firmware_load_fail:
1168 /* If we didn't unplug usb dongle and remove/insert module, driver
1169 * fails on sitesurvey for the first time when device is up.
1170 * Reset usb port for sitesurvey fail issue.
1171 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1172 index 07741ab9a46a..bbd616324faa 100644
1173 --- a/drivers/usb/host/xhci-pci.c
1174 +++ b/drivers/usb/host/xhci-pci.c
1175 @@ -55,7 +55,10 @@
1176 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba
1177 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb
1178 #define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc
1179 +#define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042
1180 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
1181 +#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
1182 +#define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142
1183
1184 static const char hcd_name[] = "xhci_hcd";
1185
1186 @@ -245,13 +248,14 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1187 xhci->quirks |= XHCI_BROKEN_STREAMS;
1188
1189 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1190 - pdev->device == 0x1042)
1191 + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
1192 xhci->quirks |= XHCI_BROKEN_STREAMS;
1193 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1194 - pdev->device == 0x1142)
1195 + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
1196 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1197 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1198 - pdev->device == 0x2142)
1199 + (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI ||
1200 + pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI))
1201 xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
1202
1203 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1204 diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
1205 index dce20301e367..103c69c692ba 100644
1206 --- a/drivers/usb/misc/iowarrior.c
1207 +++ b/drivers/usb/misc/iowarrior.c
1208 @@ -2,8 +2,9 @@
1209 /*
1210 * Native support for the I/O-Warrior USB devices
1211 *
1212 - * Copyright (c) 2003-2005 Code Mercenaries GmbH
1213 - * written by Christian Lucht <lucht@codemercs.com>
1214 + * Copyright (c) 2003-2005, 2020 Code Mercenaries GmbH
1215 + * written by Christian Lucht <lucht@codemercs.com> and
1216 + * Christoph Jung <jung@codemercs.com>
1217 *
1218 * based on
1219
1220 @@ -802,14 +803,28 @@ static int iowarrior_probe(struct usb_interface *interface,
1221
1222 /* we have to check the report_size often, so remember it in the endianness suitable for our machine */
1223 dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
1224 - if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
1225 - ((dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) ||
1226 - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56AM) ||
1227 - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28) ||
1228 - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW28L) ||
1229 - (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW100)))
1230 - /* IOWarrior56 has wMaxPacketSize different from report size */
1231 - dev->report_size = 7;
1232 +
1233 + /*
1234 + * Some devices need the report size to be different than the
1235 + * endpoint size.
1236 + */
1237 + if (dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) {
1238 + switch (dev->product_id) {
1239 + case USB_DEVICE_ID_CODEMERCS_IOW56:
1240 + case USB_DEVICE_ID_CODEMERCS_IOW56AM:
1241 + dev->report_size = 7;
1242 + break;
1243 +
1244 + case USB_DEVICE_ID_CODEMERCS_IOW28:
1245 + case USB_DEVICE_ID_CODEMERCS_IOW28L:
1246 + dev->report_size = 4;
1247 + break;
1248 +
1249 + case USB_DEVICE_ID_CODEMERCS_IOW100:
1250 + dev->report_size = 13;
1251 + break;
1252 + }
1253 + }
1254
1255 /* create the urb and buffer for reading */
1256 dev->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
1257 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1258 index d147feae83e6..0f60363c1bbc 100644
1259 --- a/drivers/usb/serial/qcserial.c
1260 +++ b/drivers/usb/serial/qcserial.c
1261 @@ -155,6 +155,7 @@ static const struct usb_device_id id_table[] = {
1262 {DEVICE_SWI(0x1199, 0x9056)}, /* Sierra Wireless Modem */
1263 {DEVICE_SWI(0x1199, 0x9060)}, /* Sierra Wireless Modem */
1264 {DEVICE_SWI(0x1199, 0x9061)}, /* Sierra Wireless Modem */
1265 + {DEVICE_SWI(0x1199, 0x9062)}, /* Sierra Wireless EM7305 QDL */
1266 {DEVICE_SWI(0x1199, 0x9063)}, /* Sierra Wireless EM7305 */
1267 {DEVICE_SWI(0x1199, 0x9070)}, /* Sierra Wireless MC74xx */
1268 {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx */
1269 diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
1270 index bfaa9ec4bc1f..e079b910feb2 100644
1271 --- a/drivers/video/console/vgacon.c
1272 +++ b/drivers/video/console/vgacon.c
1273 @@ -251,6 +251,10 @@ static void vgacon_scrollback_update(struct vc_data *c, int t, int count)
1274 p = (void *) (c->vc_origin + t * c->vc_size_row);
1275
1276 while (count--) {
1277 + if ((vgacon_scrollback_cur->tail + c->vc_size_row) >
1278 + vgacon_scrollback_cur->size)
1279 + vgacon_scrollback_cur->tail = 0;
1280 +
1281 scr_memcpyw(vgacon_scrollback_cur->data +
1282 vgacon_scrollback_cur->tail,
1283 p, c->vc_size_row);
1284 diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c
1285 index 7252d22dd117..bfc5c4c5a26a 100644
1286 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c
1287 +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c
1288 @@ -833,7 +833,7 @@ static const struct dss_features omap34xx_dss_feats = {
1289 };
1290
1291 static const struct dss_features omap3630_dss_feats = {
1292 - .fck_div_max = 32,
1293 + .fck_div_max = 31,
1294 .dss_fck_multiplier = 1,
1295 .parent_clk_name = "dpll4_ck",
1296 .dpi_select_source = &dss_dpi_select_source_omap2_omap3,
1297 diff --git a/fs/io_uring.c b/fs/io_uring.c
1298 index e0200406765c..be3d595a607f 100644
1299 --- a/fs/io_uring.c
1300 +++ b/fs/io_uring.c
1301 @@ -279,6 +279,7 @@ struct sqe_submit {
1302 bool has_user;
1303 bool needs_lock;
1304 bool needs_fixed_file;
1305 + u8 opcode;
1306 };
1307
1308 /*
1309 @@ -505,7 +506,7 @@ static inline void io_queue_async_work(struct io_ring_ctx *ctx,
1310 int rw = 0;
1311
1312 if (req->submit.sqe) {
1313 - switch (req->submit.sqe->opcode) {
1314 + switch (req->submit.opcode) {
1315 case IORING_OP_WRITEV:
1316 case IORING_OP_WRITE_FIXED:
1317 rw = !(req->rw.ki_flags & IOCB_DIRECT);
1318 @@ -1254,23 +1255,15 @@ static int io_import_fixed(struct io_ring_ctx *ctx, int rw,
1319 }
1320
1321 static ssize_t io_import_iovec(struct io_ring_ctx *ctx, int rw,
1322 - const struct sqe_submit *s, struct iovec **iovec,
1323 + struct io_kiocb *req, struct iovec **iovec,
1324 struct iov_iter *iter)
1325 {
1326 - const struct io_uring_sqe *sqe = s->sqe;
1327 + const struct io_uring_sqe *sqe = req->submit.sqe;
1328 void __user *buf = u64_to_user_ptr(READ_ONCE(sqe->addr));
1329 size_t sqe_len = READ_ONCE(sqe->len);
1330 u8 opcode;
1331
1332 - /*
1333 - * We're reading ->opcode for the second time, but the first read
1334 - * doesn't care whether it's _FIXED or not, so it doesn't matter
1335 - * whether ->opcode changes concurrently. The first read does care
1336 - * about whether it is a READ or a WRITE, so we don't trust this read
1337 - * for that purpose and instead let the caller pass in the read/write
1338 - * flag.
1339 - */
1340 - opcode = READ_ONCE(sqe->opcode);
1341 + opcode = req->submit.opcode;
1342 if (opcode == IORING_OP_READ_FIXED ||
1343 opcode == IORING_OP_WRITE_FIXED) {
1344 ssize_t ret = io_import_fixed(ctx, rw, sqe, iter);
1345 @@ -1278,7 +1271,7 @@ static ssize_t io_import_iovec(struct io_ring_ctx *ctx, int rw,
1346 return ret;
1347 }
1348
1349 - if (!s->has_user)
1350 + if (!req->submit.has_user)
1351 return -EFAULT;
1352
1353 #ifdef CONFIG_COMPAT
1354 @@ -1425,7 +1418,7 @@ static int io_read(struct io_kiocb *req, const struct sqe_submit *s,
1355 if (unlikely(!(file->f_mode & FMODE_READ)))
1356 return -EBADF;
1357
1358 - ret = io_import_iovec(req->ctx, READ, s, &iovec, &iter);
1359 + ret = io_import_iovec(req->ctx, READ, req, &iovec, &iter);
1360 if (ret < 0)
1361 return ret;
1362
1363 @@ -1490,7 +1483,7 @@ static int io_write(struct io_kiocb *req, const struct sqe_submit *s,
1364 if (unlikely(!(file->f_mode & FMODE_WRITE)))
1365 return -EBADF;
1366
1367 - ret = io_import_iovec(req->ctx, WRITE, s, &iovec, &iter);
1368 + ret = io_import_iovec(req->ctx, WRITE, req, &iovec, &iter);
1369 if (ret < 0)
1370 return ret;
1371
1372 @@ -2109,15 +2102,14 @@ static int io_req_defer(struct io_ring_ctx *ctx, struct io_kiocb *req,
1373 static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
1374 const struct sqe_submit *s, bool force_nonblock)
1375 {
1376 - int ret, opcode;
1377 + int ret;
1378
1379 req->user_data = READ_ONCE(s->sqe->user_data);
1380
1381 if (unlikely(s->index >= ctx->sq_entries))
1382 return -EINVAL;
1383
1384 - opcode = READ_ONCE(s->sqe->opcode);
1385 - switch (opcode) {
1386 + switch (req->submit.opcode) {
1387 case IORING_OP_NOP:
1388 ret = io_nop(req, req->user_data);
1389 break;
1390 @@ -2181,10 +2173,10 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
1391 return 0;
1392 }
1393
1394 -static struct async_list *io_async_list_from_sqe(struct io_ring_ctx *ctx,
1395 - const struct io_uring_sqe *sqe)
1396 +static struct async_list *io_async_list_from_req(struct io_ring_ctx *ctx,
1397 + struct io_kiocb *req)
1398 {
1399 - switch (sqe->opcode) {
1400 + switch (req->submit.opcode) {
1401 case IORING_OP_READV:
1402 case IORING_OP_READ_FIXED:
1403 return &ctx->pending_async[READ];
1404 @@ -2196,12 +2188,10 @@ static struct async_list *io_async_list_from_sqe(struct io_ring_ctx *ctx,
1405 }
1406 }
1407
1408 -static inline bool io_sqe_needs_user(const struct io_uring_sqe *sqe)
1409 +static inline bool io_req_needs_user(struct io_kiocb *req)
1410 {
1411 - u8 opcode = READ_ONCE(sqe->opcode);
1412 -
1413 - return !(opcode == IORING_OP_READ_FIXED ||
1414 - opcode == IORING_OP_WRITE_FIXED);
1415 + return !(req->submit.opcode == IORING_OP_READ_FIXED ||
1416 + req->submit.opcode == IORING_OP_WRITE_FIXED);
1417 }
1418
1419 static void io_sq_wq_submit_work(struct work_struct *work)
1420 @@ -2217,7 +2207,7 @@ static void io_sq_wq_submit_work(struct work_struct *work)
1421 int ret;
1422
1423 old_cred = override_creds(ctx->creds);
1424 - async_list = io_async_list_from_sqe(ctx, req->submit.sqe);
1425 + async_list = io_async_list_from_req(ctx, req);
1426
1427 allow_kernel_signal(SIGINT);
1428 restart:
1429 @@ -2239,9 +2229,10 @@ restart:
1430 }
1431
1432 ret = 0;
1433 - if (io_sqe_needs_user(sqe) && !cur_mm) {
1434 + if (io_req_needs_user(req) && !cur_mm) {
1435 if (!mmget_not_zero(ctx->sqo_mm)) {
1436 ret = -EFAULT;
1437 + goto end_req;
1438 } else {
1439 cur_mm = ctx->sqo_mm;
1440 use_mm(cur_mm);
1441 @@ -2387,11 +2378,9 @@ static bool io_add_to_prev_work(struct async_list *list, struct io_kiocb *req)
1442 return ret;
1443 }
1444
1445 -static bool io_op_needs_file(const struct io_uring_sqe *sqe)
1446 +static bool io_op_needs_file(struct io_kiocb *req)
1447 {
1448 - int op = READ_ONCE(sqe->opcode);
1449 -
1450 - switch (op) {
1451 + switch (req->submit.opcode) {
1452 case IORING_OP_NOP:
1453 case IORING_OP_POLL_REMOVE:
1454 case IORING_OP_TIMEOUT:
1455 @@ -2419,7 +2408,7 @@ static int io_req_set_file(struct io_ring_ctx *ctx, const struct sqe_submit *s,
1456 */
1457 req->sequence = s->sequence;
1458
1459 - if (!io_op_needs_file(s->sqe))
1460 + if (!io_op_needs_file(req))
1461 return 0;
1462
1463 if (flags & IOSQE_FIXED_FILE) {
1464 @@ -2460,7 +2449,7 @@ static int __io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
1465
1466 s->sqe = sqe_copy;
1467 memcpy(&req->submit, s, sizeof(*s));
1468 - list = io_async_list_from_sqe(ctx, s->sqe);
1469 + list = io_async_list_from_req(ctx, req);
1470 if (!io_add_to_prev_work(list, req)) {
1471 if (list)
1472 atomic_inc(&list->cnt);
1473 @@ -2582,7 +2571,7 @@ err:
1474 req->user_data = s->sqe->user_data;
1475
1476 #if defined(CONFIG_NET)
1477 - switch (READ_ONCE(s->sqe->opcode)) {
1478 + switch (req->submit.opcode) {
1479 case IORING_OP_SENDMSG:
1480 case IORING_OP_RECVMSG:
1481 spin_lock(&current->fs->lock);
1482 @@ -2697,6 +2686,7 @@ static bool io_get_sqring(struct io_ring_ctx *ctx, struct sqe_submit *s)
1483 if (head < ctx->sq_entries) {
1484 s->index = head;
1485 s->sqe = &ctx->sq_sqes[head];
1486 + s->opcode = READ_ONCE(s->sqe->opcode);
1487 s->sequence = ctx->cached_sq_head;
1488 ctx->cached_sq_head++;
1489 return true;
1490 diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
1491 index 533d0fc3c96b..d6f244559e75 100644
1492 --- a/fs/nfsd/nfs4xdr.c
1493 +++ b/fs/nfsd/nfs4xdr.c
1494 @@ -3530,17 +3530,17 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
1495 u32 zzz = 0;
1496 int pad;
1497
1498 + /*
1499 + * svcrdma requires every READ payload to start somewhere
1500 + * in xdr->pages.
1501 + */
1502 + if (xdr->iov == xdr->buf->head) {
1503 + xdr->iov = NULL;
1504 + xdr->end = xdr->p;
1505 + }
1506 +
1507 len = maxcount;
1508 v = 0;
1509 -
1510 - thislen = min_t(long, len, ((void *)xdr->end - (void *)xdr->p));
1511 - p = xdr_reserve_space(xdr, (thislen+3)&~3);
1512 - WARN_ON_ONCE(!p);
1513 - resp->rqstp->rq_vec[v].iov_base = p;
1514 - resp->rqstp->rq_vec[v].iov_len = thislen;
1515 - v++;
1516 - len -= thislen;
1517 -
1518 while (len) {
1519 thislen = min_t(long, len, PAGE_SIZE);
1520 p = xdr_reserve_space(xdr, (thislen+3)&~3);
1521 @@ -3559,6 +3559,8 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
1522 read->rd_length = maxcount;
1523 if (nfserr)
1524 return nfserr;
1525 + if (svc_encode_read_payload(resp->rqstp, starting_len + 8, maxcount))
1526 + return nfserr_io;
1527 xdr_truncate_encode(xdr, starting_len + 8 + ((maxcount+3)&~3));
1528
1529 tmp = htonl(eof);
1530 diff --git a/fs/xattr.c b/fs/xattr.c
1531 index 90dd78f0eb27..f2854570d411 100644
1532 --- a/fs/xattr.c
1533 +++ b/fs/xattr.c
1534 @@ -204,10 +204,22 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,
1535 return error;
1536 }
1537
1538 -
1539 +/**
1540 + * __vfs_setxattr_locked: set an extended attribute while holding the inode
1541 + * lock
1542 + *
1543 + * @dentry - object to perform setxattr on
1544 + * @name - xattr name to set
1545 + * @value - value to set @name to
1546 + * @size - size of @value
1547 + * @flags - flags to pass into filesystem operations
1548 + * @delegated_inode - on return, will contain an inode pointer that
1549 + * a delegation was broken on, NULL if none.
1550 + */
1551 int
1552 -vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1553 - size_t size, int flags)
1554 +__vfs_setxattr_locked(struct dentry *dentry, const char *name,
1555 + const void *value, size_t size, int flags,
1556 + struct inode **delegated_inode)
1557 {
1558 struct inode *inode = dentry->d_inode;
1559 int error;
1560 @@ -216,15 +228,40 @@ vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1561 if (error)
1562 return error;
1563
1564 - inode_lock(inode);
1565 error = security_inode_setxattr(dentry, name, value, size, flags);
1566 if (error)
1567 goto out;
1568
1569 + error = try_break_deleg(inode, delegated_inode);
1570 + if (error)
1571 + goto out;
1572 +
1573 error = __vfs_setxattr_noperm(dentry, name, value, size, flags);
1574
1575 out:
1576 + return error;
1577 +}
1578 +EXPORT_SYMBOL_GPL(__vfs_setxattr_locked);
1579 +
1580 +int
1581 +vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1582 + size_t size, int flags)
1583 +{
1584 + struct inode *inode = dentry->d_inode;
1585 + struct inode *delegated_inode = NULL;
1586 + int error;
1587 +
1588 +retry_deleg:
1589 + inode_lock(inode);
1590 + error = __vfs_setxattr_locked(dentry, name, value, size, flags,
1591 + &delegated_inode);
1592 inode_unlock(inode);
1593 +
1594 + if (delegated_inode) {
1595 + error = break_deleg_wait(&delegated_inode);
1596 + if (!error)
1597 + goto retry_deleg;
1598 + }
1599 return error;
1600 }
1601 EXPORT_SYMBOL_GPL(vfs_setxattr);
1602 @@ -378,8 +415,18 @@ __vfs_removexattr(struct dentry *dentry, const char *name)
1603 }
1604 EXPORT_SYMBOL(__vfs_removexattr);
1605
1606 +/**
1607 + * __vfs_removexattr_locked: set an extended attribute while holding the inode
1608 + * lock
1609 + *
1610 + * @dentry - object to perform setxattr on
1611 + * @name - name of xattr to remove
1612 + * @delegated_inode - on return, will contain an inode pointer that
1613 + * a delegation was broken on, NULL if none.
1614 + */
1615 int
1616 -vfs_removexattr(struct dentry *dentry, const char *name)
1617 +__vfs_removexattr_locked(struct dentry *dentry, const char *name,
1618 + struct inode **delegated_inode)
1619 {
1620 struct inode *inode = dentry->d_inode;
1621 int error;
1622 @@ -388,11 +435,14 @@ vfs_removexattr(struct dentry *dentry, const char *name)
1623 if (error)
1624 return error;
1625
1626 - inode_lock(inode);
1627 error = security_inode_removexattr(dentry, name);
1628 if (error)
1629 goto out;
1630
1631 + error = try_break_deleg(inode, delegated_inode);
1632 + if (error)
1633 + goto out;
1634 +
1635 error = __vfs_removexattr(dentry, name);
1636
1637 if (!error) {
1638 @@ -401,12 +451,32 @@ vfs_removexattr(struct dentry *dentry, const char *name)
1639 }
1640
1641 out:
1642 + return error;
1643 +}
1644 +EXPORT_SYMBOL_GPL(__vfs_removexattr_locked);
1645 +
1646 +int
1647 +vfs_removexattr(struct dentry *dentry, const char *name)
1648 +{
1649 + struct inode *inode = dentry->d_inode;
1650 + struct inode *delegated_inode = NULL;
1651 + int error;
1652 +
1653 +retry_deleg:
1654 + inode_lock(inode);
1655 + error = __vfs_removexattr_locked(dentry, name, &delegated_inode);
1656 inode_unlock(inode);
1657 +
1658 + if (delegated_inode) {
1659 + error = break_deleg_wait(&delegated_inode);
1660 + if (!error)
1661 + goto retry_deleg;
1662 + }
1663 +
1664 return error;
1665 }
1666 EXPORT_SYMBOL_GPL(vfs_removexattr);
1667
1668 -
1669 /*
1670 * Extended attribute SET operations
1671 */
1672 diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
1673 index 3bcbe30339f0..198b9d060008 100644
1674 --- a/include/drm/drm_mode_config.h
1675 +++ b/include/drm/drm_mode_config.h
1676 @@ -865,6 +865,18 @@ struct drm_mode_config {
1677 */
1678 bool prefer_shadow_fbdev;
1679
1680 + /**
1681 + * @fbdev_use_iomem:
1682 + *
1683 + * Set to true if framebuffer reside in iomem.
1684 + * When set to true memcpy_toio() is used when copying the framebuffer in
1685 + * drm_fb_helper.drm_fb_helper_dirty_blit_real().
1686 + *
1687 + * FIXME: This should be replaced with a per-mapping is_iomem
1688 + * flag (like ttm does), and then used everywhere in fbdev code.
1689 + */
1690 + bool fbdev_use_iomem;
1691 +
1692 /**
1693 * @quirk_addfb_prefer_xbgr_30bpp:
1694 *
1695 diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
1696 index b4a017093b69..67d9b5a37460 100644
1697 --- a/include/linux/hyperv.h
1698 +++ b/include/linux/hyperv.h
1699 @@ -423,6 +423,8 @@ enum vmbus_channel_message_type {
1700 CHANNELMSG_19 = 19,
1701 CHANNELMSG_20 = 20,
1702 CHANNELMSG_TL_CONNECT_REQUEST = 21,
1703 + CHANNELMSG_22 = 22,
1704 + CHANNELMSG_TL_CONNECT_RESULT = 23,
1705 CHANNELMSG_COUNT
1706 };
1707
1708 diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
1709 index 1afe38eb33f7..82665ff360fd 100644
1710 --- a/include/linux/sunrpc/svc.h
1711 +++ b/include/linux/sunrpc/svc.h
1712 @@ -517,6 +517,9 @@ void svc_wake_up(struct svc_serv *);
1713 void svc_reserve(struct svc_rqst *rqstp, int space);
1714 struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
1715 char * svc_print_addr(struct svc_rqst *, char *, size_t);
1716 +int svc_encode_read_payload(struct svc_rqst *rqstp,
1717 + unsigned int offset,
1718 + unsigned int length);
1719 unsigned int svc_fill_write_vector(struct svc_rqst *rqstp,
1720 struct page **pages,
1721 struct kvec *first, size_t total);
1722 diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
1723 index fddad9f5b390..26f282e5e082 100644
1724 --- a/include/linux/sunrpc/svc_rdma.h
1725 +++ b/include/linux/sunrpc/svc_rdma.h
1726 @@ -137,6 +137,8 @@ struct svc_rdma_recv_ctxt {
1727 unsigned int rc_page_count;
1728 unsigned int rc_hdr_count;
1729 u32 rc_inv_rkey;
1730 + unsigned int rc_read_payload_offset;
1731 + unsigned int rc_read_payload_length;
1732 struct page *rc_pages[RPCSVC_MAXPAGES];
1733 };
1734
1735 @@ -171,7 +173,9 @@ extern int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma,
1736 struct svc_rqst *rqstp,
1737 struct svc_rdma_recv_ctxt *head, __be32 *p);
1738 extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,
1739 - __be32 *wr_ch, struct xdr_buf *xdr);
1740 + __be32 *wr_ch, struct xdr_buf *xdr,
1741 + unsigned int offset,
1742 + unsigned long length);
1743 extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
1744 __be32 *rp_ch, bool writelist,
1745 struct xdr_buf *xdr);
1746 @@ -190,6 +194,8 @@ extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
1747 struct svc_rdma_send_ctxt *ctxt,
1748 struct xdr_buf *xdr, __be32 *wr_lst);
1749 extern int svc_rdma_sendto(struct svc_rqst *);
1750 +extern int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset,
1751 + unsigned int length);
1752
1753 /* svc_rdma_transport.c */
1754 extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
1755 diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
1756 index ea6f46be9cb7..9e1e046de176 100644
1757 --- a/include/linux/sunrpc/svc_xprt.h
1758 +++ b/include/linux/sunrpc/svc_xprt.h
1759 @@ -21,6 +21,8 @@ struct svc_xprt_ops {
1760 int (*xpo_has_wspace)(struct svc_xprt *);
1761 int (*xpo_recvfrom)(struct svc_rqst *);
1762 int (*xpo_sendto)(struct svc_rqst *);
1763 + int (*xpo_read_payload)(struct svc_rqst *, unsigned int,
1764 + unsigned int);
1765 void (*xpo_release_rqst)(struct svc_rqst *);
1766 void (*xpo_detach)(struct svc_xprt *);
1767 void (*xpo_free)(struct svc_xprt *);
1768 diff --git a/include/linux/xattr.h b/include/linux/xattr.h
1769 index 6dad031be3c2..3a71ad716da5 100644
1770 --- a/include/linux/xattr.h
1771 +++ b/include/linux/xattr.h
1772 @@ -51,8 +51,10 @@ ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
1773 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
1774 int __vfs_setxattr(struct dentry *, struct inode *, const char *, const void *, size_t, int);
1775 int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
1776 +int __vfs_setxattr_locked(struct dentry *, const char *, const void *, size_t, int, struct inode **);
1777 int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
1778 int __vfs_removexattr(struct dentry *, const char *);
1779 +int __vfs_removexattr_locked(struct dentry *, const char *, struct inode **);
1780 int vfs_removexattr(struct dentry *, const char *);
1781
1782 ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
1783 diff --git a/include/net/addrconf.h b/include/net/addrconf.h
1784 index 3f62b347b04a..ab8b3eb53d4b 100644
1785 --- a/include/net/addrconf.h
1786 +++ b/include/net/addrconf.h
1787 @@ -273,6 +273,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex,
1788 const struct in6_addr *addr);
1789 int ipv6_sock_ac_drop(struct sock *sk, int ifindex,
1790 const struct in6_addr *addr);
1791 +void __ipv6_sock_ac_close(struct sock *sk);
1792 void ipv6_sock_ac_close(struct sock *sk);
1793
1794 int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr);
1795 diff --git a/kernel/events/core.c b/kernel/events/core.c
1796 index aaaf50b25cc9..db1f5aa755f2 100644
1797 --- a/kernel/events/core.c
1798 +++ b/kernel/events/core.c
1799 @@ -2171,6 +2171,7 @@ __perf_remove_from_context(struct perf_event *event,
1800
1801 if (!ctx->nr_events && ctx->is_active) {
1802 ctx->is_active = 0;
1803 + ctx->rotate_necessary = 0;
1804 if (ctx->task) {
1805 WARN_ON_ONCE(cpuctx->task_ctx != ctx);
1806 cpuctx->task_ctx = NULL;
1807 @@ -3047,12 +3048,6 @@ static void ctx_sched_out(struct perf_event_context *ctx,
1808 if (!ctx->nr_active || !(is_active & EVENT_ALL))
1809 return;
1810
1811 - /*
1812 - * If we had been multiplexing, no rotations are necessary, now no events
1813 - * are active.
1814 - */
1815 - ctx->rotate_necessary = 0;
1816 -
1817 perf_pmu_disable(ctx->pmu);
1818 if (is_active & EVENT_PINNED) {
1819 list_for_each_entry_safe(event, tmp, &ctx->pinned_active, active_list)
1820 @@ -3062,6 +3057,13 @@ static void ctx_sched_out(struct perf_event_context *ctx,
1821 if (is_active & EVENT_FLEXIBLE) {
1822 list_for_each_entry_safe(event, tmp, &ctx->flexible_active, active_list)
1823 group_sched_out(event, cpuctx, ctx);
1824 +
1825 + /*
1826 + * Since we cleared EVENT_FLEXIBLE, also clear
1827 + * rotate_necessary, is will be reset by
1828 + * ctx_flexible_sched_in() when needed.
1829 + */
1830 + ctx->rotate_necessary = 0;
1831 }
1832 perf_pmu_enable(ctx->pmu);
1833 }
1834 @@ -3800,6 +3802,12 @@ ctx_event_to_rotate(struct perf_event_context *ctx)
1835 typeof(*event), group_node);
1836 }
1837
1838 + /*
1839 + * Unconditionally clear rotate_necessary; if ctx_flexible_sched_in()
1840 + * finds there are unschedulable events, it will set it again.
1841 + */
1842 + ctx->rotate_necessary = 0;
1843 +
1844 return event;
1845 }
1846
1847 diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
1848 index 3f67803123be..12ecacf0c55f 100644
1849 --- a/net/9p/trans_fd.c
1850 +++ b/net/9p/trans_fd.c
1851 @@ -816,20 +816,28 @@ static int p9_fd_open(struct p9_client *client, int rfd, int wfd)
1852 return -ENOMEM;
1853
1854 ts->rd = fget(rfd);
1855 + if (!ts->rd)
1856 + goto out_free_ts;
1857 + if (!(ts->rd->f_mode & FMODE_READ))
1858 + goto out_put_rd;
1859 ts->wr = fget(wfd);
1860 - if (!ts->rd || !ts->wr) {
1861 - if (ts->rd)
1862 - fput(ts->rd);
1863 - if (ts->wr)
1864 - fput(ts->wr);
1865 - kfree(ts);
1866 - return -EIO;
1867 - }
1868 + if (!ts->wr)
1869 + goto out_put_rd;
1870 + if (!(ts->wr->f_mode & FMODE_WRITE))
1871 + goto out_put_wr;
1872
1873 client->trans = ts;
1874 client->status = Connected;
1875
1876 return 0;
1877 +
1878 +out_put_wr:
1879 + fput(ts->wr);
1880 +out_put_rd:
1881 + fput(ts->rd);
1882 +out_free_ts:
1883 + kfree(ts);
1884 + return -EIO;
1885 }
1886
1887 static int p9_socket_open(struct p9_client *client, struct socket *csocket)
1888 diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c
1889 index 550c6ca007cc..9c1241292d1d 100644
1890 --- a/net/appletalk/atalk_proc.c
1891 +++ b/net/appletalk/atalk_proc.c
1892 @@ -229,6 +229,8 @@ int __init atalk_proc_init(void)
1893 sizeof(struct aarp_iter_state), NULL))
1894 goto out;
1895
1896 + return 0;
1897 +
1898 out:
1899 remove_proc_subtree("atalk", init_net.proc_net);
1900 return -ENOMEM;
1901 diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
1902 index 44385252d7b6..7bf6860fed78 100644
1903 --- a/net/bluetooth/hci_event.c
1904 +++ b/net/bluetooth/hci_event.c
1905 @@ -2444,7 +2444,7 @@ static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
1906
1907 BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
1908
1909 - if (!num_rsp)
1910 + if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1)
1911 return;
1912
1913 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))
1914 @@ -4067,6 +4067,9 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev,
1915 struct inquiry_info_with_rssi_and_pscan_mode *info;
1916 info = (void *) (skb->data + 1);
1917
1918 + if (skb->len < num_rsp * sizeof(*info) + 1)
1919 + goto unlock;
1920 +
1921 for (; num_rsp; num_rsp--, info++) {
1922 u32 flags;
1923
1924 @@ -4088,6 +4091,9 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev,
1925 } else {
1926 struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
1927
1928 + if (skb->len < num_rsp * sizeof(*info) + 1)
1929 + goto unlock;
1930 +
1931 for (; num_rsp; num_rsp--, info++) {
1932 u32 flags;
1933
1934 @@ -4108,6 +4114,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev,
1935 }
1936 }
1937
1938 +unlock:
1939 hci_dev_unlock(hdev);
1940 }
1941
1942 @@ -4270,7 +4277,7 @@ static void hci_extended_inquiry_result_evt(struct hci_dev *hdev,
1943
1944 BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
1945
1946 - if (!num_rsp)
1947 + if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1)
1948 return;
1949
1950 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))
1951 diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
1952 index 1b851fd82613..47b6d73d30e5 100644
1953 --- a/net/ipv4/fib_trie.c
1954 +++ b/net/ipv4/fib_trie.c
1955 @@ -1751,7 +1751,7 @@ struct fib_table *fib_trie_unmerge(struct fib_table *oldtb)
1956 while ((l = leaf_walk_rcu(&tp, key)) != NULL) {
1957 struct key_vector *local_l = NULL, *local_tp;
1958
1959 - hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) {
1960 + hlist_for_each_entry(fa, &l->leaf, fa_list) {
1961 struct fib_alias *new_fa;
1962
1963 if (local_tb->tb_id != fa->tb_id)
1964 diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
1965 index 4de7e962d3da..c840141876bc 100644
1966 --- a/net/ipv4/gre_offload.c
1967 +++ b/net/ipv4/gre_offload.c
1968 @@ -15,12 +15,12 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
1969 netdev_features_t features)
1970 {
1971 int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
1972 + bool need_csum, need_recompute_csum, gso_partial;
1973 struct sk_buff *segs = ERR_PTR(-EINVAL);
1974 u16 mac_offset = skb->mac_header;
1975 __be16 protocol = skb->protocol;
1976 u16 mac_len = skb->mac_len;
1977 int gre_offset, outer_hlen;
1978 - bool need_csum, gso_partial;
1979
1980 if (!skb->encapsulation)
1981 goto out;
1982 @@ -41,6 +41,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
1983 skb->protocol = skb->inner_protocol;
1984
1985 need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM);
1986 + need_recompute_csum = skb->csum_not_inet;
1987 skb->encap_hdr_csum = need_csum;
1988
1989 features &= skb->dev->hw_enc_features;
1990 @@ -98,7 +99,15 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
1991 }
1992
1993 *(pcsum + 1) = 0;
1994 - *pcsum = gso_make_checksum(skb, 0);
1995 + if (need_recompute_csum && !skb_is_gso(skb)) {
1996 + __wsum csum;
1997 +
1998 + csum = skb_checksum(skb, gre_offset,
1999 + skb->len - gre_offset, 0);
2000 + *pcsum = csum_fold(csum);
2001 + } else {
2002 + *pcsum = gso_make_checksum(skb, 0);
2003 + }
2004 } while ((skb = skb->next));
2005 out:
2006 return segs;
2007 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2008 index 5040f7ca37ec..ab5358281000 100644
2009 --- a/net/ipv4/tcp_input.c
2010 +++ b/net/ipv4/tcp_input.c
2011 @@ -2944,6 +2944,8 @@ static bool tcp_ack_update_rtt(struct sock *sk, const int flag,
2012 u32 delta = tcp_time_stamp(tp) - tp->rx_opt.rcv_tsecr;
2013
2014 if (likely(delta < INT_MAX / (USEC_PER_SEC / TCP_TS_HZ))) {
2015 + if (!delta)
2016 + delta = 1;
2017 seq_rtt_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
2018 ca_rtt_us = seq_rtt_us;
2019 }
2020 diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
2021 index fed91ab7ec46..cf3a88a10ddd 100644
2022 --- a/net/ipv6/anycast.c
2023 +++ b/net/ipv6/anycast.c
2024 @@ -183,7 +183,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
2025 return 0;
2026 }
2027
2028 -void ipv6_sock_ac_close(struct sock *sk)
2029 +void __ipv6_sock_ac_close(struct sock *sk)
2030 {
2031 struct ipv6_pinfo *np = inet6_sk(sk);
2032 struct net_device *dev = NULL;
2033 @@ -191,10 +191,7 @@ void ipv6_sock_ac_close(struct sock *sk)
2034 struct net *net = sock_net(sk);
2035 int prev_index;
2036
2037 - if (!np->ipv6_ac_list)
2038 - return;
2039 -
2040 - rtnl_lock();
2041 + ASSERT_RTNL();
2042 pac = np->ipv6_ac_list;
2043 np->ipv6_ac_list = NULL;
2044
2045 @@ -211,6 +208,16 @@ void ipv6_sock_ac_close(struct sock *sk)
2046 sock_kfree_s(sk, pac, sizeof(*pac));
2047 pac = next;
2048 }
2049 +}
2050 +
2051 +void ipv6_sock_ac_close(struct sock *sk)
2052 +{
2053 + struct ipv6_pinfo *np = inet6_sk(sk);
2054 +
2055 + if (!np->ipv6_ac_list)
2056 + return;
2057 + rtnl_lock();
2058 + __ipv6_sock_ac_close(sk);
2059 rtnl_unlock();
2060 }
2061
2062 diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
2063 index 5af97b4f5df3..5352c7e68c42 100644
2064 --- a/net/ipv6/ipv6_sockglue.c
2065 +++ b/net/ipv6/ipv6_sockglue.c
2066 @@ -205,6 +205,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
2067
2068 fl6_free_socklist(sk);
2069 __ipv6_sock_mc_close(sk);
2070 + __ipv6_sock_ac_close(sk);
2071
2072 /*
2073 * Sock is moving from IPv6 to IPv4 (sk_prot), so
2074 diff --git a/net/ipv6/route.c b/net/ipv6/route.c
2075 index 94ade43d5a45..46df6345bb99 100644
2076 --- a/net/ipv6/route.c
2077 +++ b/net/ipv6/route.c
2078 @@ -3686,14 +3686,14 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
2079 rt->fib6_src.plen = cfg->fc_src_len;
2080 #endif
2081 if (nh) {
2082 - if (!nexthop_get(nh)) {
2083 - NL_SET_ERR_MSG(extack, "Nexthop has been deleted");
2084 - goto out;
2085 - }
2086 if (rt->fib6_src.plen) {
2087 NL_SET_ERR_MSG(extack, "Nexthops can not be used with source routing");
2088 goto out;
2089 }
2090 + if (!nexthop_get(nh)) {
2091 + NL_SET_ERR_MSG(extack, "Nexthop has been deleted");
2092 + goto out;
2093 + }
2094 rt->nh = nh;
2095 fib6_nh = nexthop_fib6_nh(rt->nh);
2096 } else {
2097 diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
2098 index 8b70298857e3..c86e404cd65b 100644
2099 --- a/net/openvswitch/conntrack.c
2100 +++ b/net/openvswitch/conntrack.c
2101 @@ -276,10 +276,6 @@ void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key)
2102 ovs_ct_update_key(skb, NULL, key, false, false);
2103 }
2104
2105 -#define IN6_ADDR_INITIALIZER(ADDR) \
2106 - { (ADDR).s6_addr32[0], (ADDR).s6_addr32[1], \
2107 - (ADDR).s6_addr32[2], (ADDR).s6_addr32[3] }
2108 -
2109 int ovs_ct_put_key(const struct sw_flow_key *swkey,
2110 const struct sw_flow_key *output, struct sk_buff *skb)
2111 {
2112 @@ -301,24 +297,30 @@ int ovs_ct_put_key(const struct sw_flow_key *swkey,
2113
2114 if (swkey->ct_orig_proto) {
2115 if (swkey->eth.type == htons(ETH_P_IP)) {
2116 - struct ovs_key_ct_tuple_ipv4 orig = {
2117 - output->ipv4.ct_orig.src,
2118 - output->ipv4.ct_orig.dst,
2119 - output->ct.orig_tp.src,
2120 - output->ct.orig_tp.dst,
2121 - output->ct_orig_proto,
2122 - };
2123 + struct ovs_key_ct_tuple_ipv4 orig;
2124 +
2125 + memset(&orig, 0, sizeof(orig));
2126 + orig.ipv4_src = output->ipv4.ct_orig.src;
2127 + orig.ipv4_dst = output->ipv4.ct_orig.dst;
2128 + orig.src_port = output->ct.orig_tp.src;
2129 + orig.dst_port = output->ct.orig_tp.dst;
2130 + orig.ipv4_proto = output->ct_orig_proto;
2131 +
2132 if (nla_put(skb, OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4,
2133 sizeof(orig), &orig))
2134 return -EMSGSIZE;
2135 } else if (swkey->eth.type == htons(ETH_P_IPV6)) {
2136 - struct ovs_key_ct_tuple_ipv6 orig = {
2137 - IN6_ADDR_INITIALIZER(output->ipv6.ct_orig.src),
2138 - IN6_ADDR_INITIALIZER(output->ipv6.ct_orig.dst),
2139 - output->ct.orig_tp.src,
2140 - output->ct.orig_tp.dst,
2141 - output->ct_orig_proto,
2142 - };
2143 + struct ovs_key_ct_tuple_ipv6 orig;
2144 +
2145 + memset(&orig, 0, sizeof(orig));
2146 + memcpy(orig.ipv6_src, output->ipv6.ct_orig.src.s6_addr32,
2147 + sizeof(orig.ipv6_src));
2148 + memcpy(orig.ipv6_dst, output->ipv6.ct_orig.dst.s6_addr32,
2149 + sizeof(orig.ipv6_dst));
2150 + orig.src_port = output->ct.orig_tp.src;
2151 + orig.dst_port = output->ct.orig_tp.dst;
2152 + orig.ipv6_proto = output->ct_orig_proto;
2153 +
2154 if (nla_put(skb, OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6,
2155 sizeof(orig), &orig))
2156 return -EMSGSIZE;
2157 diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
2158 index f07970207b54..38a46167523f 100644
2159 --- a/net/rxrpc/call_object.c
2160 +++ b/net/rxrpc/call_object.c
2161 @@ -288,7 +288,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
2162 */
2163 ret = rxrpc_connect_call(rx, call, cp, srx, gfp);
2164 if (ret < 0)
2165 - goto error;
2166 + goto error_attached_to_socket;
2167
2168 trace_rxrpc_call(call->debug_id, rxrpc_call_connected,
2169 atomic_read(&call->usage), here, NULL);
2170 @@ -308,18 +308,29 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
2171 error_dup_user_ID:
2172 write_unlock(&rx->call_lock);
2173 release_sock(&rx->sk);
2174 - ret = -EEXIST;
2175 -
2176 -error:
2177 __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
2178 - RX_CALL_DEAD, ret);
2179 + RX_CALL_DEAD, -EEXIST);
2180 trace_rxrpc_call(call->debug_id, rxrpc_call_error,
2181 - atomic_read(&call->usage), here, ERR_PTR(ret));
2182 + atomic_read(&call->usage), here, ERR_PTR(-EEXIST));
2183 rxrpc_release_call(rx, call);
2184 mutex_unlock(&call->user_mutex);
2185 rxrpc_put_call(call, rxrpc_call_put);
2186 - _leave(" = %d", ret);
2187 - return ERR_PTR(ret);
2188 + _leave(" = -EEXIST");
2189 + return ERR_PTR(-EEXIST);
2190 +
2191 + /* We got an error, but the call is attached to the socket and is in
2192 + * need of release. However, we might now race with recvmsg() when
2193 + * completing the call queues it. Return 0 from sys_sendmsg() and
2194 + * leave the error to recvmsg() to deal with.
2195 + */
2196 +error_attached_to_socket:
2197 + trace_rxrpc_call(call->debug_id, rxrpc_call_error,
2198 + atomic_read(&call->usage), here, ERR_PTR(ret));
2199 + set_bit(RXRPC_CALL_DISCONNECTED, &call->flags);
2200 + __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
2201 + RX_CALL_DEAD, ret);
2202 + _leave(" = c=%08x [err]", call->debug_id);
2203 + return call;
2204 }
2205
2206 /*
2207 diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c
2208 index 19e141eeed17..8cbe0bf20ed5 100644
2209 --- a/net/rxrpc/conn_object.c
2210 +++ b/net/rxrpc/conn_object.c
2211 @@ -212,9 +212,11 @@ void rxrpc_disconnect_call(struct rxrpc_call *call)
2212
2213 call->peer->cong_cwnd = call->cong_cwnd;
2214
2215 - spin_lock_bh(&conn->params.peer->lock);
2216 - hlist_del_rcu(&call->error_link);
2217 - spin_unlock_bh(&conn->params.peer->lock);
2218 + if (!hlist_unhashed(&call->error_link)) {
2219 + spin_lock_bh(&call->peer->lock);
2220 + hlist_del_rcu(&call->error_link);
2221 + spin_unlock_bh(&call->peer->lock);
2222 + }
2223
2224 if (rxrpc_is_client_call(call))
2225 return rxrpc_disconnect_client_call(call);
2226 diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
2227 index 6896a33ef842..4f48e3bdd4b4 100644
2228 --- a/net/rxrpc/recvmsg.c
2229 +++ b/net/rxrpc/recvmsg.c
2230 @@ -541,7 +541,7 @@ try_again:
2231 goto error_unlock_call;
2232 }
2233
2234 - if (msg->msg_name) {
2235 + if (msg->msg_name && call->peer) {
2236 struct sockaddr_rxrpc *srx = msg->msg_name;
2237 size_t len = sizeof(call->peer->srx);
2238
2239 diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
2240 index 49d03c8c64da..1a340eb0abf7 100644
2241 --- a/net/rxrpc/sendmsg.c
2242 +++ b/net/rxrpc/sendmsg.c
2243 @@ -683,6 +683,9 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
2244 if (IS_ERR(call))
2245 return PTR_ERR(call);
2246 /* ... and we have the call lock. */
2247 + ret = 0;
2248 + if (READ_ONCE(call->state) == RXRPC_CALL_COMPLETE)
2249 + goto out_put_unlock;
2250 } else {
2251 switch (READ_ONCE(call->state)) {
2252 case RXRPC_CALL_UNINITIALISED:
2253 diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
2254 index d11b70552c33..f0dcb6d14bbb 100644
2255 --- a/net/sunrpc/svc.c
2256 +++ b/net/sunrpc/svc.c
2257 @@ -1634,6 +1634,22 @@ u32 svc_max_payload(const struct svc_rqst *rqstp)
2258 }
2259 EXPORT_SYMBOL_GPL(svc_max_payload);
2260
2261 +/**
2262 + * svc_encode_read_payload - mark a range of bytes as a READ payload
2263 + * @rqstp: svc_rqst to operate on
2264 + * @offset: payload's byte offset in rqstp->rq_res
2265 + * @length: size of payload, in bytes
2266 + *
2267 + * Returns zero on success, or a negative errno if a permanent
2268 + * error occurred.
2269 + */
2270 +int svc_encode_read_payload(struct svc_rqst *rqstp, unsigned int offset,
2271 + unsigned int length)
2272 +{
2273 + return rqstp->rq_xprt->xpt_ops->xpo_read_payload(rqstp, offset, length);
2274 +}
2275 +EXPORT_SYMBOL_GPL(svc_encode_read_payload);
2276 +
2277 /**
2278 * svc_fill_write_vector - Construct data argument for VFS write call
2279 * @rqstp: svc_rqst to operate on
2280 diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
2281 index 4260924ad9db..d52abde51f1b 100644
2282 --- a/net/sunrpc/svcsock.c
2283 +++ b/net/sunrpc/svcsock.c
2284 @@ -279,6 +279,12 @@ out:
2285 return len;
2286 }
2287
2288 +static int svc_sock_read_payload(struct svc_rqst *rqstp, unsigned int offset,
2289 + unsigned int length)
2290 +{
2291 + return 0;
2292 +}
2293 +
2294 /*
2295 * Report socket names for nfsdfs
2296 */
2297 @@ -655,6 +661,7 @@ static const struct svc_xprt_ops svc_udp_ops = {
2298 .xpo_create = svc_udp_create,
2299 .xpo_recvfrom = svc_udp_recvfrom,
2300 .xpo_sendto = svc_udp_sendto,
2301 + .xpo_read_payload = svc_sock_read_payload,
2302 .xpo_release_rqst = svc_release_udp_skb,
2303 .xpo_detach = svc_sock_detach,
2304 .xpo_free = svc_sock_free,
2305 @@ -1175,6 +1182,7 @@ static const struct svc_xprt_ops svc_tcp_ops = {
2306 .xpo_create = svc_tcp_create,
2307 .xpo_recvfrom = svc_tcp_recvfrom,
2308 .xpo_sendto = svc_tcp_sendto,
2309 + .xpo_read_payload = svc_sock_read_payload,
2310 .xpo_release_rqst = svc_release_skb,
2311 .xpo_detach = svc_tcp_sock_detach,
2312 .xpo_free = svc_sock_free,
2313 diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
2314 index b8ee91ffedda..0ce4e75b2981 100644
2315 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
2316 +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
2317 @@ -193,6 +193,7 @@ svc_rdma_recv_ctxt_get(struct svcxprt_rdma *rdma)
2318
2319 out:
2320 ctxt->rc_page_count = 0;
2321 + ctxt->rc_read_payload_length = 0;
2322 return ctxt;
2323
2324 out_empty:
2325 diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c
2326 index a59912e2666d..066af6b2eb01 100644
2327 --- a/net/sunrpc/xprtrdma/svc_rdma_rw.c
2328 +++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c
2329 @@ -481,18 +481,19 @@ static int svc_rdma_send_xdr_kvec(struct svc_rdma_write_info *info,
2330 vec->iov_len);
2331 }
2332
2333 -/* Send an xdr_buf's page list by itself. A Write chunk is
2334 - * just the page list. a Reply chunk is the head, page list,
2335 - * and tail. This function is shared between the two types
2336 - * of chunk.
2337 +/* Send an xdr_buf's page list by itself. A Write chunk is just
2338 + * the page list. A Reply chunk is @xdr's head, page list, and
2339 + * tail. This function is shared between the two types of chunk.
2340 */
2341 static int svc_rdma_send_xdr_pagelist(struct svc_rdma_write_info *info,
2342 - struct xdr_buf *xdr)
2343 + struct xdr_buf *xdr,
2344 + unsigned int offset,
2345 + unsigned long length)
2346 {
2347 info->wi_xdr = xdr;
2348 - info->wi_next_off = 0;
2349 + info->wi_next_off = offset - xdr->head[0].iov_len;
2350 return svc_rdma_build_writes(info, svc_rdma_pagelist_to_sg,
2351 - xdr->page_len);
2352 + length);
2353 }
2354
2355 /**
2356 @@ -500,6 +501,8 @@ static int svc_rdma_send_xdr_pagelist(struct svc_rdma_write_info *info,
2357 * @rdma: controlling RDMA transport
2358 * @wr_ch: Write chunk provided by client
2359 * @xdr: xdr_buf containing the data payload
2360 + * @offset: payload's byte offset in @xdr
2361 + * @length: size of payload, in bytes
2362 *
2363 * Returns a non-negative number of bytes the chunk consumed, or
2364 * %-E2BIG if the payload was larger than the Write chunk,
2365 @@ -509,19 +512,20 @@ static int svc_rdma_send_xdr_pagelist(struct svc_rdma_write_info *info,
2366 * %-EIO if rdma_rw initialization failed (DMA mapping, etc).
2367 */
2368 int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma, __be32 *wr_ch,
2369 - struct xdr_buf *xdr)
2370 + struct xdr_buf *xdr,
2371 + unsigned int offset, unsigned long length)
2372 {
2373 struct svc_rdma_write_info *info;
2374 int ret;
2375
2376 - if (!xdr->page_len)
2377 + if (!length)
2378 return 0;
2379
2380 info = svc_rdma_write_info_alloc(rdma, wr_ch);
2381 if (!info)
2382 return -ENOMEM;
2383
2384 - ret = svc_rdma_send_xdr_pagelist(info, xdr);
2385 + ret = svc_rdma_send_xdr_pagelist(info, xdr, offset, length);
2386 if (ret < 0)
2387 goto out_err;
2388
2389 @@ -530,7 +534,7 @@ int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma, __be32 *wr_ch,
2390 goto out_err;
2391
2392 trace_svcrdma_encode_write(xdr->page_len);
2393 - return xdr->page_len;
2394 + return length;
2395
2396 out_err:
2397 svc_rdma_write_info_free(info);
2398 @@ -570,7 +574,9 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, __be32 *rp_ch,
2399 * client did not provide Write chunks.
2400 */
2401 if (!writelist && xdr->page_len) {
2402 - ret = svc_rdma_send_xdr_pagelist(info, xdr);
2403 + ret = svc_rdma_send_xdr_pagelist(info, xdr,
2404 + xdr->head[0].iov_len,
2405 + xdr->page_len);
2406 if (ret < 0)
2407 goto out_err;
2408 consumed += xdr->page_len;
2409 diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
2410 index 93ff7967389a..217106c66a13 100644
2411 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
2412 +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
2413 @@ -856,7 +856,18 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
2414
2415 if (wr_lst) {
2416 /* XXX: Presume the client sent only one Write chunk */
2417 - ret = svc_rdma_send_write_chunk(rdma, wr_lst, xdr);
2418 + unsigned long offset;
2419 + unsigned int length;
2420 +
2421 + if (rctxt->rc_read_payload_length) {
2422 + offset = rctxt->rc_read_payload_offset;
2423 + length = rctxt->rc_read_payload_length;
2424 + } else {
2425 + offset = xdr->head[0].iov_len;
2426 + length = xdr->page_len;
2427 + }
2428 + ret = svc_rdma_send_write_chunk(rdma, wr_lst, xdr, offset,
2429 + length);
2430 if (ret < 0)
2431 goto err2;
2432 svc_rdma_xdr_encode_write_list(rdma_resp, wr_lst, ret);
2433 @@ -891,3 +902,30 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
2434 set_bit(XPT_CLOSE, &xprt->xpt_flags);
2435 return -ENOTCONN;
2436 }
2437 +
2438 +/**
2439 + * svc_rdma_read_payload - special processing for a READ payload
2440 + * @rqstp: svc_rqst to operate on
2441 + * @offset: payload's byte offset in @xdr
2442 + * @length: size of payload, in bytes
2443 + *
2444 + * Returns zero on success.
2445 + *
2446 + * For the moment, just record the xdr_buf location of the READ
2447 + * payload. svc_rdma_sendto will use that location later when
2448 + * we actually send the payload.
2449 + */
2450 +int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset,
2451 + unsigned int length)
2452 +{
2453 + struct svc_rdma_recv_ctxt *rctxt = rqstp->rq_xprt_ctxt;
2454 +
2455 + /* XXX: Just one READ payload slot for now, since our
2456 + * transport implementation currently supports only one
2457 + * Write chunk.
2458 + */
2459 + rctxt->rc_read_payload_offset = offset;
2460 + rctxt->rc_read_payload_length = length;
2461 +
2462 + return 0;
2463 +}
2464 diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
2465 index 889220f11a70..89a12676c59d 100644
2466 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
2467 +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
2468 @@ -81,6 +81,7 @@ static const struct svc_xprt_ops svc_rdma_ops = {
2469 .xpo_create = svc_rdma_create,
2470 .xpo_recvfrom = svc_rdma_recvfrom,
2471 .xpo_sendto = svc_rdma_sendto,
2472 + .xpo_read_payload = svc_rdma_read_payload,
2473 .xpo_release_rqst = svc_rdma_release_rqst,
2474 .xpo_detach = svc_rdma_detach,
2475 .xpo_free = svc_rdma_free,
2476 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2477 index a34bbca80f49..ec559dbad56e 100644
2478 --- a/net/wireless/nl80211.c
2479 +++ b/net/wireless/nl80211.c
2480 @@ -12949,13 +12949,13 @@ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)
2481 if (!wdev_running(wdev))
2482 return -ENETDOWN;
2483 }
2484 -
2485 - if (!vcmd->doit)
2486 - return -EOPNOTSUPP;
2487 } else {
2488 wdev = NULL;
2489 }
2490
2491 + if (!vcmd->doit)
2492 + return -EOPNOTSUPP;
2493 +
2494 if (info->attrs[NL80211_ATTR_VENDOR_DATA]) {
2495 data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]);
2496 len = nla_len(info->attrs[NL80211_ATTR_VENDOR_DATA]);
2497 diff --git a/scripts/coccinelle/misc/add_namespace.cocci b/scripts/coccinelle/misc/add_namespace.cocci
2498 index 99e93a6c2e24..cbf1614163cb 100644
2499 --- a/scripts/coccinelle/misc/add_namespace.cocci
2500 +++ b/scripts/coccinelle/misc/add_namespace.cocci
2501 @@ -6,6 +6,7 @@
2502 /// add a missing namespace tag to a module source file.
2503 ///
2504
2505 +virtual nsdeps
2506 virtual report
2507
2508 @has_ns_import@
2509 @@ -16,10 +17,15 @@ MODULE_IMPORT_NS(ns);
2510
2511 // Add missing imports, but only adjacent to a MODULE_LICENSE statement.
2512 // That ensures we are adding it only to the main module source file.
2513 -@do_import depends on !has_ns_import@
2514 +@do_import depends on !has_ns_import && nsdeps@
2515 declarer name MODULE_LICENSE;
2516 expression license;
2517 identifier virtual.ns;
2518 @@
2519 MODULE_LICENSE(license);
2520 + MODULE_IMPORT_NS(ns);
2521 +
2522 +// Dummy rule for report mode that would otherwise be empty and make spatch
2523 +// fail ("No rules apply.")
2524 +@script:python depends on report@
2525 +@@
2526 diff --git a/scripts/nsdeps b/scripts/nsdeps
2527 index 04cea0921673..e547f33b96a6 100644
2528 --- a/scripts/nsdeps
2529 +++ b/scripts/nsdeps
2530 @@ -23,7 +23,7 @@ fi
2531
2532 generate_deps_for_ns() {
2533 $SPATCH --very-quiet --in-place --sp-file \
2534 - $srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2
2535 + $srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=$1 $2
2536 }
2537
2538 generate_deps() {
2539 diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig
2540 index 838476d780e5..d2054bec4909 100644
2541 --- a/security/integrity/ima/Kconfig
2542 +++ b/security/integrity/ima/Kconfig
2543 @@ -227,7 +227,7 @@ config IMA_APPRAISE_REQUIRE_POLICY_SIGS
2544
2545 config IMA_APPRAISE_BOOTPARAM
2546 bool "ima_appraise boot parameter"
2547 - depends on IMA_APPRAISE && !IMA_ARCH_POLICY
2548 + depends on IMA_APPRAISE
2549 default y
2550 help
2551 This option enables the different "ima_appraise=" modes
2552 diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
2553 index 136ae4e0ee92..23b04c6521b2 100644
2554 --- a/security/integrity/ima/ima_appraise.c
2555 +++ b/security/integrity/ima/ima_appraise.c
2556 @@ -18,6 +18,12 @@
2557 static int __init default_appraise_setup(char *str)
2558 {
2559 #ifdef CONFIG_IMA_APPRAISE_BOOTPARAM
2560 + if (arch_ima_get_secureboot()) {
2561 + pr_info("Secure boot enabled: ignoring ima_appraise=%s boot parameter option",
2562 + str);
2563 + return 1;
2564 + }
2565 +
2566 if (strncmp(str, "off", 3) == 0)
2567 ima_appraise = 0;
2568 else if (strncmp(str, "log", 3) == 0)
2569 diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
2570 index c21b656b3263..840a192e9337 100644
2571 --- a/security/smack/smackfs.c
2572 +++ b/security/smack/smackfs.c
2573 @@ -2720,7 +2720,6 @@ static int smk_open_relabel_self(struct inode *inode, struct file *file)
2574 static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf,
2575 size_t count, loff_t *ppos)
2576 {
2577 - struct task_smack *tsp = smack_cred(current_cred());
2578 char *data;
2579 int rc;
2580 LIST_HEAD(list_tmp);
2581 @@ -2745,11 +2744,21 @@ static ssize_t smk_write_relabel_self(struct file *file, const char __user *buf,
2582 kfree(data);
2583
2584 if (!rc || (rc == -EINVAL && list_empty(&list_tmp))) {
2585 + struct cred *new;
2586 + struct task_smack *tsp;
2587 +
2588 + new = prepare_creds();
2589 + if (!new) {
2590 + rc = -ENOMEM;
2591 + goto out;
2592 + }
2593 + tsp = smack_cred(new);
2594 smk_destroy_label_list(&tsp->smk_relabel);
2595 list_splice(&list_tmp, &tsp->smk_relabel);
2596 + commit_creds(new);
2597 return count;
2598 }
2599 -
2600 +out:
2601 smk_destroy_label_list(&list_tmp);
2602 return rc;
2603 }
2604 diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
2605 index 17f913657304..c8b9c0b315d8 100644
2606 --- a/sound/core/seq/oss/seq_oss.c
2607 +++ b/sound/core/seq/oss/seq_oss.c
2608 @@ -168,10 +168,16 @@ static long
2609 odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2610 {
2611 struct seq_oss_devinfo *dp;
2612 + long rc;
2613 +
2614 dp = file->private_data;
2615 if (snd_BUG_ON(!dp))
2616 return -ENXIO;
2617 - return snd_seq_oss_ioctl(dp, cmd, arg);
2618 +
2619 + mutex_lock(&register_mutex);
2620 + rc = snd_seq_oss_ioctl(dp, cmd, arg);
2621 + mutex_unlock(&register_mutex);
2622 + return rc;
2623 }
2624
2625 #ifdef CONFIG_COMPAT
2626 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
2627 index 07c03c32715a..801abf0fc98b 100644
2628 --- a/sound/pci/hda/hda_codec.c
2629 +++ b/sound/pci/hda/hda_codec.c
2630 @@ -2924,6 +2924,10 @@ static int hda_codec_runtime_suspend(struct device *dev)
2631 struct hda_codec *codec = dev_to_hda_codec(dev);
2632 unsigned int state;
2633
2634 + /* Nothing to do if card registration fails and the component driver never probes */
2635 + if (!codec->card)
2636 + return 0;
2637 +
2638 cancel_delayed_work_sync(&codec->jackpoll_work);
2639 state = hda_call_codec_suspend(codec);
2640 if (codec->link_down_at_suspend ||
2641 @@ -2938,6 +2942,10 @@ static int hda_codec_runtime_resume(struct device *dev)
2642 {
2643 struct hda_codec *codec = dev_to_hda_codec(dev);
2644
2645 + /* Nothing to do if card registration fails and the component driver never probes */
2646 + if (!codec->card)
2647 + return 0;
2648 +
2649 codec_display_power(codec, true);
2650 snd_hdac_codec_link_up(&codec->core);
2651 hda_call_codec_resume(codec);
2652 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
2653 index 95b0fdffc504..7353d2ec359a 100644
2654 --- a/sound/pci/hda/hda_intel.c
2655 +++ b/sound/pci/hda/hda_intel.c
2656 @@ -2306,7 +2306,6 @@ static int azx_probe_continue(struct azx *chip)
2657
2658 if (azx_has_pm_runtime(chip)) {
2659 pm_runtime_use_autosuspend(&pci->dev);
2660 - pm_runtime_allow(&pci->dev);
2661 pm_runtime_put_autosuspend(&pci->dev);
2662 }
2663
2664 diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
2665 index 1e904dd15ab3..6aa39339db0a 100644
2666 --- a/sound/pci/hda/patch_ca0132.c
2667 +++ b/sound/pci/hda/patch_ca0132.c
2668 @@ -1182,6 +1182,7 @@ static const struct snd_pci_quirk ca0132_quirks[] = {
2669 SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI),
2670 SND_PCI_QUIRK(0x3842, 0x1038, "EVGA X99 Classified", QUIRK_R3DI),
2671 SND_PCI_QUIRK(0x1102, 0x0013, "Recon3D", QUIRK_R3D),
2672 + SND_PCI_QUIRK(0x1102, 0x0018, "Recon3D", QUIRK_R3D),
2673 SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),
2674 {}
2675 };
2676 @@ -4670,7 +4671,7 @@ static int ca0132_alt_select_in(struct hda_codec *codec)
2677 tmp = FLOAT_ONE;
2678 break;
2679 case QUIRK_AE5:
2680 - ca0113_mmio_command_set(codec, 0x48, 0x28, 0x00);
2681 + ca0113_mmio_command_set(codec, 0x30, 0x28, 0x00);
2682 tmp = FLOAT_THREE;
2683 break;
2684 default:
2685 @@ -4716,7 +4717,7 @@ static int ca0132_alt_select_in(struct hda_codec *codec)
2686 r3di_gpio_mic_set(codec, R3DI_REAR_MIC);
2687 break;
2688 case QUIRK_AE5:
2689 - ca0113_mmio_command_set(codec, 0x48, 0x28, 0x00);
2690 + ca0113_mmio_command_set(codec, 0x30, 0x28, 0x00);
2691 break;
2692 default:
2693 break;
2694 @@ -4755,7 +4756,7 @@ static int ca0132_alt_select_in(struct hda_codec *codec)
2695 tmp = FLOAT_ONE;
2696 break;
2697 case QUIRK_AE5:
2698 - ca0113_mmio_command_set(codec, 0x48, 0x28, 0x3f);
2699 + ca0113_mmio_command_set(codec, 0x30, 0x28, 0x3f);
2700 tmp = FLOAT_THREE;
2701 break;
2702 default:
2703 @@ -5747,6 +5748,11 @@ static int ca0132_switch_get(struct snd_kcontrol *kcontrol,
2704 return 0;
2705 }
2706
2707 + if (nid == ZXR_HEADPHONE_GAIN) {
2708 + *valp = spec->zxr_gain_set;
2709 + return 0;
2710 + }
2711 +
2712 return 0;
2713 }
2714
2715 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2716 index f50d71da1226..ea25b8d0350d 100644
2717 --- a/sound/pci/hda/patch_realtek.c
2718 +++ b/sound/pci/hda/patch_realtek.c
2719 @@ -6131,6 +6131,11 @@ enum {
2720 ALC289_FIXUP_ASUS_GA502,
2721 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
2722 ALC285_FIXUP_HP_GPIO_AMP_INIT,
2723 + ALC269_FIXUP_CZC_B20,
2724 + ALC269_FIXUP_CZC_TMI,
2725 + ALC269_FIXUP_CZC_L101,
2726 + ALC269_FIXUP_LEMOTE_A1802,
2727 + ALC269_FIXUP_LEMOTE_A190X,
2728 };
2729
2730 static const struct hda_fixup alc269_fixups[] = {
2731 @@ -7369,6 +7374,89 @@ static const struct hda_fixup alc269_fixups[] = {
2732 .chained = true,
2733 .chain_id = ALC285_FIXUP_HP_GPIO_LED
2734 },
2735 + [ALC269_FIXUP_CZC_B20] = {
2736 + .type = HDA_FIXUP_PINS,
2737 + .v.pins = (const struct hda_pintbl[]) {
2738 + { 0x12, 0x411111f0 },
2739 + { 0x14, 0x90170110 }, /* speaker */
2740 + { 0x15, 0x032f1020 }, /* HP out */
2741 + { 0x17, 0x411111f0 },
2742 + { 0x18, 0x03ab1040 }, /* mic */
2743 + { 0x19, 0xb7a7013f },
2744 + { 0x1a, 0x0181305f },
2745 + { 0x1b, 0x411111f0 },
2746 + { 0x1d, 0x411111f0 },
2747 + { 0x1e, 0x411111f0 },
2748 + { }
2749 + },
2750 + .chain_id = ALC269_FIXUP_DMIC,
2751 + },
2752 + [ALC269_FIXUP_CZC_TMI] = {
2753 + .type = HDA_FIXUP_PINS,
2754 + .v.pins = (const struct hda_pintbl[]) {
2755 + { 0x12, 0x4000c000 },
2756 + { 0x14, 0x90170110 }, /* speaker */
2757 + { 0x15, 0x0421401f }, /* HP out */
2758 + { 0x17, 0x411111f0 },
2759 + { 0x18, 0x04a19020 }, /* mic */
2760 + { 0x19, 0x411111f0 },
2761 + { 0x1a, 0x411111f0 },
2762 + { 0x1b, 0x411111f0 },
2763 + { 0x1d, 0x40448505 },
2764 + { 0x1e, 0x411111f0 },
2765 + { 0x20, 0x8000ffff },
2766 + { }
2767 + },
2768 + .chain_id = ALC269_FIXUP_DMIC,
2769 + },
2770 + [ALC269_FIXUP_CZC_L101] = {
2771 + .type = HDA_FIXUP_PINS,
2772 + .v.pins = (const struct hda_pintbl[]) {
2773 + { 0x12, 0x40000000 },
2774 + { 0x14, 0x01014010 }, /* speaker */
2775 + { 0x15, 0x411111f0 }, /* HP out */
2776 + { 0x16, 0x411111f0 },
2777 + { 0x18, 0x01a19020 }, /* mic */
2778 + { 0x19, 0x02a19021 },
2779 + { 0x1a, 0x0181302f },
2780 + { 0x1b, 0x0221401f },
2781 + { 0x1c, 0x411111f0 },
2782 + { 0x1d, 0x4044c601 },
2783 + { 0x1e, 0x411111f0 },
2784 + { }
2785 + },
2786 + .chain_id = ALC269_FIXUP_DMIC,
2787 + },
2788 + [ALC269_FIXUP_LEMOTE_A1802] = {
2789 + .type = HDA_FIXUP_PINS,
2790 + .v.pins = (const struct hda_pintbl[]) {
2791 + { 0x12, 0x40000000 },
2792 + { 0x14, 0x90170110 }, /* speaker */
2793 + { 0x17, 0x411111f0 },
2794 + { 0x18, 0x03a19040 }, /* mic1 */
2795 + { 0x19, 0x90a70130 }, /* mic2 */
2796 + { 0x1a, 0x411111f0 },
2797 + { 0x1b, 0x411111f0 },
2798 + { 0x1d, 0x40489d2d },
2799 + { 0x1e, 0x411111f0 },
2800 + { 0x20, 0x0003ffff },
2801 + { 0x21, 0x03214020 },
2802 + { }
2803 + },
2804 + .chain_id = ALC269_FIXUP_DMIC,
2805 + },
2806 + [ALC269_FIXUP_LEMOTE_A190X] = {
2807 + .type = HDA_FIXUP_PINS,
2808 + .v.pins = (const struct hda_pintbl[]) {
2809 + { 0x14, 0x99130110 }, /* speaker */
2810 + { 0x15, 0x0121401f }, /* HP out */
2811 + { 0x18, 0x01a19c20 }, /* rear mic */
2812 + { 0x19, 0x99a3092f }, /* front mic */
2813 + { 0x1b, 0x0201401f }, /* front lineout */
2814 + { }
2815 + },
2816 + .chain_id = ALC269_FIXUP_DMIC,
2817 + },
2818 };
2819
2820 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2821 @@ -7658,9 +7746,14 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2822 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
2823 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
2824 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
2825 + SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
2826 + SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
2827 + SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
2828 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
2829 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
2830 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
2831 + SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
2832 + SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
2833
2834 #if 0
2835 /* Below is a quirk table taken from the old code.
2836 @@ -8945,6 +9038,7 @@ enum {
2837 ALC662_FIXUP_LED_GPIO1,
2838 ALC662_FIXUP_IDEAPAD,
2839 ALC272_FIXUP_MARIO,
2840 + ALC662_FIXUP_CZC_ET26,
2841 ALC662_FIXUP_CZC_P10T,
2842 ALC662_FIXUP_SKU_IGNORE,
2843 ALC662_FIXUP_HP_RP5800,
2844 @@ -9014,6 +9108,25 @@ static const struct hda_fixup alc662_fixups[] = {
2845 .type = HDA_FIXUP_FUNC,
2846 .v.func = alc272_fixup_mario,
2847 },
2848 + [ALC662_FIXUP_CZC_ET26] = {
2849 + .type = HDA_FIXUP_PINS,
2850 + .v.pins = (const struct hda_pintbl[]) {
2851 + {0x12, 0x403cc000},
2852 + {0x14, 0x90170110}, /* speaker */
2853 + {0x15, 0x411111f0},
2854 + {0x16, 0x411111f0},
2855 + {0x18, 0x01a19030}, /* mic */
2856 + {0x19, 0x90a7013f}, /* int-mic */
2857 + {0x1a, 0x01014020},
2858 + {0x1b, 0x0121401f},
2859 + {0x1c, 0x411111f0},
2860 + {0x1d, 0x411111f0},
2861 + {0x1e, 0x40478e35},
2862 + {}
2863 + },
2864 + .chained = true,
2865 + .chain_id = ALC662_FIXUP_SKU_IGNORE
2866 + },
2867 [ALC662_FIXUP_CZC_P10T] = {
2868 .type = HDA_FIXUP_VERBS,
2869 .v.verbs = (const struct hda_verb[]) {
2870 @@ -9397,6 +9510,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
2871 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
2872 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
2873 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
2874 + SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
2875 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
2876 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
2877
2878 diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
2879 index 798284f511f1..4559a15e6657 100644
2880 --- a/tools/lib/traceevent/event-parse.c
2881 +++ b/tools/lib/traceevent/event-parse.c
2882 @@ -2861,6 +2861,7 @@ process_dynamic_array_len(struct tep_event *event, struct tep_print_arg *arg,
2883 if (read_expected(TEP_EVENT_DELIM, ")") < 0)
2884 goto out_err;
2885
2886 + free_token(token);
2887 type = read_token(&token);
2888 *tok = token;
2889
2890 diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c
2891 index 4b02933cab8a..bdc03a2097e8 100644
2892 --- a/tools/testing/selftests/net/msg_zerocopy.c
2893 +++ b/tools/testing/selftests/net/msg_zerocopy.c
2894 @@ -125,9 +125,8 @@ static int do_setcpu(int cpu)
2895 CPU_ZERO(&mask);
2896 CPU_SET(cpu, &mask);
2897 if (sched_setaffinity(0, sizeof(mask), &mask))
2898 - error(1, 0, "setaffinity %d", cpu);
2899 -
2900 - if (cfg_verbose)
2901 + fprintf(stderr, "cpu: unable to pin, may increase variance.\n");
2902 + else if (cfg_verbose)
2903 fprintf(stderr, "cpu: %u\n", cpu);
2904
2905 return 0;