Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Sun, 10 Mar 2019 14:15:20
Message-Id: 1552227297.1d0ba6c74d9dabecc5ab3378f68b3860a5ac86f6.mpagano@gentoo
1 commit: 1d0ba6c74d9dabecc5ab3378f68b3860a5ac86f6
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 10 14:14:57 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 10 14:14:57 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1d0ba6c7
7
8 proj/linux-patches: Linux patch 4.19.28
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1027_linux-4.19.28.patch | 2598 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2602 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 2190cb3..292278e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -151,6 +151,10 @@ Patch: 1026_linux-4.19.27.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.19.27
23
24 +Patch: 1027_linux-4.19.28.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.19.28
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1027_linux-4.19.28.patch b/1027_linux-4.19.28.patch
33 new file mode 100644
34 index 0000000..c2e1d84
35 --- /dev/null
36 +++ b/1027_linux-4.19.28.patch
37 @@ -0,0 +1,2598 @@
38 +diff --git a/Makefile b/Makefile
39 +index 70ed9a53558a5..c6ac023ba33a5 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 27
47 ++SUBLEVEL = 28
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
52 +index ba150c755fcce..85b6c60f285d2 100644
53 +--- a/arch/mips/kernel/irq.c
54 ++++ b/arch/mips/kernel/irq.c
55 +@@ -52,6 +52,7 @@ asmlinkage void spurious_interrupt(void)
56 + void __init init_IRQ(void)
57 + {
58 + int i;
59 ++ unsigned int order = get_order(IRQ_STACK_SIZE);
60 +
61 + for (i = 0; i < NR_IRQS; i++)
62 + irq_set_noprobe(i);
63 +@@ -62,8 +63,7 @@ void __init init_IRQ(void)
64 + arch_init_irq();
65 +
66 + for_each_possible_cpu(i) {
67 +- int irq_pages = IRQ_STACK_SIZE / PAGE_SIZE;
68 +- void *s = (void *)__get_free_pages(GFP_KERNEL, irq_pages);
69 ++ void *s = (void *)__get_free_pages(GFP_KERNEL, order);
70 +
71 + irq_stack[i] = s;
72 + pr_debug("CPU%d IRQ stack at 0x%p - 0x%p\n", i,
73 +diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c
74 +index 9e21573714910..f8debf7aeb4c1 100644
75 +--- a/arch/x86/boot/compressed/pgtable_64.c
76 ++++ b/arch/x86/boot/compressed/pgtable_64.c
77 +@@ -1,5 +1,7 @@
78 ++#include <linux/efi.h>
79 + #include <asm/e820/types.h>
80 + #include <asm/processor.h>
81 ++#include <asm/efi.h>
82 + #include "pgtable.h"
83 + #include "../string.h"
84 +
85 +@@ -37,9 +39,10 @@ int cmdline_find_option_bool(const char *option);
86 +
87 + static unsigned long find_trampoline_placement(void)
88 + {
89 +- unsigned long bios_start, ebda_start;
90 ++ unsigned long bios_start = 0, ebda_start = 0;
91 + unsigned long trampoline_start;
92 + struct boot_e820_entry *entry;
93 ++ char *signature;
94 + int i;
95 +
96 + /*
97 +@@ -47,8 +50,18 @@ static unsigned long find_trampoline_placement(void)
98 + * This code is based on reserve_bios_regions().
99 + */
100 +
101 +- ebda_start = *(unsigned short *)0x40e << 4;
102 +- bios_start = *(unsigned short *)0x413 << 10;
103 ++ /*
104 ++ * EFI systems may not provide legacy ROM. The memory may not be mapped
105 ++ * at all.
106 ++ *
107 ++ * Only look for values in the legacy ROM for non-EFI system.
108 ++ */
109 ++ signature = (char *)&boot_params->efi_info.efi_loader_signature;
110 ++ if (strncmp(signature, EFI32_LOADER_SIGNATURE, 4) &&
111 ++ strncmp(signature, EFI64_LOADER_SIGNATURE, 4)) {
112 ++ ebda_start = *(unsigned short *)0x40e << 4;
113 ++ bios_start = *(unsigned short *)0x413 << 10;
114 ++ }
115 +
116 + if (bios_start < BIOS_START_MIN || bios_start > BIOS_START_MAX)
117 + bios_start = BIOS_START_MAX;
118 +diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
119 +index eeea634bee0a7..6a25278e00929 100644
120 +--- a/arch/x86/kernel/cpu/amd.c
121 ++++ b/arch/x86/kernel/cpu/amd.c
122 +@@ -818,11 +818,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
123 + static void init_amd_zn(struct cpuinfo_x86 *c)
124 + {
125 + set_cpu_cap(c, X86_FEATURE_ZEN);
126 +- /*
127 +- * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
128 +- * all up to and including B1.
129 +- */
130 +- if (c->x86_model <= 1 && c->x86_stepping <= 1)
131 ++
132 ++ /* Fix erratum 1076: CPB feature bit not being set in CPUID. */
133 ++ if (!cpu_has(c, X86_FEATURE_CPB))
134 + set_cpu_cap(c, X86_FEATURE_CPB);
135 + }
136 +
137 +diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
138 +index 4bb68133a72af..5a0e0bd68b769 100644
139 +--- a/arch/xtensa/kernel/process.c
140 ++++ b/arch/xtensa/kernel/process.c
141 +@@ -320,8 +320,8 @@ unsigned long get_wchan(struct task_struct *p)
142 +
143 + /* Stack layout: sp-4: ra, sp-3: sp' */
144 +
145 +- pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp);
146 +- sp = *(unsigned long *)sp - 3;
147 ++ pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp);
148 ++ sp = SPILL_SLOT(sp, 1);
149 + } while (count++ < 16);
150 + return 0;
151 + }
152 +diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
153 +index 7f9ea8e4c1b22..1342f8e6025cc 100644
154 +--- a/drivers/bluetooth/btrtl.c
155 ++++ b/drivers/bluetooth/btrtl.c
156 +@@ -544,10 +544,9 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
157 + hdev->bus);
158 +
159 + if (!btrtl_dev->ic_info) {
160 +- rtl_dev_err(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
161 ++ rtl_dev_info(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
162 + lmp_subver, hci_rev, hci_ver);
163 +- ret = -EINVAL;
164 +- goto err_free;
165 ++ return btrtl_dev;
166 + }
167 +
168 + if (btrtl_dev->ic_info->has_rom_version) {
169 +@@ -602,6 +601,11 @@ int btrtl_download_firmware(struct hci_dev *hdev,
170 + * standard btusb. Once that firmware is uploaded, the subver changes
171 + * to a different value.
172 + */
173 ++ if (!btrtl_dev->ic_info) {
174 ++ rtl_dev_info(hdev, "rtl: assuming no firmware upload needed\n");
175 ++ return 0;
176 ++ }
177 ++
178 + switch (btrtl_dev->ic_info->lmp_subver) {
179 + case RTL_ROM_LMP_8723A:
180 + case RTL_ROM_LMP_3499:
181 +diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
182 +index c0a5b1f3a9863..4ccc39e00ced3 100644
183 +--- a/drivers/char/applicom.c
184 ++++ b/drivers/char/applicom.c
185 +@@ -32,6 +32,7 @@
186 + #include <linux/wait.h>
187 + #include <linux/init.h>
188 + #include <linux/fs.h>
189 ++#include <linux/nospec.h>
190 +
191 + #include <asm/io.h>
192 + #include <linux/uaccess.h>
193 +@@ -386,7 +387,11 @@ static ssize_t ac_write(struct file *file, const char __user *buf, size_t count,
194 + TicCard = st_loc.tic_des_from_pc; /* tic number to send */
195 + IndexCard = NumCard - 1;
196 +
197 +- if((NumCard < 1) || (NumCard > MAX_BOARD) || !apbs[IndexCard].RamIO)
198 ++ if (IndexCard >= MAX_BOARD)
199 ++ return -EINVAL;
200 ++ IndexCard = array_index_nospec(IndexCard, MAX_BOARD);
201 ++
202 ++ if (!apbs[IndexCard].RamIO)
203 + return -EINVAL;
204 +
205 + #ifdef DEBUG
206 +@@ -697,6 +702,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
207 + unsigned char IndexCard;
208 + void __iomem *pmem;
209 + int ret = 0;
210 ++ static int warncount = 10;
211 + volatile unsigned char byte_reset_it;
212 + struct st_ram_io *adgl;
213 + void __user *argp = (void __user *)arg;
214 +@@ -711,16 +717,12 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
215 + mutex_lock(&ac_mutex);
216 + IndexCard = adgl->num_card-1;
217 +
218 +- if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
219 +- static int warncount = 10;
220 +- if (warncount) {
221 +- printk( KERN_WARNING "APPLICOM driver IOCTL, bad board number %d\n",(int)IndexCard+1);
222 +- warncount--;
223 +- }
224 +- kfree(adgl);
225 +- mutex_unlock(&ac_mutex);
226 +- return -EINVAL;
227 +- }
228 ++ if (cmd != 6 && IndexCard >= MAX_BOARD)
229 ++ goto err;
230 ++ IndexCard = array_index_nospec(IndexCard, MAX_BOARD);
231 ++
232 ++ if (cmd != 6 && !apbs[IndexCard].RamIO)
233 ++ goto err;
234 +
235 + switch (cmd) {
236 +
237 +@@ -838,5 +840,16 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
238 + kfree(adgl);
239 + mutex_unlock(&ac_mutex);
240 + return 0;
241 ++
242 ++err:
243 ++ if (warncount) {
244 ++ pr_warn("APPLICOM driver IOCTL, bad board number %d\n",
245 ++ (int)IndexCard + 1);
246 ++ warncount--;
247 ++ }
248 ++ kfree(adgl);
249 ++ mutex_unlock(&ac_mutex);
250 ++ return -EINVAL;
251 ++
252 + }
253 +
254 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
255 +index b100260b6ed2e..505c9a55d5551 100644
256 +--- a/drivers/cpufreq/cpufreq.c
257 ++++ b/drivers/cpufreq/cpufreq.c
258 +@@ -545,13 +545,13 @@ EXPORT_SYMBOL_GPL(cpufreq_policy_transition_delay_us);
259 + * SYSFS INTERFACE *
260 + *********************************************************************/
261 + static ssize_t show_boost(struct kobject *kobj,
262 +- struct attribute *attr, char *buf)
263 ++ struct kobj_attribute *attr, char *buf)
264 + {
265 + return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled);
266 + }
267 +
268 +-static ssize_t store_boost(struct kobject *kobj, struct attribute *attr,
269 +- const char *buf, size_t count)
270 ++static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr,
271 ++ const char *buf, size_t count)
272 + {
273 + int ret, enable;
274 +
275 +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
276 +index b6a1aadaff9f3..a005711f909ea 100644
277 +--- a/drivers/cpufreq/intel_pstate.c
278 ++++ b/drivers/cpufreq/intel_pstate.c
279 +@@ -833,7 +833,7 @@ static void intel_pstate_update_policies(void)
280 + /************************** sysfs begin ************************/
281 + #define show_one(file_name, object) \
282 + static ssize_t show_##file_name \
283 +- (struct kobject *kobj, struct attribute *attr, char *buf) \
284 ++ (struct kobject *kobj, struct kobj_attribute *attr, char *buf) \
285 + { \
286 + return sprintf(buf, "%u\n", global.object); \
287 + }
288 +@@ -842,7 +842,7 @@ static ssize_t intel_pstate_show_status(char *buf);
289 + static int intel_pstate_update_status(const char *buf, size_t size);
290 +
291 + static ssize_t show_status(struct kobject *kobj,
292 +- struct attribute *attr, char *buf)
293 ++ struct kobj_attribute *attr, char *buf)
294 + {
295 + ssize_t ret;
296 +
297 +@@ -853,7 +853,7 @@ static ssize_t show_status(struct kobject *kobj,
298 + return ret;
299 + }
300 +
301 +-static ssize_t store_status(struct kobject *a, struct attribute *b,
302 ++static ssize_t store_status(struct kobject *a, struct kobj_attribute *b,
303 + const char *buf, size_t count)
304 + {
305 + char *p = memchr(buf, '\n', count);
306 +@@ -867,7 +867,7 @@ static ssize_t store_status(struct kobject *a, struct attribute *b,
307 + }
308 +
309 + static ssize_t show_turbo_pct(struct kobject *kobj,
310 +- struct attribute *attr, char *buf)
311 ++ struct kobj_attribute *attr, char *buf)
312 + {
313 + struct cpudata *cpu;
314 + int total, no_turbo, turbo_pct;
315 +@@ -893,7 +893,7 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
316 + }
317 +
318 + static ssize_t show_num_pstates(struct kobject *kobj,
319 +- struct attribute *attr, char *buf)
320 ++ struct kobj_attribute *attr, char *buf)
321 + {
322 + struct cpudata *cpu;
323 + int total;
324 +@@ -914,7 +914,7 @@ static ssize_t show_num_pstates(struct kobject *kobj,
325 + }
326 +
327 + static ssize_t show_no_turbo(struct kobject *kobj,
328 +- struct attribute *attr, char *buf)
329 ++ struct kobj_attribute *attr, char *buf)
330 + {
331 + ssize_t ret;
332 +
333 +@@ -936,7 +936,7 @@ static ssize_t show_no_turbo(struct kobject *kobj,
334 + return ret;
335 + }
336 +
337 +-static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
338 ++static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
339 + const char *buf, size_t count)
340 + {
341 + unsigned int input;
342 +@@ -983,7 +983,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
343 + return count;
344 + }
345 +
346 +-static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
347 ++static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b,
348 + const char *buf, size_t count)
349 + {
350 + unsigned int input;
351 +@@ -1013,7 +1013,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
352 + return count;
353 + }
354 +
355 +-static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
356 ++static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b,
357 + const char *buf, size_t count)
358 + {
359 + unsigned int input;
360 +@@ -1045,12 +1045,13 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
361 + }
362 +
363 + static ssize_t show_hwp_dynamic_boost(struct kobject *kobj,
364 +- struct attribute *attr, char *buf)
365 ++ struct kobj_attribute *attr, char *buf)
366 + {
367 + return sprintf(buf, "%u\n", hwp_boost);
368 + }
369 +
370 +-static ssize_t store_hwp_dynamic_boost(struct kobject *a, struct attribute *b,
371 ++static ssize_t store_hwp_dynamic_boost(struct kobject *a,
372 ++ struct kobj_attribute *b,
373 + const char *buf, size_t count)
374 + {
375 + unsigned int input;
376 +diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
377 +index 2c22836d3ffd5..4596fde16dfe6 100644
378 +--- a/drivers/gnss/sirf.c
379 ++++ b/drivers/gnss/sirf.c
380 +@@ -310,30 +310,26 @@ static int sirf_probe(struct serdev_device *serdev)
381 + ret = -ENODEV;
382 + goto err_put_device;
383 + }
384 ++
385 ++ ret = regulator_enable(data->vcc);
386 ++ if (ret)
387 ++ goto err_put_device;
388 ++
389 ++ /* Wait for chip to boot into hibernate mode. */
390 ++ msleep(SIRF_BOOT_DELAY);
391 + }
392 +
393 + if (data->wakeup) {
394 + ret = gpiod_to_irq(data->wakeup);
395 + if (ret < 0)
396 +- goto err_put_device;
397 +-
398 ++ goto err_disable_vcc;
399 + data->irq = ret;
400 +
401 +- ret = devm_request_threaded_irq(dev, data->irq, NULL,
402 +- sirf_wakeup_handler,
403 ++ ret = request_threaded_irq(data->irq, NULL, sirf_wakeup_handler,
404 + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
405 + "wakeup", data);
406 + if (ret)
407 +- goto err_put_device;
408 +- }
409 +-
410 +- if (data->on_off) {
411 +- ret = regulator_enable(data->vcc);
412 +- if (ret)
413 +- goto err_put_device;
414 +-
415 +- /* Wait for chip to boot into hibernate mode */
416 +- msleep(SIRF_BOOT_DELAY);
417 ++ goto err_disable_vcc;
418 + }
419 +
420 + if (IS_ENABLED(CONFIG_PM)) {
421 +@@ -342,7 +338,7 @@ static int sirf_probe(struct serdev_device *serdev)
422 + } else {
423 + ret = sirf_runtime_resume(dev);
424 + if (ret < 0)
425 +- goto err_disable_vcc;
426 ++ goto err_free_irq;
427 + }
428 +
429 + ret = gnss_register_device(gdev);
430 +@@ -356,6 +352,9 @@ err_disable_rpm:
431 + pm_runtime_disable(dev);
432 + else
433 + sirf_runtime_suspend(dev);
434 ++err_free_irq:
435 ++ if (data->wakeup)
436 ++ free_irq(data->irq, data);
437 + err_disable_vcc:
438 + if (data->on_off)
439 + regulator_disable(data->vcc);
440 +@@ -376,6 +375,9 @@ static void sirf_remove(struct serdev_device *serdev)
441 + else
442 + sirf_runtime_suspend(&serdev->dev);
443 +
444 ++ if (data->wakeup)
445 ++ free_irq(data->irq, data);
446 ++
447 + if (data->on_off)
448 + regulator_disable(data->vcc);
449 +
450 +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
451 +index 9f697a5b8e3df..c078c791f481a 100644
452 +--- a/drivers/net/dsa/mv88e6xxx/chip.c
453 ++++ b/drivers/net/dsa/mv88e6xxx/chip.c
454 +@@ -884,7 +884,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip,
455 + default:
456 + return U64_MAX;
457 + }
458 +- value = (((u64)high) << 16) | low;
459 ++ value = (((u64)high) << 32) | low;
460 + return value;
461 + }
462 +
463 +@@ -3070,7 +3070,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = {
464 + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
465 + .port_link_state = mv88e6352_port_link_state,
466 + .port_get_cmode = mv88e6185_port_get_cmode,
467 +- .stats_snapshot = mv88e6320_g1_stats_snapshot,
468 ++ .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
469 + .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
470 + .stats_get_sset_count = mv88e6095_stats_get_sset_count,
471 + .stats_get_strings = mv88e6095_stats_get_strings,
472 +@@ -4188,7 +4188,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
473 + .name = "Marvell 88E6190",
474 + .num_databases = 4096,
475 + .num_ports = 11, /* 10 + Z80 */
476 +- .num_internal_phys = 11,
477 ++ .num_internal_phys = 9,
478 + .num_gpio = 16,
479 + .max_vid = 8191,
480 + .port_base_addr = 0x0,
481 +@@ -4211,7 +4211,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
482 + .name = "Marvell 88E6190X",
483 + .num_databases = 4096,
484 + .num_ports = 11, /* 10 + Z80 */
485 +- .num_internal_phys = 11,
486 ++ .num_internal_phys = 9,
487 + .num_gpio = 16,
488 + .max_vid = 8191,
489 + .port_base_addr = 0x0,
490 +@@ -4234,7 +4234,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
491 + .name = "Marvell 88E6191",
492 + .num_databases = 4096,
493 + .num_ports = 11, /* 10 + Z80 */
494 +- .num_internal_phys = 11,
495 ++ .num_internal_phys = 9,
496 + .max_vid = 8191,
497 + .port_base_addr = 0x0,
498 + .phy_base_addr = 0x0,
499 +@@ -4281,7 +4281,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
500 + .name = "Marvell 88E6290",
501 + .num_databases = 4096,
502 + .num_ports = 11, /* 10 + Z80 */
503 +- .num_internal_phys = 11,
504 ++ .num_internal_phys = 9,
505 + .num_gpio = 16,
506 + .max_vid = 8191,
507 + .port_base_addr = 0x0,
508 +@@ -4443,7 +4443,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
509 + .name = "Marvell 88E6390",
510 + .num_databases = 4096,
511 + .num_ports = 11, /* 10 + Z80 */
512 +- .num_internal_phys = 11,
513 ++ .num_internal_phys = 9,
514 + .num_gpio = 16,
515 + .max_vid = 8191,
516 + .port_base_addr = 0x0,
517 +@@ -4466,7 +4466,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
518 + .name = "Marvell 88E6390X",
519 + .num_databases = 4096,
520 + .num_ports = 11, /* 10 + Z80 */
521 +- .num_internal_phys = 11,
522 ++ .num_internal_phys = 9,
523 + .num_gpio = 16,
524 + .max_vid = 8191,
525 + .port_base_addr = 0x0,
526 +@@ -4561,6 +4561,14 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
527 + return 0;
528 + }
529 +
530 ++static void mv88e6xxx_ports_cmode_init(struct mv88e6xxx_chip *chip)
531 ++{
532 ++ int i;
533 ++
534 ++ for (i = 0; i < mv88e6xxx_num_ports(chip); i++)
535 ++ chip->ports[i].cmode = MV88E6XXX_PORT_STS_CMODE_INVALID;
536 ++}
537 ++
538 + static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
539 + int port)
540 + {
541 +@@ -4597,6 +4605,8 @@ static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
542 + if (err)
543 + goto free;
544 +
545 ++ mv88e6xxx_ports_cmode_init(chip);
546 ++
547 + mutex_lock(&chip->reg_lock);
548 + err = mv88e6xxx_switch_reset(chip);
549 + mutex_unlock(&chip->reg_lock);
550 +diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c
551 +index 92945841c8e88..7fffce734f0a5 100644
552 +--- a/drivers/net/dsa/mv88e6xxx/port.c
553 ++++ b/drivers/net/dsa/mv88e6xxx/port.c
554 +@@ -190,7 +190,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup)
555 + /* normal duplex detection */
556 + break;
557 + default:
558 +- return -EINVAL;
559 ++ return -EOPNOTSUPP;
560 + }
561 +
562 + err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg);
563 +@@ -374,6 +374,10 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
564 + cmode = 0;
565 + }
566 +
567 ++ /* cmode doesn't change, nothing to do for us */
568 ++ if (cmode == chip->ports[port].cmode)
569 ++ return 0;
570 ++
571 + lane = mv88e6390x_serdes_get_lane(chip, port);
572 + if (lane < 0)
573 + return lane;
574 +@@ -384,7 +388,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
575 + return err;
576 + }
577 +
578 +- err = mv88e6390_serdes_power(chip, port, false);
579 ++ err = mv88e6390x_serdes_power(chip, port, false);
580 + if (err)
581 + return err;
582 +
583 +@@ -400,7 +404,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
584 + if (err)
585 + return err;
586 +
587 +- err = mv88e6390_serdes_power(chip, port, true);
588 ++ err = mv88e6390x_serdes_power(chip, port, true);
589 + if (err)
590 + return err;
591 +
592 +diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h
593 +index b31910023bb64..95b59f5eb3931 100644
594 +--- a/drivers/net/dsa/mv88e6xxx/port.h
595 ++++ b/drivers/net/dsa/mv88e6xxx/port.h
596 +@@ -52,6 +52,7 @@
597 + #define MV88E6185_PORT_STS_CMODE_1000BASE_X 0x0005
598 + #define MV88E6185_PORT_STS_CMODE_PHY 0x0006
599 + #define MV88E6185_PORT_STS_CMODE_DISABLED 0x0007
600 ++#define MV88E6XXX_PORT_STS_CMODE_INVALID 0xff
601 +
602 + /* Offset 0x01: MAC (or PCS or Physical) Control Register */
603 + #define MV88E6XXX_PORT_MAC_CTL 0x01
604 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
605 +index 034f57500f00e..1fdaf86bbe8fb 100644
606 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
607 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
608 +@@ -463,6 +463,12 @@ normal_tx:
609 + }
610 +
611 + length >>= 9;
612 ++ if (unlikely(length >= ARRAY_SIZE(bnxt_lhint_arr))) {
613 ++ dev_warn_ratelimited(&pdev->dev, "Dropped oversize %d bytes TX packet.\n",
614 ++ skb->len);
615 ++ i = 0;
616 ++ goto tx_dma_error;
617 ++ }
618 + flags |= bnxt_lhint_arr[length];
619 + txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
620 +
621 +diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
622 +index ae2f35039343b..1485f66cf7b0c 100644
623 +--- a/drivers/net/ethernet/marvell/sky2.c
624 ++++ b/drivers/net/ethernet/marvell/sky2.c
625 +@@ -46,6 +46,7 @@
626 + #include <linux/mii.h>
627 + #include <linux/of_device.h>
628 + #include <linux/of_net.h>
629 ++#include <linux/dmi.h>
630 +
631 + #include <asm/irq.h>
632 +
633 +@@ -93,7 +94,7 @@ static int copybreak __read_mostly = 128;
634 + module_param(copybreak, int, 0);
635 + MODULE_PARM_DESC(copybreak, "Receive copy threshold");
636 +
637 +-static int disable_msi = 0;
638 ++static int disable_msi = -1;
639 + module_param(disable_msi, int, 0);
640 + MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
641 +
642 +@@ -4931,6 +4932,24 @@ static const char *sky2_name(u8 chipid, char *buf, int sz)
643 + return buf;
644 + }
645 +
646 ++static const struct dmi_system_id msi_blacklist[] = {
647 ++ {
648 ++ .ident = "Dell Inspiron 1545",
649 ++ .matches = {
650 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
651 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1545"),
652 ++ },
653 ++ },
654 ++ {
655 ++ .ident = "Gateway P-79",
656 ++ .matches = {
657 ++ DMI_MATCH(DMI_SYS_VENDOR, "Gateway"),
658 ++ DMI_MATCH(DMI_PRODUCT_NAME, "P-79"),
659 ++ },
660 ++ },
661 ++ {}
662 ++};
663 ++
664 + static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
665 + {
666 + struct net_device *dev, *dev1;
667 +@@ -5042,6 +5061,9 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
668 + goto err_out_free_pci;
669 + }
670 +
671 ++ if (disable_msi == -1)
672 ++ disable_msi = !!dmi_check_system(msi_blacklist);
673 ++
674 + if (!disable_msi && pci_enable_msi(pdev) == 0) {
675 + err = sky2_test_msi(hw);
676 + if (err) {
677 +diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
678 +index 42f5bfa33694c..de5a6abda7e3f 100644
679 +--- a/drivers/net/ethernet/microchip/lan743x_main.c
680 ++++ b/drivers/net/ethernet/microchip/lan743x_main.c
681 +@@ -1403,7 +1403,8 @@ static int lan743x_tx_frame_start(struct lan743x_tx *tx,
682 + }
683 +
684 + static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
685 +- unsigned int frame_length)
686 ++ unsigned int frame_length,
687 ++ int nr_frags)
688 + {
689 + /* called only from within lan743x_tx_xmit_frame.
690 + * assuming tx->ring_lock has already been acquired.
691 +@@ -1413,6 +1414,10 @@ static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
692 +
693 + /* wrap up previous descriptor */
694 + tx->frame_data0 |= TX_DESC_DATA0_EXT_;
695 ++ if (nr_frags <= 0) {
696 ++ tx->frame_data0 |= TX_DESC_DATA0_LS_;
697 ++ tx->frame_data0 |= TX_DESC_DATA0_IOC_;
698 ++ }
699 + tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
700 + tx_descriptor->data0 = tx->frame_data0;
701 +
702 +@@ -1517,8 +1522,11 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx,
703 + u32 tx_tail_flags = 0;
704 +
705 + /* wrap up previous descriptor */
706 +- tx->frame_data0 |= TX_DESC_DATA0_LS_;
707 +- tx->frame_data0 |= TX_DESC_DATA0_IOC_;
708 ++ if ((tx->frame_data0 & TX_DESC_DATA0_DTYPE_MASK_) ==
709 ++ TX_DESC_DATA0_DTYPE_DATA_) {
710 ++ tx->frame_data0 |= TX_DESC_DATA0_LS_;
711 ++ tx->frame_data0 |= TX_DESC_DATA0_IOC_;
712 ++ }
713 +
714 + tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
715 + buffer_info = &tx->buffer_info[tx->frame_tail];
716 +@@ -1603,7 +1611,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
717 + }
718 +
719 + if (gso)
720 +- lan743x_tx_frame_add_lso(tx, frame_length);
721 ++ lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);
722 +
723 + if (nr_frags <= 0)
724 + goto finish;
725 +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
726 +index 01711e6e9a394..e1427b56a073a 100644
727 +--- a/drivers/net/geneve.c
728 ++++ b/drivers/net/geneve.c
729 +@@ -636,15 +636,20 @@ out:
730 + static int geneve_open(struct net_device *dev)
731 + {
732 + struct geneve_dev *geneve = netdev_priv(dev);
733 +- bool ipv6 = !!(geneve->info.mode & IP_TUNNEL_INFO_IPV6);
734 + bool metadata = geneve->collect_md;
735 ++ bool ipv4, ipv6;
736 + int ret = 0;
737 +
738 ++ ipv6 = geneve->info.mode & IP_TUNNEL_INFO_IPV6 || metadata;
739 ++ ipv4 = !ipv6 || metadata;
740 + #if IS_ENABLED(CONFIG_IPV6)
741 +- if (ipv6 || metadata)
742 ++ if (ipv6) {
743 + ret = geneve_sock_add(geneve, true);
744 ++ if (ret < 0 && ret != -EAFNOSUPPORT)
745 ++ ipv4 = false;
746 ++ }
747 + #endif
748 +- if (!ret && (!ipv6 || metadata))
749 ++ if (ipv4)
750 + ret = geneve_sock_add(geneve, false);
751 + if (ret < 0)
752 + geneve_sock_release(geneve);
753 +diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
754 +index c9e2a986ccb72..c8320405c8f1d 100644
755 +--- a/drivers/net/hyperv/netvsc_drv.c
756 ++++ b/drivers/net/hyperv/netvsc_drv.c
757 +@@ -743,6 +743,14 @@ void netvsc_linkstatus_callback(struct net_device *net,
758 + schedule_delayed_work(&ndev_ctx->dwork, 0);
759 + }
760 +
761 ++static void netvsc_comp_ipcsum(struct sk_buff *skb)
762 ++{
763 ++ struct iphdr *iph = (struct iphdr *)skb->data;
764 ++
765 ++ iph->check = 0;
766 ++ iph->check = ip_fast_csum(iph, iph->ihl);
767 ++}
768 ++
769 + static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
770 + struct napi_struct *napi,
771 + const struct ndis_tcp_ip_checksum_info *csum_info,
772 +@@ -766,9 +774,17 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
773 + /* skb is already created with CHECKSUM_NONE */
774 + skb_checksum_none_assert(skb);
775 +
776 +- /*
777 +- * In Linux, the IP checksum is always checked.
778 +- * Do L4 checksum offload if enabled and present.
779 ++ /* Incoming packets may have IP header checksum verified by the host.
780 ++ * They may not have IP header checksum computed after coalescing.
781 ++ * We compute it here if the flags are set, because on Linux, the IP
782 ++ * checksum is always checked.
783 ++ */
784 ++ if (csum_info && csum_info->receive.ip_checksum_value_invalid &&
785 ++ csum_info->receive.ip_checksum_succeeded &&
786 ++ skb->protocol == htons(ETH_P_IP))
787 ++ netvsc_comp_ipcsum(skb);
788 ++
789 ++ /* Do L4 checksum offload if enabled and present.
790 + */
791 + if (csum_info && (net->features & NETIF_F_RXCSUM)) {
792 + if (csum_info->receive.tcp_checksum_succeeded ||
793 +diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
794 +index 3db06b40580d3..05a6ae32ff652 100644
795 +--- a/drivers/net/phy/micrel.c
796 ++++ b/drivers/net/phy/micrel.c
797 +@@ -339,6 +339,17 @@ static int ksz8041_config_aneg(struct phy_device *phydev)
798 + return genphy_config_aneg(phydev);
799 + }
800 +
801 ++static int ksz8061_config_init(struct phy_device *phydev)
802 ++{
803 ++ int ret;
804 ++
805 ++ ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A);
806 ++ if (ret)
807 ++ return ret;
808 ++
809 ++ return kszphy_config_init(phydev);
810 ++}
811 ++
812 + static int ksz9021_load_values_from_of(struct phy_device *phydev,
813 + const struct device_node *of_node,
814 + u16 reg,
815 +@@ -934,7 +945,7 @@ static struct phy_driver ksphy_driver[] = {
816 + .phy_id_mask = MICREL_PHY_ID_MASK,
817 + .features = PHY_BASIC_FEATURES,
818 + .flags = PHY_HAS_INTERRUPT,
819 +- .config_init = kszphy_config_init,
820 ++ .config_init = ksz8061_config_init,
821 + .ack_interrupt = kszphy_ack_interrupt,
822 + .config_intr = kszphy_config_intr,
823 + .suspend = genphy_suspend,
824 +diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
825 +index 2787e8b1d668a..f6e70f2dfd12b 100644
826 +--- a/drivers/net/phy/phylink.c
827 ++++ b/drivers/net/phy/phylink.c
828 +@@ -348,6 +348,10 @@ static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state *
829 + linkmode_zero(state->lp_advertising);
830 + state->interface = pl->link_config.interface;
831 + state->an_enabled = pl->link_config.an_enabled;
832 ++ state->speed = SPEED_UNKNOWN;
833 ++ state->duplex = DUPLEX_UNKNOWN;
834 ++ state->pause = MLO_PAUSE_NONE;
835 ++ state->an_complete = 0;
836 + state->link = 1;
837 +
838 + return pl->ops->mac_link_state(ndev, state);
839 +diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
840 +index a5ef97010eb34..5541e1c19936c 100644
841 +--- a/drivers/net/team/team_mode_loadbalance.c
842 ++++ b/drivers/net/team/team_mode_loadbalance.c
843 +@@ -325,6 +325,20 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx)
844 + return 0;
845 + }
846 +
847 ++static void lb_bpf_func_free(struct team *team)
848 ++{
849 ++ struct lb_priv *lb_priv = get_lb_priv(team);
850 ++ struct bpf_prog *fp;
851 ++
852 ++ if (!lb_priv->ex->orig_fprog)
853 ++ return;
854 ++
855 ++ __fprog_destroy(lb_priv->ex->orig_fprog);
856 ++ fp = rcu_dereference_protected(lb_priv->fp,
857 ++ lockdep_is_held(&team->lock));
858 ++ bpf_prog_destroy(fp);
859 ++}
860 ++
861 + static int lb_tx_method_get(struct team *team, struct team_gsetter_ctx *ctx)
862 + {
863 + struct lb_priv *lb_priv = get_lb_priv(team);
864 +@@ -639,6 +653,7 @@ static void lb_exit(struct team *team)
865 +
866 + team_options_unregister(team, lb_options,
867 + ARRAY_SIZE(lb_options));
868 ++ lb_bpf_func_free(team);
869 + cancel_delayed_work_sync(&lb_priv->ex->stats.refresh_dw);
870 + free_percpu(lb_priv->pcpu_stats);
871 + kfree(lb_priv->ex);
872 +diff --git a/drivers/net/tun.c b/drivers/net/tun.c
873 +index 65844f28db30e..f3293355c7849 100644
874 +--- a/drivers/net/tun.c
875 ++++ b/drivers/net/tun.c
876 +@@ -2122,9 +2122,9 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
877 + }
878 +
879 + add_wait_queue(&tfile->wq.wait, &wait);
880 +- current->state = TASK_INTERRUPTIBLE;
881 +
882 + while (1) {
883 ++ set_current_state(TASK_INTERRUPTIBLE);
884 + ptr = ptr_ring_consume(&tfile->tx_ring);
885 + if (ptr)
886 + break;
887 +@@ -2140,7 +2140,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
888 + schedule();
889 + }
890 +
891 +- current->state = TASK_RUNNING;
892 ++ __set_current_state(TASK_RUNNING);
893 + remove_wait_queue(&tfile->wq.wait, &wait);
894 +
895 + out:
896 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
897 +index 735ad838e2ba8..6e381354f658e 100644
898 +--- a/drivers/net/usb/qmi_wwan.c
899 ++++ b/drivers/net/usb/qmi_wwan.c
900 +@@ -976,6 +976,13 @@ static const struct usb_device_id products[] = {
901 + 0xff),
902 + .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,
903 + },
904 ++ { /* Quectel EG12/EM12 */
905 ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0512,
906 ++ USB_CLASS_VENDOR_SPEC,
907 ++ USB_SUBCLASS_VENDOR_SPEC,
908 ++ 0xff),
909 ++ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,
910 ++ },
911 +
912 + /* 3. Combined interface devices matching on interface number */
913 + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
914 +@@ -1343,17 +1350,20 @@ static bool quectel_ec20_detected(struct usb_interface *intf)
915 + return false;
916 + }
917 +
918 +-static bool quectel_ep06_diag_detected(struct usb_interface *intf)
919 ++static bool quectel_diag_detected(struct usb_interface *intf)
920 + {
921 + struct usb_device *dev = interface_to_usbdev(intf);
922 + struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc;
923 ++ u16 id_vendor = le16_to_cpu(dev->descriptor.idVendor);
924 ++ u16 id_product = le16_to_cpu(dev->descriptor.idProduct);
925 +
926 +- if (le16_to_cpu(dev->descriptor.idVendor) == 0x2c7c &&
927 +- le16_to_cpu(dev->descriptor.idProduct) == 0x0306 &&
928 +- intf_desc.bNumEndpoints == 2)
929 +- return true;
930 ++ if (id_vendor != 0x2c7c || intf_desc.bNumEndpoints != 2)
931 ++ return false;
932 +
933 +- return false;
934 ++ if (id_product == 0x0306 || id_product == 0x0512)
935 ++ return true;
936 ++ else
937 ++ return false;
938 + }
939 +
940 + static int qmi_wwan_probe(struct usb_interface *intf,
941 +@@ -1390,13 +1400,13 @@ static int qmi_wwan_probe(struct usb_interface *intf,
942 + return -ENODEV;
943 + }
944 +
945 +- /* Quectel EP06/EM06/EG06 supports dynamic interface configuration, so
946 ++ /* Several Quectel modems supports dynamic interface configuration, so
947 + * we need to match on class/subclass/protocol. These values are
948 + * identical for the diagnostic- and QMI-interface, but bNumEndpoints is
949 + * different. Ignore the current interface if the number of endpoints
950 + * the number for the diag interface (two).
951 + */
952 +- if (quectel_ep06_diag_detected(intf))
953 ++ if (quectel_diag_detected(intf))
954 + return -ENODEV;
955 +
956 + return usbnet_probe(intf, id);
957 +diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
958 +index 0ccb021f1e786..10d580c3dea3f 100644
959 +--- a/drivers/net/xen-netback/hash.c
960 ++++ b/drivers/net/xen-netback/hash.c
961 +@@ -454,6 +454,8 @@ void xenvif_init_hash(struct xenvif *vif)
962 + if (xenvif_hash_cache_size == 0)
963 + return;
964 +
965 ++ BUG_ON(vif->hash.cache.count);
966 ++
967 + spin_lock_init(&vif->hash.cache.lock);
968 + INIT_LIST_HEAD(&vif->hash.cache.list);
969 + }
970 +diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
971 +index f6ae23fc3f6b0..82add0ac4a5f6 100644
972 +--- a/drivers/net/xen-netback/interface.c
973 ++++ b/drivers/net/xen-netback/interface.c
974 +@@ -153,6 +153,13 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
975 + {
976 + struct xenvif *vif = netdev_priv(dev);
977 + unsigned int size = vif->hash.size;
978 ++ unsigned int num_queues;
979 ++
980 ++ /* If queues are not set up internally - always return 0
981 ++ * as the packet going to be dropped anyway */
982 ++ num_queues = READ_ONCE(vif->num_queues);
983 ++ if (num_queues < 1)
984 ++ return 0;
985 +
986 + if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
987 + return fallback(dev, skb, NULL) % dev->real_num_tx_queues;
988 +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
989 +index 3621e05a7494c..d5081ffdc8f03 100644
990 +--- a/drivers/net/xen-netback/netback.c
991 ++++ b/drivers/net/xen-netback/netback.c
992 +@@ -1072,11 +1072,6 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s
993 + skb_frag_size_set(&frags[i], len);
994 + }
995 +
996 +- /* Copied all the bits from the frag list -- free it. */
997 +- skb_frag_list_init(skb);
998 +- xenvif_skb_zerocopy_prepare(queue, nskb);
999 +- kfree_skb(nskb);
1000 +-
1001 + /* Release all the original (foreign) frags. */
1002 + for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)
1003 + skb_frag_unref(skb, f);
1004 +@@ -1145,6 +1140,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
1005 + xenvif_fill_frags(queue, skb);
1006 +
1007 + if (unlikely(skb_has_frag_list(skb))) {
1008 ++ struct sk_buff *nskb = skb_shinfo(skb)->frag_list;
1009 ++ xenvif_skb_zerocopy_prepare(queue, nskb);
1010 + if (xenvif_handle_frag_list(queue, skb)) {
1011 + if (net_ratelimit())
1012 + netdev_err(queue->vif->dev,
1013 +@@ -1153,6 +1150,9 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
1014 + kfree_skb(skb);
1015 + continue;
1016 + }
1017 ++ /* Copied all the bits from the frag list -- free it. */
1018 ++ skb_frag_list_init(skb);
1019 ++ kfree_skb(nskb);
1020 + }
1021 +
1022 + skb->dev = queue->vif->dev;
1023 +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
1024 +index b5f638286037a..18e4289baf993 100644
1025 +--- a/drivers/scsi/scsi_lib.c
1026 ++++ b/drivers/scsi/scsi_lib.c
1027 +@@ -757,6 +757,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
1028 + set_host_byte(cmd, DID_OK);
1029 + return BLK_STS_TARGET;
1030 + case DID_NEXUS_FAILURE:
1031 ++ set_host_byte(cmd, DID_OK);
1032 + return BLK_STS_NEXUS;
1033 + case DID_ALLOC_FAILURE:
1034 + set_host_byte(cmd, DID_OK);
1035 +diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
1036 +index a880b5c6c6c32..be815330ed958 100644
1037 +--- a/drivers/staging/android/ashmem.c
1038 ++++ b/drivers/staging/android/ashmem.c
1039 +@@ -75,6 +75,9 @@ struct ashmem_range {
1040 + /* LRU list of unpinned pages, protected by ashmem_mutex */
1041 + static LIST_HEAD(ashmem_lru_list);
1042 +
1043 ++static atomic_t ashmem_shrink_inflight = ATOMIC_INIT(0);
1044 ++static DECLARE_WAIT_QUEUE_HEAD(ashmem_shrink_wait);
1045 ++
1046 + /*
1047 + * long lru_count - The count of pages on our LRU list.
1048 + *
1049 +@@ -168,19 +171,15 @@ static inline void lru_del(struct ashmem_range *range)
1050 + * @end: The ending page (inclusive)
1051 + *
1052 + * This function is protected by ashmem_mutex.
1053 +- *
1054 +- * Return: 0 if successful, or -ENOMEM if there is an error
1055 + */
1056 +-static int range_alloc(struct ashmem_area *asma,
1057 +- struct ashmem_range *prev_range, unsigned int purged,
1058 +- size_t start, size_t end)
1059 ++static void range_alloc(struct ashmem_area *asma,
1060 ++ struct ashmem_range *prev_range, unsigned int purged,
1061 ++ size_t start, size_t end,
1062 ++ struct ashmem_range **new_range)
1063 + {
1064 +- struct ashmem_range *range;
1065 +-
1066 +- range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL);
1067 +- if (!range)
1068 +- return -ENOMEM;
1069 ++ struct ashmem_range *range = *new_range;
1070 +
1071 ++ *new_range = NULL;
1072 + range->asma = asma;
1073 + range->pgstart = start;
1074 + range->pgend = end;
1075 +@@ -190,8 +189,6 @@ static int range_alloc(struct ashmem_area *asma,
1076 +
1077 + if (range_on_lru(range))
1078 + lru_add(range);
1079 +-
1080 +- return 0;
1081 + }
1082 +
1083 + /**
1084 +@@ -438,7 +435,6 @@ out:
1085 + static unsigned long
1086 + ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1087 + {
1088 +- struct ashmem_range *range, *next;
1089 + unsigned long freed = 0;
1090 +
1091 + /* We might recurse into filesystem code, so bail out if necessary */
1092 +@@ -448,21 +444,33 @@ ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1093 + if (!mutex_trylock(&ashmem_mutex))
1094 + return -1;
1095 +
1096 +- list_for_each_entry_safe(range, next, &ashmem_lru_list, lru) {
1097 ++ while (!list_empty(&ashmem_lru_list)) {
1098 ++ struct ashmem_range *range =
1099 ++ list_first_entry(&ashmem_lru_list, typeof(*range), lru);
1100 + loff_t start = range->pgstart * PAGE_SIZE;
1101 + loff_t end = (range->pgend + 1) * PAGE_SIZE;
1102 ++ struct file *f = range->asma->file;
1103 +
1104 +- range->asma->file->f_op->fallocate(range->asma->file,
1105 +- FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
1106 +- start, end - start);
1107 ++ get_file(f);
1108 ++ atomic_inc(&ashmem_shrink_inflight);
1109 + range->purged = ASHMEM_WAS_PURGED;
1110 + lru_del(range);
1111 +
1112 + freed += range_size(range);
1113 ++ mutex_unlock(&ashmem_mutex);
1114 ++ f->f_op->fallocate(f,
1115 ++ FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
1116 ++ start, end - start);
1117 ++ fput(f);
1118 ++ if (atomic_dec_and_test(&ashmem_shrink_inflight))
1119 ++ wake_up_all(&ashmem_shrink_wait);
1120 ++ if (!mutex_trylock(&ashmem_mutex))
1121 ++ goto out;
1122 + if (--sc->nr_to_scan <= 0)
1123 + break;
1124 + }
1125 + mutex_unlock(&ashmem_mutex);
1126 ++out:
1127 + return freed;
1128 + }
1129 +
1130 +@@ -582,7 +590,8 @@ static int get_name(struct ashmem_area *asma, void __user *name)
1131 + *
1132 + * Caller must hold ashmem_mutex.
1133 + */
1134 +-static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1135 ++static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend,
1136 ++ struct ashmem_range **new_range)
1137 + {
1138 + struct ashmem_range *range, *next;
1139 + int ret = ASHMEM_NOT_PURGED;
1140 +@@ -635,7 +644,7 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1141 + * second half and adjust the first chunk's endpoint.
1142 + */
1143 + range_alloc(asma, range, range->purged,
1144 +- pgend + 1, range->pgend);
1145 ++ pgend + 1, range->pgend, new_range);
1146 + range_shrink(range, range->pgstart, pgstart - 1);
1147 + break;
1148 + }
1149 +@@ -649,7 +658,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1150 + *
1151 + * Caller must hold ashmem_mutex.
1152 + */
1153 +-static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1154 ++static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend,
1155 ++ struct ashmem_range **new_range)
1156 + {
1157 + struct ashmem_range *range, *next;
1158 + unsigned int purged = ASHMEM_NOT_PURGED;
1159 +@@ -675,7 +685,8 @@ restart:
1160 + }
1161 + }
1162 +
1163 +- return range_alloc(asma, range, purged, pgstart, pgend);
1164 ++ range_alloc(asma, range, purged, pgstart, pgend, new_range);
1165 ++ return 0;
1166 + }
1167 +
1168 + /*
1169 +@@ -708,11 +719,19 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
1170 + struct ashmem_pin pin;
1171 + size_t pgstart, pgend;
1172 + int ret = -EINVAL;
1173 ++ struct ashmem_range *range = NULL;
1174 +
1175 + if (copy_from_user(&pin, p, sizeof(pin)))
1176 + return -EFAULT;
1177 +
1178 ++ if (cmd == ASHMEM_PIN || cmd == ASHMEM_UNPIN) {
1179 ++ range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL);
1180 ++ if (!range)
1181 ++ return -ENOMEM;
1182 ++ }
1183 ++
1184 + mutex_lock(&ashmem_mutex);
1185 ++ wait_event(ashmem_shrink_wait, !atomic_read(&ashmem_shrink_inflight));
1186 +
1187 + if (!asma->file)
1188 + goto out_unlock;
1189 +@@ -735,10 +754,10 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
1190 +
1191 + switch (cmd) {
1192 + case ASHMEM_PIN:
1193 +- ret = ashmem_pin(asma, pgstart, pgend);
1194 ++ ret = ashmem_pin(asma, pgstart, pgend, &range);
1195 + break;
1196 + case ASHMEM_UNPIN:
1197 +- ret = ashmem_unpin(asma, pgstart, pgend);
1198 ++ ret = ashmem_unpin(asma, pgstart, pgend, &range);
1199 + break;
1200 + case ASHMEM_GET_PIN_STATUS:
1201 + ret = ashmem_get_pin_status(asma, pgstart, pgend);
1202 +@@ -747,6 +766,8 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
1203 +
1204 + out_unlock:
1205 + mutex_unlock(&ashmem_mutex);
1206 ++ if (range)
1207 ++ kmem_cache_free(ashmem_range_cachep, range);
1208 +
1209 + return ret;
1210 + }
1211 +diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
1212 +index 701eb9f3b0f13..0a1b1ff1be042 100644
1213 +--- a/drivers/staging/android/ion/ion_system_heap.c
1214 ++++ b/drivers/staging/android/ion/ion_system_heap.c
1215 +@@ -247,10 +247,10 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools)
1216 + static int ion_system_heap_create_pools(struct ion_page_pool **pools)
1217 + {
1218 + int i;
1219 +- gfp_t gfp_flags = low_order_gfp_flags;
1220 +
1221 + for (i = 0; i < NUM_ORDERS; i++) {
1222 + struct ion_page_pool *pool;
1223 ++ gfp_t gfp_flags = low_order_gfp_flags;
1224 +
1225 + if (orders[i] > 4)
1226 + gfp_flags = high_order_gfp_flags;
1227 +diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
1228 +index e521ed9d08870..35bd4d2efe166 100644
1229 +--- a/drivers/staging/comedi/drivers/ni_660x.c
1230 ++++ b/drivers/staging/comedi/drivers/ni_660x.c
1231 +@@ -602,6 +602,7 @@ static int ni_660x_set_pfi_routing(struct comedi_device *dev,
1232 + case NI_660X_PFI_OUTPUT_DIO:
1233 + if (chan > 31)
1234 + return -EINVAL;
1235 ++ break;
1236 + default:
1237 + return -EINVAL;
1238 + }
1239 +diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
1240 +index 1279241449f4b..f44662dd795c4 100644
1241 +--- a/drivers/staging/erofs/unzip_vle.c
1242 ++++ b/drivers/staging/erofs/unzip_vle.c
1243 +@@ -57,15 +57,30 @@ enum z_erofs_vle_work_role {
1244 + Z_EROFS_VLE_WORK_SECONDARY,
1245 + Z_EROFS_VLE_WORK_PRIMARY,
1246 + /*
1247 +- * The current work has at least been linked with the following
1248 +- * processed chained works, which means if the processing page
1249 +- * is the tail partial page of the work, the current work can
1250 +- * safely use the whole page, as illustrated below:
1251 +- * +--------------+-------------------------------------------+
1252 +- * | tail page | head page (of the previous work) |
1253 +- * +--------------+-------------------------------------------+
1254 +- * /\ which belongs to the current work
1255 +- * [ (*) this page can be used for the current work itself. ]
1256 ++ * The current work was the tail of an exist chain, and the previous
1257 ++ * processed chained works are all decided to be hooked up to it.
1258 ++ * A new chain should be created for the remaining unprocessed works,
1259 ++ * therefore different from Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED,
1260 ++ * the next work cannot reuse the whole page in the following scenario:
1261 ++ * ________________________________________________________________
1262 ++ * | tail (partial) page | head (partial) page |
1263 ++ * | (belongs to the next work) | (belongs to the current work) |
1264 ++ * |_______PRIMARY_FOLLOWED_______|________PRIMARY_HOOKED___________|
1265 ++ */
1266 ++ Z_EROFS_VLE_WORK_PRIMARY_HOOKED,
1267 ++ /*
1268 ++ * The current work has been linked with the processed chained works,
1269 ++ * and could be also linked with the potential remaining works, which
1270 ++ * means if the processing page is the tail partial page of the work,
1271 ++ * the current work can safely use the whole page (since the next work
1272 ++ * is under control) for in-place decompression, as illustrated below:
1273 ++ * ________________________________________________________________
1274 ++ * | tail (partial) page | head (partial) page |
1275 ++ * | (of the current work) | (of the previous work) |
1276 ++ * | PRIMARY_FOLLOWED or | |
1277 ++ * |_____PRIMARY_HOOKED____|____________PRIMARY_FOLLOWED____________|
1278 ++ *
1279 ++ * [ (*) the above page can be used for the current work itself. ]
1280 + */
1281 + Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED,
1282 + Z_EROFS_VLE_WORK_MAX
1283 +@@ -234,10 +249,10 @@ static int z_erofs_vle_work_add_page(
1284 + return ret ? 0 : -EAGAIN;
1285 + }
1286 +
1287 +-static inline bool try_to_claim_workgroup(
1288 +- struct z_erofs_vle_workgroup *grp,
1289 +- z_erofs_vle_owned_workgrp_t *owned_head,
1290 +- bool *hosted)
1291 ++static enum z_erofs_vle_work_role
1292 ++try_to_claim_workgroup(struct z_erofs_vle_workgroup *grp,
1293 ++ z_erofs_vle_owned_workgrp_t *owned_head,
1294 ++ bool *hosted)
1295 + {
1296 + DBG_BUGON(*hosted == true);
1297 +
1298 +@@ -251,6 +266,9 @@ retry:
1299 +
1300 + *owned_head = grp;
1301 + *hosted = true;
1302 ++ /* lucky, I am the followee :) */
1303 ++ return Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED;
1304 ++
1305 + } else if (grp->next == Z_EROFS_VLE_WORKGRP_TAIL) {
1306 + /*
1307 + * type 2, link to the end of a existing open chain,
1308 +@@ -260,12 +278,11 @@ retry:
1309 + if (Z_EROFS_VLE_WORKGRP_TAIL != cmpxchg(&grp->next,
1310 + Z_EROFS_VLE_WORKGRP_TAIL, *owned_head))
1311 + goto retry;
1312 +-
1313 + *owned_head = Z_EROFS_VLE_WORKGRP_TAIL;
1314 +- } else
1315 +- return false; /* :( better luck next time */
1316 ++ return Z_EROFS_VLE_WORK_PRIMARY_HOOKED;
1317 ++ }
1318 +
1319 +- return true; /* lucky, I am the followee :) */
1320 ++ return Z_EROFS_VLE_WORK_PRIMARY; /* :( better luck next time */
1321 + }
1322 +
1323 + static struct z_erofs_vle_work *
1324 +@@ -337,12 +354,8 @@ z_erofs_vle_work_lookup(struct super_block *sb,
1325 + *hosted = false;
1326 + if (!primary)
1327 + *role = Z_EROFS_VLE_WORK_SECONDARY;
1328 +- /* claim the workgroup if possible */
1329 +- else if (try_to_claim_workgroup(grp, owned_head, hosted))
1330 +- *role = Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED;
1331 +- else
1332 +- *role = Z_EROFS_VLE_WORK_PRIMARY;
1333 +-
1334 ++ else /* claim the workgroup if possible */
1335 ++ *role = try_to_claim_workgroup(grp, owned_head, hosted);
1336 + return work;
1337 + }
1338 +
1339 +@@ -419,6 +432,9 @@ static inline void __update_workgrp_llen(struct z_erofs_vle_workgroup *grp,
1340 + }
1341 + }
1342 +
1343 ++#define builder_is_hooked(builder) \
1344 ++ ((builder)->role >= Z_EROFS_VLE_WORK_PRIMARY_HOOKED)
1345 ++
1346 + #define builder_is_followed(builder) \
1347 + ((builder)->role >= Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED)
1348 +
1349 +@@ -583,7 +599,7 @@ static int z_erofs_do_read_page(struct z_erofs_vle_frontend *fe,
1350 + struct z_erofs_vle_work_builder *const builder = &fe->builder;
1351 + const loff_t offset = page_offset(page);
1352 +
1353 +- bool tight = builder_is_followed(builder);
1354 ++ bool tight = builder_is_hooked(builder);
1355 + struct z_erofs_vle_work *work = builder->work;
1356 +
1357 + #ifdef EROFS_FS_HAS_MANAGED_CACHE
1358 +@@ -606,8 +622,12 @@ repeat:
1359 +
1360 + /* lucky, within the range of the current map_blocks */
1361 + if (offset + cur >= map->m_la &&
1362 +- offset + cur < map->m_la + map->m_llen)
1363 ++ offset + cur < map->m_la + map->m_llen) {
1364 ++ /* didn't get a valid unzip work previously (very rare) */
1365 ++ if (!builder->work)
1366 ++ goto restart_now;
1367 + goto hitted;
1368 ++ }
1369 +
1370 + /* go ahead the next map_blocks */
1371 + debugln("%s: [out-of-range] pos %llu", __func__, offset + cur);
1372 +@@ -621,6 +641,7 @@ repeat:
1373 + if (unlikely(err))
1374 + goto err_out;
1375 +
1376 ++restart_now:
1377 + if (unlikely(!(map->m_flags & EROFS_MAP_MAPPED)))
1378 + goto hitted;
1379 +
1380 +@@ -646,7 +667,7 @@ repeat:
1381 + builder->role = Z_EROFS_VLE_WORK_PRIMARY;
1382 + #endif
1383 +
1384 +- tight &= builder_is_followed(builder);
1385 ++ tight &= builder_is_hooked(builder);
1386 + work = builder->work;
1387 + hitted:
1388 + cur = end - min_t(unsigned, offset + end - map->m_la, end);
1389 +@@ -661,6 +682,9 @@ hitted:
1390 + (tight ? Z_EROFS_PAGE_TYPE_EXCLUSIVE :
1391 + Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED));
1392 +
1393 ++ if (cur)
1394 ++ tight &= builder_is_followed(builder);
1395 ++
1396 + retry:
1397 + err = z_erofs_vle_work_add_page(builder, page, page_type);
1398 + /* should allocate an additional staging page for pagevec */
1399 +@@ -901,11 +925,10 @@ repeat:
1400 + if (llen > grp->llen)
1401 + llen = grp->llen;
1402 +
1403 +- err = z_erofs_vle_unzip_fast_percpu(compressed_pages,
1404 +- clusterpages, pages, llen, work->pageofs,
1405 +- z_erofs_onlinepage_endio);
1406 ++ err = z_erofs_vle_unzip_fast_percpu(compressed_pages, clusterpages,
1407 ++ pages, llen, work->pageofs);
1408 + if (err != -ENOTSUPP)
1409 +- goto out_percpu;
1410 ++ goto out;
1411 +
1412 + if (sparsemem_pages >= nr_pages)
1413 + goto skip_allocpage;
1414 +@@ -926,8 +949,25 @@ skip_allocpage:
1415 + erofs_vunmap(vout, nr_pages);
1416 +
1417 + out:
1418 ++ /* must handle all compressed pages before endding pages */
1419 ++ for (i = 0; i < clusterpages; ++i) {
1420 ++ page = compressed_pages[i];
1421 ++
1422 ++#ifdef EROFS_FS_HAS_MANAGED_CACHE
1423 ++ if (page->mapping == mngda)
1424 ++ continue;
1425 ++#endif
1426 ++ /* recycle all individual staging pages */
1427 ++ (void)z_erofs_gather_if_stagingpage(page_pool, page);
1428 ++
1429 ++ WRITE_ONCE(compressed_pages[i], NULL);
1430 ++ }
1431 ++
1432 + for (i = 0; i < nr_pages; ++i) {
1433 + page = pages[i];
1434 ++ if (!page)
1435 ++ continue;
1436 ++
1437 + DBG_BUGON(page->mapping == NULL);
1438 +
1439 + /* recycle all individual staging pages */
1440 +@@ -940,20 +980,6 @@ out:
1441 + z_erofs_onlinepage_endio(page);
1442 + }
1443 +
1444 +-out_percpu:
1445 +- for (i = 0; i < clusterpages; ++i) {
1446 +- page = compressed_pages[i];
1447 +-
1448 +-#ifdef EROFS_FS_HAS_MANAGED_CACHE
1449 +- if (page->mapping == mngda)
1450 +- continue;
1451 +-#endif
1452 +- /* recycle all individual staging pages */
1453 +- (void)z_erofs_gather_if_stagingpage(page_pool, page);
1454 +-
1455 +- WRITE_ONCE(compressed_pages[i], NULL);
1456 +- }
1457 +-
1458 + if (pages == z_pagemap_global)
1459 + mutex_unlock(&z_pagemap_global_lock);
1460 + else if (unlikely(pages != pages_onstack))
1461 +diff --git a/drivers/staging/erofs/unzip_vle.h b/drivers/staging/erofs/unzip_vle.h
1462 +index 3316bc36965d4..684ff06fc7bf8 100644
1463 +--- a/drivers/staging/erofs/unzip_vle.h
1464 ++++ b/drivers/staging/erofs/unzip_vle.h
1465 +@@ -218,8 +218,7 @@ extern int z_erofs_vle_plain_copy(struct page **compressed_pages,
1466 +
1467 + extern int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages,
1468 + unsigned clusterpages, struct page **pages,
1469 +- unsigned outlen, unsigned short pageofs,
1470 +- void (*endio)(struct page *));
1471 ++ unsigned int outlen, unsigned short pageofs);
1472 +
1473 + extern int z_erofs_vle_unzip_vmap(struct page **compressed_pages,
1474 + unsigned clusterpages, void *vaddr, unsigned llen,
1475 +diff --git a/drivers/staging/erofs/unzip_vle_lz4.c b/drivers/staging/erofs/unzip_vle_lz4.c
1476 +index 9cb35cd33365a..055420e8af2cf 100644
1477 +--- a/drivers/staging/erofs/unzip_vle_lz4.c
1478 ++++ b/drivers/staging/erofs/unzip_vle_lz4.c
1479 +@@ -105,8 +105,7 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages,
1480 + unsigned clusterpages,
1481 + struct page **pages,
1482 + unsigned outlen,
1483 +- unsigned short pageofs,
1484 +- void (*endio)(struct page *))
1485 ++ unsigned short pageofs)
1486 + {
1487 + void *vin, *vout;
1488 + unsigned nr_pages, i, j;
1489 +@@ -128,31 +127,30 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages,
1490 + ret = z_erofs_unzip_lz4(vin, vout + pageofs,
1491 + clusterpages * PAGE_SIZE, outlen);
1492 +
1493 +- if (ret >= 0) {
1494 +- outlen = ret;
1495 +- ret = 0;
1496 +- }
1497 ++ if (ret < 0)
1498 ++ goto out;
1499 ++ ret = 0;
1500 +
1501 + for (i = 0; i < nr_pages; ++i) {
1502 + j = min((unsigned)PAGE_SIZE - pageofs, outlen);
1503 +
1504 + if (pages[i] != NULL) {
1505 +- if (ret < 0)
1506 +- SetPageError(pages[i]);
1507 +- else if (clusterpages == 1 && pages[i] == compressed_pages[0])
1508 ++ if (clusterpages == 1 &&
1509 ++ pages[i] == compressed_pages[0]) {
1510 + memcpy(vin + pageofs, vout + pageofs, j);
1511 +- else {
1512 ++ } else {
1513 + void *dst = kmap_atomic(pages[i]);
1514 +
1515 + memcpy(dst + pageofs, vout + pageofs, j);
1516 + kunmap_atomic(dst);
1517 + }
1518 +- endio(pages[i]);
1519 + }
1520 + vout += PAGE_SIZE;
1521 + outlen -= j;
1522 + pageofs = 0;
1523 + }
1524 ++
1525 ++out:
1526 + preempt_enable();
1527 +
1528 + if (clusterpages == 1)
1529 +diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
1530 +index 3b8d237decbf1..649caae2b6033 100644
1531 +--- a/drivers/staging/wilc1000/linux_wlan.c
1532 ++++ b/drivers/staging/wilc1000/linux_wlan.c
1533 +@@ -1090,8 +1090,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
1534 + vif->wilc = *wilc;
1535 + vif->ndev = ndev;
1536 + wl->vif[i] = vif;
1537 +- wl->vif_num = i;
1538 +- vif->idx = wl->vif_num;
1539 ++ wl->vif_num = i + 1;
1540 ++ vif->idx = i;
1541 +
1542 + ndev->netdev_ops = &wilc_netdev_ops;
1543 +
1544 +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1545 +index 09bf6b4b741b8..1493d0fdf5ad1 100644
1546 +--- a/drivers/usb/host/xhci-pci.c
1547 ++++ b/drivers/usb/host/xhci-pci.c
1548 +@@ -187,6 +187,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1549 + xhci->quirks |= XHCI_SSIC_PORT_UNUSED;
1550 + if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
1551 + (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
1552 ++ pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
1553 + pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI))
1554 + xhci->quirks |= XHCI_INTEL_USB_ROLE_SW;
1555 + if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
1556 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1557 +index c0777a374a88f..4c66edf533fe9 100644
1558 +--- a/drivers/usb/serial/cp210x.c
1559 ++++ b/drivers/usb/serial/cp210x.c
1560 +@@ -61,6 +61,7 @@ static const struct usb_device_id id_table[] = {
1561 + { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
1562 + { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
1563 + { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */
1564 ++ { USB_DEVICE(0x0B00, 0x3070) }, /* Ingenico 3070 */
1565 + { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
1566 + { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
1567 + { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
1568 +@@ -1353,8 +1354,13 @@ static int cp210x_gpio_get(struct gpio_chip *gc, unsigned int gpio)
1569 + if (priv->partnum == CP210X_PARTNUM_CP2105)
1570 + req_type = REQTYPE_INTERFACE_TO_HOST;
1571 +
1572 ++ result = usb_autopm_get_interface(serial->interface);
1573 ++ if (result)
1574 ++ return result;
1575 ++
1576 + result = cp210x_read_vendor_block(serial, req_type,
1577 + CP210X_READ_LATCH, &buf, sizeof(buf));
1578 ++ usb_autopm_put_interface(serial->interface);
1579 + if (result < 0)
1580 + return result;
1581 +
1582 +@@ -1375,6 +1381,10 @@ static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1583 +
1584 + buf.mask = BIT(gpio);
1585 +
1586 ++ result = usb_autopm_get_interface(serial->interface);
1587 ++ if (result)
1588 ++ goto out;
1589 ++
1590 + if (priv->partnum == CP210X_PARTNUM_CP2105) {
1591 + result = cp210x_write_vendor_block(serial,
1592 + REQTYPE_HOST_TO_INTERFACE,
1593 +@@ -1392,6 +1402,8 @@ static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1594 + NULL, 0, USB_CTRL_SET_TIMEOUT);
1595 + }
1596 +
1597 ++ usb_autopm_put_interface(serial->interface);
1598 ++out:
1599 + if (result < 0) {
1600 + dev_err(&serial->interface->dev, "failed to set GPIO value: %d\n",
1601 + result);
1602 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1603 +index b5cef322826f1..1d8077e880a01 100644
1604 +--- a/drivers/usb/serial/ftdi_sio.c
1605 ++++ b/drivers/usb/serial/ftdi_sio.c
1606 +@@ -1015,6 +1015,8 @@ static const struct usb_device_id id_table_combined[] = {
1607 + { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) },
1608 + { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) },
1609 + { USB_DEVICE(AIRBUS_DS_VID, AIRBUS_DS_P8GR) },
1610 ++ /* EZPrototypes devices */
1611 ++ { USB_DEVICE(EZPROTOTYPES_VID, HJELMSLUND_USB485_ISO_PID) },
1612 + { } /* Terminating entry */
1613 + };
1614 +
1615 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1616 +index 975d02666c5a0..b863bedb55a13 100644
1617 +--- a/drivers/usb/serial/ftdi_sio_ids.h
1618 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
1619 +@@ -1308,6 +1308,12 @@
1620 + #define IONICS_VID 0x1c0c
1621 + #define IONICS_PLUGCOMPUTER_PID 0x0102
1622 +
1623 ++/*
1624 ++ * EZPrototypes (PID reseller)
1625 ++ */
1626 ++#define EZPROTOTYPES_VID 0x1c40
1627 ++#define HJELMSLUND_USB485_ISO_PID 0x0477
1628 ++
1629 + /*
1630 + * Dresden Elektronik Sensor Terminal Board
1631 + */
1632 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1633 +index fb544340888b0..faf833e8f5573 100644
1634 +--- a/drivers/usb/serial/option.c
1635 ++++ b/drivers/usb/serial/option.c
1636 +@@ -1148,6 +1148,8 @@ static const struct usb_device_id option_ids[] = {
1637 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
1638 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
1639 + .driver_info = NCTRL(0) | RSVD(3) },
1640 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */
1641 ++ .driver_info = NCTRL(0) },
1642 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
1643 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1644 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
1645 +diff --git a/fs/aio.c b/fs/aio.c
1646 +index 44551d96eaa4b..45d5ef8dd0a87 100644
1647 +--- a/fs/aio.c
1648 ++++ b/fs/aio.c
1649 +@@ -1661,6 +1661,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
1650 + struct poll_iocb *req = container_of(wait, struct poll_iocb, wait);
1651 + struct aio_kiocb *iocb = container_of(req, struct aio_kiocb, poll);
1652 + __poll_t mask = key_to_poll(key);
1653 ++ unsigned long flags;
1654 +
1655 + req->woken = true;
1656 +
1657 +@@ -1669,10 +1670,15 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
1658 + if (!(mask & req->events))
1659 + return 0;
1660 +
1661 +- /* try to complete the iocb inline if we can: */
1662 +- if (spin_trylock(&iocb->ki_ctx->ctx_lock)) {
1663 ++ /*
1664 ++ * Try to complete the iocb inline if we can. Use
1665 ++ * irqsave/irqrestore because not all filesystems (e.g. fuse)
1666 ++ * call this function with IRQs disabled and because IRQs
1667 ++ * have to be disabled before ctx_lock is obtained.
1668 ++ */
1669 ++ if (spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) {
1670 + list_del(&iocb->ki_list);
1671 +- spin_unlock(&iocb->ki_ctx->ctx_lock);
1672 ++ spin_unlock_irqrestore(&iocb->ki_ctx->ctx_lock, flags);
1673 +
1674 + list_del_init(&req->wait.entry);
1675 + aio_poll_complete(iocb, mask);
1676 +diff --git a/fs/exec.c b/fs/exec.c
1677 +index 1ebf6e5a521d9..433b1257694ab 100644
1678 +--- a/fs/exec.c
1679 ++++ b/fs/exec.c
1680 +@@ -929,7 +929,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
1681 + bytes = kernel_read(file, *buf + pos, i_size - pos, &pos);
1682 + if (bytes < 0) {
1683 + ret = bytes;
1684 +- goto out;
1685 ++ goto out_free;
1686 + }
1687 +
1688 + if (bytes == 0)
1689 +diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
1690 +index 882a9b9e34bc2..72f59e8321e79 100644
1691 +--- a/include/linux/cpufreq.h
1692 ++++ b/include/linux/cpufreq.h
1693 +@@ -254,20 +254,12 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
1694 + static struct freq_attr _name = \
1695 + __ATTR(_name, 0200, NULL, store_##_name)
1696 +
1697 +-struct global_attr {
1698 +- struct attribute attr;
1699 +- ssize_t (*show)(struct kobject *kobj,
1700 +- struct attribute *attr, char *buf);
1701 +- ssize_t (*store)(struct kobject *a, struct attribute *b,
1702 +- const char *c, size_t count);
1703 +-};
1704 +-
1705 + #define define_one_global_ro(_name) \
1706 +-static struct global_attr _name = \
1707 ++static struct kobj_attribute _name = \
1708 + __ATTR(_name, 0444, show_##_name, NULL)
1709 +
1710 + #define define_one_global_rw(_name) \
1711 +-static struct global_attr _name = \
1712 ++static struct kobj_attribute _name = \
1713 + __ATTR(_name, 0644, show_##_name, store_##_name)
1714 +
1715 +
1716 +diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
1717 +index ec9d6bc658559..fabee6db0abb7 100644
1718 +--- a/include/net/bluetooth/bluetooth.h
1719 ++++ b/include/net/bluetooth/bluetooth.h
1720 +@@ -276,7 +276,7 @@ int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
1721 + int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
1722 + int bt_sock_wait_ready(struct sock *sk, unsigned long flags);
1723 +
1724 +-void bt_accept_enqueue(struct sock *parent, struct sock *sk);
1725 ++void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh);
1726 + void bt_accept_unlink(struct sock *sk);
1727 + struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
1728 +
1729 +diff --git a/include/net/icmp.h b/include/net/icmp.h
1730 +index 3ef2743a8eecc..8665bf24e3b7a 100644
1731 +--- a/include/net/icmp.h
1732 ++++ b/include/net/icmp.h
1733 +@@ -22,6 +22,7 @@
1734 +
1735 + #include <net/inet_sock.h>
1736 + #include <net/snmp.h>
1737 ++#include <net/ip.h>
1738 +
1739 + struct icmp_err {
1740 + int errno;
1741 +@@ -39,7 +40,13 @@ struct net_proto_family;
1742 + struct sk_buff;
1743 + struct net;
1744 +
1745 +-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
1746 ++void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
1747 ++ const struct ip_options *opt);
1748 ++static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
1749 ++{
1750 ++ __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
1751 ++}
1752 ++
1753 + int icmp_rcv(struct sk_buff *skb);
1754 + void icmp_err(struct sk_buff *skb, u32 info);
1755 + int icmp_init(void);
1756 +diff --git a/include/net/ip.h b/include/net/ip.h
1757 +index e44b1a44f67ad..71d31e4d4391f 100644
1758 +--- a/include/net/ip.h
1759 ++++ b/include/net/ip.h
1760 +@@ -638,6 +638,8 @@ static inline int ip_options_echo(struct net *net, struct ip_options *dopt,
1761 + }
1762 +
1763 + void ip_options_fragment(struct sk_buff *skb);
1764 ++int __ip_options_compile(struct net *net, struct ip_options *opt,
1765 ++ struct sk_buff *skb, __be32 *info);
1766 + int ip_options_compile(struct net *net, struct ip_options *opt,
1767 + struct sk_buff *skb);
1768 + int ip_options_get(struct net *net, struct ip_options_rcu **optp,
1769 +@@ -687,7 +689,7 @@ extern int sysctl_icmp_msgs_burst;
1770 + int ip_misc_proc_init(void);
1771 + #endif
1772 +
1773 +-int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
1774 ++int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
1775 + struct netlink_ext_ack *extack);
1776 +
1777 + #endif /* _IP_H */
1778 +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
1779 +index a6d00093f35e7..c44da48de7dfd 100644
1780 +--- a/include/net/sch_generic.h
1781 ++++ b/include/net/sch_generic.h
1782 +@@ -47,7 +47,10 @@ struct qdisc_size_table {
1783 + struct qdisc_skb_head {
1784 + struct sk_buff *head;
1785 + struct sk_buff *tail;
1786 +- __u32 qlen;
1787 ++ union {
1788 ++ u32 qlen;
1789 ++ atomic_t atomic_qlen;
1790 ++ };
1791 + spinlock_t lock;
1792 + };
1793 +
1794 +@@ -384,27 +387,19 @@ static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
1795 + BUILD_BUG_ON(sizeof(qcb->data) < sz);
1796 + }
1797 +
1798 +-static inline int qdisc_qlen_cpu(const struct Qdisc *q)
1799 +-{
1800 +- return this_cpu_ptr(q->cpu_qstats)->qlen;
1801 +-}
1802 +-
1803 + static inline int qdisc_qlen(const struct Qdisc *q)
1804 + {
1805 + return q->q.qlen;
1806 + }
1807 +
1808 +-static inline int qdisc_qlen_sum(const struct Qdisc *q)
1809 ++static inline u32 qdisc_qlen_sum(const struct Qdisc *q)
1810 + {
1811 +- __u32 qlen = q->qstats.qlen;
1812 +- int i;
1813 ++ u32 qlen = q->qstats.qlen;
1814 +
1815 +- if (q->flags & TCQ_F_NOLOCK) {
1816 +- for_each_possible_cpu(i)
1817 +- qlen += per_cpu_ptr(q->cpu_qstats, i)->qlen;
1818 +- } else {
1819 ++ if (q->flags & TCQ_F_NOLOCK)
1820 ++ qlen += atomic_read(&q->q.atomic_qlen);
1821 ++ else
1822 + qlen += q->q.qlen;
1823 +- }
1824 +
1825 + return qlen;
1826 + }
1827 +@@ -776,14 +771,14 @@ static inline void qdisc_qstats_cpu_backlog_inc(struct Qdisc *sch,
1828 + this_cpu_add(sch->cpu_qstats->backlog, qdisc_pkt_len(skb));
1829 + }
1830 +
1831 +-static inline void qdisc_qstats_cpu_qlen_inc(struct Qdisc *sch)
1832 ++static inline void qdisc_qstats_atomic_qlen_inc(struct Qdisc *sch)
1833 + {
1834 +- this_cpu_inc(sch->cpu_qstats->qlen);
1835 ++ atomic_inc(&sch->q.atomic_qlen);
1836 + }
1837 +
1838 +-static inline void qdisc_qstats_cpu_qlen_dec(struct Qdisc *sch)
1839 ++static inline void qdisc_qstats_atomic_qlen_dec(struct Qdisc *sch)
1840 + {
1841 +- this_cpu_dec(sch->cpu_qstats->qlen);
1842 ++ atomic_dec(&sch->q.atomic_qlen);
1843 + }
1844 +
1845 + static inline void qdisc_qstats_cpu_requeues_inc(struct Qdisc *sch)
1846 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
1847 +index 4d81be2d07390..bcb42aaf1b3ae 100644
1848 +--- a/kernel/bpf/verifier.c
1849 ++++ b/kernel/bpf/verifier.c
1850 +@@ -6035,7 +6035,8 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
1851 + u32 off_reg;
1852 +
1853 + aux = &env->insn_aux_data[i + delta];
1854 +- if (!aux->alu_state)
1855 ++ if (!aux->alu_state ||
1856 ++ aux->alu_state == BPF_ALU_NON_POINTER)
1857 + continue;
1858 +
1859 + isneg = aux->alu_state & BPF_ALU_NEG_VALUE;
1860 +diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
1861 +index 5574e862de8d5..5a1c64a26e819 100644
1862 +--- a/kernel/trace/trace_events_filter.c
1863 ++++ b/kernel/trace/trace_events_filter.c
1864 +@@ -1301,7 +1301,7 @@ static int parse_pred(const char *str, void *data,
1865 + /* go past the last quote */
1866 + i++;
1867 +
1868 +- } else if (isdigit(str[i])) {
1869 ++ } else if (isdigit(str[i]) || str[i] == '-') {
1870 +
1871 + /* Make sure the field is not a string */
1872 + if (is_string_field(field)) {
1873 +@@ -1314,6 +1314,9 @@ static int parse_pred(const char *str, void *data,
1874 + goto err_free;
1875 + }
1876 +
1877 ++ if (str[i] == '-')
1878 ++ i++;
1879 ++
1880 + /* We allow 0xDEADBEEF */
1881 + while (isalnum(str[i]))
1882 + i++;
1883 +diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
1884 +index deacc52d7ff18..8d12198eaa949 100644
1885 +--- a/net/bluetooth/af_bluetooth.c
1886 ++++ b/net/bluetooth/af_bluetooth.c
1887 +@@ -154,15 +154,25 @@ void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
1888 + }
1889 + EXPORT_SYMBOL(bt_sock_unlink);
1890 +
1891 +-void bt_accept_enqueue(struct sock *parent, struct sock *sk)
1892 ++void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh)
1893 + {
1894 + BT_DBG("parent %p, sk %p", parent, sk);
1895 +
1896 + sock_hold(sk);
1897 +- lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
1898 ++
1899 ++ if (bh)
1900 ++ bh_lock_sock_nested(sk);
1901 ++ else
1902 ++ lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
1903 ++
1904 + list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q);
1905 + bt_sk(sk)->parent = parent;
1906 +- release_sock(sk);
1907 ++
1908 ++ if (bh)
1909 ++ bh_unlock_sock(sk);
1910 ++ else
1911 ++ release_sock(sk);
1912 ++
1913 + parent->sk_ack_backlog++;
1914 + }
1915 + EXPORT_SYMBOL(bt_accept_enqueue);
1916 +diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
1917 +index 686bdc6b35b03..a3a2cd55e23a9 100644
1918 +--- a/net/bluetooth/l2cap_sock.c
1919 ++++ b/net/bluetooth/l2cap_sock.c
1920 +@@ -1252,7 +1252,7 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan)
1921 +
1922 + l2cap_sock_init(sk, parent);
1923 +
1924 +- bt_accept_enqueue(parent, sk);
1925 ++ bt_accept_enqueue(parent, sk, false);
1926 +
1927 + release_sock(parent);
1928 +
1929 +diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
1930 +index d606e92122916..c044ff2f73e6c 100644
1931 +--- a/net/bluetooth/rfcomm/sock.c
1932 ++++ b/net/bluetooth/rfcomm/sock.c
1933 +@@ -988,7 +988,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
1934 + rfcomm_pi(sk)->channel = channel;
1935 +
1936 + sk->sk_state = BT_CONFIG;
1937 +- bt_accept_enqueue(parent, sk);
1938 ++ bt_accept_enqueue(parent, sk, true);
1939 +
1940 + /* Accept connection and return socket DLC */
1941 + *d = rfcomm_pi(sk)->dlc;
1942 +diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
1943 +index 8f0f9279eac9f..a4ca55df73908 100644
1944 +--- a/net/bluetooth/sco.c
1945 ++++ b/net/bluetooth/sco.c
1946 +@@ -193,7 +193,7 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk,
1947 + conn->sk = sk;
1948 +
1949 + if (parent)
1950 +- bt_accept_enqueue(parent, sk);
1951 ++ bt_accept_enqueue(parent, sk, true);
1952 + }
1953 +
1954 + static int sco_chan_add(struct sco_conn *conn, struct sock *sk,
1955 +diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
1956 +index 188d693cb251a..e2fd8baec65f3 100644
1957 +--- a/net/core/gen_stats.c
1958 ++++ b/net/core/gen_stats.c
1959 +@@ -256,7 +256,6 @@ __gnet_stats_copy_queue_cpu(struct gnet_stats_queue *qstats,
1960 + for_each_possible_cpu(i) {
1961 + const struct gnet_stats_queue *qcpu = per_cpu_ptr(q, i);
1962 +
1963 +- qstats->qlen = 0;
1964 + qstats->backlog += qcpu->backlog;
1965 + qstats->drops += qcpu->drops;
1966 + qstats->requeues += qcpu->requeues;
1967 +@@ -272,7 +271,6 @@ void __gnet_stats_copy_queue(struct gnet_stats_queue *qstats,
1968 + if (cpu) {
1969 + __gnet_stats_copy_queue_cpu(qstats, cpu);
1970 + } else {
1971 +- qstats->qlen = q->qlen;
1972 + qstats->backlog = q->backlog;
1973 + qstats->drops = q->drops;
1974 + qstats->requeues = q->requeues;
1975 +diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
1976 +index bd67c4d0fcfdf..2aabb7eb08541 100644
1977 +--- a/net/core/net-sysfs.c
1978 ++++ b/net/core/net-sysfs.c
1979 +@@ -1547,6 +1547,9 @@ static int register_queue_kobjects(struct net_device *dev)
1980 + error:
1981 + netdev_queue_update_kobjects(dev, txq, 0);
1982 + net_rx_queue_update_kobjects(dev, rxq, 0);
1983 ++#ifdef CONFIG_SYSFS
1984 ++ kset_unregister(dev->queues_kset);
1985 ++#endif
1986 + return error;
1987 + }
1988 +
1989 +diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
1990 +index 777fa3b7fb13d..f0165c5f376b3 100644
1991 +--- a/net/ipv4/cipso_ipv4.c
1992 ++++ b/net/ipv4/cipso_ipv4.c
1993 +@@ -667,7 +667,8 @@ static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level)
1994 + case CIPSO_V4_MAP_PASS:
1995 + return 0;
1996 + case CIPSO_V4_MAP_TRANS:
1997 +- if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)
1998 ++ if ((level < doi_def->map.std->lvl.cipso_size) &&
1999 ++ (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL))
2000 + return 0;
2001 + break;
2002 + }
2003 +@@ -1735,13 +1736,26 @@ validate_return:
2004 + */
2005 + void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
2006 + {
2007 ++ unsigned char optbuf[sizeof(struct ip_options) + 40];
2008 ++ struct ip_options *opt = (struct ip_options *)optbuf;
2009 ++
2010 + if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES)
2011 + return;
2012 +
2013 ++ /*
2014 ++ * We might be called above the IP layer,
2015 ++ * so we can not use icmp_send and IPCB here.
2016 ++ */
2017 ++
2018 ++ memset(opt, 0, sizeof(struct ip_options));
2019 ++ opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
2020 ++ if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL))
2021 ++ return;
2022 ++
2023 + if (gateway)
2024 +- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0);
2025 ++ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, opt);
2026 + else
2027 +- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0);
2028 ++ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, opt);
2029 + }
2030 +
2031 + /**
2032 +diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
2033 +index 958e185a8e8d1..dae743b649c1d 100644
2034 +--- a/net/ipv4/fib_frontend.c
2035 ++++ b/net/ipv4/fib_frontend.c
2036 +@@ -700,6 +700,10 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
2037 + case RTA_GATEWAY:
2038 + cfg->fc_gw = nla_get_be32(attr);
2039 + break;
2040 ++ case RTA_VIA:
2041 ++ NL_SET_ERR_MSG(extack, "IPv4 does not support RTA_VIA attribute");
2042 ++ err = -EINVAL;
2043 ++ goto errout;
2044 + case RTA_PRIORITY:
2045 + cfg->fc_priority = nla_get_u32(attr);
2046 + break;
2047 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2048 +index 695979b7ef6d0..ad75c468ecfb2 100644
2049 +--- a/net/ipv4/icmp.c
2050 ++++ b/net/ipv4/icmp.c
2051 +@@ -570,7 +570,8 @@ relookup_failed:
2052 + * MUST reply to only the first fragment.
2053 + */
2054 +
2055 +-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
2056 ++void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
2057 ++ const struct ip_options *opt)
2058 + {
2059 + struct iphdr *iph;
2060 + int room;
2061 +@@ -691,7 +692,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
2062 + iph->tos;
2063 + mark = IP4_REPLY_MARK(net, skb_in->mark);
2064 +
2065 +- if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in))
2066 ++ if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt))
2067 + goto out_unlock;
2068 +
2069 +
2070 +@@ -742,7 +743,7 @@ out_bh_enable:
2071 + local_bh_enable();
2072 + out:;
2073 + }
2074 +-EXPORT_SYMBOL(icmp_send);
2075 ++EXPORT_SYMBOL(__icmp_send);
2076 +
2077 +
2078 + static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
2079 +diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
2080 +index 6f977b0fef545..bd8ef4f87c795 100644
2081 +--- a/net/ipv4/ip_input.c
2082 ++++ b/net/ipv4/ip_input.c
2083 +@@ -308,11 +308,10 @@ drop:
2084 + }
2085 +
2086 + static int ip_rcv_finish_core(struct net *net, struct sock *sk,
2087 +- struct sk_buff *skb)
2088 ++ struct sk_buff *skb, struct net_device *dev)
2089 + {
2090 + const struct iphdr *iph = ip_hdr(skb);
2091 + int (*edemux)(struct sk_buff *skb);
2092 +- struct net_device *dev = skb->dev;
2093 + struct rtable *rt;
2094 + int err;
2095 +
2096 +@@ -401,6 +400,7 @@ drop_error:
2097 +
2098 + static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
2099 + {
2100 ++ struct net_device *dev = skb->dev;
2101 + int ret;
2102 +
2103 + /* if ingress device is enslaved to an L3 master device pass the
2104 +@@ -410,7 +410,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
2105 + if (!skb)
2106 + return NET_RX_SUCCESS;
2107 +
2108 +- ret = ip_rcv_finish_core(net, sk, skb);
2109 ++ ret = ip_rcv_finish_core(net, sk, skb, dev);
2110 + if (ret != NET_RX_DROP)
2111 + ret = dst_input(skb);
2112 + return ret;
2113 +@@ -550,6 +550,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
2114 +
2115 + INIT_LIST_HEAD(&sublist);
2116 + list_for_each_entry_safe(skb, next, head, list) {
2117 ++ struct net_device *dev = skb->dev;
2118 + struct dst_entry *dst;
2119 +
2120 + skb_list_del_init(skb);
2121 +@@ -559,7 +560,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
2122 + skb = l3mdev_ip_rcv(skb);
2123 + if (!skb)
2124 + continue;
2125 +- if (ip_rcv_finish_core(net, sk, skb) == NET_RX_DROP)
2126 ++ if (ip_rcv_finish_core(net, sk, skb, dev) == NET_RX_DROP)
2127 + continue;
2128 +
2129 + dst = skb_dst(skb);
2130 +diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
2131 +index ed194d46c00e3..32a35043c9f59 100644
2132 +--- a/net/ipv4/ip_options.c
2133 ++++ b/net/ipv4/ip_options.c
2134 +@@ -251,8 +251,9 @@ static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb)
2135 + * If opt == NULL, then skb->data should point to IP header.
2136 + */
2137 +
2138 +-int ip_options_compile(struct net *net,
2139 +- struct ip_options *opt, struct sk_buff *skb)
2140 ++int __ip_options_compile(struct net *net,
2141 ++ struct ip_options *opt, struct sk_buff *skb,
2142 ++ __be32 *info)
2143 + {
2144 + __be32 spec_dst = htonl(INADDR_ANY);
2145 + unsigned char *pp_ptr = NULL;
2146 +@@ -468,11 +469,22 @@ eol:
2147 + return 0;
2148 +
2149 + error:
2150 +- if (skb) {
2151 +- icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));
2152 +- }
2153 ++ if (info)
2154 ++ *info = htonl((pp_ptr-iph)<<24);
2155 + return -EINVAL;
2156 + }
2157 ++
2158 ++int ip_options_compile(struct net *net,
2159 ++ struct ip_options *opt, struct sk_buff *skb)
2160 ++{
2161 ++ int ret;
2162 ++ __be32 info;
2163 ++
2164 ++ ret = __ip_options_compile(net, opt, skb, &info);
2165 ++ if (ret != 0 && skb)
2166 ++ icmp_send(skb, ICMP_PARAMETERPROB, 0, info);
2167 ++ return ret;
2168 ++}
2169 + EXPORT_SYMBOL(ip_options_compile);
2170 +
2171 + /*
2172 +diff --git a/net/ipv4/netlink.c b/net/ipv4/netlink.c
2173 +index f86bb4f066095..d8e3a1fb8e826 100644
2174 +--- a/net/ipv4/netlink.c
2175 ++++ b/net/ipv4/netlink.c
2176 +@@ -3,9 +3,10 @@
2177 + #include <linux/types.h>
2178 + #include <net/net_namespace.h>
2179 + #include <net/netlink.h>
2180 ++#include <linux/in6.h>
2181 + #include <net/ip.h>
2182 +
2183 +-int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
2184 ++int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
2185 + struct netlink_ext_ack *extack)
2186 + {
2187 + *ip_proto = nla_get_u8(attr);
2188 +@@ -13,11 +14,19 @@ int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
2189 + switch (*ip_proto) {
2190 + case IPPROTO_TCP:
2191 + case IPPROTO_UDP:
2192 ++ return 0;
2193 + case IPPROTO_ICMP:
2194 ++ if (family != AF_INET)
2195 ++ break;
2196 ++ return 0;
2197 ++#if IS_ENABLED(CONFIG_IPV6)
2198 ++ case IPPROTO_ICMPV6:
2199 ++ if (family != AF_INET6)
2200 ++ break;
2201 + return 0;
2202 +- default:
2203 +- NL_SET_ERR_MSG(extack, "Unsupported ip proto");
2204 +- return -EOPNOTSUPP;
2205 ++#endif
2206 + }
2207 ++ NL_SET_ERR_MSG(extack, "Unsupported ip proto");
2208 ++ return -EOPNOTSUPP;
2209 + }
2210 + EXPORT_SYMBOL_GPL(rtm_getroute_parse_ip_proto);
2211 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
2212 +index 436b46c0e687f..ca87bb6784e5d 100644
2213 +--- a/net/ipv4/route.c
2214 ++++ b/net/ipv4/route.c
2215 +@@ -2814,7 +2814,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
2216 +
2217 + if (tb[RTA_IP_PROTO]) {
2218 + err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
2219 +- &ip_proto, extack);
2220 ++ &ip_proto, AF_INET, extack);
2221 + if (err)
2222 + return err;
2223 + }
2224 +diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
2225 +index 10aafea3af0f1..35e7092eceb37 100644
2226 +--- a/net/ipv6/ip6mr.c
2227 ++++ b/net/ipv6/ip6mr.c
2228 +@@ -1954,10 +1954,10 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
2229 +
2230 + static inline int ip6mr_forward2_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
2231 + {
2232 +- __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
2233 +- IPSTATS_MIB_OUTFORWDATAGRAMS);
2234 +- __IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)),
2235 +- IPSTATS_MIB_OUTOCTETS, skb->len);
2236 ++ IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
2237 ++ IPSTATS_MIB_OUTFORWDATAGRAMS);
2238 ++ IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)),
2239 ++ IPSTATS_MIB_OUTOCTETS, skb->len);
2240 + return dst_output(net, sk, skb);
2241 + }
2242 +
2243 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
2244 +index 08c4516ae4a4d..ba59a9c14e02a 100644
2245 +--- a/net/ipv6/route.c
2246 ++++ b/net/ipv6/route.c
2247 +@@ -4213,6 +4213,10 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
2248 + cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
2249 + cfg->fc_flags |= RTF_GATEWAY;
2250 + }
2251 ++ if (tb[RTA_VIA]) {
2252 ++ NL_SET_ERR_MSG(extack, "IPv6 does not support RTA_VIA attribute");
2253 ++ goto errout;
2254 ++ }
2255 +
2256 + if (tb[RTA_DST]) {
2257 + int plen = (rtm->rtm_dst_len + 7) >> 3;
2258 +@@ -4907,7 +4911,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
2259 +
2260 + if (tb[RTA_IP_PROTO]) {
2261 + err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
2262 +- &fl6.flowi6_proto, extack);
2263 ++ &fl6.flowi6_proto, AF_INET6,
2264 ++ extack);
2265 + if (err)
2266 + goto errout;
2267 + }
2268 +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
2269 +index da6d5a3f53995..868d7da7a0cb3 100644
2270 +--- a/net/ipv6/sit.c
2271 ++++ b/net/ipv6/sit.c
2272 +@@ -1873,6 +1873,7 @@ static int __net_init sit_init_net(struct net *net)
2273 +
2274 + err_reg_dev:
2275 + ipip6_dev_free(sitn->fb_tunnel_dev);
2276 ++ free_netdev(sitn->fb_tunnel_dev);
2277 + err_alloc_dev:
2278 + return err;
2279 + }
2280 +diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
2281 +index 8fbe6cdbe255d..d5a4db5b3fe7b 100644
2282 +--- a/net/mpls/af_mpls.c
2283 ++++ b/net/mpls/af_mpls.c
2284 +@@ -1822,6 +1822,9 @@ static int rtm_to_route_config(struct sk_buff *skb,
2285 + goto errout;
2286 + break;
2287 + }
2288 ++ case RTA_GATEWAY:
2289 ++ NL_SET_ERR_MSG(extack, "MPLS does not support RTA_GATEWAY attribute");
2290 ++ goto errout;
2291 + case RTA_VIA:
2292 + {
2293 + if (nla_get_via(nla, &cfg->rc_via_alen,
2294 +diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
2295 +index ea7c67050792c..ee3e5b6471a69 100644
2296 +--- a/net/netlabel/netlabel_kapi.c
2297 ++++ b/net/netlabel/netlabel_kapi.c
2298 +@@ -903,7 +903,8 @@ int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len,
2299 + (state == 0 && (byte & bitmask) == 0))
2300 + return bit_spot;
2301 +
2302 +- bit_spot++;
2303 ++ if (++bit_spot >= bitmap_len)
2304 ++ return -1;
2305 + bitmask >>= 1;
2306 + if (bitmask == 0) {
2307 + byte = bitmap[++byte_offset];
2308 +diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c
2309 +index 6a196e438b6c0..d1fc019e932e0 100644
2310 +--- a/net/nfc/llcp_commands.c
2311 ++++ b/net/nfc/llcp_commands.c
2312 +@@ -419,6 +419,10 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
2313 + sock->service_name,
2314 + sock->service_name_len,
2315 + &service_name_tlv_length);
2316 ++ if (!service_name_tlv) {
2317 ++ err = -ENOMEM;
2318 ++ goto error_tlv;
2319 ++ }
2320 + size += service_name_tlv_length;
2321 + }
2322 +
2323 +@@ -429,9 +433,17 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
2324 +
2325 + miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
2326 + &miux_tlv_length);
2327 ++ if (!miux_tlv) {
2328 ++ err = -ENOMEM;
2329 ++ goto error_tlv;
2330 ++ }
2331 + size += miux_tlv_length;
2332 +
2333 + rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
2334 ++ if (!rw_tlv) {
2335 ++ err = -ENOMEM;
2336 ++ goto error_tlv;
2337 ++ }
2338 + size += rw_tlv_length;
2339 +
2340 + pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len);
2341 +@@ -484,9 +496,17 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
2342 +
2343 + miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
2344 + &miux_tlv_length);
2345 ++ if (!miux_tlv) {
2346 ++ err = -ENOMEM;
2347 ++ goto error_tlv;
2348 ++ }
2349 + size += miux_tlv_length;
2350 +
2351 + rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
2352 ++ if (!rw_tlv) {
2353 ++ err = -ENOMEM;
2354 ++ goto error_tlv;
2355 ++ }
2356 + size += rw_tlv_length;
2357 +
2358 + skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size);
2359 +diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
2360 +index ef4026a23e802..4fa015208aab1 100644
2361 +--- a/net/nfc/llcp_core.c
2362 ++++ b/net/nfc/llcp_core.c
2363 +@@ -532,10 +532,10 @@ static u8 nfc_llcp_reserve_sdp_ssap(struct nfc_llcp_local *local)
2364 +
2365 + static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
2366 + {
2367 +- u8 *gb_cur, *version_tlv, version, version_length;
2368 +- u8 *lto_tlv, lto_length;
2369 +- u8 *wks_tlv, wks_length;
2370 +- u8 *miux_tlv, miux_length;
2371 ++ u8 *gb_cur, version, version_length;
2372 ++ u8 lto_length, wks_length, miux_length;
2373 ++ u8 *version_tlv = NULL, *lto_tlv = NULL,
2374 ++ *wks_tlv = NULL, *miux_tlv = NULL;
2375 + __be16 wks = cpu_to_be16(local->local_wks);
2376 + u8 gb_len = 0;
2377 + int ret = 0;
2378 +@@ -543,17 +543,33 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
2379 + version = LLCP_VERSION_11;
2380 + version_tlv = nfc_llcp_build_tlv(LLCP_TLV_VERSION, &version,
2381 + 1, &version_length);
2382 ++ if (!version_tlv) {
2383 ++ ret = -ENOMEM;
2384 ++ goto out;
2385 ++ }
2386 + gb_len += version_length;
2387 +
2388 + lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_LTO, &local->lto, 1, &lto_length);
2389 ++ if (!lto_tlv) {
2390 ++ ret = -ENOMEM;
2391 ++ goto out;
2392 ++ }
2393 + gb_len += lto_length;
2394 +
2395 + pr_debug("Local wks 0x%lx\n", local->local_wks);
2396 + wks_tlv = nfc_llcp_build_tlv(LLCP_TLV_WKS, (u8 *)&wks, 2, &wks_length);
2397 ++ if (!wks_tlv) {
2398 ++ ret = -ENOMEM;
2399 ++ goto out;
2400 ++ }
2401 + gb_len += wks_length;
2402 +
2403 + miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0,
2404 + &miux_length);
2405 ++ if (!miux_tlv) {
2406 ++ ret = -ENOMEM;
2407 ++ goto out;
2408 ++ }
2409 + gb_len += miux_length;
2410 +
2411 + gb_len += ARRAY_SIZE(llcp_magic);
2412 +diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
2413 +index 8525de8116163..334f3a0576713 100644
2414 +--- a/net/sched/act_ipt.c
2415 ++++ b/net/sched/act_ipt.c
2416 +@@ -199,8 +199,7 @@ err3:
2417 + err2:
2418 + kfree(tname);
2419 + err1:
2420 +- if (ret == ACT_P_CREATED)
2421 +- tcf_idr_release(*a, bind);
2422 ++ tcf_idr_release(*a, bind);
2423 + return err;
2424 + }
2425 +
2426 +diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
2427 +index 73e44ce2a8837..86d90fc5e97ea 100644
2428 +--- a/net/sched/act_skbedit.c
2429 ++++ b/net/sched/act_skbedit.c
2430 +@@ -191,8 +191,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
2431 +
2432 + params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
2433 + if (unlikely(!params_new)) {
2434 +- if (ret == ACT_P_CREATED)
2435 +- tcf_idr_release(*a, bind);
2436 ++ tcf_idr_release(*a, bind);
2437 + return -ENOMEM;
2438 + }
2439 +
2440 +diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
2441 +index 0f6601fdf8899..72d9c432e8b42 100644
2442 +--- a/net/sched/act_tunnel_key.c
2443 ++++ b/net/sched/act_tunnel_key.c
2444 +@@ -377,7 +377,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
2445 + return ret;
2446 +
2447 + release_tun_meta:
2448 +- dst_release(&metadata->dst);
2449 ++ if (metadata)
2450 ++ dst_release(&metadata->dst);
2451 +
2452 + err_out:
2453 + if (exists)
2454 +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
2455 +index 69078c82963ef..77b289da77636 100644
2456 +--- a/net/sched/sch_generic.c
2457 ++++ b/net/sched/sch_generic.c
2458 +@@ -68,7 +68,7 @@ static inline struct sk_buff *__skb_dequeue_bad_txq(struct Qdisc *q)
2459 + skb = __skb_dequeue(&q->skb_bad_txq);
2460 + if (qdisc_is_percpu_stats(q)) {
2461 + qdisc_qstats_cpu_backlog_dec(q, skb);
2462 +- qdisc_qstats_cpu_qlen_dec(q);
2463 ++ qdisc_qstats_atomic_qlen_dec(q);
2464 + } else {
2465 + qdisc_qstats_backlog_dec(q, skb);
2466 + q->q.qlen--;
2467 +@@ -108,7 +108,7 @@ static inline void qdisc_enqueue_skb_bad_txq(struct Qdisc *q,
2468 +
2469 + if (qdisc_is_percpu_stats(q)) {
2470 + qdisc_qstats_cpu_backlog_inc(q, skb);
2471 +- qdisc_qstats_cpu_qlen_inc(q);
2472 ++ qdisc_qstats_atomic_qlen_inc(q);
2473 + } else {
2474 + qdisc_qstats_backlog_inc(q, skb);
2475 + q->q.qlen++;
2476 +@@ -147,7 +147,7 @@ static inline int dev_requeue_skb_locked(struct sk_buff *skb, struct Qdisc *q)
2477 +
2478 + qdisc_qstats_cpu_requeues_inc(q);
2479 + qdisc_qstats_cpu_backlog_inc(q, skb);
2480 +- qdisc_qstats_cpu_qlen_inc(q);
2481 ++ qdisc_qstats_atomic_qlen_inc(q);
2482 +
2483 + skb = next;
2484 + }
2485 +@@ -252,7 +252,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate,
2486 + skb = __skb_dequeue(&q->gso_skb);
2487 + if (qdisc_is_percpu_stats(q)) {
2488 + qdisc_qstats_cpu_backlog_dec(q, skb);
2489 +- qdisc_qstats_cpu_qlen_dec(q);
2490 ++ qdisc_qstats_atomic_qlen_dec(q);
2491 + } else {
2492 + qdisc_qstats_backlog_dec(q, skb);
2493 + q->q.qlen--;
2494 +@@ -633,7 +633,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc,
2495 + if (unlikely(err))
2496 + return qdisc_drop_cpu(skb, qdisc, to_free);
2497 +
2498 +- qdisc_qstats_cpu_qlen_inc(qdisc);
2499 ++ qdisc_qstats_atomic_qlen_inc(qdisc);
2500 + /* Note: skb can not be used after skb_array_produce(),
2501 + * so we better not use qdisc_qstats_cpu_backlog_inc()
2502 + */
2503 +@@ -658,7 +658,7 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
2504 + if (likely(skb)) {
2505 + qdisc_qstats_cpu_backlog_dec(qdisc, skb);
2506 + qdisc_bstats_cpu_update(qdisc, skb);
2507 +- qdisc_qstats_cpu_qlen_dec(qdisc);
2508 ++ qdisc_qstats_atomic_qlen_dec(qdisc);
2509 + }
2510 +
2511 + return skb;
2512 +@@ -702,7 +702,6 @@ static void pfifo_fast_reset(struct Qdisc *qdisc)
2513 + struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i);
2514 +
2515 + q->backlog = 0;
2516 +- q->qlen = 0;
2517 + }
2518 + }
2519 +
2520 +diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
2521 +index 74c0f656f28c5..4dfe10b9f96c8 100644
2522 +--- a/net/sched/sch_netem.c
2523 ++++ b/net/sched/sch_netem.c
2524 +@@ -440,6 +440,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
2525 + int nb = 0;
2526 + int count = 1;
2527 + int rc = NET_XMIT_SUCCESS;
2528 ++ int rc_drop = NET_XMIT_DROP;
2529 +
2530 + /* Do not fool qdisc_drop_all() */
2531 + skb->prev = NULL;
2532 +@@ -479,6 +480,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
2533 + q->duplicate = 0;
2534 + rootq->enqueue(skb2, rootq, to_free);
2535 + q->duplicate = dupsave;
2536 ++ rc_drop = NET_XMIT_SUCCESS;
2537 + }
2538 +
2539 + /*
2540 +@@ -491,7 +493,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
2541 + if (skb_is_gso(skb)) {
2542 + segs = netem_segment(skb, sch, to_free);
2543 + if (!segs)
2544 +- return NET_XMIT_DROP;
2545 ++ return rc_drop;
2546 + } else {
2547 + segs = skb;
2548 + }
2549 +@@ -514,8 +516,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
2550 + 1<<(prandom_u32() % 8);
2551 + }
2552 +
2553 +- if (unlikely(sch->q.qlen >= sch->limit))
2554 +- return qdisc_drop_all(skb, sch, to_free);
2555 ++ if (unlikely(sch->q.qlen >= sch->limit)) {
2556 ++ qdisc_drop_all(skb, sch, to_free);
2557 ++ return rc_drop;
2558 ++ }
2559 +
2560 + qdisc_qstats_backlog_inc(sch, skb);
2561 +
2562 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
2563 +index e5e70cff5bb30..1b16250c5718d 100644
2564 +--- a/net/sctp/socket.c
2565 ++++ b/net/sctp/socket.c
2566 +@@ -1884,6 +1884,7 @@ static int sctp_sendmsg_check_sflags(struct sctp_association *asoc,
2567 +
2568 + pr_debug("%s: aborting association:%p\n", __func__, asoc);
2569 + sctp_primitive_ABORT(net, asoc, chunk);
2570 ++ iov_iter_revert(&msg->msg_iter, msg_len);
2571 +
2572 + return 0;
2573 + }
2574 +diff --git a/net/socket.c b/net/socket.c
2575 +index 5c820212ba815..18d27b8c25116 100644
2576 +--- a/net/socket.c
2577 ++++ b/net/socket.c
2578 +@@ -577,6 +577,7 @@ static void __sock_release(struct socket *sock, struct inode *inode)
2579 + if (inode)
2580 + inode_lock(inode);
2581 + sock->ops->release(sock);
2582 ++ sock->sk = NULL;
2583 + if (inode)
2584 + inode_unlock(inode);
2585 + sock->ops = NULL;
2586 +diff --git a/net/tipc/socket.c b/net/tipc/socket.c
2587 +index e1bdaf056c8f7..88c307ef13181 100644
2588 +--- a/net/tipc/socket.c
2589 ++++ b/net/tipc/socket.c
2590 +@@ -377,11 +377,13 @@ static int tipc_sk_sock_err(struct socket *sock, long *timeout)
2591 +
2592 + #define tipc_wait_for_cond(sock_, timeo_, condition_) \
2593 + ({ \
2594 ++ DEFINE_WAIT_FUNC(wait_, woken_wake_function); \
2595 + struct sock *sk_; \
2596 + int rc_; \
2597 + \
2598 + while ((rc_ = !(condition_))) { \
2599 +- DEFINE_WAIT_FUNC(wait_, woken_wake_function); \
2600 ++ /* coupled with smp_wmb() in tipc_sk_proto_rcv() */ \
2601 ++ smp_rmb(); \
2602 + sk_ = (sock_)->sk; \
2603 + rc_ = tipc_sk_sock_err((sock_), timeo_); \
2604 + if (rc_) \
2605 +@@ -1318,7 +1320,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
2606 +
2607 + if (unlikely(!dest)) {
2608 + dest = &tsk->peer;
2609 +- if (!syn || dest->family != AF_TIPC)
2610 ++ if (!syn && dest->family != AF_TIPC)
2611 + return -EDESTADDRREQ;
2612 + }
2613 +
2614 +@@ -1961,6 +1963,8 @@ static void tipc_sk_proto_rcv(struct sock *sk,
2615 + return;
2616 + case SOCK_WAKEUP:
2617 + tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0);
2618 ++ /* coupled with smp_rmb() in tipc_wait_for_cond() */
2619 ++ smp_wmb();
2620 + tsk->cong_link_cnt--;
2621 + wakeup = true;
2622 + break;
2623 +diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh
2624 +index 6c5f1b2ffb745..1cbb12e284a68 100755
2625 +--- a/tools/testing/selftests/firmware/fw_lib.sh
2626 ++++ b/tools/testing/selftests/firmware/fw_lib.sh
2627 +@@ -91,7 +91,7 @@ verify_reqs()
2628 + if [ "$TEST_REQS_FW_SYSFS_FALLBACK" = "yes" ]; then
2629 + if [ ! "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
2630 + echo "usermode helper disabled so ignoring test"
2631 +- exit $ksft_skip
2632 ++ exit 0
2633 + fi
2634 + fi
2635 + }