Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0366-4.9.267-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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