Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Wed, 28 Apr 2021 11:31:49
Message-Id: 1619609492.98785a39927138ac5e8dd3d64bd6f9a1717c552e.alicef@gentoo
1 commit: 98785a39927138ac5e8dd3d64bd6f9a1717c552e
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 28 11:31:17 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 28 11:31:32 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=98785a39
7
8 linux patch 4.14.232
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1231_linux-4.14.232.patch | 1268 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1272 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 8c683a8..1317cfd 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -967,6 +967,10 @@ Patch: 1230_linux-4.14.231.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.231
23
24 +Patch: 1231_linux-4.14.232.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.232
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/1231_linux-4.14.232.patch b/1231_linux-4.14.232.patch
33 new file mode 100644
34 index 0000000..cee6d41
35 --- /dev/null
36 +++ b/1231_linux-4.14.232.patch
37 @@ -0,0 +1,1268 @@
38 +diff --git a/Makefile b/Makefile
39 +index cee830aea284c..52dcd6596184b 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 231
47 ++SUBLEVEL = 232
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
52 +index 48685445002e7..da243420bcb58 100644
53 +--- a/arch/arc/kernel/signal.c
54 ++++ b/arch/arc/kernel/signal.c
55 +@@ -99,7 +99,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
56 + sizeof(sf->uc.uc_mcontext.regs.scratch));
57 + err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
58 +
59 +- return err;
60 ++ return err ? -EFAULT : 0;
61 + }
62 +
63 + static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
64 +@@ -113,7 +113,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
65 + &(sf->uc.uc_mcontext.regs.scratch),
66 + sizeof(sf->uc.uc_mcontext.regs.scratch));
67 + if (err)
68 +- return err;
69 ++ return -EFAULT;
70 +
71 + set_current_blocked(&set);
72 + regs->bta = uregs.scratch.bta;
73 +diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
74 +index bdaf30c8c4057..21eef1679d086 100644
75 +--- a/arch/arm/boot/dts/omap3.dtsi
76 ++++ b/arch/arm/boot/dts/omap3.dtsi
77 +@@ -23,6 +23,9 @@
78 + i2c0 = &i2c1;
79 + i2c1 = &i2c2;
80 + i2c2 = &i2c3;
81 ++ mmc0 = &mmc1;
82 ++ mmc1 = &mmc2;
83 ++ mmc2 = &mmc3;
84 + serial0 = &uart1;
85 + serial1 = &uart2;
86 + serial2 = &uart3;
87 +diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
88 +index 28d10abd8b047..09129365c0e10 100644
89 +--- a/arch/arm/boot/dts/omap4.dtsi
90 ++++ b/arch/arm/boot/dts/omap4.dtsi
91 +@@ -22,6 +22,11 @@
92 + i2c1 = &i2c2;
93 + i2c2 = &i2c3;
94 + i2c3 = &i2c4;
95 ++ mmc0 = &mmc1;
96 ++ mmc1 = &mmc2;
97 ++ mmc2 = &mmc3;
98 ++ mmc3 = &mmc4;
99 ++ mmc4 = &mmc5;
100 + serial0 = &uart1;
101 + serial1 = &uart2;
102 + serial2 = &uart3;
103 +diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
104 +index bc3f53c79e9da..9786baf7f9c44 100644
105 +--- a/arch/arm/boot/dts/omap5.dtsi
106 ++++ b/arch/arm/boot/dts/omap5.dtsi
107 +@@ -25,6 +25,11 @@
108 + i2c2 = &i2c3;
109 + i2c3 = &i2c4;
110 + i2c4 = &i2c5;
111 ++ mmc0 = &mmc1;
112 ++ mmc1 = &mmc2;
113 ++ mmc2 = &mmc3;
114 ++ mmc3 = &mmc4;
115 ++ mmc4 = &mmc5;
116 + serial0 = &uart1;
117 + serial1 = &uart2;
118 + serial2 = &uart3;
119 +diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c
120 +index 0b2fd7e2e9b42..90b1e9be430e9 100644
121 +--- a/arch/arm/mach-footbridge/cats-pci.c
122 ++++ b/arch/arm/mach-footbridge/cats-pci.c
123 +@@ -15,14 +15,14 @@
124 + #include <asm/mach-types.h>
125 +
126 + /* cats host-specific stuff */
127 +-static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
128 ++static int irqmap_cats[] = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
129 +
130 + static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin)
131 + {
132 + return 0;
133 + }
134 +
135 +-static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
136 ++static int cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
137 + {
138 + if (dev->irq >= 255)
139 + return -1; /* not a valid interrupt. */
140 +diff --git a/arch/arm/mach-footbridge/ebsa285-pci.c b/arch/arm/mach-footbridge/ebsa285-pci.c
141 +index 6f28aaa9ca79b..c3f280d08fa7f 100644
142 +--- a/arch/arm/mach-footbridge/ebsa285-pci.c
143 ++++ b/arch/arm/mach-footbridge/ebsa285-pci.c
144 +@@ -14,9 +14,9 @@
145 + #include <asm/mach/pci.h>
146 + #include <asm/mach-types.h>
147 +
148 +-static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
149 ++static int irqmap_ebsa285[] = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
150 +
151 +-static int __init ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
152 ++static int ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
153 + {
154 + if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
155 + dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
156 +diff --git a/arch/arm/mach-footbridge/netwinder-pci.c b/arch/arm/mach-footbridge/netwinder-pci.c
157 +index 9473aa0305e5f..e8304392074b8 100644
158 +--- a/arch/arm/mach-footbridge/netwinder-pci.c
159 ++++ b/arch/arm/mach-footbridge/netwinder-pci.c
160 +@@ -18,7 +18,7 @@
161 + * We now use the slot ID instead of the device identifiers to select
162 + * which interrupt is routed where.
163 + */
164 +-static int __init netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
165 ++static int netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
166 + {
167 + switch (slot) {
168 + case 0: /* host bridge */
169 +diff --git a/arch/arm/mach-footbridge/personal-pci.c b/arch/arm/mach-footbridge/personal-pci.c
170 +index 4391e433a4b2f..9d19aa98a663e 100644
171 +--- a/arch/arm/mach-footbridge/personal-pci.c
172 ++++ b/arch/arm/mach-footbridge/personal-pci.c
173 +@@ -14,13 +14,12 @@
174 + #include <asm/mach/pci.h>
175 + #include <asm/mach-types.h>
176 +
177 +-static int irqmap_personal_server[] __initdata = {
178 ++static int irqmap_personal_server[] = {
179 + IRQ_IN0, IRQ_IN1, IRQ_IN2, IRQ_IN3, 0, 0, 0,
180 + IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI
181 + };
182 +
183 +-static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot,
184 +- u8 pin)
185 ++static int personal_server_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
186 + {
187 + unsigned char line;
188 +
189 +diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
190 +index 84613abf35a33..79ff5b9534313 100644
191 +--- a/arch/arm/mach-keystone/keystone.c
192 ++++ b/arch/arm/mach-keystone/keystone.c
193 +@@ -65,7 +65,7 @@ static void __init keystone_init(void)
194 + static long long __init keystone_pv_fixup(void)
195 + {
196 + long long offset;
197 +- phys_addr_t mem_start, mem_end;
198 ++ u64 mem_start, mem_end;
199 +
200 + mem_start = memblock_start_of_DRAM();
201 + mem_end = memblock_end_of_DRAM();
202 +@@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void)
203 + if (mem_start < KEYSTONE_HIGH_PHYS_START ||
204 + mem_end > KEYSTONE_HIGH_PHYS_END) {
205 + pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
206 +- (u64)mem_start, (u64)mem_end);
207 ++ mem_start, mem_end);
208 + return 0;
209 + }
210 +
211 +diff --git a/arch/arm/probes/uprobes/core.c b/arch/arm/probes/uprobes/core.c
212 +index d1329f1ba4e4c..b97230704b744 100644
213 +--- a/arch/arm/probes/uprobes/core.c
214 ++++ b/arch/arm/probes/uprobes/core.c
215 +@@ -207,7 +207,7 @@ unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
216 + static struct undef_hook uprobes_arm_break_hook = {
217 + .instr_mask = 0x0fffffff,
218 + .instr_val = (UPROBE_SWBP_ARM_INSN & 0x0fffffff),
219 +- .cpsr_mask = MODE_MASK,
220 ++ .cpsr_mask = (PSR_T_BIT | MODE_MASK),
221 + .cpsr_val = USR_MODE,
222 + .fn = uprobe_trap_handler,
223 + };
224 +@@ -215,7 +215,7 @@ static struct undef_hook uprobes_arm_break_hook = {
225 + static struct undef_hook uprobes_arm_ss_hook = {
226 + .instr_mask = 0x0fffffff,
227 + .instr_val = (UPROBE_SS_ARM_INSN & 0x0fffffff),
228 +- .cpsr_mask = MODE_MASK,
229 ++ .cpsr_mask = (PSR_T_BIT | MODE_MASK),
230 + .cpsr_val = USR_MODE,
231 + .fn = uprobe_trap_handler,
232 + };
233 +diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
234 +index 3abb2dacb43f4..ad986cfa592da 100644
235 +--- a/arch/arm64/include/asm/alternative.h
236 ++++ b/arch/arm64/include/asm/alternative.h
237 +@@ -114,9 +114,9 @@ void apply_alternatives(void *start, size_t length);
238 + .popsection
239 + .subsection 1
240 + 663: \insn2
241 +-664: .previous
242 +- .org . - (664b-663b) + (662b-661b)
243 ++664: .org . - (664b-663b) + (662b-661b)
244 + .org . - (662b-661b) + (664b-663b)
245 ++ .previous
246 + .endif
247 + .endm
248 +
249 +@@ -186,11 +186,11 @@ void apply_alternatives(void *start, size_t length);
250 + */
251 + .macro alternative_endif
252 + 664:
253 ++ .org . - (664b-663b) + (662b-661b)
254 ++ .org . - (662b-661b) + (664b-663b)
255 + .if .Lasm_alt_mode==0
256 + .previous
257 + .endif
258 +- .org . - (664b-663b) + (662b-661b)
259 +- .org . - (662b-661b) + (664b-663b)
260 + .endm
261 +
262 + /*
263 +diff --git a/arch/arm64/include/asm/word-at-a-time.h b/arch/arm64/include/asm/word-at-a-time.h
264 +index b0d708ff7f4e5..a2601c1ccf435 100644
265 +--- a/arch/arm64/include/asm/word-at-a-time.h
266 ++++ b/arch/arm64/include/asm/word-at-a-time.h
267 +@@ -64,7 +64,7 @@ static inline unsigned long find_zero(unsigned long mask)
268 + */
269 + static inline unsigned long load_unaligned_zeropad(const void *addr)
270 + {
271 +- unsigned long ret, offset;
272 ++ unsigned long ret, tmp;
273 +
274 + /* Load word from unaligned pointer addr */
275 + asm(
276 +@@ -72,9 +72,9 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
277 + "2:\n"
278 + " .pushsection .fixup,\"ax\"\n"
279 + " .align 2\n"
280 +- "3: and %1, %2, #0x7\n"
281 +- " bic %2, %2, #0x7\n"
282 +- " ldr %0, [%2]\n"
283 ++ "3: bic %1, %2, #0x7\n"
284 ++ " ldr %0, [%1]\n"
285 ++ " and %1, %2, #0x7\n"
286 + " lsl %1, %1, #0x3\n"
287 + #ifndef __AARCH64EB__
288 + " lsr %0, %0, %1\n"
289 +@@ -84,7 +84,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
290 + " b 2b\n"
291 + " .popsection\n"
292 + _ASM_EXTABLE(1b, 3b)
293 +- : "=&r" (ret), "=&r" (offset)
294 ++ : "=&r" (ret), "=&r" (tmp)
295 + : "r" (addr), "Q" (*(unsigned long *)addr));
296 +
297 + return ret;
298 +diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
299 +index 9b2d994cddf68..99b59a7ec187e 100644
300 +--- a/arch/ia64/mm/discontig.c
301 ++++ b/arch/ia64/mm/discontig.c
302 +@@ -100,7 +100,7 @@ static int __init build_node_maps(unsigned long start, unsigned long len,
303 + * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been
304 + * called yet. Note that node 0 will also count all non-existent cpus.
305 + */
306 +-static int __meminit early_nr_cpus_node(int node)
307 ++static int early_nr_cpus_node(int node)
308 + {
309 + int cpu, n = 0;
310 +
311 +@@ -115,7 +115,7 @@ static int __meminit early_nr_cpus_node(int node)
312 + * compute_pernodesize - compute size of pernode data
313 + * @node: the node id.
314 + */
315 +-static unsigned long __meminit compute_pernodesize(int node)
316 ++static unsigned long compute_pernodesize(int node)
317 + {
318 + unsigned long pernodesize = 0, cpus;
319 +
320 +@@ -412,7 +412,7 @@ static void __init reserve_pernode_space(void)
321 + }
322 + }
323 +
324 +-static void __meminit scatter_node_data(void)
325 ++static void scatter_node_data(void)
326 + {
327 + pg_data_t **dst;
328 + int node;
329 +diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
330 +index e928c2af6a10d..dd470f45c4b98 100644
331 +--- a/arch/s390/kernel/entry.S
332 ++++ b/arch/s390/kernel/entry.S
333 +@@ -967,6 +967,7 @@ ENTRY(ext_int_handler)
334 + * Load idle PSW. The second "half" of this function is in .Lcleanup_idle.
335 + */
336 + ENTRY(psw_idle)
337 ++ stg %r14,(__SF_GPRS+8*8)(%r15)
338 + stg %r3,__SF_EMPTY(%r15)
339 + larl %r1,.Lpsw_idle_lpsw+4
340 + stg %r1,__SF_EMPTY+8(%r15)
341 +diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
342 +index 44404e2307bbe..ce5f8e25f70de 100644
343 +--- a/arch/x86/kernel/crash.c
344 ++++ b/arch/x86/kernel/crash.c
345 +@@ -23,6 +23,7 @@
346 + #include <linux/export.h>
347 + #include <linux/slab.h>
348 + #include <linux/vmalloc.h>
349 ++#include <linux/overflow.h>
350 +
351 + #include <asm/processor.h>
352 + #include <asm/hardirq.h>
353 +@@ -565,7 +566,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
354 + struct crash_memmap_data cmd;
355 + struct crash_mem *cmem;
356 +
357 +- cmem = vzalloc(sizeof(struct crash_mem));
358 ++ cmem = vzalloc(struct_size(cmem, ranges, 1));
359 + if (!cmem)
360 + return -ENOMEM;
361 +
362 +diff --git a/drivers/dma/dw/Kconfig b/drivers/dma/dw/Kconfig
363 +index 04b9728c1d269..070860ec0ef1d 100644
364 +--- a/drivers/dma/dw/Kconfig
365 ++++ b/drivers/dma/dw/Kconfig
366 +@@ -8,6 +8,7 @@ config DW_DMAC_CORE
367 +
368 + config DW_DMAC
369 + tristate "Synopsys DesignWare AHB DMA platform driver"
370 ++ depends on HAS_IOMEM
371 + select DW_DMAC_CORE
372 + help
373 + Support the Synopsys DesignWare AHB DMA controller. This
374 +@@ -16,6 +17,7 @@ config DW_DMAC
375 + config DW_DMAC_PCI
376 + tristate "Synopsys DesignWare AHB DMA PCI driver"
377 + depends on PCI
378 ++ depends on HAS_IOMEM
379 + select DW_DMAC_CORE
380 + help
381 + Support the Synopsys DesignWare AHB DMA controller on the
382 +diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
383 +index ed9c0ea5b026e..1bc6ad0339d22 100644
384 +--- a/drivers/hid/hid-alps.c
385 ++++ b/drivers/hid/hid-alps.c
386 +@@ -429,6 +429,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
387 + ret = input_register_device(data->input2);
388 + if (ret) {
389 + input_free_device(input2);
390 ++ ret = -ENOENT;
391 + goto exit;
392 + }
393 + }
394 +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
395 +index 8c0718b3754ec..df89f490e5528 100644
396 +--- a/drivers/hid/wacom_wac.c
397 ++++ b/drivers/hid/wacom_wac.c
398 +@@ -2391,7 +2391,7 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
399 + !wacom_wac->shared->is_touch_on) {
400 + if (!wacom_wac->shared->touch_down)
401 + return;
402 +- prox = 0;
403 ++ prox = false;
404 + }
405 +
406 + wacom_wac->hid_data.num_received++;
407 +@@ -3346,8 +3346,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
408 + {
409 + struct wacom_features *features = &wacom_wac->features;
410 +
411 +- input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
412 +-
413 + if (!(features->device_type & WACOM_DEVICETYPE_PEN))
414 + return -ENODEV;
415 +
416 +@@ -3360,6 +3358,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
417 + /* setup has already been done */
418 + return 0;
419 +
420 ++ input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
421 + __set_bit(BTN_TOUCH, input_dev->keybit);
422 + __set_bit(ABS_MISC, input_dev->absbit);
423 +
424 +@@ -3508,8 +3507,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
425 + {
426 + struct wacom_features *features = &wacom_wac->features;
427 +
428 +- input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
429 +-
430 + if (!(features->device_type & WACOM_DEVICETYPE_TOUCH))
431 + return -ENODEV;
432 +
433 +@@ -3522,6 +3519,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
434 + /* setup has already been done */
435 + return 0;
436 +
437 ++ input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
438 + __set_bit(BTN_TOUCH, input_dev->keybit);
439 +
440 + if (features->touch_max == 1) {
441 +diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c
442 +index c7f26fa3034ca..cf138d836eec6 100644
443 +--- a/drivers/input/keyboard/nspire-keypad.c
444 ++++ b/drivers/input/keyboard/nspire-keypad.c
445 +@@ -96,9 +96,15 @@ static irqreturn_t nspire_keypad_irq(int irq, void *dev_id)
446 + return IRQ_HANDLED;
447 + }
448 +
449 +-static int nspire_keypad_chip_init(struct nspire_keypad *keypad)
450 ++static int nspire_keypad_open(struct input_dev *input)
451 + {
452 ++ struct nspire_keypad *keypad = input_get_drvdata(input);
453 + unsigned long val = 0, cycles_per_us, delay_cycles, row_delay_cycles;
454 ++ int error;
455 ++
456 ++ error = clk_prepare_enable(keypad->clk);
457 ++ if (error)
458 ++ return error;
459 +
460 + cycles_per_us = (clk_get_rate(keypad->clk) / 1000000);
461 + if (cycles_per_us == 0)
462 +@@ -124,30 +130,6 @@ static int nspire_keypad_chip_init(struct nspire_keypad *keypad)
463 + keypad->int_mask = 1 << 1;
464 + writel(keypad->int_mask, keypad->reg_base + KEYPAD_INTMSK);
465 +
466 +- /* Disable GPIO interrupts to prevent hanging on touchpad */
467 +- /* Possibly used to detect touchpad events */
468 +- writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT);
469 +- /* Acknowledge existing interrupts */
470 +- writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS);
471 +-
472 +- return 0;
473 +-}
474 +-
475 +-static int nspire_keypad_open(struct input_dev *input)
476 +-{
477 +- struct nspire_keypad *keypad = input_get_drvdata(input);
478 +- int error;
479 +-
480 +- error = clk_prepare_enable(keypad->clk);
481 +- if (error)
482 +- return error;
483 +-
484 +- error = nspire_keypad_chip_init(keypad);
485 +- if (error) {
486 +- clk_disable_unprepare(keypad->clk);
487 +- return error;
488 +- }
489 +-
490 + return 0;
491 + }
492 +
493 +@@ -155,6 +137,11 @@ static void nspire_keypad_close(struct input_dev *input)
494 + {
495 + struct nspire_keypad *keypad = input_get_drvdata(input);
496 +
497 ++ /* Disable interrupts */
498 ++ writel(0, keypad->reg_base + KEYPAD_INTMSK);
499 ++ /* Acknowledge existing interrupts */
500 ++ writel(~0, keypad->reg_base + KEYPAD_INT);
501 ++
502 + clk_disable_unprepare(keypad->clk);
503 + }
504 +
505 +@@ -215,6 +202,25 @@ static int nspire_keypad_probe(struct platform_device *pdev)
506 + return -ENOMEM;
507 + }
508 +
509 ++ error = clk_prepare_enable(keypad->clk);
510 ++ if (error) {
511 ++ dev_err(&pdev->dev, "failed to enable clock\n");
512 ++ return error;
513 ++ }
514 ++
515 ++ /* Disable interrupts */
516 ++ writel(0, keypad->reg_base + KEYPAD_INTMSK);
517 ++ /* Acknowledge existing interrupts */
518 ++ writel(~0, keypad->reg_base + KEYPAD_INT);
519 ++
520 ++ /* Disable GPIO interrupts to prevent hanging on touchpad */
521 ++ /* Possibly used to detect touchpad events */
522 ++ writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT);
523 ++ /* Acknowledge existing GPIO interrupts */
524 ++ writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS);
525 ++
526 ++ clk_disable_unprepare(keypad->clk);
527 ++
528 + input_set_drvdata(input, keypad);
529 +
530 + input->id.bustype = BUS_HOST;
531 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
532 +index 0463ab79160b7..f20e54f41dde9 100644
533 +--- a/drivers/input/serio/i8042-x86ia64io.h
534 ++++ b/drivers/input/serio/i8042-x86ia64io.h
535 +@@ -592,6 +592,7 @@ static const struct dmi_system_id i8042_dmi_noselftest_table[] = {
536 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
537 + DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
538 + },
539 ++ }, {
540 + .matches = {
541 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
542 + DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
543 +diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
544 +index 7f60d17819cea..073184f15c643 100644
545 +--- a/drivers/net/ethernet/amd/pcnet32.c
546 ++++ b/drivers/net/ethernet/amd/pcnet32.c
547 +@@ -1548,8 +1548,7 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
548 + }
549 + pci_set_master(pdev);
550 +
551 +- ioaddr = pci_resource_start(pdev, 0);
552 +- if (!ioaddr) {
553 ++ if (!pci_resource_len(pdev, 0)) {
554 + if (pcnet32_debug & NETIF_MSG_PROBE)
555 + pr_err("card has no PCI IO resources, aborting\n");
556 + return -ENODEV;
557 +@@ -1561,6 +1560,8 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
558 + pr_err("architecture does not support 32bit PCI busmaster DMA\n");
559 + return err;
560 + }
561 ++
562 ++ ioaddr = pci_resource_start(pdev, 0);
563 + if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
564 + if (pcnet32_debug & NETIF_MSG_PROBE)
565 + pr_err("io address range already allocated\n");
566 +diff --git a/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h b/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h
567 +index b248966837b4c..7aad40b2aa736 100644
568 +--- a/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h
569 ++++ b/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h
570 +@@ -412,7 +412,7 @@
571 + | CN6XXX_INTR_M0UNWI_ERR \
572 + | CN6XXX_INTR_M1UPB0_ERR \
573 + | CN6XXX_INTR_M1UPWI_ERR \
574 +- | CN6XXX_INTR_M1UPB0_ERR \
575 ++ | CN6XXX_INTR_M1UNB0_ERR \
576 + | CN6XXX_INTR_M1UNWI_ERR \
577 + | CN6XXX_INTR_INSTR_DB_OF_ERR \
578 + | CN6XXX_INTR_SLIST_DB_OF_ERR \
579 +diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
580 +index a339ea2fd4961..8b07890b0b232 100644
581 +--- a/drivers/net/ethernet/davicom/dm9000.c
582 ++++ b/drivers/net/ethernet/davicom/dm9000.c
583 +@@ -1482,8 +1482,10 @@ dm9000_probe(struct platform_device *pdev)
584 +
585 + /* Init network device */
586 + ndev = alloc_etherdev(sizeof(struct board_info));
587 +- if (!ndev)
588 +- return -ENOMEM;
589 ++ if (!ndev) {
590 ++ ret = -ENOMEM;
591 ++ goto out_regulator_disable;
592 ++ }
593 +
594 + SET_NETDEV_DEV(ndev, &pdev->dev);
595 +
596 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
597 +index 4771dbee96819..66fddc4ba56b1 100644
598 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
599 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
600 +@@ -891,19 +891,13 @@ static int __ibmvnic_open(struct net_device *netdev)
601 +
602 + rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP);
603 + if (rc) {
604 +- for (i = 0; i < adapter->req_rx_queues; i++)
605 +- napi_disable(&adapter->napi[i]);
606 ++ ibmvnic_napi_disable(adapter);
607 + release_resources(adapter);
608 + return rc;
609 + }
610 +
611 + netif_tx_start_all_queues(netdev);
612 +
613 +- if (prev_state == VNIC_CLOSED) {
614 +- for (i = 0; i < adapter->req_rx_queues; i++)
615 +- napi_schedule(&adapter->napi[i]);
616 +- }
617 +-
618 + adapter->state = VNIC_OPEN;
619 + return rc;
620 + }
621 +@@ -1432,7 +1426,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
622 + struct ibmvnic_rwi *rwi, u32 reset_state)
623 + {
624 + struct net_device *netdev = adapter->netdev;
625 +- int i, rc;
626 ++ int rc;
627 +
628 + netdev_dbg(adapter->netdev, "Re-setting driver (%d)\n",
629 + rwi->reset_reason);
630 +@@ -1497,10 +1491,6 @@ static int do_reset(struct ibmvnic_adapter *adapter,
631 + /* refresh device's multicast list */
632 + ibmvnic_set_multi(netdev);
633 +
634 +- /* kick napi */
635 +- for (i = 0; i < adapter->req_rx_queues; i++)
636 +- napi_schedule(&adapter->napi[i]);
637 +-
638 + if (adapter->reset_reason != VNIC_RESET_FAILOVER)
639 + netdev_notify_peers(netdev);
640 +
641 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
642 +index 3f43e4f0d3b17..e25bb667fb59b 100644
643 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
644 ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
645 +@@ -8941,6 +8941,7 @@ static int i40e_sw_init(struct i40e_pf *pf)
646 + {
647 + int err = 0;
648 + int size;
649 ++ u16 pow;
650 +
651 + /* Set default capability flags */
652 + pf->flags = I40E_FLAG_RX_CSUM_ENABLED |
653 +@@ -8959,6 +8960,11 @@ static int i40e_sw_init(struct i40e_pf *pf)
654 + pf->rss_table_size = pf->hw.func_caps.rss_table_size;
655 + pf->rss_size_max = min_t(int, pf->rss_size_max,
656 + pf->hw.func_caps.num_tx_qp);
657 ++
658 ++ /* find the next higher power-of-2 of num cpus */
659 ++ pow = roundup_pow_of_two(num_online_cpus());
660 ++ pf->rss_size_max = min_t(int, pf->rss_size_max, pow);
661 ++
662 + if (pf->hw.func_caps.rss) {
663 + pf->flags |= I40E_FLAG_RSS_ENABLED;
664 + pf->alloc_rss_size = min_t(int, pf->rss_size_max,
665 +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
666 +index f48006c22a8a6..2a9bb13ecb547 100644
667 +--- a/drivers/net/geneve.c
668 ++++ b/drivers/net/geneve.c
669 +@@ -835,6 +835,9 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
670 + __be16 df;
671 + int err;
672 +
673 ++ if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
674 ++ return -EINVAL;
675 ++
676 + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
677 + rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
678 + geneve->info.key.tp_dst, sport);
679 +@@ -882,6 +885,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
680 + __be16 sport;
681 + int err;
682 +
683 ++ if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
684 ++ return -EINVAL;
685 ++
686 + sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
687 + dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
688 + geneve->info.key.tp_dst, sport);
689 +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
690 +index 0e3d13e192e38..9ae6a1ccfbe18 100644
691 +--- a/drivers/net/usb/hso.c
692 ++++ b/drivers/net/usb/hso.c
693 +@@ -626,7 +626,7 @@ static struct hso_serial *get_serial_by_index(unsigned index)
694 + return serial;
695 + }
696 +
697 +-static int get_free_serial_index(void)
698 ++static int obtain_minor(struct hso_serial *serial)
699 + {
700 + int index;
701 + unsigned long flags;
702 +@@ -634,8 +634,10 @@ static int get_free_serial_index(void)
703 + spin_lock_irqsave(&serial_table_lock, flags);
704 + for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) {
705 + if (serial_table[index] == NULL) {
706 ++ serial_table[index] = serial->parent;
707 ++ serial->minor = index;
708 + spin_unlock_irqrestore(&serial_table_lock, flags);
709 +- return index;
710 ++ return 0;
711 + }
712 + }
713 + spin_unlock_irqrestore(&serial_table_lock, flags);
714 +@@ -644,15 +646,12 @@ static int get_free_serial_index(void)
715 + return -1;
716 + }
717 +
718 +-static void set_serial_by_index(unsigned index, struct hso_serial *serial)
719 ++static void release_minor(struct hso_serial *serial)
720 + {
721 + unsigned long flags;
722 +
723 + spin_lock_irqsave(&serial_table_lock, flags);
724 +- if (serial)
725 +- serial_table[index] = serial->parent;
726 +- else
727 +- serial_table[index] = NULL;
728 ++ serial_table[serial->minor] = NULL;
729 + spin_unlock_irqrestore(&serial_table_lock, flags);
730 + }
731 +
732 +@@ -2241,6 +2240,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev)
733 + static void hso_serial_tty_unregister(struct hso_serial *serial)
734 + {
735 + tty_unregister_device(tty_drv, serial->minor);
736 ++ release_minor(serial);
737 + }
738 +
739 + static void hso_serial_common_free(struct hso_serial *serial)
740 +@@ -2265,25 +2265,23 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
741 + int rx_size, int tx_size)
742 + {
743 + struct device *dev;
744 +- int minor;
745 + int i;
746 +
747 + tty_port_init(&serial->port);
748 +
749 +- minor = get_free_serial_index();
750 +- if (minor < 0)
751 ++ if (obtain_minor(serial))
752 + goto exit2;
753 +
754 + /* register our minor number */
755 + serial->parent->dev = tty_port_register_device_attr(&serial->port,
756 +- tty_drv, minor, &serial->parent->interface->dev,
757 ++ tty_drv, serial->minor, &serial->parent->interface->dev,
758 + serial->parent, hso_serial_dev_groups);
759 +- if (IS_ERR(serial->parent->dev))
760 ++ if (IS_ERR(serial->parent->dev)) {
761 ++ release_minor(serial);
762 + goto exit2;
763 ++ }
764 + dev = serial->parent->dev;
765 +
766 +- /* fill in specific data for later use */
767 +- serial->minor = minor;
768 + serial->magic = HSO_SERIAL_MAGIC;
769 + spin_lock_init(&serial->serial_lock);
770 + serial->num_rx_urbs = num_urbs;
771 +@@ -2676,9 +2674,6 @@ static struct hso_device *hso_create_bulk_serial_device(
772 +
773 + serial->write_data = hso_std_serial_write_data;
774 +
775 +- /* and record this serial */
776 +- set_serial_by_index(serial->minor, serial);
777 +-
778 + /* setup the proc dirs and files if needed */
779 + hso_log_port(hso_dev);
780 +
781 +@@ -2735,9 +2730,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface,
782 + serial->shared_int->ref_count++;
783 + mutex_unlock(&serial->shared_int->shared_int_lock);
784 +
785 +- /* and record this serial */
786 +- set_serial_by_index(serial->minor, serial);
787 +-
788 + /* setup the proc dirs and files if needed */
789 + hso_log_port(hso_dev);
790 +
791 +@@ -3121,8 +3113,7 @@ static void hso_free_interface(struct usb_interface *interface)
792 + cancel_work_sync(&serial_table[i]->async_put_intf);
793 + cancel_work_sync(&serial_table[i]->async_get_intf);
794 + hso_serial_tty_unregister(serial);
795 +- kref_put(&serial_table[i]->ref, hso_serial_ref_free);
796 +- set_serial_by_index(i, NULL);
797 ++ kref_put(&serial->parent->ref, hso_serial_ref_free);
798 + }
799 + }
800 +
801 +diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
802 +index 910322b442bd6..9092b55e087f1 100644
803 +--- a/drivers/net/xen-netback/xenbus.c
804 ++++ b/drivers/net/xen-netback/xenbus.c
805 +@@ -1043,11 +1043,15 @@ static void connect(struct backend_info *be)
806 + xenvif_carrier_on(be->vif);
807 +
808 + unregister_hotplug_status_watch(be);
809 +- err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
810 +- hotplug_status_changed,
811 +- "%s/%s", dev->nodename, "hotplug-status");
812 +- if (!err)
813 ++ if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) {
814 ++ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
815 ++ NULL, hotplug_status_changed,
816 ++ "%s/%s", dev->nodename,
817 ++ "hotplug-status");
818 ++ if (err)
819 ++ goto err;
820 + be->have_hotplug_status_watch = 1;
821 ++ }
822 +
823 + netif_tx_wake_all_queues(be->vif->dev);
824 +
825 +diff --git a/drivers/pinctrl/intel/pinctrl-lewisburg.c b/drivers/pinctrl/intel/pinctrl-lewisburg.c
826 +index c2164db14e9cf..9fdcae3260e85 100644
827 +--- a/drivers/pinctrl/intel/pinctrl-lewisburg.c
828 ++++ b/drivers/pinctrl/intel/pinctrl-lewisburg.c
829 +@@ -300,9 +300,9 @@ static const struct pinctrl_pin_desc lbg_pins[] = {
830 + static const struct intel_community lbg_communities[] = {
831 + LBG_COMMUNITY(0, 0, 71),
832 + LBG_COMMUNITY(1, 72, 132),
833 +- LBG_COMMUNITY(3, 133, 144),
834 +- LBG_COMMUNITY(4, 145, 180),
835 +- LBG_COMMUNITY(5, 181, 246),
836 ++ LBG_COMMUNITY(3, 133, 143),
837 ++ LBG_COMMUNITY(4, 144, 178),
838 ++ LBG_COMMUNITY(5, 179, 246),
839 + };
840 +
841 + static const struct intel_pinctrl_soc_data lbg_soc_data = {
842 +diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
843 +index 470e11b428208..9eb61a41be24f 100644
844 +--- a/drivers/scsi/libsas/sas_ata.c
845 ++++ b/drivers/scsi/libsas/sas_ata.c
846 +@@ -219,18 +219,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
847 + memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
848 + task->total_xfer_len = qc->nbytes;
849 + task->num_scatter = qc->n_elem;
850 ++ task->data_dir = qc->dma_dir;
851 ++ } else if (qc->tf.protocol == ATA_PROT_NODATA) {
852 ++ task->data_dir = DMA_NONE;
853 + } else {
854 + for_each_sg(qc->sg, sg, qc->n_elem, si)
855 + xfer += sg_dma_len(sg);
856 +
857 + task->total_xfer_len = xfer;
858 + task->num_scatter = si;
859 +- }
860 +-
861 +- if (qc->tf.protocol == ATA_PROT_NODATA)
862 +- task->data_dir = DMA_NONE;
863 +- else
864 + task->data_dir = qc->dma_dir;
865 ++ }
866 + task->scatter = qc->sg;
867 + task->ata_task.retry_count = 1;
868 + task->task_state_flags = SAS_TASK_STATE_PENDING;
869 +diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
870 +index a0e35028ebdac..118e764108f74 100644
871 +--- a/drivers/scsi/scsi_transport_srp.c
872 ++++ b/drivers/scsi/scsi_transport_srp.c
873 +@@ -555,7 +555,7 @@ int srp_reconnect_rport(struct srp_rport *rport)
874 + res = mutex_lock_interruptible(&rport->mutex);
875 + if (res)
876 + goto out;
877 +- if (rport->state != SRP_RPORT_FAIL_FAST)
878 ++ if (rport->state != SRP_RPORT_FAIL_FAST && rport->state != SRP_RPORT_LOST)
879 + /*
880 + * sdev state must be SDEV_TRANSPORT_OFFLINE, transition
881 + * to SDEV_BLOCK is illegal. Calling scsi_target_unblock()
882 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
883 +index b2f67d7ace6d8..22a7f67e70e7f 100644
884 +--- a/drivers/usb/class/cdc-acm.c
885 ++++ b/drivers/usb/class/cdc-acm.c
886 +@@ -1696,12 +1696,13 @@ static int acm_resume(struct usb_interface *intf)
887 + struct urb *urb;
888 + int rv = 0;
889 +
890 +- acm_unpoison_urbs(acm);
891 + spin_lock_irq(&acm->write_lock);
892 +
893 + if (--acm->susp_count)
894 + goto out;
895 +
896 ++ acm_unpoison_urbs(acm);
897 ++
898 + if (tty_port_initialized(&acm->port)) {
899 + rv = usb_submit_urb(acm->ctrlurb, GFP_ATOMIC);
900 +
901 +diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
902 +index f44d98eeb36ac..51cc5258b63e5 100644
903 +--- a/drivers/usb/usbip/vudc_sysfs.c
904 ++++ b/drivers/usb/usbip/vudc_sysfs.c
905 +@@ -187,7 +187,7 @@ static ssize_t store_sockfd(struct device *dev,
906 +
907 + udc->ud.tcp_socket = socket;
908 + udc->ud.tcp_rx = tcp_rx;
909 +- udc->ud.tcp_rx = tcp_tx;
910 ++ udc->ud.tcp_tx = tcp_tx;
911 + udc->ud.status = SDEV_ST_USED;
912 +
913 + spin_unlock_irq(&udc->ud.lock);
914 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
915 +index b4ec5a41797b8..83bdae81721d4 100644
916 +--- a/fs/ext4/namei.c
917 ++++ b/fs/ext4/namei.c
918 +@@ -3641,7 +3641,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
919 + ext4_encrypted_inode(new.dir) &&
920 + !fscrypt_has_permitted_context(new.dir, old.inode)) {
921 + retval = -EXDEV;
922 +- goto end_rename;
923 ++ goto release_bh;
924 + }
925 +
926 + new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
927 +diff --git a/fs/readdir.c b/fs/readdir.c
928 +index 0c357663e33a7..e6f4c7b8884bb 100644
929 +--- a/fs/readdir.c
930 ++++ b/fs/readdir.c
931 +@@ -133,6 +133,9 @@ static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
932 +
933 + if (buf->result)
934 + return -EINVAL;
935 ++ buf->result = verify_dirent_name(name, namlen);
936 ++ if (buf->result < 0)
937 ++ return buf->result;
938 + d_ino = ino;
939 + if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
940 + buf->result = -EOVERFLOW;
941 +@@ -392,6 +395,9 @@ static int compat_fillonedir(struct dir_context *ctx, const char *name,
942 +
943 + if (buf->result)
944 + return -EINVAL;
945 ++ buf->result = verify_dirent_name(name, namlen);
946 ++ if (buf->result < 0)
947 ++ return buf->result;
948 + d_ino = ino;
949 + if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
950 + buf->result = -EOVERFLOW;
951 +diff --git a/mm/gup.c b/mm/gup.c
952 +index 12b9626b1a9ed..cfe0a56f8e275 100644
953 +--- a/mm/gup.c
954 ++++ b/mm/gup.c
955 +@@ -61,13 +61,22 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address,
956 + }
957 +
958 + /*
959 +- * FOLL_FORCE can write to even unwritable pte's, but only
960 +- * after we've gone through a COW cycle and they are dirty.
961 ++ * FOLL_FORCE or a forced COW break can write even to unwritable pte's,
962 ++ * but only after we've gone through a COW cycle and they are dirty.
963 + */
964 + static inline bool can_follow_write_pte(pte_t pte, unsigned int flags)
965 + {
966 +- return pte_write(pte) ||
967 +- ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte));
968 ++ return pte_write(pte) || ((flags & FOLL_COW) && pte_dirty(pte));
969 ++}
970 ++
971 ++/*
972 ++ * A (separate) COW fault might break the page the other way and
973 ++ * get_user_pages() would return the page from what is now the wrong
974 ++ * VM. So we need to force a COW break at GUP time even for reads.
975 ++ */
976 ++static inline bool should_force_cow_break(struct vm_area_struct *vma, unsigned int flags)
977 ++{
978 ++ return is_cow_mapping(vma->vm_flags) && (flags & FOLL_GET);
979 + }
980 +
981 + static struct page *follow_page_pte(struct vm_area_struct *vma,
982 +@@ -694,12 +703,18 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
983 + if (!vma || check_vma_flags(vma, gup_flags))
984 + return i ? : -EFAULT;
985 + if (is_vm_hugetlb_page(vma)) {
986 ++ if (should_force_cow_break(vma, foll_flags))
987 ++ foll_flags |= FOLL_WRITE;
988 + i = follow_hugetlb_page(mm, vma, pages, vmas,
989 + &start, &nr_pages, i,
990 +- gup_flags, nonblocking);
991 ++ foll_flags, nonblocking);
992 + continue;
993 + }
994 + }
995 ++
996 ++ if (should_force_cow_break(vma, foll_flags))
997 ++ foll_flags |= FOLL_WRITE;
998 ++
999 + retry:
1000 + /*
1001 + * If we have a pending SIGKILL, don't keep faulting pages and
1002 +@@ -1796,6 +1811,10 @@ bool gup_fast_permitted(unsigned long start, int nr_pages, int write)
1003 + /*
1004 + * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to
1005 + * the regular GUP. It will only return non-negative values.
1006 ++ *
1007 ++ * Careful, careful! COW breaking can go either way, so a non-write
1008 ++ * access can get ambiguous page results. If you call this function without
1009 ++ * 'write' set, you'd better be sure that you're ok with that ambiguity.
1010 + */
1011 + int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
1012 + struct page **pages)
1013 +@@ -1823,6 +1842,12 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
1014 + *
1015 + * We do not adopt an rcu_read_lock(.) here as we also want to
1016 + * block IPIs that come from THPs splitting.
1017 ++ *
1018 ++ * NOTE! We allow read-only gup_fast() here, but you'd better be
1019 ++ * careful about possible COW pages. You'll get _a_ COW page, but
1020 ++ * not necessarily the one you intended to get depending on what
1021 ++ * COW event happens after this. COW may break the page copy in a
1022 ++ * random direction.
1023 + */
1024 +
1025 + if (gup_fast_permitted(start, nr_pages, write)) {
1026 +@@ -1868,9 +1893,16 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
1027 + (void __user *)start, len)))
1028 + return -EFAULT;
1029 +
1030 ++ /*
1031 ++ * The FAST_GUP case requires FOLL_WRITE even for pure reads,
1032 ++ * because get_user_pages() may need to cause an early COW in
1033 ++ * order to avoid confusing the normal COW routines. So only
1034 ++ * targets that are already writable are safe to do by just
1035 ++ * looking at the page tables.
1036 ++ */
1037 + if (gup_fast_permitted(start, nr_pages, write)) {
1038 + local_irq_disable();
1039 +- gup_pgd_range(addr, end, write, pages, &nr);
1040 ++ gup_pgd_range(addr, end, 1, pages, &nr);
1041 + local_irq_enable();
1042 + ret = nr;
1043 + }
1044 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
1045 +index 9dbfa7286c611..513f0cf173ad5 100644
1046 +--- a/mm/huge_memory.c
1047 ++++ b/mm/huge_memory.c
1048 +@@ -1367,13 +1367,12 @@ out_unlock:
1049 + }
1050 +
1051 + /*
1052 +- * FOLL_FORCE can write to even unwritable pmd's, but only
1053 +- * after we've gone through a COW cycle and they are dirty.
1054 ++ * FOLL_FORCE or a forced COW break can write even to unwritable pmd's,
1055 ++ * but only after we've gone through a COW cycle and they are dirty.
1056 + */
1057 + static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags)
1058 + {
1059 +- return pmd_write(pmd) ||
1060 +- ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd));
1061 ++ return pmd_write(pmd) || ((flags & FOLL_COW) && pmd_dirty(pmd));
1062 + }
1063 +
1064 + struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
1065 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
1066 +index 20f6c634ad68a..f9aa9912f9404 100644
1067 +--- a/net/core/neighbour.c
1068 ++++ b/net/core/neighbour.c
1069 +@@ -1266,7 +1266,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1070 + * we can reinject the packet there.
1071 + */
1072 + n2 = NULL;
1073 +- if (dst) {
1074 ++ if (dst && dst->obsolete != DST_OBSOLETE_DEAD) {
1075 + n2 = dst_neigh_lookup_skb(dst, skb);
1076 + if (n2)
1077 + n1 = n2;
1078 +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
1079 +index b10b297e76b78..b1c55db737648 100644
1080 +--- a/net/ieee802154/nl802154.c
1081 ++++ b/net/ieee802154/nl802154.c
1082 +@@ -1516,6 +1516,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb)
1083 + if (err)
1084 + return err;
1085 +
1086 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
1087 ++ err = skb->len;
1088 ++ goto out_err;
1089 ++ }
1090 ++
1091 + if (!wpan_dev->netdev) {
1092 + err = -EINVAL;
1093 + goto out_err;
1094 +@@ -1688,6 +1693,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb)
1095 + if (err)
1096 + return err;
1097 +
1098 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
1099 ++ err = skb->len;
1100 ++ goto out_err;
1101 ++ }
1102 ++
1103 + if (!wpan_dev->netdev) {
1104 + err = -EINVAL;
1105 + goto out_err;
1106 +@@ -1775,6 +1785,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info)
1107 + struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
1108 + struct ieee802154_llsec_device dev_desc;
1109 +
1110 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
1111 ++ return -EOPNOTSUPP;
1112 ++
1113 + if (ieee802154_llsec_parse_device(info->attrs[NL802154_ATTR_SEC_DEVICE],
1114 + &dev_desc) < 0)
1115 + return -EINVAL;
1116 +@@ -1861,6 +1874,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)
1117 + if (err)
1118 + return err;
1119 +
1120 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
1121 ++ err = skb->len;
1122 ++ goto out_err;
1123 ++ }
1124 ++
1125 + if (!wpan_dev->netdev) {
1126 + err = -EINVAL;
1127 + goto out_err;
1128 +@@ -1918,6 +1936,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info
1129 + struct ieee802154_llsec_device_key key;
1130 + __le64 extended_addr;
1131 +
1132 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
1133 ++ return -EOPNOTSUPP;
1134 ++
1135 + if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
1136 + nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX,
1137 + info->attrs[NL802154_ATTR_SEC_DEVKEY],
1138 +@@ -2027,6 +2048,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb)
1139 + if (err)
1140 + return err;
1141 +
1142 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
1143 ++ err = skb->len;
1144 ++ goto out_err;
1145 ++ }
1146 ++
1147 + if (!wpan_dev->netdev) {
1148 + err = -EINVAL;
1149 + goto out_err;
1150 +@@ -2112,6 +2138,9 @@ static int nl802154_add_llsec_seclevel(struct sk_buff *skb,
1151 + struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
1152 + struct ieee802154_llsec_seclevel sl;
1153 +
1154 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
1155 ++ return -EOPNOTSUPP;
1156 ++
1157 + if (llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL],
1158 + &sl) < 0)
1159 + return -EINVAL;
1160 +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
1161 +index a598bb2080efe..6d85d995b9429 100644
1162 +--- a/net/ipv6/sit.c
1163 ++++ b/net/ipv6/sit.c
1164 +@@ -1804,9 +1804,9 @@ static void __net_exit sit_destroy_tunnels(struct net *net,
1165 + if (dev->rtnl_link_ops == &sit_link_ops)
1166 + unregister_netdevice_queue(dev, head);
1167 +
1168 +- for (prio = 1; prio < 4; prio++) {
1169 ++ for (prio = 0; prio < 4; prio++) {
1170 + int h;
1171 +- for (h = 0; h < IP6_SIT_HASH_SIZE; h++) {
1172 ++ for (h = 0; h < (prio ? IP6_SIT_HASH_SIZE : 1); h++) {
1173 + struct ip_tunnel *t;
1174 +
1175 + t = rtnl_dereference(sitn->tunnels[prio][h]);
1176 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
1177 +index 0563bde0c285c..3b3ed96c19e52 100644
1178 +--- a/net/mac80211/cfg.c
1179 ++++ b/net/mac80211/cfg.c
1180 +@@ -1536,8 +1536,10 @@ static int ieee80211_change_station(struct wiphy *wiphy,
1181 + }
1182 +
1183 + if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
1184 +- sta->sdata->u.vlan.sta)
1185 ++ sta->sdata->u.vlan.sta) {
1186 ++ ieee80211_clear_fast_rx(sta);
1187 + RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL);
1188 ++ }
1189 +
1190 + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1191 + ieee80211_vif_dec_num_mcast(sta->sdata);
1192 +diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
1193 +index a519c4a06c18c..c0be39bcd6382 100644
1194 +--- a/net/netfilter/nf_conntrack_standalone.c
1195 ++++ b/net/netfilter/nf_conntrack_standalone.c
1196 +@@ -272,6 +272,7 @@ static const char* l4proto_name(u16 proto)
1197 + case IPPROTO_GRE: return "gre";
1198 + case IPPROTO_SCTP: return "sctp";
1199 + case IPPROTO_UDPLITE: return "udplite";
1200 ++ case IPPROTO_ICMPV6: return "icmpv6";
1201 + }
1202 +
1203 + return "unknown";
1204 +diff --git a/net/netfilter/nft_limit.c b/net/netfilter/nft_limit.c
1205 +index 72f13a1144dd6..a7bdc532479a3 100644
1206 +--- a/net/netfilter/nft_limit.c
1207 ++++ b/net/netfilter/nft_limit.c
1208 +@@ -79,13 +79,13 @@ static int nft_limit_init(struct nft_limit *limit,
1209 + return -EOVERFLOW;
1210 +
1211 + if (pkts) {
1212 +- tokens = div_u64(limit->nsecs, limit->rate) * limit->burst;
1213 ++ tokens = div64_u64(limit->nsecs, limit->rate) * limit->burst;
1214 + } else {
1215 + /* The token bucket size limits the number of tokens can be
1216 + * accumulated. tokens_max specifies the bucket size.
1217 + * tokens_max = unit * (rate + burst) / rate.
1218 + */
1219 +- tokens = div_u64(limit->nsecs * (limit->rate + limit->burst),
1220 ++ tokens = div64_u64(limit->nsecs * (limit->rate + limit->burst),
1221 + limit->rate);
1222 + }
1223 +
1224 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
1225 +index 1f154276a681f..5df93a00fda2e 100644
1226 +--- a/net/sctp/socket.c
1227 ++++ b/net/sctp/socket.c
1228 +@@ -1586,11 +1586,9 @@ static void sctp_close(struct sock *sk, long timeout)
1229 +
1230 + /* Supposedly, no process has access to the socket, but
1231 + * the net layers still may.
1232 +- * Also, sctp_destroy_sock() needs to be called with addr_wq_lock
1233 +- * held and that should be grabbed before socket lock.
1234 + */
1235 +- spin_lock_bh(&net->sctp.addr_wq_lock);
1236 +- bh_lock_sock_nested(sk);
1237 ++ local_bh_disable();
1238 ++ bh_lock_sock(sk);
1239 +
1240 + /* Hold the sock, since sk_common_release() will put sock_put()
1241 + * and we have just a little more cleanup.
1242 +@@ -1599,7 +1597,7 @@ static void sctp_close(struct sock *sk, long timeout)
1243 + sk_common_release(sk);
1244 +
1245 + bh_unlock_sock(sk);
1246 +- spin_unlock_bh(&net->sctp.addr_wq_lock);
1247 ++ local_bh_enable();
1248 +
1249 + sock_put(sk);
1250 +
1251 +@@ -4449,9 +4447,6 @@ static int sctp_init_sock(struct sock *sk)
1252 + sk_sockets_allocated_inc(sk);
1253 + sock_prot_inuse_add(net, sk->sk_prot, 1);
1254 +
1255 +- /* Nothing can fail after this block, otherwise
1256 +- * sctp_destroy_sock() will be called without addr_wq_lock held
1257 +- */
1258 + if (net->sctp.default_auto_asconf) {
1259 + spin_lock(&sock_net(sk)->sctp.addr_wq_lock);
1260 + list_add_tail(&sp->auto_asconf_list,
1261 +@@ -4486,7 +4481,9 @@ static void sctp_destroy_sock(struct sock *sk)
1262 +
1263 + if (sp->do_auto_asconf) {
1264 + sp->do_auto_asconf = 0;
1265 ++ spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock);
1266 + list_del(&sp->auto_asconf_list);
1267 ++ spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock);
1268 + }
1269 + sctp_endpoint_free(sp->ep);
1270 + local_bh_disable();
1271 +diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
1272 +index 6152ae24772b1..3ac87f7843f6a 100644
1273 +--- a/sound/soc/fsl/fsl_esai.c
1274 ++++ b/sound/soc/fsl/fsl_esai.c
1275 +@@ -494,11 +494,13 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
1276 + ESAI_SAICR_SYNC, esai_priv->synchronous ?
1277 + ESAI_SAICR_SYNC : 0);
1278 +
1279 +- /* Set a default slot number -- 2 */
1280 ++ /* Set slots count */
1281 + regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR,
1282 +- ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2));
1283 ++ ESAI_xCCR_xDC_MASK,
1284 ++ ESAI_xCCR_xDC(esai_priv->slots));
1285 + regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
1286 +- ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2));
1287 ++ ESAI_xCCR_xDC_MASK,
1288 ++ ESAI_xCCR_xDC(esai_priv->slots));
1289 + }
1290 +
1291 + return 0;
1292 +diff --git a/tools/arch/ia64/include/asm/barrier.h b/tools/arch/ia64/include/asm/barrier.h
1293 +index d808ee0e77b58..90f8bbd9aede7 100644
1294 +--- a/tools/arch/ia64/include/asm/barrier.h
1295 ++++ b/tools/arch/ia64/include/asm/barrier.h
1296 +@@ -39,9 +39,6 @@
1297 + * sequential memory pages only.
1298 + */
1299 +
1300 +-/* XXX From arch/ia64/include/uapi/asm/gcc_intrin.h */
1301 +-#define ia64_mf() asm volatile ("mf" ::: "memory")
1302 +-
1303 + #define mb() ia64_mf()
1304 + #define rmb() mb()
1305 + #define wmb() mb()