Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Fri, 16 Apr 2021 11:19:06
Message-Id: 1618571926.de5cca9a5ad898060187ec3422fe3c2cfd5d5190.alicef@gentoo
1 commit: de5cca9a5ad898060187ec3422fe3c2cfd5d5190
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 16 11:18:35 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 16 11:18:46 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=de5cca9a
7
8 linux patch 4.9.267
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1266_linux-4.9.267.patch | 1273 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1277 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 25dd58a..8021097 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1107,6 +1107,10 @@ Patch: 1265_linux-4.9.266.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.266
23
24 +Patch: 1266_linux-4.9.267.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.267
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/1266_linux-4.9.267.patch b/1266_linux-4.9.267.patch
33 new file mode 100644
34 index 0000000..b9ce4f5
35 --- /dev/null
36 +++ b/1266_linux-4.9.267.patch
37 @@ -0,0 +1,1273 @@
38 +diff --git a/Makefile b/Makefile
39 +index 9e055c32d77ac..790f3619772a8 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 266
46 ++SUBLEVEL = 267
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
51 +index ae55f5db97f8d..9dbaa283f01db 100644
52 +--- a/arch/arm/Kconfig
53 ++++ b/arch/arm/Kconfig
54 +@@ -1546,12 +1546,10 @@ config THUMB2_KERNEL
55 + depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
56 + default y if CPU_THUMBONLY
57 + select AEABI
58 +- select ARM_ASM_UNIFIED
59 + select ARM_UNWIND
60 + help
61 + By enabling this option, the kernel will be compiled in
62 +- Thumb-2 mode. A compiler/assembler that understand the unified
63 +- ARM-Thumb syntax is needed.
64 ++ Thumb-2 mode.
65 +
66 + If unsure, say N.
67 +
68 +@@ -1586,9 +1584,6 @@ config THUMB2_AVOID_R_ARM_THM_JUMP11
69 +
70 + Unless you are sure your tools don't have this problem, say Y.
71 +
72 +-config ARM_ASM_UNIFIED
73 +- bool
74 +-
75 + config ARM_PATCH_IDIV
76 + bool "Runtime patch udiv/sdiv instructions into __aeabi_{u}idiv()"
77 + depends on CPU_32v7 && !XIP_KERNEL
78 +diff --git a/arch/arm/Makefile b/arch/arm/Makefile
79 +index e14ddca59d02d..975b110e7d87a 100644
80 +--- a/arch/arm/Makefile
81 ++++ b/arch/arm/Makefile
82 +@@ -113,9 +113,11 @@ ifeq ($(CONFIG_ARM_UNWIND),y)
83 + CFLAGS_ABI +=-funwind-tables
84 + endif
85 +
86 ++# Accept old syntax despite ".syntax unified"
87 ++AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
88 ++
89 + ifeq ($(CONFIG_THUMB2_KERNEL),y)
90 + AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
91 +-AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
92 + CFLAGS_ISA :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
93 + AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
94 + # Work around buggy relocation from gas if requested:
95 +@@ -123,7 +125,7 @@ ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
96 + CFLAGS_MODULE +=-fno-optimize-sibling-calls
97 + endif
98 + else
99 +-CFLAGS_ISA :=$(call cc-option,-marm,)
100 ++CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
101 + AFLAGS_ISA :=$(CFLAGS_ISA)
102 + endif
103 +
104 +diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
105 +index a91ae499614cb..2c3b952be63eb 100644
106 +--- a/arch/arm/include/asm/unified.h
107 ++++ b/arch/arm/include/asm/unified.h
108 +@@ -20,8 +20,10 @@
109 + #ifndef __ASM_UNIFIED_H
110 + #define __ASM_UNIFIED_H
111 +
112 +-#if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
113 ++#if defined(__ASSEMBLY__)
114 + .syntax unified
115 ++#else
116 ++__asm__(".syntax unified");
117 + #endif
118 +
119 + #ifdef CONFIG_CPU_V7M
120 +@@ -64,77 +66,4 @@
121 +
122 + #endif /* CONFIG_THUMB2_KERNEL */
123 +
124 +-#ifndef CONFIG_ARM_ASM_UNIFIED
125 +-
126 +-/*
127 +- * If the unified assembly syntax isn't used (in ARM mode), these
128 +- * macros expand to an empty string
129 +- */
130 +-#ifdef __ASSEMBLY__
131 +- .macro it, cond
132 +- .endm
133 +- .macro itt, cond
134 +- .endm
135 +- .macro ite, cond
136 +- .endm
137 +- .macro ittt, cond
138 +- .endm
139 +- .macro itte, cond
140 +- .endm
141 +- .macro itet, cond
142 +- .endm
143 +- .macro itee, cond
144 +- .endm
145 +- .macro itttt, cond
146 +- .endm
147 +- .macro ittte, cond
148 +- .endm
149 +- .macro ittet, cond
150 +- .endm
151 +- .macro ittee, cond
152 +- .endm
153 +- .macro itett, cond
154 +- .endm
155 +- .macro itete, cond
156 +- .endm
157 +- .macro iteet, cond
158 +- .endm
159 +- .macro iteee, cond
160 +- .endm
161 +-#else /* !__ASSEMBLY__ */
162 +-__asm__(
163 +-" .macro it, cond\n"
164 +-" .endm\n"
165 +-" .macro itt, cond\n"
166 +-" .endm\n"
167 +-" .macro ite, cond\n"
168 +-" .endm\n"
169 +-" .macro ittt, cond\n"
170 +-" .endm\n"
171 +-" .macro itte, cond\n"
172 +-" .endm\n"
173 +-" .macro itet, cond\n"
174 +-" .endm\n"
175 +-" .macro itee, cond\n"
176 +-" .endm\n"
177 +-" .macro itttt, cond\n"
178 +-" .endm\n"
179 +-" .macro ittte, cond\n"
180 +-" .endm\n"
181 +-" .macro ittet, cond\n"
182 +-" .endm\n"
183 +-" .macro ittee, cond\n"
184 +-" .endm\n"
185 +-" .macro itett, cond\n"
186 +-" .endm\n"
187 +-" .macro itete, cond\n"
188 +-" .endm\n"
189 +-" .macro iteet, cond\n"
190 +-" .endm\n"
191 +-" .macro iteee, cond\n"
192 +-" .endm\n");
193 +-#endif /* __ASSEMBLY__ */
194 +-
195 +-#endif /* CONFIG_ARM_ASM_UNIFIED */
196 +-
197 + #endif /* !__ASM_UNIFIED_H */
198 +diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h
199 +index 845143990a1d6..9d3d4fb87a7a3 100644
200 +--- a/arch/ia64/include/asm/ptrace.h
201 ++++ b/arch/ia64/include/asm/ptrace.h
202 +@@ -53,8 +53,7 @@
203 +
204 + static inline unsigned long user_stack_pointer(struct pt_regs *regs)
205 + {
206 +- /* FIXME: should this be bspstore + nr_dirty regs? */
207 +- return regs->ar_bspstore;
208 ++ return regs->r12;
209 + }
210 +
211 + static inline int is_syscall_success(struct pt_regs *regs)
212 +@@ -78,11 +77,6 @@ static inline long regs_return_value(struct pt_regs *regs)
213 + unsigned long __ip = instruction_pointer(regs); \
214 + (__ip & ~3UL) + ((__ip & 3UL) << 2); \
215 + })
216 +-/*
217 +- * Why not default? Because user_stack_pointer() on ia64 gives register
218 +- * stack backing store instead...
219 +- */
220 +-#define current_user_stack_pointer() (current_pt_regs()->r12)
221 +
222 + /* given a pointer to a task_struct, return the user's pt_regs */
223 + # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
224 +diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h
225 +index 536690a68917c..8dc6d198039d2 100644
226 +--- a/arch/parisc/include/asm/cmpxchg.h
227 ++++ b/arch/parisc/include/asm/cmpxchg.h
228 +@@ -71,7 +71,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
229 + #endif
230 + case 4: return __cmpxchg_u32((unsigned int *)ptr,
231 + (unsigned int)old, (unsigned int)new_);
232 +- case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
233 ++ case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff);
234 + }
235 + __cmpxchg_called_with_bad_pointer();
236 + return old;
237 +diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
238 +index 7f48e568ac644..540912666740f 100644
239 +--- a/arch/s390/kernel/cpcmd.c
240 ++++ b/arch/s390/kernel/cpcmd.c
241 +@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen)
242 +
243 + static int diag8_response(int cmdlen, char *response, int *rlen)
244 + {
245 ++ unsigned long _cmdlen = cmdlen | 0x40000000L;
246 ++ unsigned long _rlen = *rlen;
247 + register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
248 + register unsigned long reg3 asm ("3") = (addr_t) response;
249 +- register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L;
250 +- register unsigned long reg5 asm ("5") = *rlen;
251 ++ register unsigned long reg4 asm ("4") = _cmdlen;
252 ++ register unsigned long reg5 asm ("5") = _rlen;
253 +
254 + asm volatile(
255 + " sam31\n"
256 +diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
257 +index c528f96ee204f..07de755ca30c5 100644
258 +--- a/drivers/char/agp/Kconfig
259 ++++ b/drivers/char/agp/Kconfig
260 +@@ -124,7 +124,7 @@ config AGP_HP_ZX1
261 +
262 + config AGP_PARISC
263 + tristate "HP Quicksilver AGP support"
264 +- depends on AGP && PARISC && 64BIT
265 ++ depends on AGP && PARISC && 64BIT && IOMMU_SBA
266 + help
267 + This option gives you AGP GART support for the HP Quicksilver
268 + AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000
269 +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
270 +index af4f2ffc4fc50..9d60b3f219f6b 100644
271 +--- a/drivers/clk/clk.c
272 ++++ b/drivers/clk/clk.c
273 +@@ -2990,32 +2990,28 @@ EXPORT_SYMBOL_GPL(clk_notifier_register);
274 + */
275 + int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
276 + {
277 +- struct clk_notifier *cn = NULL;
278 +- int ret = -EINVAL;
279 ++ struct clk_notifier *cn;
280 ++ int ret = -ENOENT;
281 +
282 + if (!clk || !nb)
283 + return -EINVAL;
284 +
285 + clk_prepare_lock();
286 +
287 +- list_for_each_entry(cn, &clk_notifier_list, node)
288 +- if (cn->clk == clk)
289 +- break;
290 +-
291 +- if (cn->clk == clk) {
292 +- ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb);
293 ++ list_for_each_entry(cn, &clk_notifier_list, node) {
294 ++ if (cn->clk == clk) {
295 ++ ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb);
296 +
297 +- clk->core->notifier_count--;
298 ++ clk->core->notifier_count--;
299 +
300 +- /* XXX the notifier code should handle this better */
301 +- if (!cn->notifier_head.head) {
302 +- srcu_cleanup_notifier_head(&cn->notifier_head);
303 +- list_del(&cn->node);
304 +- kfree(cn);
305 ++ /* XXX the notifier code should handle this better */
306 ++ if (!cn->notifier_head.head) {
307 ++ srcu_cleanup_notifier_head(&cn->notifier_head);
308 ++ list_del(&cn->node);
309 ++ kfree(cn);
310 ++ }
311 ++ break;
312 + }
313 +-
314 +- } else {
315 +- ret = -ENOENT;
316 + }
317 +
318 + clk_prepare_unlock();
319 +diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
320 +index aa7a6e6a15b65..14918896811d6 100644
321 +--- a/drivers/clk/socfpga/clk-gate.c
322 ++++ b/drivers/clk/socfpga/clk-gate.c
323 +@@ -107,7 +107,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
324 + val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
325 + val &= GENMASK(socfpgaclk->width - 1, 0);
326 + /* Check for GPIO_DB_CLK by its offset */
327 +- if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
328 ++ if ((uintptr_t) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
329 + div = val + 1;
330 + else
331 + div = (1 << val);
332 +diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
333 +index 2df407b2b0da7..3a9d06de81b4c 100644
334 +--- a/drivers/gpu/drm/imx/imx-ldb.c
335 ++++ b/drivers/gpu/drm/imx/imx-ldb.c
336 +@@ -212,6 +212,11 @@ static void imx_ldb_encoder_enable(struct drm_encoder *encoder)
337 + int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
338 + int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
339 +
340 ++ if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) {
341 ++ dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux);
342 ++ return;
343 ++ }
344 ++
345 + drm_panel_prepare(imx_ldb_ch->panel);
346 +
347 + if (dual) {
348 +@@ -270,6 +275,11 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
349 + int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
350 + u32 bus_format = imx_ldb_ch->bus_format;
351 +
352 ++ if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) {
353 ++ dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux);
354 ++ return;
355 ++ }
356 ++
357 + if (mode->clock > 170000) {
358 + dev_warn(ldb->dev,
359 + "%s: mode exceeds 170 MHz pixel clock\n", __func__);
360 +diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
361 +index 45ca056f019ed..63041dcec7afd 100644
362 +--- a/drivers/iio/light/hid-sensor-prox.c
363 ++++ b/drivers/iio/light/hid-sensor-prox.c
364 +@@ -37,6 +37,9 @@ struct prox_state {
365 + struct hid_sensor_common common_attributes;
366 + struct hid_sensor_hub_attribute_info prox_attr;
367 + u32 human_presence;
368 ++ int scale_pre_decml;
369 ++ int scale_post_decml;
370 ++ int scale_precision;
371 + };
372 +
373 + /* Channel definitions */
374 +@@ -105,8 +108,9 @@ static int prox_read_raw(struct iio_dev *indio_dev,
375 + ret_type = IIO_VAL_INT;
376 + break;
377 + case IIO_CHAN_INFO_SCALE:
378 +- *val = prox_state->prox_attr.units;
379 +- ret_type = IIO_VAL_INT;
380 ++ *val = prox_state->scale_pre_decml;
381 ++ *val2 = prox_state->scale_post_decml;
382 ++ ret_type = prox_state->scale_precision;
383 + break;
384 + case IIO_CHAN_INFO_OFFSET:
385 + *val = hid_sensor_convert_exponent(
386 +@@ -240,6 +244,12 @@ static int prox_parse_report(struct platform_device *pdev,
387 + st->common_attributes.sensitivity.index,
388 + st->common_attributes.sensitivity.report_id);
389 + }
390 ++
391 ++ st->scale_precision = hid_sensor_format_scale(
392 ++ hsdev->usage,
393 ++ &st->prox_attr,
394 ++ &st->scale_pre_decml, &st->scale_post_decml);
395 ++
396 + return ret;
397 + }
398 +
399 +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
400 +index 8bd062635399a..ed4397c3af1a6 100644
401 +--- a/drivers/infiniband/hw/cxgb4/cm.c
402 ++++ b/drivers/infiniband/hw/cxgb4/cm.c
403 +@@ -3478,7 +3478,8 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id)
404 + c4iw_init_wr_wait(&ep->com.wr_wait);
405 + err = cxgb4_remove_server(
406 + ep->com.dev->rdev.lldi.ports[0], ep->stid,
407 +- ep->com.dev->rdev.lldi.rxq_ids[0], true);
408 ++ ep->com.dev->rdev.lldi.rxq_ids[0],
409 ++ ep->com.local_addr.ss_family == AF_INET6);
410 + if (err)
411 + goto done;
412 + err = c4iw_wait_for_reply(&ep->com.dev->rdev, &ep->com.wr_wait,
413 +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
414 +index 2e316228aa1e8..c8502bd8e3dc5 100644
415 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
416 ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
417 +@@ -880,7 +880,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
418 + if (dev->adapter->dev_set_bus) {
419 + err = dev->adapter->dev_set_bus(dev, 0);
420 + if (err)
421 +- goto lbl_unregister_candev;
422 ++ goto adap_dev_free;
423 + }
424 +
425 + /* get device number early */
426 +@@ -892,6 +892,10 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
427 +
428 + return 0;
429 +
430 ++adap_dev_free:
431 ++ if (dev->adapter->dev_free)
432 ++ dev->adapter->dev_free(dev);
433 ++
434 + lbl_unregister_candev:
435 + unregister_candev(netdev);
436 +
437 +diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
438 +index 2df646348dbd4..9fd68cfdd9734 100644
439 +--- a/drivers/net/ethernet/freescale/gianfar.c
440 ++++ b/drivers/net/ethernet/freescale/gianfar.c
441 +@@ -485,7 +485,11 @@ static struct net_device_stats *gfar_get_stats(struct net_device *dev)
442 +
443 + static int gfar_set_mac_addr(struct net_device *dev, void *p)
444 + {
445 +- eth_mac_addr(dev, p);
446 ++ int ret;
447 ++
448 ++ ret = eth_mac_addr(dev, p);
449 ++ if (ret)
450 ++ return ret;
451 +
452 + gfar_set_mac_for_addr(dev, 0, dev->dev_addr);
453 +
454 +diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
455 +index 12df6cfb423ac..0ee54fba0a237 100644
456 +--- a/drivers/net/ieee802154/atusb.c
457 ++++ b/drivers/net/ieee802154/atusb.c
458 +@@ -341,6 +341,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n)
459 + return -ENOMEM;
460 + }
461 + usb_anchor_urb(urb, &atusb->idle_urbs);
462 ++ usb_free_urb(urb);
463 + n--;
464 + }
465 + return 0;
466 +diff --git a/drivers/net/tun.c b/drivers/net/tun.c
467 +index 44b16d945e33a..dc0349d13f86a 100644
468 +--- a/drivers/net/tun.c
469 ++++ b/drivers/net/tun.c
470 +@@ -72,6 +72,14 @@
471 + #include <linux/seq_file.h>
472 + #include <linux/uio.h>
473 + #include <linux/skb_array.h>
474 ++#include <linux/ieee802154.h>
475 ++#include <linux/if_ltalk.h>
476 ++#include <uapi/linux/if_fddi.h>
477 ++#include <uapi/linux/if_hippi.h>
478 ++#include <uapi/linux/if_fc.h>
479 ++#include <net/ax25.h>
480 ++#include <net/rose.h>
481 ++#include <net/6lowpan.h>
482 +
483 + #include <asm/uaccess.h>
484 +
485 +@@ -2021,6 +2029,45 @@ unlock:
486 + return ret;
487 + }
488 +
489 ++/* Return correct value for tun->dev->addr_len based on tun->dev->type. */
490 ++static unsigned char tun_get_addr_len(unsigned short type)
491 ++{
492 ++ switch (type) {
493 ++ case ARPHRD_IP6GRE:
494 ++ case ARPHRD_TUNNEL6:
495 ++ return sizeof(struct in6_addr);
496 ++ case ARPHRD_IPGRE:
497 ++ case ARPHRD_TUNNEL:
498 ++ case ARPHRD_SIT:
499 ++ return 4;
500 ++ case ARPHRD_ETHER:
501 ++ return ETH_ALEN;
502 ++ case ARPHRD_IEEE802154:
503 ++ case ARPHRD_IEEE802154_MONITOR:
504 ++ return IEEE802154_EXTENDED_ADDR_LEN;
505 ++ case ARPHRD_PHONET_PIPE:
506 ++ case ARPHRD_PPP:
507 ++ case ARPHRD_NONE:
508 ++ return 0;
509 ++ case ARPHRD_6LOWPAN:
510 ++ return EUI64_ADDR_LEN;
511 ++ case ARPHRD_FDDI:
512 ++ return FDDI_K_ALEN;
513 ++ case ARPHRD_HIPPI:
514 ++ return HIPPI_ALEN;
515 ++ case ARPHRD_IEEE802:
516 ++ return FC_ALEN;
517 ++ case ARPHRD_ROSE:
518 ++ return ROSE_ADDR_LEN;
519 ++ case ARPHRD_NETROM:
520 ++ return AX25_ADDR_LEN;
521 ++ case ARPHRD_LOCALTLK:
522 ++ return LTALK_ALEN;
523 ++ default:
524 ++ return 0;
525 ++ }
526 ++}
527 ++
528 + static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
529 + unsigned long arg, int ifreq_len)
530 + {
531 +@@ -2159,6 +2206,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
532 + ret = -EBUSY;
533 + } else {
534 + tun->dev->type = (int) arg;
535 ++ tun->dev->addr_len = tun_get_addr_len(tun->dev->type);
536 + tun_debug(KERN_INFO, tun, "linktype set to %d\n",
537 + tun->dev->type);
538 + ret = 0;
539 +diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
540 +index 91f5c951850f7..44463afb80150 100644
541 +--- a/drivers/soc/fsl/qbman/qman.c
542 ++++ b/drivers/soc/fsl/qbman/qman.c
543 +@@ -146,7 +146,7 @@ struct qm_eqcr_entry {
544 + u32 tag;
545 + struct qm_fd fd;
546 + u8 __reserved3[32];
547 +-} __packed;
548 ++} __packed __aligned(8);
549 + #define QM_EQCR_VERB_VBIT 0x80
550 + #define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */
551 + #define QM_EQCR_VERB_CMD_ENQUEUE 0x01
552 +diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
553 +index e3f7c76d19562..f44d98eeb36ac 100644
554 +--- a/drivers/usb/usbip/vudc_sysfs.c
555 ++++ b/drivers/usb/usbip/vudc_sysfs.c
556 +@@ -103,8 +103,9 @@ unlock:
557 + }
558 + static BIN_ATTR_RO(dev_desc, sizeof(struct usb_device_descriptor));
559 +
560 +-static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
561 +- const char *in, size_t count)
562 ++static ssize_t store_sockfd(struct device *dev,
563 ++ struct device_attribute *attr,
564 ++ const char *in, size_t count)
565 + {
566 + struct vudc *udc = (struct vudc *) dev_get_drvdata(dev);
567 + int rv;
568 +@@ -113,6 +114,8 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
569 + struct socket *socket;
570 + unsigned long flags;
571 + int ret;
572 ++ struct task_struct *tcp_rx = NULL;
573 ++ struct task_struct *tcp_tx = NULL;
574 +
575 + rv = kstrtoint(in, 0, &sockfd);
576 + if (rv != 0)
577 +@@ -158,24 +161,47 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,
578 + goto sock_err;
579 + }
580 +
581 +- udc->ud.tcp_socket = socket;
582 +-
583 ++ /* unlock and create threads and get tasks */
584 + spin_unlock_irq(&udc->ud.lock);
585 + spin_unlock_irqrestore(&udc->lock, flags);
586 +
587 +- udc->ud.tcp_rx = kthread_get_run(&v_rx_loop,
588 +- &udc->ud, "vudc_rx");
589 +- udc->ud.tcp_tx = kthread_get_run(&v_tx_loop,
590 +- &udc->ud, "vudc_tx");
591 ++ tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
592 ++ if (IS_ERR(tcp_rx)) {
593 ++ sockfd_put(socket);
594 ++ return -EINVAL;
595 ++ }
596 ++ tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
597 ++ if (IS_ERR(tcp_tx)) {
598 ++ kthread_stop(tcp_rx);
599 ++ sockfd_put(socket);
600 ++ return -EINVAL;
601 ++ }
602 ++
603 ++ /* get task structs now */
604 ++ get_task_struct(tcp_rx);
605 ++ get_task_struct(tcp_tx);
606 +
607 ++ /* lock and update udc->ud state */
608 + spin_lock_irqsave(&udc->lock, flags);
609 + spin_lock_irq(&udc->ud.lock);
610 ++
611 ++ udc->ud.tcp_socket = socket;
612 ++ udc->ud.tcp_rx = tcp_rx;
613 ++ udc->ud.tcp_rx = tcp_tx;
614 + udc->ud.status = SDEV_ST_USED;
615 ++
616 + spin_unlock_irq(&udc->ud.lock);
617 +
618 + do_gettimeofday(&udc->start_time);
619 + v_start_timer(udc);
620 + udc->connected = 1;
621 ++
622 ++ spin_unlock_irqrestore(&udc->lock, flags);
623 ++
624 ++ wake_up_process(udc->ud.tcp_rx);
625 ++ wake_up_process(udc->ud.tcp_tx);
626 ++ return count;
627 ++
628 + } else {
629 + if (!udc->connected) {
630 + dev_err(dev, "Device not connected");
631 +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
632 +index 2adf541196776..ea307f40cab19 100644
633 +--- a/drivers/xen/events/events_base.c
634 ++++ b/drivers/xen/events/events_base.c
635 +@@ -222,7 +222,7 @@ static int xen_irq_info_common_setup(struct irq_info *info,
636 + info->evtchn = evtchn;
637 + info->cpu = cpu;
638 + info->mask_reason = EVT_MASK_REASON_EXPLICIT;
639 +- spin_lock_init(&info->lock);
640 ++ raw_spin_lock_init(&info->lock);
641 +
642 + ret = set_evtchn_to_irq(evtchn, irq);
643 + if (ret < 0)
644 +@@ -374,28 +374,28 @@ static void do_mask(struct irq_info *info, u8 reason)
645 + {
646 + unsigned long flags;
647 +
648 +- spin_lock_irqsave(&info->lock, flags);
649 ++ raw_spin_lock_irqsave(&info->lock, flags);
650 +
651 + if (!info->mask_reason)
652 + mask_evtchn(info->evtchn);
653 +
654 + info->mask_reason |= reason;
655 +
656 +- spin_unlock_irqrestore(&info->lock, flags);
657 ++ raw_spin_unlock_irqrestore(&info->lock, flags);
658 + }
659 +
660 + static void do_unmask(struct irq_info *info, u8 reason)
661 + {
662 + unsigned long flags;
663 +
664 +- spin_lock_irqsave(&info->lock, flags);
665 ++ raw_spin_lock_irqsave(&info->lock, flags);
666 +
667 + info->mask_reason &= ~reason;
668 +
669 + if (!info->mask_reason)
670 + unmask_evtchn(info->evtchn);
671 +
672 +- spin_unlock_irqrestore(&info->lock, flags);
673 ++ raw_spin_unlock_irqrestore(&info->lock, flags);
674 + }
675 +
676 + #ifdef CONFIG_X86
677 +@@ -1780,7 +1780,7 @@ static void lateeoi_ack_dynirq(struct irq_data *data)
678 +
679 + if (VALID_EVTCHN(evtchn)) {
680 + do_mask(info, EVT_MASK_REASON_EOI_PENDING);
681 +- event_handler_exit(info);
682 ++ ack_dynirq(data);
683 + }
684 + }
685 +
686 +@@ -1791,7 +1791,7 @@ static void lateeoi_mask_ack_dynirq(struct irq_data *data)
687 +
688 + if (VALID_EVTCHN(evtchn)) {
689 + do_mask(info, EVT_MASK_REASON_EXPLICIT);
690 +- event_handler_exit(info);
691 ++ ack_dynirq(data);
692 + }
693 + }
694 +
695 +diff --git a/drivers/xen/events/events_internal.h b/drivers/xen/events/events_internal.h
696 +index 3df6f28b75e69..cc37b711491ce 100644
697 +--- a/drivers/xen/events/events_internal.h
698 ++++ b/drivers/xen/events/events_internal.h
699 +@@ -47,7 +47,7 @@ struct irq_info {
700 + unsigned short eoi_cpu; /* EOI must happen on this cpu */
701 + unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
702 + u64 eoi_time; /* Time in jiffies when to EOI. */
703 +- spinlock_t lock;
704 ++ raw_spinlock_t lock;
705 +
706 + union {
707 + unsigned short virq;
708 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
709 +index 8508dc8270593..af78de9ef036c 100644
710 +--- a/fs/cifs/connect.c
711 ++++ b/fs/cifs/connect.c
712 +@@ -3488,7 +3488,6 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
713 + cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
714 + if (cifs_sb->prepath == NULL)
715 + return -ENOMEM;
716 +- cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
717 + }
718 +
719 + return 0;
720 +diff --git a/fs/direct-io.c b/fs/direct-io.c
721 +index fc90f0c33cbe4..a9b8e68e439db 100644
722 +--- a/fs/direct-io.c
723 ++++ b/fs/direct-io.c
724 +@@ -793,6 +793,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
725 + struct buffer_head *map_bh)
726 + {
727 + int ret = 0;
728 ++ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */
729 +
730 + if (dio->op == REQ_OP_WRITE) {
731 + /*
732 +@@ -831,10 +832,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
733 + sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits;
734 + out:
735 + /*
736 +- * If sdio->boundary then we want to schedule the IO now to
737 ++ * If boundary then we want to schedule the IO now to
738 + * avoid metadata seeks.
739 + */
740 +- if (sdio->boundary) {
741 ++ if (boundary) {
742 + ret = dio_send_cur_page(dio, sdio, map_bh);
743 + if (sdio->bio)
744 + dio_bio_submit(dio, sdio);
745 +diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
746 +index 37496d83661a7..ef401aecaa2c4 100644
747 +--- a/fs/gfs2/super.c
748 ++++ b/fs/gfs2/super.c
749 +@@ -986,11 +986,13 @@ void gfs2_freeze_func(struct work_struct *work)
750 + static int gfs2_freeze(struct super_block *sb)
751 + {
752 + struct gfs2_sbd *sdp = sb->s_fs_info;
753 +- int error = 0;
754 ++ int error;
755 +
756 + mutex_lock(&sdp->sd_freeze_mutex);
757 +- if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN)
758 ++ if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) {
759 ++ error = -EBUSY;
760 + goto out;
761 ++ }
762 +
763 + if (test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) {
764 + error = -EINVAL;
765 +@@ -1032,10 +1034,10 @@ static int gfs2_unfreeze(struct super_block *sb)
766 + struct gfs2_sbd *sdp = sb->s_fs_info;
767 +
768 + mutex_lock(&sdp->sd_freeze_mutex);
769 +- if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
770 ++ if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
771 + !gfs2_holder_initialized(&sdp->sd_freeze_gh)) {
772 + mutex_unlock(&sdp->sd_freeze_mutex);
773 +- return 0;
774 ++ return -EINVAL;
775 + }
776 +
777 + gfs2_glock_dq_uninit(&sdp->sd_freeze_gh);
778 +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
779 +index 6ad76397b31de..291a8250017ad 100644
780 +--- a/fs/ocfs2/aops.c
781 ++++ b/fs/ocfs2/aops.c
782 +@@ -2301,7 +2301,7 @@ static void ocfs2_dio_end_io_write(struct inode *inode,
783 + struct ocfs2_alloc_context *meta_ac = NULL;
784 + handle_t *handle = NULL;
785 + loff_t end = offset + bytes;
786 +- int ret = 0, credits = 0, locked = 0;
787 ++ int ret = 0, credits = 0;
788 +
789 + ocfs2_init_dealloc_ctxt(&dealloc);
790 +
791 +@@ -2312,13 +2312,6 @@ static void ocfs2_dio_end_io_write(struct inode *inode,
792 + !dwc->dw_orphaned)
793 + goto out;
794 +
795 +- /* ocfs2_file_write_iter will get i_mutex, so we need not lock if we
796 +- * are in that context. */
797 +- if (dwc->dw_writer_pid != task_pid_nr(current)) {
798 +- inode_lock(inode);
799 +- locked = 1;
800 +- }
801 +-
802 + ret = ocfs2_inode_lock(inode, &di_bh, 1);
803 + if (ret < 0) {
804 + mlog_errno(ret);
805 +@@ -2393,8 +2386,6 @@ out:
806 + if (meta_ac)
807 + ocfs2_free_alloc_context(meta_ac);
808 + ocfs2_run_deallocs(osb, &dealloc);
809 +- if (locked)
810 +- inode_unlock(inode);
811 + ocfs2_dio_free_write_ctx(inode, dwc);
812 + }
813 +
814 +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
815 +index 05a0fb9854f9e..c17285df12be2 100644
816 +--- a/fs/ocfs2/file.c
817 ++++ b/fs/ocfs2/file.c
818 +@@ -1236,22 +1236,24 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
819 + goto bail_unlock;
820 + }
821 + }
822 ++ down_write(&OCFS2_I(inode)->ip_alloc_sem);
823 + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS +
824 + 2 * ocfs2_quota_trans_credits(sb));
825 + if (IS_ERR(handle)) {
826 + status = PTR_ERR(handle);
827 + mlog_errno(status);
828 +- goto bail_unlock;
829 ++ goto bail_unlock_alloc;
830 + }
831 + status = __dquot_transfer(inode, transfer_to);
832 + if (status < 0)
833 + goto bail_commit;
834 + } else {
835 ++ down_write(&OCFS2_I(inode)->ip_alloc_sem);
836 + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
837 + if (IS_ERR(handle)) {
838 + status = PTR_ERR(handle);
839 + mlog_errno(status);
840 +- goto bail_unlock;
841 ++ goto bail_unlock_alloc;
842 + }
843 + }
844 +
845 +@@ -1264,6 +1266,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
846 +
847 + bail_commit:
848 + ocfs2_commit_trans(osb, handle);
849 ++bail_unlock_alloc:
850 ++ up_write(&OCFS2_I(inode)->ip_alloc_sem);
851 + bail_unlock:
852 + if (status) {
853 + ocfs2_inode_unlock(inode, 1);
854 +diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
855 +index 4b207b10db030..e6c8eadfaa801 100644
856 +--- a/fs/proc/task_mmu.c
857 ++++ b/fs/proc/task_mmu.c
858 +@@ -1609,6 +1609,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
859 +
860 + } while (pte++, addr += PAGE_SIZE, addr != end);
861 + pte_unmap_unlock(orig_pte, ptl);
862 ++ cond_resched();
863 + return 0;
864 + }
865 + #ifdef CONFIG_HUGETLB_PAGE
866 +diff --git a/include/net/red.h b/include/net/red.h
867 +index b3ab5c6bfa83f..117a3654d3194 100644
868 +--- a/include/net/red.h
869 ++++ b/include/net/red.h
870 +@@ -170,9 +170,9 @@ static inline void red_set_vars(struct red_vars *v)
871 + static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog,
872 + u8 Scell_log, u8 *stab)
873 + {
874 +- if (fls(qth_min) + Wlog > 32)
875 ++ if (fls(qth_min) + Wlog >= 32)
876 + return false;
877 +- if (fls(qth_max) + Wlog > 32)
878 ++ if (fls(qth_max) + Wlog >= 32)
879 + return false;
880 + if (Scell_log >= 32)
881 + return false;
882 +diff --git a/kernel/workqueue.c b/kernel/workqueue.c
883 +index 205c3131f8b05..3231088afd73d 100644
884 +--- a/kernel/workqueue.c
885 ++++ b/kernel/workqueue.c
886 +@@ -1377,7 +1377,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
887 + */
888 + WARN_ON_ONCE(!irqs_disabled());
889 +
890 +- debug_work_activate(work);
891 +
892 + /* if draining, only works from the same workqueue are allowed */
893 + if (unlikely(wq->flags & __WQ_DRAINING) &&
894 +@@ -1460,6 +1459,7 @@ retry:
895 + worklist = &pwq->delayed_works;
896 + }
897 +
898 ++ debug_work_activate(work);
899 + insert_work(pwq, work, worklist, work_flags);
900 +
901 + spin_unlock(&pwq->pool->lock);
902 +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
903 +index d40d83949b005..607d8bac83760 100644
904 +--- a/net/batman-adv/translation-table.c
905 ++++ b/net/batman-adv/translation-table.c
906 +@@ -897,6 +897,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
907 + hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
908 + tt_vlan->vid = htons(vlan->vid);
909 + tt_vlan->crc = htonl(vlan->tt.crc);
910 ++ tt_vlan->reserved = 0;
911 +
912 + tt_vlan++;
913 + }
914 +@@ -980,6 +981,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
915 +
916 + tt_vlan->vid = htons(vlan->vid);
917 + tt_vlan->crc = htonl(vlan->tt.crc);
918 ++ tt_vlan->reserved = 0;
919 +
920 + tt_vlan++;
921 + }
922 +diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
923 +index d3cbb32587187..c0930b9fe848b 100644
924 +--- a/net/ieee802154/nl-mac.c
925 ++++ b/net/ieee802154/nl-mac.c
926 +@@ -559,9 +559,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
927 + desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]);
928 +
929 + if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) {
930 +- if (!info->attrs[IEEE802154_ATTR_PAN_ID] &&
931 +- !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] ||
932 +- info->attrs[IEEE802154_ATTR_HW_ADDR]))
933 ++ if (!info->attrs[IEEE802154_ATTR_PAN_ID])
934 + return -EINVAL;
935 +
936 + desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]);
937 +@@ -570,6 +568,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
938 + desc->device_addr.mode = IEEE802154_ADDR_SHORT;
939 + desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]);
940 + } else {
941 ++ if (!info->attrs[IEEE802154_ATTR_HW_ADDR])
942 ++ return -EINVAL;
943 ++
944 + desc->device_addr.mode = IEEE802154_ADDR_LONG;
945 + desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]);
946 + }
947 +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
948 +index d90a4ed5b8a03..f07a208ae21fe 100644
949 +--- a/net/ieee802154/nl802154.c
950 ++++ b/net/ieee802154/nl802154.c
951 +@@ -851,8 +851,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
952 + goto nla_put_failure;
953 +
954 + #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
955 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
956 ++ goto out;
957 ++
958 + if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0)
959 + goto nla_put_failure;
960 ++
961 ++out:
962 + #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
963 +
964 + genlmsg_end(msg, hdr);
965 +@@ -1417,6 +1422,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb,
966 + u32 changed = 0;
967 + int ret;
968 +
969 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
970 ++ return -EOPNOTSUPP;
971 ++
972 + if (info->attrs[NL802154_ATTR_SEC_ENABLED]) {
973 + u8 enabled;
974 +
975 +@@ -1577,7 +1585,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
976 + struct ieee802154_llsec_key_id id = { };
977 + u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { };
978 +
979 +- if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
980 ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
981 ++ nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
982 + info->attrs[NL802154_ATTR_SEC_KEY],
983 + nl802154_key_policy))
984 + return -EINVAL;
985 +@@ -1627,7 +1636,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)
986 + struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1];
987 + struct ieee802154_llsec_key_id id;
988 +
989 +- if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
990 ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
991 ++ nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
992 + info->attrs[NL802154_ATTR_SEC_KEY],
993 + nl802154_key_policy))
994 + return -EINVAL;
995 +@@ -1795,7 +1805,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)
996 + struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1];
997 + __le64 extended_addr;
998 +
999 +- if (nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX,
1000 ++ if (!info->attrs[NL802154_ATTR_SEC_DEVICE] ||
1001 ++ nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX,
1002 + info->attrs[NL802154_ATTR_SEC_DEVICE],
1003 + nl802154_dev_policy))
1004 + return -EINVAL;
1005 +@@ -1955,7 +1966,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info
1006 + struct ieee802154_llsec_device_key key;
1007 + __le64 extended_addr;
1008 +
1009 +- if (nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX,
1010 ++ if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
1011 ++ nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX,
1012 + info->attrs[NL802154_ATTR_SEC_DEVKEY],
1013 + nl802154_devkey_policy))
1014 + return -EINVAL;
1015 +@@ -2130,6 +2142,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb,
1016 + struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
1017 + struct ieee802154_llsec_seclevel sl;
1018 +
1019 ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
1020 ++ return -EOPNOTSUPP;
1021 ++
1022 + if (!info->attrs[NL802154_ATTR_SEC_LEVEL] ||
1023 + llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL],
1024 + &sl) < 0)
1025 +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
1026 +index e02b862651942..5cb5a2957cb27 100644
1027 +--- a/net/ipv4/netfilter/arp_tables.c
1028 ++++ b/net/ipv4/netfilter/arp_tables.c
1029 +@@ -1209,6 +1209,8 @@ static int translate_compat_table(struct net *net,
1030 + if (!newinfo)
1031 + goto out_unlock;
1032 +
1033 ++ memset(newinfo->entries, 0, size);
1034 ++
1035 + newinfo->number = compatr->num_entries;
1036 + for (i = 0; i < NF_ARP_NUMHOOKS; i++) {
1037 + newinfo->hook_entry[i] = compatr->hook_entry[i];
1038 +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
1039 +index 4822459e8f425..9bee964c6a4be 100644
1040 +--- a/net/ipv4/netfilter/ip_tables.c
1041 ++++ b/net/ipv4/netfilter/ip_tables.c
1042 +@@ -1451,6 +1451,8 @@ translate_compat_table(struct net *net,
1043 + if (!newinfo)
1044 + goto out_unlock;
1045 +
1046 ++ memset(newinfo->entries, 0, size);
1047 ++
1048 + newinfo->number = compatr->num_entries;
1049 + for (i = 0; i < NF_INET_NUMHOOKS; i++) {
1050 + newinfo->hook_entry[i] = compatr->hook_entry[i];
1051 +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
1052 +index 21cad30e4546b..579fda1bc45df 100644
1053 +--- a/net/ipv6/netfilter/ip6_tables.c
1054 ++++ b/net/ipv6/netfilter/ip6_tables.c
1055 +@@ -1476,6 +1476,8 @@ translate_compat_table(struct net *net,
1056 + if (!newinfo)
1057 + goto out_unlock;
1058 +
1059 ++ memset(newinfo->entries, 0, size);
1060 ++
1061 + newinfo->number = compatr->num_entries;
1062 + for (i = 0; i < NF_INET_NUMHOOKS; i++) {
1063 + newinfo->hook_entry[i] = compatr->hook_entry[i];
1064 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
1065 +index 03d1a61b4729a..70c37951b3f62 100644
1066 +--- a/net/ipv6/route.c
1067 ++++ b/net/ipv6/route.c
1068 +@@ -3069,9 +3069,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg)
1069 + * nexthops have been replaced by first new, the rest should
1070 + * be added to it.
1071 + */
1072 +- cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
1073 +- NLM_F_REPLACE);
1074 +- cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
1075 ++ if (cfg->fc_nlinfo.nlh) {
1076 ++ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
1077 ++ NLM_F_REPLACE);
1078 ++ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
1079 ++ }
1080 + nhn++;
1081 + }
1082 +
1083 +diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
1084 +index 6a3e1c2181d3a..9e885d94e5157 100644
1085 +--- a/net/mac802154/llsec.c
1086 ++++ b/net/mac802154/llsec.c
1087 +@@ -158,7 +158,7 @@ err_tfm0:
1088 + crypto_free_skcipher(key->tfm0);
1089 + err_tfm:
1090 + for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
1091 +- if (key->tfm[i])
1092 ++ if (!IS_ERR_OR_NULL(key->tfm[i]))
1093 + crypto_free_aead(key->tfm[i]);
1094 +
1095 + kzfree(key);
1096 +diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
1097 +index cef5674ea434c..059f9fa0f6c91 100644
1098 +--- a/net/netfilter/x_tables.c
1099 ++++ b/net/netfilter/x_tables.c
1100 +@@ -569,7 +569,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
1101 + {
1102 + const struct xt_match *match = m->u.kernel.match;
1103 + struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m;
1104 +- int pad, off = xt_compat_match_offset(match);
1105 ++ int off = xt_compat_match_offset(match);
1106 + u_int16_t msize = cm->u.user.match_size;
1107 + char name[sizeof(m->u.user.name)];
1108 +
1109 +@@ -579,9 +579,6 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
1110 + match->compat_from_user(m->data, cm->data);
1111 + else
1112 + memcpy(m->data, cm->data, msize - sizeof(*cm));
1113 +- pad = XT_ALIGN(match->matchsize) - match->matchsize;
1114 +- if (pad > 0)
1115 +- memset(m->data + match->matchsize, 0, pad);
1116 +
1117 + msize += off;
1118 + m->u.user.match_size = msize;
1119 +@@ -927,7 +924,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
1120 + {
1121 + const struct xt_target *target = t->u.kernel.target;
1122 + struct compat_xt_entry_target *ct = (struct compat_xt_entry_target *)t;
1123 +- int pad, off = xt_compat_target_offset(target);
1124 ++ int off = xt_compat_target_offset(target);
1125 + u_int16_t tsize = ct->u.user.target_size;
1126 + char name[sizeof(t->u.user.name)];
1127 +
1128 +@@ -937,9 +934,6 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
1129 + target->compat_from_user(t->data, ct->data);
1130 + else
1131 + memcpy(t->data, ct->data, tsize - sizeof(*ct));
1132 +- pad = XT_ALIGN(target->targetsize) - target->targetsize;
1133 +- if (pad > 0)
1134 +- memset(t->data + target->targetsize, 0, pad);
1135 +
1136 + tsize += off;
1137 + t->u.user.target_size = tsize;
1138 +diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
1139 +index dd59fde1dac83..c2bc0f0f04786 100644
1140 +--- a/net/nfc/llcp_sock.c
1141 ++++ b/net/nfc/llcp_sock.c
1142 +@@ -119,11 +119,13 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
1143 + llcp_sock->service_name_len,
1144 + GFP_KERNEL);
1145 + if (!llcp_sock->service_name) {
1146 ++ nfc_llcp_local_put(llcp_sock->local);
1147 + ret = -ENOMEM;
1148 + goto put_dev;
1149 + }
1150 + llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
1151 + if (llcp_sock->ssap == LLCP_SAP_MAX) {
1152 ++ nfc_llcp_local_put(llcp_sock->local);
1153 + kfree(llcp_sock->service_name);
1154 + llcp_sock->service_name = NULL;
1155 + ret = -EADDRINUSE;
1156 +@@ -683,6 +685,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
1157 + ret = -EISCONN;
1158 + goto error;
1159 + }
1160 ++ if (sk->sk_state == LLCP_CONNECTING) {
1161 ++ ret = -EINPROGRESS;
1162 ++ goto error;
1163 ++ }
1164 +
1165 + dev = nfc_get_device(addr->dev_idx);
1166 + if (dev == NULL) {
1167 +@@ -714,6 +720,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
1168 + llcp_sock->local = nfc_llcp_local_get(local);
1169 + llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
1170 + if (llcp_sock->ssap == LLCP_SAP_MAX) {
1171 ++ nfc_llcp_local_put(llcp_sock->local);
1172 + ret = -ENOMEM;
1173 + goto put_dev;
1174 + }
1175 +@@ -751,8 +758,11 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
1176 +
1177 + sock_unlink:
1178 + nfc_llcp_put_ssap(local, llcp_sock->ssap);
1179 ++ nfc_llcp_local_put(llcp_sock->local);
1180 +
1181 + nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
1182 ++ kfree(llcp_sock->service_name);
1183 ++ llcp_sock->service_name = NULL;
1184 +
1185 + put_dev:
1186 + nfc_put_device(dev);
1187 +diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
1188 +index 2cd9b4478b92f..90e440c468035 100644
1189 +--- a/net/sched/sch_teql.c
1190 ++++ b/net/sched/sch_teql.c
1191 +@@ -138,6 +138,9 @@ teql_destroy(struct Qdisc *sch)
1192 + struct teql_sched_data *dat = qdisc_priv(sch);
1193 + struct teql_master *master = dat->m;
1194 +
1195 ++ if (!master)
1196 ++ return;
1197 ++
1198 + prev = master->slaves;
1199 + if (prev) {
1200 + do {
1201 +diff --git a/net/tipc/socket.c b/net/tipc/socket.c
1202 +index 57df99ca6347c..804cab8f95090 100644
1203 +--- a/net/tipc/socket.c
1204 ++++ b/net/tipc/socket.c
1205 +@@ -741,7 +741,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
1206 + spin_lock_bh(&inputq->lock);
1207 + if (skb_peek(arrvq) == skb) {
1208 + skb_queue_splice_tail_init(&tmpq, inputq);
1209 +- kfree_skb(__skb_dequeue(arrvq));
1210 ++ __skb_dequeue(arrvq);
1211 + }
1212 + spin_unlock_bh(&inputq->lock);
1213 + __skb_queue_purge(&tmpq);
1214 +diff --git a/net/wireless/sme.c b/net/wireless/sme.c
1215 +index 6fd24f6435c3a..ce6823646f635 100644
1216 +--- a/net/wireless/sme.c
1217 ++++ b/net/wireless/sme.c
1218 +@@ -512,7 +512,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev,
1219 + cfg80211_sme_free(wdev);
1220 + }
1221 +
1222 +- if (WARN_ON(wdev->conn))
1223 ++ if (wdev->conn)
1224 + return -EINPROGRESS;
1225 +
1226 + wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL);
1227 +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
1228 +index 847f70348d4d5..cc600aa0f6c78 100644
1229 +--- a/sound/drivers/aloop.c
1230 ++++ b/sound/drivers/aloop.c
1231 +@@ -1062,6 +1062,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
1232 + return -ENOMEM;
1233 + kctl->id.device = dev;
1234 + kctl->id.subdevice = substr;
1235 ++
1236 ++ /* Add the control before copying the id so that
1237 ++ * the numid field of the id is set in the copy.
1238 ++ */
1239 ++ err = snd_ctl_add(card, kctl);
1240 ++ if (err < 0)
1241 ++ return err;
1242 ++
1243 + switch (idx) {
1244 + case ACTIVE_IDX:
1245 + setup->active_id = kctl->id;
1246 +@@ -1078,9 +1086,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
1247 + default:
1248 + break;
1249 + }
1250 +- err = snd_ctl_add(card, kctl);
1251 +- if (err < 0)
1252 +- return err;
1253 + }
1254 + }
1255 + }
1256 +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
1257 +index dc1b9a32c0575..d812cbf41b944 100644
1258 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
1259 ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
1260 +@@ -508,14 +508,14 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
1261 + .channels_min = SST_STEREO,
1262 + .channels_max = SST_STEREO,
1263 + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
1264 +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
1265 ++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
1266 + },
1267 + .capture = {
1268 + .stream_name = "Headset Capture",
1269 + .channels_min = 1,
1270 + .channels_max = 2,
1271 + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
1272 +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
1273 ++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
1274 + },
1275 + },
1276 + {
1277 +@@ -526,7 +526,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
1278 + .channels_min = SST_STEREO,
1279 + .channels_max = SST_STEREO,
1280 + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
1281 +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
1282 ++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
1283 + },
1284 + },
1285 + {
1286 +diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
1287 +index ab8ebfa2159d8..2593b7c28de77 100644
1288 +--- a/tools/perf/util/map.c
1289 ++++ b/tools/perf/util/map.c
1290 +@@ -91,8 +91,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
1291 + if (!strncmp(filename, "/system/lib/", 12)) {
1292 + char *ndk, *app;
1293 + const char *arch;
1294 +- size_t ndk_length;
1295 +- size_t app_length;
1296 ++ int ndk_length, app_length;
1297 +
1298 + ndk = getenv("NDK_ROOT");
1299 + app = getenv("APP_PLATFORM");
1300 +@@ -120,8 +119,8 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
1301 + if (new_length > PATH_MAX)
1302 + return false;
1303 + snprintf(newfilename, new_length,
1304 +- "%s/platforms/%s/arch-%s/usr/lib/%s",
1305 +- ndk, app, arch, libname);
1306 ++ "%.*s/platforms/%.*s/arch-%s/usr/lib/%s",
1307 ++ ndk_length, ndk, app_length, app, arch, libname);
1308 +
1309 + return true;
1310 + }