1 |
commit: 34c1f78fd1578cb47b7d5ea3de66faec2b9baea4 |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 28 11:06:57 2021 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 28 11:08:05 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=34c1f78f |
7 |
|
8 |
Linux patch 4.4.268 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1267_linux-4.4.268.patch | 1103 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1107 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 074f637..f7c5147 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1111,6 +1111,10 @@ Patch: 1266_linux-4.4.267.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.267 |
23 |
|
24 |
+Patch: 1267_linux-4.4.268.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.268 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1267_linux-4.4.268.patch b/1267_linux-4.4.268.patch |
33 |
new file mode 100644 |
34 |
index 0000000..63cb1d0 |
35 |
--- /dev/null |
36 |
+++ b/1267_linux-4.4.268.patch |
37 |
@@ -0,0 +1,1103 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 8a564934a742e..43bb823afb631 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 267 |
46 |
++SUBLEVEL = 268 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c |
51 |
+index 257b8699efde4..639f39f399173 100644 |
52 |
+--- a/arch/arc/kernel/signal.c |
53 |
++++ b/arch/arc/kernel/signal.c |
54 |
+@@ -97,7 +97,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, |
55 |
+ sizeof(sf->uc.uc_mcontext.regs.scratch)); |
56 |
+ err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); |
57 |
+ |
58 |
+- return err; |
59 |
++ return err ? -EFAULT : 0; |
60 |
+ } |
61 |
+ |
62 |
+ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) |
63 |
+@@ -111,7 +111,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) |
64 |
+ &(sf->uc.uc_mcontext.regs.scratch), |
65 |
+ sizeof(sf->uc.uc_mcontext.regs.scratch)); |
66 |
+ if (err) |
67 |
+- return err; |
68 |
++ return -EFAULT; |
69 |
+ |
70 |
+ set_current_blocked(&set); |
71 |
+ regs->bta = uregs.scratch.bta; |
72 |
+diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi |
73 |
+index 8a2b25332b8c7..a2e41d79e8299 100644 |
74 |
+--- a/arch/arm/boot/dts/omap3.dtsi |
75 |
++++ b/arch/arm/boot/dts/omap3.dtsi |
76 |
+@@ -22,6 +22,9 @@ |
77 |
+ i2c0 = &i2c1; |
78 |
+ i2c1 = &i2c2; |
79 |
+ i2c2 = &i2c3; |
80 |
++ mmc0 = &mmc1; |
81 |
++ mmc1 = &mmc2; |
82 |
++ mmc2 = &mmc3; |
83 |
+ serial0 = &uart1; |
84 |
+ serial1 = &uart2; |
85 |
+ serial2 = &uart3; |
86 |
+diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi |
87 |
+index 8a5628c4b135c..656e35ec037d7 100644 |
88 |
+--- a/arch/arm/boot/dts/omap4.dtsi |
89 |
++++ b/arch/arm/boot/dts/omap4.dtsi |
90 |
+@@ -21,6 +21,11 @@ |
91 |
+ i2c1 = &i2c2; |
92 |
+ i2c2 = &i2c3; |
93 |
+ i2c3 = &i2c4; |
94 |
++ mmc0 = &mmc1; |
95 |
++ mmc1 = &mmc2; |
96 |
++ mmc2 = &mmc3; |
97 |
++ mmc3 = &mmc4; |
98 |
++ mmc4 = &mmc5; |
99 |
+ serial0 = &uart1; |
100 |
+ serial1 = &uart2; |
101 |
+ serial2 = &uart3; |
102 |
+diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi |
103 |
+index 4c04389dab325..b61ea6ca59b32 100644 |
104 |
+--- a/arch/arm/boot/dts/omap5.dtsi |
105 |
++++ b/arch/arm/boot/dts/omap5.dtsi |
106 |
+@@ -26,6 +26,11 @@ |
107 |
+ i2c2 = &i2c3; |
108 |
+ i2c3 = &i2c4; |
109 |
+ i2c4 = &i2c5; |
110 |
++ mmc0 = &mmc1; |
111 |
++ mmc1 = &mmc2; |
112 |
++ mmc2 = &mmc3; |
113 |
++ mmc3 = &mmc4; |
114 |
++ mmc4 = &mmc5; |
115 |
+ serial0 = &uart1; |
116 |
+ serial1 = &uart2; |
117 |
+ serial2 = &uart3; |
118 |
+diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c |
119 |
+index c279293f084cb..0f1f5c4141d59 100644 |
120 |
+--- a/arch/arm/mach-keystone/keystone.c |
121 |
++++ b/arch/arm/mach-keystone/keystone.c |
122 |
+@@ -71,7 +71,7 @@ static phys_addr_t keystone_virt_to_idmap(unsigned long x) |
123 |
+ static long long __init keystone_pv_fixup(void) |
124 |
+ { |
125 |
+ long long offset; |
126 |
+- phys_addr_t mem_start, mem_end; |
127 |
++ u64 mem_start, mem_end; |
128 |
+ |
129 |
+ mem_start = memblock_start_of_DRAM(); |
130 |
+ mem_end = memblock_end_of_DRAM(); |
131 |
+@@ -84,7 +84,7 @@ static long long __init keystone_pv_fixup(void) |
132 |
+ if (mem_start < KEYSTONE_HIGH_PHYS_START || |
133 |
+ mem_end > KEYSTONE_HIGH_PHYS_END) { |
134 |
+ pr_crit("Invalid address space for memory (%08llx-%08llx)\n", |
135 |
+- (u64)mem_start, (u64)mem_end); |
136 |
++ mem_start, mem_end); |
137 |
+ return 0; |
138 |
+ } |
139 |
+ |
140 |
+diff --git a/arch/arm/probes/uprobes/core.c b/arch/arm/probes/uprobes/core.c |
141 |
+index d1329f1ba4e4c..b97230704b744 100644 |
142 |
+--- a/arch/arm/probes/uprobes/core.c |
143 |
++++ b/arch/arm/probes/uprobes/core.c |
144 |
+@@ -207,7 +207,7 @@ unsigned long uprobe_get_swbp_addr(struct pt_regs *regs) |
145 |
+ static struct undef_hook uprobes_arm_break_hook = { |
146 |
+ .instr_mask = 0x0fffffff, |
147 |
+ .instr_val = (UPROBE_SWBP_ARM_INSN & 0x0fffffff), |
148 |
+- .cpsr_mask = MODE_MASK, |
149 |
++ .cpsr_mask = (PSR_T_BIT | MODE_MASK), |
150 |
+ .cpsr_val = USR_MODE, |
151 |
+ .fn = uprobe_trap_handler, |
152 |
+ }; |
153 |
+@@ -215,7 +215,7 @@ static struct undef_hook uprobes_arm_break_hook = { |
154 |
+ static struct undef_hook uprobes_arm_ss_hook = { |
155 |
+ .instr_mask = 0x0fffffff, |
156 |
+ .instr_val = (UPROBE_SS_ARM_INSN & 0x0fffffff), |
157 |
+- .cpsr_mask = MODE_MASK, |
158 |
++ .cpsr_mask = (PSR_T_BIT | MODE_MASK), |
159 |
+ .cpsr_val = USR_MODE, |
160 |
+ .fn = uprobe_trap_handler, |
161 |
+ }; |
162 |
+diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c |
163 |
+index 8786268053693..3b0c892953ab4 100644 |
164 |
+--- a/arch/ia64/mm/discontig.c |
165 |
++++ b/arch/ia64/mm/discontig.c |
166 |
+@@ -99,7 +99,7 @@ static int __init build_node_maps(unsigned long start, unsigned long len, |
167 |
+ * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been |
168 |
+ * called yet. Note that node 0 will also count all non-existent cpus. |
169 |
+ */ |
170 |
+-static int __meminit early_nr_cpus_node(int node) |
171 |
++static int early_nr_cpus_node(int node) |
172 |
+ { |
173 |
+ int cpu, n = 0; |
174 |
+ |
175 |
+@@ -114,7 +114,7 @@ static int __meminit early_nr_cpus_node(int node) |
176 |
+ * compute_pernodesize - compute size of pernode data |
177 |
+ * @node: the node id. |
178 |
+ */ |
179 |
+-static unsigned long __meminit compute_pernodesize(int node) |
180 |
++static unsigned long compute_pernodesize(int node) |
181 |
+ { |
182 |
+ unsigned long pernodesize = 0, cpus; |
183 |
+ |
184 |
+@@ -411,7 +411,7 @@ static void __init reserve_pernode_space(void) |
185 |
+ } |
186 |
+ } |
187 |
+ |
188 |
+-static void __meminit scatter_node_data(void) |
189 |
++static void scatter_node_data(void) |
190 |
+ { |
191 |
+ pg_data_t **dst; |
192 |
+ int node; |
193 |
+diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S |
194 |
+index 4cad1adff16bf..d43f18b3d42c3 100644 |
195 |
+--- a/arch/s390/kernel/entry.S |
196 |
++++ b/arch/s390/kernel/entry.S |
197 |
+@@ -889,6 +889,7 @@ ENTRY(ext_int_handler) |
198 |
+ * Load idle PSW. The second "half" of this function is in .Lcleanup_idle. |
199 |
+ */ |
200 |
+ ENTRY(psw_idle) |
201 |
++ stg %r14,(__SF_GPRS+8*8)(%r15) |
202 |
+ stg %r3,__SF_EMPTY(%r15) |
203 |
+ larl %r1,.Lpsw_idle_lpsw+4 |
204 |
+ stg %r1,__SF_EMPTY+8(%r15) |
205 |
+diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c |
206 |
+index 2c1910f6717ed..a6d623e43d623 100644 |
207 |
+--- a/arch/x86/kernel/crash.c |
208 |
++++ b/arch/x86/kernel/crash.c |
209 |
+@@ -23,6 +23,7 @@ |
210 |
+ #include <linux/module.h> |
211 |
+ #include <linux/slab.h> |
212 |
+ #include <linux/vmalloc.h> |
213 |
++#include <linux/overflow.h> |
214 |
+ |
215 |
+ #include <asm/processor.h> |
216 |
+ #include <asm/hardirq.h> |
217 |
+@@ -572,7 +573,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) |
218 |
+ struct crash_memmap_data cmd; |
219 |
+ struct crash_mem *cmem; |
220 |
+ |
221 |
+- cmem = vzalloc(sizeof(struct crash_mem)); |
222 |
++ cmem = vzalloc(struct_size(cmem, ranges, 1)); |
223 |
+ if (!cmem) |
224 |
+ return -ENOMEM; |
225 |
+ |
226 |
+diff --git a/drivers/dma/dw/Kconfig b/drivers/dma/dw/Kconfig |
227 |
+index e00c9b0229647..6ea3e95c287bd 100644 |
228 |
+--- a/drivers/dma/dw/Kconfig |
229 |
++++ b/drivers/dma/dw/Kconfig |
230 |
+@@ -11,6 +11,7 @@ config DW_DMAC_BIG_ENDIAN_IO |
231 |
+ |
232 |
+ config DW_DMAC |
233 |
+ tristate "Synopsys DesignWare AHB DMA platform driver" |
234 |
++ depends on HAS_IOMEM |
235 |
+ select DW_DMAC_CORE |
236 |
+ select DW_DMAC_BIG_ENDIAN_IO if AVR32 |
237 |
+ default y if CPU_AT32AP7000 |
238 |
+@@ -21,6 +22,7 @@ config DW_DMAC |
239 |
+ config DW_DMAC_PCI |
240 |
+ tristate "Synopsys DesignWare AHB DMA PCI driver" |
241 |
+ depends on PCI |
242 |
++ depends on HAS_IOMEM |
243 |
+ select DW_DMAC_CORE |
244 |
+ help |
245 |
+ Support the Synopsys DesignWare AHB DMA controller on the |
246 |
+diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c |
247 |
+index 7abfd34eb87ec..bcec72367c1d4 100644 |
248 |
+--- a/drivers/input/keyboard/nspire-keypad.c |
249 |
++++ b/drivers/input/keyboard/nspire-keypad.c |
250 |
+@@ -96,9 +96,15 @@ static irqreturn_t nspire_keypad_irq(int irq, void *dev_id) |
251 |
+ return IRQ_HANDLED; |
252 |
+ } |
253 |
+ |
254 |
+-static int nspire_keypad_chip_init(struct nspire_keypad *keypad) |
255 |
++static int nspire_keypad_open(struct input_dev *input) |
256 |
+ { |
257 |
++ struct nspire_keypad *keypad = input_get_drvdata(input); |
258 |
+ unsigned long val = 0, cycles_per_us, delay_cycles, row_delay_cycles; |
259 |
++ int error; |
260 |
++ |
261 |
++ error = clk_prepare_enable(keypad->clk); |
262 |
++ if (error) |
263 |
++ return error; |
264 |
+ |
265 |
+ cycles_per_us = (clk_get_rate(keypad->clk) / 1000000); |
266 |
+ if (cycles_per_us == 0) |
267 |
+@@ -124,30 +130,6 @@ static int nspire_keypad_chip_init(struct nspire_keypad *keypad) |
268 |
+ keypad->int_mask = 1 << 1; |
269 |
+ writel(keypad->int_mask, keypad->reg_base + KEYPAD_INTMSK); |
270 |
+ |
271 |
+- /* Disable GPIO interrupts to prevent hanging on touchpad */ |
272 |
+- /* Possibly used to detect touchpad events */ |
273 |
+- writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT); |
274 |
+- /* Acknowledge existing interrupts */ |
275 |
+- writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS); |
276 |
+- |
277 |
+- return 0; |
278 |
+-} |
279 |
+- |
280 |
+-static int nspire_keypad_open(struct input_dev *input) |
281 |
+-{ |
282 |
+- struct nspire_keypad *keypad = input_get_drvdata(input); |
283 |
+- int error; |
284 |
+- |
285 |
+- error = clk_prepare_enable(keypad->clk); |
286 |
+- if (error) |
287 |
+- return error; |
288 |
+- |
289 |
+- error = nspire_keypad_chip_init(keypad); |
290 |
+- if (error) { |
291 |
+- clk_disable_unprepare(keypad->clk); |
292 |
+- return error; |
293 |
+- } |
294 |
+- |
295 |
+ return 0; |
296 |
+ } |
297 |
+ |
298 |
+@@ -155,6 +137,11 @@ static void nspire_keypad_close(struct input_dev *input) |
299 |
+ { |
300 |
+ struct nspire_keypad *keypad = input_get_drvdata(input); |
301 |
+ |
302 |
++ /* Disable interrupts */ |
303 |
++ writel(0, keypad->reg_base + KEYPAD_INTMSK); |
304 |
++ /* Acknowledge existing interrupts */ |
305 |
++ writel(~0, keypad->reg_base + KEYPAD_INT); |
306 |
++ |
307 |
+ clk_disable_unprepare(keypad->clk); |
308 |
+ } |
309 |
+ |
310 |
+@@ -215,6 +202,25 @@ static int nspire_keypad_probe(struct platform_device *pdev) |
311 |
+ return -ENOMEM; |
312 |
+ } |
313 |
+ |
314 |
++ error = clk_prepare_enable(keypad->clk); |
315 |
++ if (error) { |
316 |
++ dev_err(&pdev->dev, "failed to enable clock\n"); |
317 |
++ return error; |
318 |
++ } |
319 |
++ |
320 |
++ /* Disable interrupts */ |
321 |
++ writel(0, keypad->reg_base + KEYPAD_INTMSK); |
322 |
++ /* Acknowledge existing interrupts */ |
323 |
++ writel(~0, keypad->reg_base + KEYPAD_INT); |
324 |
++ |
325 |
++ /* Disable GPIO interrupts to prevent hanging on touchpad */ |
326 |
++ /* Possibly used to detect touchpad events */ |
327 |
++ writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT); |
328 |
++ /* Acknowledge existing GPIO interrupts */ |
329 |
++ writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS); |
330 |
++ |
331 |
++ clk_disable_unprepare(keypad->clk); |
332 |
++ |
333 |
+ input_set_drvdata(input, keypad); |
334 |
+ |
335 |
+ input->id.bustype = BUS_HOST; |
336 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
337 |
+index ff0f3c3e2f804..3049bccf24227 100644 |
338 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
339 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
340 |
+@@ -579,6 +579,7 @@ static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = { |
341 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
342 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"), |
343 |
+ }, |
344 |
++ }, { |
345 |
+ .matches = { |
346 |
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
347 |
+ DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */ |
348 |
+diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c |
349 |
+index 7ee520d4d216e..9da3ff8a07cce 100644 |
350 |
+--- a/drivers/md/dm-table.c |
351 |
++++ b/drivers/md/dm-table.c |
352 |
+@@ -516,14 +516,14 @@ static int adjoin(struct dm_table *table, struct dm_target *ti) |
353 |
+ * On the other hand, dm-switch needs to process bulk data using messages and |
354 |
+ * excessive use of GFP_NOIO could cause trouble. |
355 |
+ */ |
356 |
+-static char **realloc_argv(unsigned *array_size, char **old_argv) |
357 |
++static char **realloc_argv(unsigned *size, char **old_argv) |
358 |
+ { |
359 |
+ char **argv; |
360 |
+ unsigned new_size; |
361 |
+ gfp_t gfp; |
362 |
+ |
363 |
+- if (*array_size) { |
364 |
+- new_size = *array_size * 2; |
365 |
++ if (*size) { |
366 |
++ new_size = *size * 2; |
367 |
+ gfp = GFP_KERNEL; |
368 |
+ } else { |
369 |
+ new_size = 8; |
370 |
+@@ -531,8 +531,8 @@ static char **realloc_argv(unsigned *array_size, char **old_argv) |
371 |
+ } |
372 |
+ argv = kmalloc(new_size * sizeof(*argv), gfp); |
373 |
+ if (argv) { |
374 |
+- memcpy(argv, old_argv, *array_size * sizeof(*argv)); |
375 |
+- *array_size = new_size; |
376 |
++ memcpy(argv, old_argv, *size * sizeof(*argv)); |
377 |
++ *size = new_size; |
378 |
+ } |
379 |
+ |
380 |
+ kfree(old_argv); |
381 |
+diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c |
382 |
+index 7ccebae9cb487..b305903c91c41 100644 |
383 |
+--- a/drivers/net/ethernet/amd/pcnet32.c |
384 |
++++ b/drivers/net/ethernet/amd/pcnet32.c |
385 |
+@@ -1493,8 +1493,7 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) |
386 |
+ } |
387 |
+ pci_set_master(pdev); |
388 |
+ |
389 |
+- ioaddr = pci_resource_start(pdev, 0); |
390 |
+- if (!ioaddr) { |
391 |
++ if (!pci_resource_len(pdev, 0)) { |
392 |
+ if (pcnet32_debug & NETIF_MSG_PROBE) |
393 |
+ pr_err("card has no PCI IO resources, aborting\n"); |
394 |
+ return -ENODEV; |
395 |
+@@ -1506,6 +1505,8 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) |
396 |
+ pr_err("architecture does not support 32bit PCI busmaster DMA\n"); |
397 |
+ return err; |
398 |
+ } |
399 |
++ |
400 |
++ ioaddr = pci_resource_start(pdev, 0); |
401 |
+ if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) { |
402 |
+ if (pcnet32_debug & NETIF_MSG_PROBE) |
403 |
+ pr_err("io address range already allocated\n"); |
404 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h b/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h |
405 |
+index 5e3aff242ad38..3ab84d18ad3ac 100644 |
406 |
+--- a/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h |
407 |
++++ b/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h |
408 |
+@@ -417,7 +417,7 @@ |
409 |
+ | CN6XXX_INTR_M0UNWI_ERR \ |
410 |
+ | CN6XXX_INTR_M1UPB0_ERR \ |
411 |
+ | CN6XXX_INTR_M1UPWI_ERR \ |
412 |
+- | CN6XXX_INTR_M1UPB0_ERR \ |
413 |
++ | CN6XXX_INTR_M1UNB0_ERR \ |
414 |
+ | CN6XXX_INTR_M1UNWI_ERR \ |
415 |
+ | CN6XXX_INTR_INSTR_DB_OF_ERR \ |
416 |
+ | CN6XXX_INTR_SLIST_DB_OF_ERR \ |
417 |
+diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c |
418 |
+index ab06cf36af083..b8d82f32b2dbd 100644 |
419 |
+--- a/drivers/net/ethernet/davicom/dm9000.c |
420 |
++++ b/drivers/net/ethernet/davicom/dm9000.c |
421 |
+@@ -1484,8 +1484,10 @@ dm9000_probe(struct platform_device *pdev) |
422 |
+ |
423 |
+ /* Init network device */ |
424 |
+ ndev = alloc_etherdev(sizeof(struct board_info)); |
425 |
+- if (!ndev) |
426 |
+- return -ENOMEM; |
427 |
++ if (!ndev) { |
428 |
++ ret = -ENOMEM; |
429 |
++ goto out_regulator_disable; |
430 |
++ } |
431 |
+ |
432 |
+ SET_NETDEV_DEV(ndev, &pdev->dev); |
433 |
+ |
434 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
435 |
+index 756c4ea176554..8bdc17658f3f1 100644 |
436 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
437 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
438 |
+@@ -8148,6 +8148,7 @@ static int i40e_sw_init(struct i40e_pf *pf) |
439 |
+ { |
440 |
+ int err = 0; |
441 |
+ int size; |
442 |
++ u16 pow; |
443 |
+ |
444 |
+ pf->msg_enable = netif_msg_init(I40E_DEFAULT_MSG_ENABLE, |
445 |
+ (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)); |
446 |
+@@ -8182,6 +8183,11 @@ static int i40e_sw_init(struct i40e_pf *pf) |
447 |
+ pf->rss_table_size = pf->hw.func_caps.rss_table_size; |
448 |
+ pf->rss_size_max = min_t(int, pf->rss_size_max, |
449 |
+ pf->hw.func_caps.num_tx_qp); |
450 |
++ |
451 |
++ /* find the next higher power-of-2 of num cpus */ |
452 |
++ pow = roundup_pow_of_two(num_online_cpus()); |
453 |
++ pf->rss_size_max = min_t(int, pf->rss_size_max, pow); |
454 |
++ |
455 |
+ if (pf->hw.func_caps.rss) { |
456 |
+ pf->flags |= I40E_FLAG_RSS_ENABLED; |
457 |
+ pf->rss_size = min_t(int, pf->rss_size_max, num_online_cpus()); |
458 |
+diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c |
459 |
+index efd4bf06f6ada..559c9b6290e1a 100644 |
460 |
+--- a/drivers/net/usb/hso.c |
461 |
++++ b/drivers/net/usb/hso.c |
462 |
+@@ -635,7 +635,7 @@ static struct hso_serial *get_serial_by_index(unsigned index) |
463 |
+ return serial; |
464 |
+ } |
465 |
+ |
466 |
+-static int get_free_serial_index(void) |
467 |
++static int obtain_minor(struct hso_serial *serial) |
468 |
+ { |
469 |
+ int index; |
470 |
+ unsigned long flags; |
471 |
+@@ -643,8 +643,10 @@ static int get_free_serial_index(void) |
472 |
+ spin_lock_irqsave(&serial_table_lock, flags); |
473 |
+ for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) { |
474 |
+ if (serial_table[index] == NULL) { |
475 |
++ serial_table[index] = serial->parent; |
476 |
++ serial->minor = index; |
477 |
+ spin_unlock_irqrestore(&serial_table_lock, flags); |
478 |
+- return index; |
479 |
++ return 0; |
480 |
+ } |
481 |
+ } |
482 |
+ spin_unlock_irqrestore(&serial_table_lock, flags); |
483 |
+@@ -653,15 +655,12 @@ static int get_free_serial_index(void) |
484 |
+ return -1; |
485 |
+ } |
486 |
+ |
487 |
+-static void set_serial_by_index(unsigned index, struct hso_serial *serial) |
488 |
++static void release_minor(struct hso_serial *serial) |
489 |
+ { |
490 |
+ unsigned long flags; |
491 |
+ |
492 |
+ spin_lock_irqsave(&serial_table_lock, flags); |
493 |
+- if (serial) |
494 |
+- serial_table[index] = serial->parent; |
495 |
+- else |
496 |
+- serial_table[index] = NULL; |
497 |
++ serial_table[serial->minor] = NULL; |
498 |
+ spin_unlock_irqrestore(&serial_table_lock, flags); |
499 |
+ } |
500 |
+ |
501 |
+@@ -2249,6 +2248,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) |
502 |
+ static void hso_serial_tty_unregister(struct hso_serial *serial) |
503 |
+ { |
504 |
+ tty_unregister_device(tty_drv, serial->minor); |
505 |
++ release_minor(serial); |
506 |
+ } |
507 |
+ |
508 |
+ static void hso_serial_common_free(struct hso_serial *serial) |
509 |
+@@ -2273,25 +2273,23 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, |
510 |
+ int rx_size, int tx_size) |
511 |
+ { |
512 |
+ struct device *dev; |
513 |
+- int minor; |
514 |
+ int i; |
515 |
+ |
516 |
+ tty_port_init(&serial->port); |
517 |
+ |
518 |
+- minor = get_free_serial_index(); |
519 |
+- if (minor < 0) |
520 |
++ if (obtain_minor(serial)) |
521 |
+ goto exit2; |
522 |
+ |
523 |
+ /* register our minor number */ |
524 |
+ serial->parent->dev = tty_port_register_device_attr(&serial->port, |
525 |
+- tty_drv, minor, &serial->parent->interface->dev, |
526 |
++ tty_drv, serial->minor, &serial->parent->interface->dev, |
527 |
+ serial->parent, hso_serial_dev_groups); |
528 |
+- if (IS_ERR(serial->parent->dev)) |
529 |
++ if (IS_ERR(serial->parent->dev)) { |
530 |
++ release_minor(serial); |
531 |
+ goto exit2; |
532 |
++ } |
533 |
+ dev = serial->parent->dev; |
534 |
+ |
535 |
+- /* fill in specific data for later use */ |
536 |
+- serial->minor = minor; |
537 |
+ serial->magic = HSO_SERIAL_MAGIC; |
538 |
+ spin_lock_init(&serial->serial_lock); |
539 |
+ serial->num_rx_urbs = num_urbs; |
540 |
+@@ -2692,9 +2690,6 @@ static struct hso_device *hso_create_bulk_serial_device( |
541 |
+ |
542 |
+ serial->write_data = hso_std_serial_write_data; |
543 |
+ |
544 |
+- /* and record this serial */ |
545 |
+- set_serial_by_index(serial->minor, serial); |
546 |
+- |
547 |
+ /* setup the proc dirs and files if needed */ |
548 |
+ hso_log_port(hso_dev); |
549 |
+ |
550 |
+@@ -2751,9 +2746,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, |
551 |
+ serial->shared_int->ref_count++; |
552 |
+ mutex_unlock(&serial->shared_int->shared_int_lock); |
553 |
+ |
554 |
+- /* and record this serial */ |
555 |
+- set_serial_by_index(serial->minor, serial); |
556 |
+- |
557 |
+ /* setup the proc dirs and files if needed */ |
558 |
+ hso_log_port(hso_dev); |
559 |
+ |
560 |
+@@ -3139,8 +3131,7 @@ static void hso_free_interface(struct usb_interface *interface) |
561 |
+ cancel_work_sync(&serial_table[i]->async_put_intf); |
562 |
+ cancel_work_sync(&serial_table[i]->async_get_intf); |
563 |
+ hso_serial_tty_unregister(serial); |
564 |
+- kref_put(&serial_table[i]->ref, hso_serial_ref_free); |
565 |
+- set_serial_by_index(i, NULL); |
566 |
++ kref_put(&serial->parent->ref, hso_serial_ref_free); |
567 |
+ } |
568 |
+ } |
569 |
+ |
570 |
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c |
571 |
+index 21c8e2720b403..683fd8560f2bc 100644 |
572 |
+--- a/drivers/net/xen-netback/xenbus.c |
573 |
++++ b/drivers/net/xen-netback/xenbus.c |
574 |
+@@ -849,11 +849,15 @@ static void connect(struct backend_info *be) |
575 |
+ xenvif_carrier_on(be->vif); |
576 |
+ |
577 |
+ unregister_hotplug_status_watch(be); |
578 |
+- err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL, |
579 |
+- hotplug_status_changed, |
580 |
+- "%s/%s", dev->nodename, "hotplug-status"); |
581 |
+- if (!err) |
582 |
++ if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) { |
583 |
++ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, |
584 |
++ NULL, hotplug_status_changed, |
585 |
++ "%s/%s", dev->nodename, |
586 |
++ "hotplug-status"); |
587 |
++ if (err) |
588 |
++ goto err; |
589 |
+ be->have_hotplug_status_watch = 1; |
590 |
++ } |
591 |
+ |
592 |
+ netif_tx_wake_all_queues(be->vif->dev); |
593 |
+ |
594 |
+diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c |
595 |
+index 68b33abeaa5fa..eba0d4ef546db 100644 |
596 |
+--- a/drivers/scsi/libsas/sas_ata.c |
597 |
++++ b/drivers/scsi/libsas/sas_ata.c |
598 |
+@@ -216,18 +216,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) |
599 |
+ memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); |
600 |
+ task->total_xfer_len = qc->nbytes; |
601 |
+ task->num_scatter = qc->n_elem; |
602 |
++ task->data_dir = qc->dma_dir; |
603 |
++ } else if (qc->tf.protocol == ATA_PROT_NODATA) { |
604 |
++ task->data_dir = DMA_NONE; |
605 |
+ } else { |
606 |
+ for_each_sg(qc->sg, sg, qc->n_elem, si) |
607 |
+ xfer += sg_dma_len(sg); |
608 |
+ |
609 |
+ task->total_xfer_len = xfer; |
610 |
+ task->num_scatter = si; |
611 |
+- } |
612 |
+- |
613 |
+- if (qc->tf.protocol == ATA_PROT_NODATA) |
614 |
+- task->data_dir = DMA_NONE; |
615 |
+- else |
616 |
+ task->data_dir = qc->dma_dir; |
617 |
++ } |
618 |
+ task->scatter = qc->sg; |
619 |
+ task->ata_task.retry_count = 1; |
620 |
+ task->task_state_flags = SAS_TASK_STATE_PENDING; |
621 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
622 |
+index f22fcb3936841..8cd2a7e1eef17 100644 |
623 |
+--- a/fs/ext4/namei.c |
624 |
++++ b/fs/ext4/namei.c |
625 |
+@@ -3561,7 +3561,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
626 |
+ !ext4_is_child_context_consistent_with_parent(new.dir, |
627 |
+ old.inode)) { |
628 |
+ retval = -EXDEV; |
629 |
+- goto end_rename; |
630 |
++ goto release_bh; |
631 |
+ } |
632 |
+ |
633 |
+ new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
634 |
+diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h |
635 |
+index de179993e039d..6851c4214ac6f 100644 |
636 |
+--- a/include/linux/compiler-clang.h |
637 |
++++ b/include/linux/compiler-clang.h |
638 |
+@@ -15,3 +15,17 @@ |
639 |
+ * with any version that can compile the kernel |
640 |
+ */ |
641 |
+ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) |
642 |
++ |
643 |
++/* |
644 |
++ * Not all versions of clang implement the the type-generic versions |
645 |
++ * of the builtin overflow checkers. Fortunately, clang implements |
646 |
++ * __has_builtin allowing us to avoid awkward version |
647 |
++ * checks. Unfortunately, we don't know which version of gcc clang |
648 |
++ * pretends to be, so the macro may or may not be defined. |
649 |
++ */ |
650 |
++#undef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW |
651 |
++#if __has_builtin(__builtin_mul_overflow) && \ |
652 |
++ __has_builtin(__builtin_add_overflow) && \ |
653 |
++ __has_builtin(__builtin_sub_overflow) |
654 |
++#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 |
655 |
++#endif |
656 |
+diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h |
657 |
+index 9485abe76b687..bce8a8f5b562c 100644 |
658 |
+--- a/include/linux/compiler-gcc.h |
659 |
++++ b/include/linux/compiler-gcc.h |
660 |
+@@ -321,3 +321,7 @@ |
661 |
+ * code |
662 |
+ */ |
663 |
+ #define uninitialized_var(x) x = x |
664 |
++ |
665 |
++#if GCC_VERSION >= 50100 |
666 |
++#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 |
667 |
++#endif |
668 |
+diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h |
669 |
+index d4c71132d07f0..8c9897b1b9537 100644 |
670 |
+--- a/include/linux/compiler-intel.h |
671 |
++++ b/include/linux/compiler-intel.h |
672 |
+@@ -43,3 +43,7 @@ |
673 |
+ #define __builtin_bswap16 _bswap16 |
674 |
+ #endif |
675 |
+ |
676 |
++/* |
677 |
++ * icc defines __GNUC__, but does not implement the builtin overflow checkers. |
678 |
++ */ |
679 |
++#undef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW |
680 |
+diff --git a/include/linux/overflow.h b/include/linux/overflow.h |
681 |
+new file mode 100644 |
682 |
+index 0000000000000..8712ff70995f4 |
683 |
+--- /dev/null |
684 |
++++ b/include/linux/overflow.h |
685 |
+@@ -0,0 +1,278 @@ |
686 |
++/* SPDX-License-Identifier: GPL-2.0 OR MIT */ |
687 |
++#ifndef __LINUX_OVERFLOW_H |
688 |
++#define __LINUX_OVERFLOW_H |
689 |
++ |
690 |
++#include <linux/compiler.h> |
691 |
++ |
692 |
++/* |
693 |
++ * In the fallback code below, we need to compute the minimum and |
694 |
++ * maximum values representable in a given type. These macros may also |
695 |
++ * be useful elsewhere, so we provide them outside the |
696 |
++ * COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW block. |
697 |
++ * |
698 |
++ * It would seem more obvious to do something like |
699 |
++ * |
700 |
++ * #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0) |
701 |
++ * #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0) |
702 |
++ * |
703 |
++ * Unfortunately, the middle expressions, strictly speaking, have |
704 |
++ * undefined behaviour, and at least some versions of gcc warn about |
705 |
++ * the type_max expression (but not if -fsanitize=undefined is in |
706 |
++ * effect; in that case, the warning is deferred to runtime...). |
707 |
++ * |
708 |
++ * The slightly excessive casting in type_min is to make sure the |
709 |
++ * macros also produce sensible values for the exotic type _Bool. [The |
710 |
++ * overflow checkers only almost work for _Bool, but that's |
711 |
++ * a-feature-not-a-bug, since people shouldn't be doing arithmetic on |
712 |
++ * _Bools. Besides, the gcc builtins don't allow _Bool* as third |
713 |
++ * argument.] |
714 |
++ * |
715 |
++ * Idea stolen from |
716 |
++ * https://mail-index.netbsd.org/tech-misc/2007/02/05/0000.html - |
717 |
++ * credit to Christian Biere. |
718 |
++ */ |
719 |
++#define is_signed_type(type) (((type)(-1)) < (type)1) |
720 |
++#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) |
721 |
++#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) |
722 |
++#define type_min(T) ((T)((T)-type_max(T)-(T)1)) |
723 |
++ |
724 |
++ |
725 |
++#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW |
726 |
++/* |
727 |
++ * For simplicity and code hygiene, the fallback code below insists on |
728 |
++ * a, b and *d having the same type (similar to the min() and max() |
729 |
++ * macros), whereas gcc's type-generic overflow checkers accept |
730 |
++ * different types. Hence we don't just make check_add_overflow an |
731 |
++ * alias for __builtin_add_overflow, but add type checks similar to |
732 |
++ * below. |
733 |
++ */ |
734 |
++#define check_add_overflow(a, b, d) ({ \ |
735 |
++ typeof(a) __a = (a); \ |
736 |
++ typeof(b) __b = (b); \ |
737 |
++ typeof(d) __d = (d); \ |
738 |
++ (void) (&__a == &__b); \ |
739 |
++ (void) (&__a == __d); \ |
740 |
++ __builtin_add_overflow(__a, __b, __d); \ |
741 |
++}) |
742 |
++ |
743 |
++#define check_sub_overflow(a, b, d) ({ \ |
744 |
++ typeof(a) __a = (a); \ |
745 |
++ typeof(b) __b = (b); \ |
746 |
++ typeof(d) __d = (d); \ |
747 |
++ (void) (&__a == &__b); \ |
748 |
++ (void) (&__a == __d); \ |
749 |
++ __builtin_sub_overflow(__a, __b, __d); \ |
750 |
++}) |
751 |
++ |
752 |
++#define check_mul_overflow(a, b, d) ({ \ |
753 |
++ typeof(a) __a = (a); \ |
754 |
++ typeof(b) __b = (b); \ |
755 |
++ typeof(d) __d = (d); \ |
756 |
++ (void) (&__a == &__b); \ |
757 |
++ (void) (&__a == __d); \ |
758 |
++ __builtin_mul_overflow(__a, __b, __d); \ |
759 |
++}) |
760 |
++ |
761 |
++#else |
762 |
++ |
763 |
++ |
764 |
++/* Checking for unsigned overflow is relatively easy without causing UB. */ |
765 |
++#define __unsigned_add_overflow(a, b, d) ({ \ |
766 |
++ typeof(a) __a = (a); \ |
767 |
++ typeof(b) __b = (b); \ |
768 |
++ typeof(d) __d = (d); \ |
769 |
++ (void) (&__a == &__b); \ |
770 |
++ (void) (&__a == __d); \ |
771 |
++ *__d = __a + __b; \ |
772 |
++ *__d < __a; \ |
773 |
++}) |
774 |
++#define __unsigned_sub_overflow(a, b, d) ({ \ |
775 |
++ typeof(a) __a = (a); \ |
776 |
++ typeof(b) __b = (b); \ |
777 |
++ typeof(d) __d = (d); \ |
778 |
++ (void) (&__a == &__b); \ |
779 |
++ (void) (&__a == __d); \ |
780 |
++ *__d = __a - __b; \ |
781 |
++ __a < __b; \ |
782 |
++}) |
783 |
++/* |
784 |
++ * If one of a or b is a compile-time constant, this avoids a division. |
785 |
++ */ |
786 |
++#define __unsigned_mul_overflow(a, b, d) ({ \ |
787 |
++ typeof(a) __a = (a); \ |
788 |
++ typeof(b) __b = (b); \ |
789 |
++ typeof(d) __d = (d); \ |
790 |
++ (void) (&__a == &__b); \ |
791 |
++ (void) (&__a == __d); \ |
792 |
++ *__d = __a * __b; \ |
793 |
++ __builtin_constant_p(__b) ? \ |
794 |
++ __b > 0 && __a > type_max(typeof(__a)) / __b : \ |
795 |
++ __a > 0 && __b > type_max(typeof(__b)) / __a; \ |
796 |
++}) |
797 |
++ |
798 |
++/* |
799 |
++ * For signed types, detecting overflow is much harder, especially if |
800 |
++ * we want to avoid UB. But the interface of these macros is such that |
801 |
++ * we must provide a result in *d, and in fact we must produce the |
802 |
++ * result promised by gcc's builtins, which is simply the possibly |
803 |
++ * wrapped-around value. Fortunately, we can just formally do the |
804 |
++ * operations in the widest relevant unsigned type (u64) and then |
805 |
++ * truncate the result - gcc is smart enough to generate the same code |
806 |
++ * with and without the (u64) casts. |
807 |
++ */ |
808 |
++ |
809 |
++/* |
810 |
++ * Adding two signed integers can overflow only if they have the same |
811 |
++ * sign, and overflow has happened iff the result has the opposite |
812 |
++ * sign. |
813 |
++ */ |
814 |
++#define __signed_add_overflow(a, b, d) ({ \ |
815 |
++ typeof(a) __a = (a); \ |
816 |
++ typeof(b) __b = (b); \ |
817 |
++ typeof(d) __d = (d); \ |
818 |
++ (void) (&__a == &__b); \ |
819 |
++ (void) (&__a == __d); \ |
820 |
++ *__d = (u64)__a + (u64)__b; \ |
821 |
++ (((~(__a ^ __b)) & (*__d ^ __a)) \ |
822 |
++ & type_min(typeof(__a))) != 0; \ |
823 |
++}) |
824 |
++ |
825 |
++/* |
826 |
++ * Subtraction is similar, except that overflow can now happen only |
827 |
++ * when the signs are opposite. In this case, overflow has happened if |
828 |
++ * the result has the opposite sign of a. |
829 |
++ */ |
830 |
++#define __signed_sub_overflow(a, b, d) ({ \ |
831 |
++ typeof(a) __a = (a); \ |
832 |
++ typeof(b) __b = (b); \ |
833 |
++ typeof(d) __d = (d); \ |
834 |
++ (void) (&__a == &__b); \ |
835 |
++ (void) (&__a == __d); \ |
836 |
++ *__d = (u64)__a - (u64)__b; \ |
837 |
++ ((((__a ^ __b)) & (*__d ^ __a)) \ |
838 |
++ & type_min(typeof(__a))) != 0; \ |
839 |
++}) |
840 |
++ |
841 |
++/* |
842 |
++ * Signed multiplication is rather hard. gcc always follows C99, so |
843 |
++ * division is truncated towards 0. This means that we can write the |
844 |
++ * overflow check like this: |
845 |
++ * |
846 |
++ * (a > 0 && (b > MAX/a || b < MIN/a)) || |
847 |
++ * (a < -1 && (b > MIN/a || b < MAX/a) || |
848 |
++ * (a == -1 && b == MIN) |
849 |
++ * |
850 |
++ * The redundant casts of -1 are to silence an annoying -Wtype-limits |
851 |
++ * (included in -Wextra) warning: When the type is u8 or u16, the |
852 |
++ * __b_c_e in check_mul_overflow obviously selects |
853 |
++ * __unsigned_mul_overflow, but unfortunately gcc still parses this |
854 |
++ * code and warns about the limited range of __b. |
855 |
++ */ |
856 |
++ |
857 |
++#define __signed_mul_overflow(a, b, d) ({ \ |
858 |
++ typeof(a) __a = (a); \ |
859 |
++ typeof(b) __b = (b); \ |
860 |
++ typeof(d) __d = (d); \ |
861 |
++ typeof(a) __tmax = type_max(typeof(a)); \ |
862 |
++ typeof(a) __tmin = type_min(typeof(a)); \ |
863 |
++ (void) (&__a == &__b); \ |
864 |
++ (void) (&__a == __d); \ |
865 |
++ *__d = (u64)__a * (u64)__b; \ |
866 |
++ (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ |
867 |
++ (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ |
868 |
++ (__b == (typeof(__b))-1 && __a == __tmin); \ |
869 |
++}) |
870 |
++ |
871 |
++ |
872 |
++#define check_add_overflow(a, b, d) \ |
873 |
++ __builtin_choose_expr(is_signed_type(typeof(a)), \ |
874 |
++ __signed_add_overflow(a, b, d), \ |
875 |
++ __unsigned_add_overflow(a, b, d)) |
876 |
++ |
877 |
++#define check_sub_overflow(a, b, d) \ |
878 |
++ __builtin_choose_expr(is_signed_type(typeof(a)), \ |
879 |
++ __signed_sub_overflow(a, b, d), \ |
880 |
++ __unsigned_sub_overflow(a, b, d)) |
881 |
++ |
882 |
++#define check_mul_overflow(a, b, d) \ |
883 |
++ __builtin_choose_expr(is_signed_type(typeof(a)), \ |
884 |
++ __signed_mul_overflow(a, b, d), \ |
885 |
++ __unsigned_mul_overflow(a, b, d)) |
886 |
++ |
887 |
++ |
888 |
++#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */ |
889 |
++ |
890 |
++/** |
891 |
++ * array_size() - Calculate size of 2-dimensional array. |
892 |
++ * |
893 |
++ * @a: dimension one |
894 |
++ * @b: dimension two |
895 |
++ * |
896 |
++ * Calculates size of 2-dimensional array: @a * @b. |
897 |
++ * |
898 |
++ * Returns: number of bytes needed to represent the array or SIZE_MAX on |
899 |
++ * overflow. |
900 |
++ */ |
901 |
++static inline __must_check size_t array_size(size_t a, size_t b) |
902 |
++{ |
903 |
++ size_t bytes; |
904 |
++ |
905 |
++ if (check_mul_overflow(a, b, &bytes)) |
906 |
++ return SIZE_MAX; |
907 |
++ |
908 |
++ return bytes; |
909 |
++} |
910 |
++ |
911 |
++/** |
912 |
++ * array3_size() - Calculate size of 3-dimensional array. |
913 |
++ * |
914 |
++ * @a: dimension one |
915 |
++ * @b: dimension two |
916 |
++ * @c: dimension three |
917 |
++ * |
918 |
++ * Calculates size of 3-dimensional array: @a * @b * @c. |
919 |
++ * |
920 |
++ * Returns: number of bytes needed to represent the array or SIZE_MAX on |
921 |
++ * overflow. |
922 |
++ */ |
923 |
++static inline __must_check size_t array3_size(size_t a, size_t b, size_t c) |
924 |
++{ |
925 |
++ size_t bytes; |
926 |
++ |
927 |
++ if (check_mul_overflow(a, b, &bytes)) |
928 |
++ return SIZE_MAX; |
929 |
++ if (check_mul_overflow(bytes, c, &bytes)) |
930 |
++ return SIZE_MAX; |
931 |
++ |
932 |
++ return bytes; |
933 |
++} |
934 |
++ |
935 |
++static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c) |
936 |
++{ |
937 |
++ size_t bytes; |
938 |
++ |
939 |
++ if (check_mul_overflow(n, size, &bytes)) |
940 |
++ return SIZE_MAX; |
941 |
++ if (check_add_overflow(bytes, c, &bytes)) |
942 |
++ return SIZE_MAX; |
943 |
++ |
944 |
++ return bytes; |
945 |
++} |
946 |
++ |
947 |
++/** |
948 |
++ * struct_size() - Calculate size of structure with trailing array. |
949 |
++ * @p: Pointer to the structure. |
950 |
++ * @member: Name of the array member. |
951 |
++ * @n: Number of elements in the array. |
952 |
++ * |
953 |
++ * Calculates size of memory needed for structure @p followed by an |
954 |
++ * array of @n @member elements. |
955 |
++ * |
956 |
++ * Return: number of bytes needed or SIZE_MAX on overflow. |
957 |
++ */ |
958 |
++#define struct_size(p, member, n) \ |
959 |
++ __ab_c_size(n, \ |
960 |
++ sizeof(*(p)->member) + __must_be_array((p)->member),\ |
961 |
++ sizeof(*(p))) |
962 |
++ |
963 |
++#endif /* __LINUX_OVERFLOW_H */ |
964 |
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
965 |
+index 40d33431bc585..17997902d3167 100644 |
966 |
+--- a/net/core/neighbour.c |
967 |
++++ b/net/core/neighbour.c |
968 |
+@@ -1234,7 +1234,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, |
969 |
+ * we can reinject the packet there. |
970 |
+ */ |
971 |
+ n2 = NULL; |
972 |
+- if (dst) { |
973 |
++ if (dst && dst->obsolete != DST_OBSOLETE_DEAD) { |
974 |
+ n2 = dst_neigh_lookup_skb(dst, skb); |
975 |
+ if (n2) |
976 |
+ n1 = n2; |
977 |
+diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c |
978 |
+index c23c08f49c3c3..b2ff2f7329c39 100644 |
979 |
+--- a/net/ieee802154/nl802154.c |
980 |
++++ b/net/ieee802154/nl802154.c |
981 |
+@@ -1481,6 +1481,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb) |
982 |
+ if (err) |
983 |
+ return err; |
984 |
+ |
985 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { |
986 |
++ err = skb->len; |
987 |
++ goto out_err; |
988 |
++ } |
989 |
++ |
990 |
+ if (!wpan_dev->netdev) { |
991 |
+ err = -EINVAL; |
992 |
+ goto out_err; |
993 |
+@@ -1653,6 +1658,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb) |
994 |
+ if (err) |
995 |
+ return err; |
996 |
+ |
997 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { |
998 |
++ err = skb->len; |
999 |
++ goto out_err; |
1000 |
++ } |
1001 |
++ |
1002 |
+ if (!wpan_dev->netdev) { |
1003 |
+ err = -EINVAL; |
1004 |
+ goto out_err; |
1005 |
+@@ -1740,6 +1750,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info) |
1006 |
+ struct wpan_dev *wpan_dev = dev->ieee802154_ptr; |
1007 |
+ struct ieee802154_llsec_device dev_desc; |
1008 |
+ |
1009 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) |
1010 |
++ return -EOPNOTSUPP; |
1011 |
++ |
1012 |
+ if (ieee802154_llsec_parse_device(info->attrs[NL802154_ATTR_SEC_DEVICE], |
1013 |
+ &dev_desc) < 0) |
1014 |
+ return -EINVAL; |
1015 |
+@@ -1826,6 +1839,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb) |
1016 |
+ if (err) |
1017 |
+ return err; |
1018 |
+ |
1019 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { |
1020 |
++ err = skb->len; |
1021 |
++ goto out_err; |
1022 |
++ } |
1023 |
++ |
1024 |
+ if (!wpan_dev->netdev) { |
1025 |
+ err = -EINVAL; |
1026 |
+ goto out_err; |
1027 |
+@@ -1883,6 +1901,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info |
1028 |
+ struct ieee802154_llsec_device_key key; |
1029 |
+ __le64 extended_addr; |
1030 |
+ |
1031 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) |
1032 |
++ return -EOPNOTSUPP; |
1033 |
++ |
1034 |
+ if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || |
1035 |
+ nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX, |
1036 |
+ info->attrs[NL802154_ATTR_SEC_DEVKEY], |
1037 |
+@@ -1992,6 +2013,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb) |
1038 |
+ if (err) |
1039 |
+ return err; |
1040 |
+ |
1041 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { |
1042 |
++ err = skb->len; |
1043 |
++ goto out_err; |
1044 |
++ } |
1045 |
++ |
1046 |
+ if (!wpan_dev->netdev) { |
1047 |
+ err = -EINVAL; |
1048 |
+ goto out_err; |
1049 |
+@@ -2077,6 +2103,9 @@ static int nl802154_add_llsec_seclevel(struct sk_buff *skb, |
1050 |
+ struct wpan_dev *wpan_dev = dev->ieee802154_ptr; |
1051 |
+ struct ieee802154_llsec_seclevel sl; |
1052 |
+ |
1053 |
++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) |
1054 |
++ return -EOPNOTSUPP; |
1055 |
++ |
1056 |
+ if (llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], |
1057 |
+ &sl) < 0) |
1058 |
+ return -EINVAL; |
1059 |
+diff --git a/net/sctp/socket.c b/net/sctp/socket.c |
1060 |
+index 62ba9a49c1265..405dc1863b30c 100644 |
1061 |
+--- a/net/sctp/socket.c |
1062 |
++++ b/net/sctp/socket.c |
1063 |
+@@ -1567,11 +1567,9 @@ static void sctp_close(struct sock *sk, long timeout) |
1064 |
+ |
1065 |
+ /* Supposedly, no process has access to the socket, but |
1066 |
+ * the net layers still may. |
1067 |
+- * Also, sctp_destroy_sock() needs to be called with addr_wq_lock |
1068 |
+- * held and that should be grabbed before socket lock. |
1069 |
+ */ |
1070 |
+- spin_lock_bh(&net->sctp.addr_wq_lock); |
1071 |
+- bh_lock_sock_nested(sk); |
1072 |
++ local_bh_disable(); |
1073 |
++ bh_lock_sock(sk); |
1074 |
+ |
1075 |
+ /* Hold the sock, since sk_common_release() will put sock_put() |
1076 |
+ * and we have just a little more cleanup. |
1077 |
+@@ -1580,7 +1578,7 @@ static void sctp_close(struct sock *sk, long timeout) |
1078 |
+ sk_common_release(sk); |
1079 |
+ |
1080 |
+ bh_unlock_sock(sk); |
1081 |
+- spin_unlock_bh(&net->sctp.addr_wq_lock); |
1082 |
++ local_bh_enable(); |
1083 |
+ |
1084 |
+ sock_put(sk); |
1085 |
+ |
1086 |
+@@ -4161,9 +4159,6 @@ static int sctp_init_sock(struct sock *sk) |
1087 |
+ sk_sockets_allocated_inc(sk); |
1088 |
+ sock_prot_inuse_add(net, sk->sk_prot, 1); |
1089 |
+ |
1090 |
+- /* Nothing can fail after this block, otherwise |
1091 |
+- * sctp_destroy_sock() will be called without addr_wq_lock held |
1092 |
+- */ |
1093 |
+ if (net->sctp.default_auto_asconf) { |
1094 |
+ spin_lock(&sock_net(sk)->sctp.addr_wq_lock); |
1095 |
+ list_add_tail(&sp->auto_asconf_list, |
1096 |
+@@ -4198,7 +4193,9 @@ static void sctp_destroy_sock(struct sock *sk) |
1097 |
+ |
1098 |
+ if (sp->do_auto_asconf) { |
1099 |
+ sp->do_auto_asconf = 0; |
1100 |
++ spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock); |
1101 |
+ list_del(&sp->auto_asconf_list); |
1102 |
++ spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock); |
1103 |
+ } |
1104 |
+ sctp_endpoint_free(sp->ep); |
1105 |
+ local_bh_disable(); |
1106 |
+diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c |
1107 |
+index 40075b9afb792..fad711a3f4b42 100644 |
1108 |
+--- a/sound/soc/fsl/fsl_esai.c |
1109 |
++++ b/sound/soc/fsl/fsl_esai.c |
1110 |
+@@ -488,11 +488,13 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream, |
1111 |
+ ESAI_SAICR_SYNC, esai_priv->synchronous ? |
1112 |
+ ESAI_SAICR_SYNC : 0); |
1113 |
+ |
1114 |
+- /* Set a default slot number -- 2 */ |
1115 |
++ /* Set slots count */ |
1116 |
+ regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR, |
1117 |
+- ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2)); |
1118 |
++ ESAI_xCCR_xDC_MASK, |
1119 |
++ ESAI_xCCR_xDC(esai_priv->slots)); |
1120 |
+ regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR, |
1121 |
+- ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2)); |
1122 |
++ ESAI_xCCR_xDC_MASK, |
1123 |
++ ESAI_xCCR_xDC(esai_priv->slots)); |
1124 |
+ } |
1125 |
+ |
1126 |
+ return 0; |
1127 |
+diff --git a/tools/arch/ia64/include/asm/barrier.h b/tools/arch/ia64/include/asm/barrier.h |
1128 |
+index e4422b4b634e6..94ae4a333a35f 100644 |
1129 |
+--- a/tools/arch/ia64/include/asm/barrier.h |
1130 |
++++ b/tools/arch/ia64/include/asm/barrier.h |
1131 |
+@@ -38,9 +38,6 @@ |
1132 |
+ * sequential memory pages only. |
1133 |
+ */ |
1134 |
+ |
1135 |
+-/* XXX From arch/ia64/include/uapi/asm/gcc_intrin.h */ |
1136 |
+-#define ia64_mf() asm volatile ("mf" ::: "memory") |
1137 |
+- |
1138 |
+ #define mb() ia64_mf() |
1139 |
+ #define rmb() mb() |
1140 |
+ #define wmb() mb() |