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