Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0390-4.9.291-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3692 - (show annotations) (download)
Mon Oct 24 14:08:06 2022 UTC (19 months ago) by niro
File size: 213831 byte(s)
-linux-4.9.291
1 diff --git a/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt b/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt
2 index 093edda0c8dfc..6cd83d920155f 100644
3 --- a/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt
4 +++ b/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt
5 @@ -13,6 +13,14 @@ common regulator binding documented in:
6
7
8 Required properties of the main device node (the parent!):
9 + - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
10 + for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
11 +
12 + [1] If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
13 + property is specified, then all the eight voltage values for the
14 + 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
15 +
16 +Optional properties of the main device node (the parent!):
17 - s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
18 units for buck2 when changing voltage using gpio dvs. Refer to [1] below
19 for additional information.
20 @@ -25,26 +33,13 @@ Required properties of the main device node (the parent!):
21 units for buck4 when changing voltage using gpio dvs. Refer to [1] below
22 for additional information.
23
24 - - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
25 - for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
26 -
27 - [1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
28 - property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage'
29 - property should specify atleast one voltage level (which would be a
30 - safe operating voltage).
31 -
32 - If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
33 - property is specified, then all the eight voltage values for the
34 - 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
35 -
36 -Optional properties of the main device node (the parent!):
37 - s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
38 - s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs.
39 - s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.
40
41 Additional properties required if either of the optional properties are used:
42
43 - - s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from
44 + - s5m8767,pmic-buck-default-dvs-idx: Default voltage setting selected from
45 the possible 8 options selectable by the dvs gpios. The value of this
46 property should be between 0 and 7. If not specified or if out of range, the
47 default value of this property is set to 0.
48 diff --git a/Makefile b/Makefile
49 index 9f1647076926d..fa41ff3c7cc38 100644
50 --- a/Makefile
51 +++ b/Makefile
52 @@ -1,6 +1,6 @@
53 VERSION = 4
54 PATCHLEVEL = 9
55 -SUBLEVEL = 290
56 +SUBLEVEL = 291
57 EXTRAVERSION =
58 NAME = Roaring Lionus
59
60 diff --git a/arch/arm/Makefile b/arch/arm/Makefile
61 index d9a2fcd33bc60..1f9747cbc86c0 100644
62 --- a/arch/arm/Makefile
63 +++ b/arch/arm/Makefile
64 @@ -64,15 +64,15 @@ KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra)
65 # Note that GCC does not numerically define an architecture version
66 # macro, but instead defines a whole series of macros which makes
67 # testing for a specific architecture or later rather impossible.
68 -arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m
69 -arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
70 -arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
71 +arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m
72 +arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 -march=armv7-a
73 +arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 -march=armv6
74 # Only override the compiler option if ARMv6. The ARMv6K extensions are
75 # always available in ARMv7
76 ifeq ($(CONFIG_CPU_32v6),y)
77 -arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
78 +arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 -march=armv6k
79 endif
80 -arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
81 +arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 -march=armv5te
82 arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t
83 arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4
84 arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3
85 @@ -86,7 +86,7 @@ tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7tdmi
86 tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi
87 tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi
88 tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi
89 -tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
90 +tune-$(CONFIG_CPU_ARM946E) =-mtune=arm9e
91 tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi
92 tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi
93 tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi
94 @@ -94,11 +94,11 @@ tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9tdmi
95 tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi
96 tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110
97 tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100
98 -tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
99 -tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
100 -tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale)
101 -tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
102 -tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
103 +tune-$(CONFIG_CPU_XSCALE) =-mtune=xscale
104 +tune-$(CONFIG_CPU_XSC3) =-mtune=xscale
105 +tune-$(CONFIG_CPU_FEROCEON) =-mtune=xscale
106 +tune-$(CONFIG_CPU_V6) =-mtune=arm1136j-s
107 +tune-$(CONFIG_CPU_V6K) =-mtune=arm1136j-s
108
109 # Evaluate tune cc-option calls now
110 tune-y := $(tune-y)
111 diff --git a/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi b/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi
112 index 73e272fadc202..58d288fddd9c2 100644
113 --- a/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi
114 +++ b/arch/arm/boot/dts/omap-gpmc-smsc9221.dtsi
115 @@ -28,7 +28,7 @@
116 compatible = "smsc,lan9221","smsc,lan9115";
117 bank-width = <2>;
118
119 - gpmc,mux-add-data;
120 + gpmc,mux-add-data = <0>;
121 gpmc,cs-on-ns = <0>;
122 gpmc,cs-rd-off-ns = <42>;
123 gpmc,cs-wr-off-ns = <36>;
124 diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
125 index 7191506934494..338ee6bd0e0c0 100644
126 --- a/arch/arm/boot/dts/omap3-gta04.dtsi
127 +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
128 @@ -352,7 +352,7 @@
129 compatible = "bosch,bma180";
130 reg = <0x41>;
131 pinctrl-names = "default";
132 - pintcrl-0 = <&bma180_pins>;
133 + pinctrl-0 = <&bma180_pins>;
134 interrupt-parent = <&gpio4>;
135 interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_115 */
136 };
137 diff --git a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
138 index 82e98ee3023ad..3dbeb7a6c569c 100644
139 --- a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
140 +++ b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
141 @@ -25,7 +25,7 @@
142 compatible = "smsc,lan9221","smsc,lan9115";
143 bank-width = <2>;
144
145 - gpmc,mux-add-data;
146 + gpmc,mux-add-data = <0>;
147 gpmc,cs-on-ns = <0>;
148 gpmc,cs-rd-off-ns = <42>;
149 gpmc,cs-wr-off-ns = <36>;
150 diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
151 index 6e8a50de40e2b..c10c1de244eba 100644
152 --- a/arch/arm/kernel/stacktrace.c
153 +++ b/arch/arm/kernel/stacktrace.c
154 @@ -51,8 +51,7 @@ int notrace unwind_frame(struct stackframe *frame)
155
156 frame->sp = frame->fp;
157 frame->fp = *(unsigned long *)(fp);
158 - frame->pc = frame->lr;
159 - frame->lr = *(unsigned long *)(fp + 4);
160 + frame->pc = *(unsigned long *)(fp + 4);
161 #else
162 /* check current frame pointer is within bounds */
163 if (fp < low + 12 || fp > high - 4)
164 diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
165 index 7f3760fa9c154..93623627a0b68 100644
166 --- a/arch/arm/mm/Kconfig
167 +++ b/arch/arm/mm/Kconfig
168 @@ -731,7 +731,7 @@ config CPU_BIG_ENDIAN
169 config CPU_ENDIAN_BE8
170 bool
171 depends on CPU_BIG_ENDIAN
172 - default CPU_V6 || CPU_V6K || CPU_V7
173 + default CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M
174 help
175 Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors.
176
177 diff --git a/arch/hexagon/lib/io.c b/arch/hexagon/lib/io.c
178 index 885c9626d5e08..e5dfed1cf151b 100644
179 --- a/arch/hexagon/lib/io.c
180 +++ b/arch/hexagon/lib/io.c
181 @@ -40,6 +40,7 @@ void __raw_readsw(const void __iomem *addr, void *data, int len)
182 *dst++ = *src;
183
184 }
185 +EXPORT_SYMBOL(__raw_readsw);
186
187 /*
188 * __raw_writesw - read words a short at a time
189 @@ -60,6 +61,7 @@ void __raw_writesw(void __iomem *addr, const void *data, int len)
190
191
192 }
193 +EXPORT_SYMBOL(__raw_writesw);
194
195 /* Pretty sure len is pre-adjusted for the length of the access already */
196 void __raw_readsl(const void __iomem *addr, void *data, int len)
197 @@ -75,6 +77,7 @@ void __raw_readsl(const void __iomem *addr, void *data, int len)
198
199
200 }
201 +EXPORT_SYMBOL(__raw_readsl);
202
203 void __raw_writesl(void __iomem *addr, const void *data, int len)
204 {
205 @@ -89,3 +92,4 @@ void __raw_writesl(void __iomem *addr, const void *data, int len)
206
207
208 }
209 +EXPORT_SYMBOL(__raw_writesl);
210 diff --git a/arch/ia64/Kconfig.debug b/arch/ia64/Kconfig.debug
211 index de9d507ba0fd4..ee6c7f75f479d 100644
212 --- a/arch/ia64/Kconfig.debug
213 +++ b/arch/ia64/Kconfig.debug
214 @@ -41,7 +41,7 @@ config DISABLE_VHPT
215
216 config IA64_DEBUG_CMPXCHG
217 bool "Turn on compare-and-exchange bug checking (slow!)"
218 - depends on DEBUG_KERNEL
219 + depends on DEBUG_KERNEL && PRINTK
220 help
221 Selecting this option turns on bug checking for the IA-64
222 compare-and-exchange instructions. This is slow! Itaniums
223 diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
224 index 2a5c7abb2896e..f622c3ccafc31 100644
225 --- a/arch/m68k/Kconfig.machine
226 +++ b/arch/m68k/Kconfig.machine
227 @@ -184,6 +184,7 @@ config INIT_LCD
228 config MEMORY_RESERVE
229 int "Memory reservation (MiB)"
230 depends on (UCSIMM || UCDIMM)
231 + default 0
232 help
233 Reserve certain memory regions on 68x328 based boards.
234
235 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
236 index 24eb7fe7922e6..9708c319a7444 100644
237 --- a/arch/mips/Kconfig
238 +++ b/arch/mips/Kconfig
239 @@ -267,6 +267,9 @@ config BCM63XX
240 select SYS_SUPPORTS_32BIT_KERNEL
241 select SYS_SUPPORTS_BIG_ENDIAN
242 select SYS_HAS_EARLY_PRINTK
243 + select SYS_HAS_CPU_BMIPS32_3300
244 + select SYS_HAS_CPU_BMIPS4350
245 + select SYS_HAS_CPU_BMIPS4380
246 select SWAP_IO_SPACE
247 select GPIOLIB
248 select HAVE_CLK
249 @@ -1373,6 +1376,7 @@ config CPU_LOONGSON3
250 select WEAK_REORDERING_BEYOND_LLSC
251 select MIPS_PGD_C0_CONTEXT
252 select MIPS_L1_CACHE_SHIFT_6
253 + select MIPS_FP_SUPPORT
254 select GPIOLIB
255 help
256 The Loongson 3 processor implements the MIPS64R2 instruction
257 diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
258 index b49fc9cb9cad2..4f375050ab8e9 100644
259 --- a/arch/mips/bcm63xx/clk.c
260 +++ b/arch/mips/bcm63xx/clk.c
261 @@ -336,6 +336,12 @@ void clk_disable(struct clk *clk)
262
263 EXPORT_SYMBOL(clk_disable);
264
265 +struct clk *clk_get_parent(struct clk *clk)
266 +{
267 + return NULL;
268 +}
269 +EXPORT_SYMBOL(clk_get_parent);
270 +
271 unsigned long clk_get_rate(struct clk *clk)
272 {
273 return clk->rate;
274 diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
275 index 918f2f6d3861a..ca34767280791 100644
276 --- a/arch/mips/kernel/r2300_fpu.S
277 +++ b/arch/mips/kernel/r2300_fpu.S
278 @@ -27,8 +27,8 @@
279 #define EX2(a,b) \
280 9: a,##b; \
281 .section __ex_table,"a"; \
282 - PTR 9b,bad_stack; \
283 - PTR 9b+4,bad_stack; \
284 + PTR 9b,fault; \
285 + PTR 9b+4,fault; \
286 .previous
287
288 .set noreorder
289 diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
290 index 4234b2d726c55..67d3cba60c9fa 100644
291 --- a/arch/mips/kernel/syscall.c
292 +++ b/arch/mips/kernel/syscall.c
293 @@ -244,12 +244,3 @@ SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op)
294 {
295 return -ENOSYS;
296 }
297 -
298 -/*
299 - * If we ever come here the user sp is bad. Zap the process right away.
300 - * Due to the bad stack signaling wouldn't work.
301 - */
302 -asmlinkage void bad_stack(void)
303 -{
304 - do_exit(SIGSEGV);
305 -}
306 diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
307 index cef811755123f..fc9eff29d8ff0 100644
308 --- a/arch/mips/lantiq/xway/dma.c
309 +++ b/arch/mips/lantiq/xway/dma.c
310 @@ -21,6 +21,7 @@
311 #include <linux/dma-mapping.h>
312 #include <linux/module.h>
313 #include <linux/clk.h>
314 +#include <linux/delay.h>
315 #include <linux/err.h>
316
317 #include <lantiq_soc.h>
318 @@ -39,6 +40,7 @@
319 #define LTQ_DMA_PCTRL 0x44
320 #define LTQ_DMA_IRNEN 0xf4
321
322 +#define DMA_ID_CHNR GENMASK(26, 20) /* channel number */
323 #define DMA_DESCPT BIT(3) /* descriptor complete irq */
324 #define DMA_TX BIT(8) /* TX channel direction */
325 #define DMA_CHAN_ON BIT(0) /* channel on / off bit */
326 @@ -49,7 +51,6 @@
327 #define DMA_POLL BIT(31) /* turn on channel polling */
328 #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */
329 #define DMA_2W_BURST BIT(1) /* 2 word burst length */
330 -#define DMA_MAX_CHANNEL 20 /* the soc has 20 channels */
331 #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */
332 #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */
333
334 @@ -216,7 +217,7 @@ ltq_dma_init(struct platform_device *pdev)
335 {
336 struct clk *clk;
337 struct resource *res;
338 - unsigned id;
339 + unsigned int id, nchannels;
340 int i;
341
342 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
343 @@ -232,21 +233,24 @@ ltq_dma_init(struct platform_device *pdev)
344 clk_enable(clk);
345 ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL);
346
347 + usleep_range(1, 10);
348 +
349 /* disable all interrupts */
350 ltq_dma_w32(0, LTQ_DMA_IRNEN);
351
352 /* reset/configure each channel */
353 - for (i = 0; i < DMA_MAX_CHANNEL; i++) {
354 + id = ltq_dma_r32(LTQ_DMA_ID);
355 + nchannels = ((id & DMA_ID_CHNR) >> 20);
356 + for (i = 0; i < nchannels; i++) {
357 ltq_dma_w32(i, LTQ_DMA_CS);
358 ltq_dma_w32(DMA_CHAN_RST, LTQ_DMA_CCTRL);
359 ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL);
360 ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL);
361 }
362
363 - id = ltq_dma_r32(LTQ_DMA_ID);
364 dev_info(&pdev->dev,
365 "Init done - hw rev: %X, ports: %d, channels: %d\n",
366 - id & 0x1f, (id >> 16) & 0xf, id >> 20);
367 + id & 0x1f, (id >> 16) & 0xf, nchannels);
368
369 return 0;
370 }
371 diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
372 index 7ee14f41fc25d..1ea060f08ffea 100644
373 --- a/arch/mips/sni/time.c
374 +++ b/arch/mips/sni/time.c
375 @@ -17,14 +17,14 @@ static int a20r_set_periodic(struct clock_event_device *evt)
376 {
377 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34;
378 wmb();
379 - *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
380 + *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV & 0xff;
381 wmb();
382 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV >> 8;
383 wmb();
384
385 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0xb4;
386 wmb();
387 - *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV;
388 + *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV & 0xff;
389 wmb();
390 *(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV >> 8;
391 wmb();
392 diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
393 index 63b140bde2a3a..ad20414b7fb5d 100644
394 --- a/arch/parisc/kernel/entry.S
395 +++ b/arch/parisc/kernel/entry.S
396 @@ -1849,8 +1849,8 @@ syscall_restore:
397 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
398
399 /* Are we being ptraced? */
400 - ldw TASK_FLAGS(%r1),%r19
401 - ldi _TIF_SYSCALL_TRACE_MASK,%r2
402 + LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
403 + ldi _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2
404 and,COND(=) %r19,%r2,%r0
405 b,n syscall_restore_rfi
406
407 diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
408 index 75dab2871346c..af966c1c922ff 100644
409 --- a/arch/parisc/kernel/smp.c
410 +++ b/arch/parisc/kernel/smp.c
411 @@ -32,6 +32,7 @@
412 #include <linux/bitops.h>
413 #include <linux/ftrace.h>
414 #include <linux/cpu.h>
415 +#include <linux/kgdb.h>
416
417 #include <linux/atomic.h>
418 #include <asm/current.h>
419 @@ -74,7 +75,10 @@ enum ipi_message_type {
420 IPI_CALL_FUNC,
421 IPI_CPU_START,
422 IPI_CPU_STOP,
423 - IPI_CPU_TEST
424 + IPI_CPU_TEST,
425 +#ifdef CONFIG_KGDB
426 + IPI_ENTER_KGDB,
427 +#endif
428 };
429
430
431 @@ -170,7 +174,12 @@ ipi_interrupt(int irq, void *dev_id)
432 case IPI_CPU_TEST:
433 smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu);
434 break;
435 -
436 +#ifdef CONFIG_KGDB
437 + case IPI_ENTER_KGDB:
438 + smp_debug(100, KERN_DEBUG "CPU%d ENTER_KGDB\n", this_cpu);
439 + kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
440 + break;
441 +#endif
442 default:
443 printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n",
444 this_cpu, which);
445 @@ -226,6 +235,12 @@ send_IPI_allbutself(enum ipi_message_type op)
446 }
447 }
448
449 +#ifdef CONFIG_KGDB
450 +void kgdb_roundup_cpus(void)
451 +{
452 + send_IPI_allbutself(IPI_ENTER_KGDB);
453 +}
454 +#endif
455
456 inline void
457 smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); }
458 diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
459 index dbbe3932f833c..7bdc449615e85 100644
460 --- a/arch/parisc/mm/init.c
461 +++ b/arch/parisc/mm/init.c
462 @@ -940,9 +940,9 @@ void flush_tlb_all(void)
463 {
464 int do_recycle;
465
466 - __inc_irq_stat(irq_tlb_count);
467 do_recycle = 0;
468 spin_lock(&sid_lock);
469 + __inc_irq_stat(irq_tlb_count);
470 if (dirty_space_ids > RECYCLE_THRESHOLD) {
471 BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */
472 get_dirty_sids(&recycle_ndirty,recycle_dirty_array);
473 @@ -961,8 +961,8 @@ void flush_tlb_all(void)
474 #else
475 void flush_tlb_all(void)
476 {
477 - __inc_irq_stat(irq_tlb_count);
478 spin_lock(&sid_lock);
479 + __inc_irq_stat(irq_tlb_count);
480 flush_tlb_all_local(NULL);
481 recycle_sids();
482 spin_unlock(&sid_lock);
483 diff --git a/arch/powerpc/boot/dts/charon.dts b/arch/powerpc/boot/dts/charon.dts
484 index 0e00e508eaa6a..1c8fe20752e6a 100644
485 --- a/arch/powerpc/boot/dts/charon.dts
486 +++ b/arch/powerpc/boot/dts/charon.dts
487 @@ -39,7 +39,7 @@
488 };
489 };
490
491 - memory {
492 + memory@0 {
493 device_type = "memory";
494 reg = <0x00000000 0x08000000>; // 128MB
495 };
496 diff --git a/arch/powerpc/boot/dts/digsy_mtc.dts b/arch/powerpc/boot/dts/digsy_mtc.dts
497 index 955bff629df3c..bf511255f3ae8 100644
498 --- a/arch/powerpc/boot/dts/digsy_mtc.dts
499 +++ b/arch/powerpc/boot/dts/digsy_mtc.dts
500 @@ -20,7 +20,7 @@
501 model = "intercontrol,digsy-mtc";
502 compatible = "intercontrol,digsy-mtc";
503
504 - memory {
505 + memory@0 {
506 reg = <0x00000000 0x02000000>; // 32MB
507 };
508
509 diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
510 index 179a1785d6454..18d137a3393f0 100644
511 --- a/arch/powerpc/boot/dts/lite5200.dts
512 +++ b/arch/powerpc/boot/dts/lite5200.dts
513 @@ -36,7 +36,7 @@
514 };
515 };
516
517 - memory {
518 + memory@0 {
519 device_type = "memory";
520 reg = <0x00000000 0x04000000>; // 64MB
521 };
522 diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
523 index 5abb46c5cc951..29419cf81e044 100644
524 --- a/arch/powerpc/boot/dts/lite5200b.dts
525 +++ b/arch/powerpc/boot/dts/lite5200b.dts
526 @@ -35,7 +35,7 @@
527 led4 { gpios = <&gpio_simple 2 1>; };
528 };
529
530 - memory {
531 + memory@0 {
532 reg = <0x00000000 0x10000000>; // 256MB
533 };
534
535 diff --git a/arch/powerpc/boot/dts/media5200.dts b/arch/powerpc/boot/dts/media5200.dts
536 index b5413cb85f134..3d57463bc49da 100644
537 --- a/arch/powerpc/boot/dts/media5200.dts
538 +++ b/arch/powerpc/boot/dts/media5200.dts
539 @@ -36,7 +36,7 @@
540 };
541 };
542
543 - memory {
544 + memory@0 {
545 reg = <0x00000000 0x08000000>; // 128MB RAM
546 };
547
548 diff --git a/arch/powerpc/boot/dts/mpc5200b.dtsi b/arch/powerpc/boot/dts/mpc5200b.dtsi
549 index 969b2200b2f97..ecfba675b5611 100644
550 --- a/arch/powerpc/boot/dts/mpc5200b.dtsi
551 +++ b/arch/powerpc/boot/dts/mpc5200b.dtsi
552 @@ -37,7 +37,7 @@
553 };
554 };
555
556 - memory: memory {
557 + memory: memory@0 {
558 device_type = "memory";
559 reg = <0x00000000 0x04000000>; // 64MB
560 };
561 diff --git a/arch/powerpc/boot/dts/o2d.dts b/arch/powerpc/boot/dts/o2d.dts
562 index 9f6dd4d889b32..5a676e8141caf 100644
563 --- a/arch/powerpc/boot/dts/o2d.dts
564 +++ b/arch/powerpc/boot/dts/o2d.dts
565 @@ -16,7 +16,7 @@
566 model = "ifm,o2d";
567 compatible = "ifm,o2d";
568
569 - memory {
570 + memory@0 {
571 reg = <0x00000000 0x08000000>; // 128MB
572 };
573
574 diff --git a/arch/powerpc/boot/dts/o2d.dtsi b/arch/powerpc/boot/dts/o2d.dtsi
575 index cf073e693f24d..1b4df5f64b580 100644
576 --- a/arch/powerpc/boot/dts/o2d.dtsi
577 +++ b/arch/powerpc/boot/dts/o2d.dtsi
578 @@ -23,7 +23,7 @@
579 model = "ifm,o2d";
580 compatible = "ifm,o2d";
581
582 - memory {
583 + memory@0 {
584 reg = <0x00000000 0x04000000>; // 64MB
585 };
586
587 diff --git a/arch/powerpc/boot/dts/o2dnt2.dts b/arch/powerpc/boot/dts/o2dnt2.dts
588 index a0f5b97a4f06e..5184c461a205f 100644
589 --- a/arch/powerpc/boot/dts/o2dnt2.dts
590 +++ b/arch/powerpc/boot/dts/o2dnt2.dts
591 @@ -16,7 +16,7 @@
592 model = "ifm,o2dnt2";
593 compatible = "ifm,o2d";
594
595 - memory {
596 + memory@0 {
597 reg = <0x00000000 0x08000000>; // 128MB
598 };
599
600 diff --git a/arch/powerpc/boot/dts/o3dnt.dts b/arch/powerpc/boot/dts/o3dnt.dts
601 index acce49326491b..045b901719245 100644
602 --- a/arch/powerpc/boot/dts/o3dnt.dts
603 +++ b/arch/powerpc/boot/dts/o3dnt.dts
604 @@ -16,7 +16,7 @@
605 model = "ifm,o3dnt";
606 compatible = "ifm,o2d";
607
608 - memory {
609 + memory@0 {
610 reg = <0x00000000 0x04000000>; // 64MB
611 };
612
613 diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
614 index 96b139bf50e9c..ac3f53c1a1f5b 100644
615 --- a/arch/powerpc/boot/dts/pcm032.dts
616 +++ b/arch/powerpc/boot/dts/pcm032.dts
617 @@ -26,7 +26,7 @@
618 model = "phytec,pcm032";
619 compatible = "phytec,pcm032";
620
621 - memory {
622 + memory@0 {
623 reg = <0x00000000 0x08000000>; // 128MB
624 };
625
626 diff --git a/arch/powerpc/boot/dts/tqm5200.dts b/arch/powerpc/boot/dts/tqm5200.dts
627 index 1db07f6cf133c..68b9e8240fb5b 100644
628 --- a/arch/powerpc/boot/dts/tqm5200.dts
629 +++ b/arch/powerpc/boot/dts/tqm5200.dts
630 @@ -36,7 +36,7 @@
631 };
632 };
633
634 - memory {
635 + memory@0 {
636 device_type = "memory";
637 reg = <0x00000000 0x04000000>; // 64MB
638 };
639 diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
640 index 83e5b255d1423..89e61b109c17f 100644
641 --- a/arch/powerpc/net/bpf_jit.h
642 +++ b/arch/powerpc/net/bpf_jit.h
643 @@ -177,13 +177,26 @@
644 #define PPC_NEG(d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a))
645
646 /* Long jump; (unconditional 'branch') */
647 -#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \
648 - (((dest) - (ctx->idx * 4)) & 0x03fffffc))
649 +#define PPC_JMP(dest) \
650 + do { \
651 + long offset = (long)(dest) - (ctx->idx * 4); \
652 + if (offset < -0x2000000 || offset > 0x1fffffc || offset & 0x3) { \
653 + pr_err_ratelimited("Branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \
654 + return -ERANGE; \
655 + } \
656 + EMIT(PPC_INST_BRANCH | (offset & 0x03fffffc)); \
657 + } while (0)
658 /* "cond" here covers BO:BI fields. */
659 -#define PPC_BCC_SHORT(cond, dest) EMIT(PPC_INST_BRANCH_COND | \
660 - (((cond) & 0x3ff) << 16) | \
661 - (((dest) - (ctx->idx * 4)) & \
662 - 0xfffc))
663 +#define PPC_BCC_SHORT(cond, dest) \
664 + do { \
665 + long offset = (long)(dest) - (ctx->idx * 4); \
666 + if (offset < -0x8000 || offset > 0x7fff || offset & 0x3) { \
667 + pr_err_ratelimited("Conditional branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \
668 + return -ERANGE; \
669 + } \
670 + EMIT(PPC_INST_BRANCH_COND | (((cond) & 0x3ff) << 16) | (offset & 0xfffc)); \
671 + } while (0)
672 +
673 /* Sign-extended 32-bit immediate load */
674 #define PPC_LI32(d, i) do { \
675 if ((int)(uintptr_t)(i) >= -32768 && \
676 diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
677 index e08e55cd98e6f..5a834e34c5b4d 100644
678 --- a/arch/powerpc/net/bpf_jit_comp64.c
679 +++ b/arch/powerpc/net/bpf_jit_comp64.c
680 @@ -239,7 +239,7 @@ static void bpf_jit_emit_func_call(u32 *image, struct codegen_context *ctx, u64
681 PPC_BLRL();
682 }
683
684 -static void bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 out)
685 +static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 out)
686 {
687 /*
688 * By now, the eBPF program has already setup parameters in r3, r4 and r5
689 @@ -300,7 +300,9 @@ static void bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32
690 bpf_jit_emit_common_epilogue(image, ctx);
691
692 PPC_BCTR();
693 +
694 /* out: */
695 + return 0;
696 }
697
698 /* Assemble the body code between the prologue & epilogue */
699 @@ -310,7 +312,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
700 {
701 const struct bpf_insn *insn = fp->insnsi;
702 int flen = fp->len;
703 - int i;
704 + int i, ret;
705
706 /* Start of epilogue code - will only be valid 2nd pass onwards */
707 u32 exit_addr = addrs[flen];
708 @@ -361,18 +363,25 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
709 PPC_SUB(dst_reg, dst_reg, src_reg);
710 goto bpf_alu32_trunc;
711 case BPF_ALU | BPF_ADD | BPF_K: /* (u32) dst += (u32) imm */
712 - case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */
713 case BPF_ALU64 | BPF_ADD | BPF_K: /* dst += imm */
714 + if (!imm) {
715 + goto bpf_alu32_trunc;
716 + } else if (imm >= -32768 && imm < 32768) {
717 + PPC_ADDI(dst_reg, dst_reg, IMM_L(imm));
718 + } else {
719 + PPC_LI32(b2p[TMP_REG_1], imm);
720 + PPC_ADD(dst_reg, dst_reg, b2p[TMP_REG_1]);
721 + }
722 + goto bpf_alu32_trunc;
723 + case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */
724 case BPF_ALU64 | BPF_SUB | BPF_K: /* dst -= imm */
725 - if (BPF_OP(code) == BPF_SUB)
726 - imm = -imm;
727 - if (imm) {
728 - if (imm >= -32768 && imm < 32768)
729 - PPC_ADDI(dst_reg, dst_reg, IMM_L(imm));
730 - else {
731 - PPC_LI32(b2p[TMP_REG_1], imm);
732 - PPC_ADD(dst_reg, dst_reg, b2p[TMP_REG_1]);
733 - }
734 + if (!imm) {
735 + goto bpf_alu32_trunc;
736 + } else if (imm > -32768 && imm <= 32768) {
737 + PPC_ADDI(dst_reg, dst_reg, IMM_L(-imm));
738 + } else {
739 + PPC_LI32(b2p[TMP_REG_1], imm);
740 + PPC_SUB(dst_reg, dst_reg, b2p[TMP_REG_1]);
741 }
742 goto bpf_alu32_trunc;
743 case BPF_ALU | BPF_MUL | BPF_X: /* (u32) dst *= (u32) src */
744 @@ -938,7 +947,9 @@ common_load:
745 */
746 case BPF_JMP | BPF_CALL | BPF_X:
747 ctx->seen |= SEEN_TAILCALL;
748 - bpf_jit_emit_tail_call(image, ctx, addrs[i + 1]);
749 + ret = bpf_jit_emit_tail_call(image, ctx, addrs[i + 1]);
750 + if (ret < 0)
751 + return ret;
752 break;
753
754 default:
755 diff --git a/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c b/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c
756 index f05325f0cc03b..ddd2953965aa1 100644
757 --- a/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c
758 +++ b/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c
759 @@ -98,9 +98,8 @@ int __init mpc85xx_setup_pmc(void)
760 pr_err("Could not map guts node address\n");
761 return -ENOMEM;
762 }
763 + qoriq_pm_ops = &mpc85xx_pm_ops;
764 }
765
766 - qoriq_pm_ops = &mpc85xx_pm_ops;
767 -
768 return 0;
769 }
770 diff --git a/arch/powerpc/sysdev/dcr-low.S b/arch/powerpc/sysdev/dcr-low.S
771 index e687bb2003ff0..5589fbe48bbdc 100644
772 --- a/arch/powerpc/sysdev/dcr-low.S
773 +++ b/arch/powerpc/sysdev/dcr-low.S
774 @@ -15,7 +15,7 @@
775 #include <asm/export.h>
776
777 #define DCR_ACCESS_PROLOG(table) \
778 - cmpli cr0,r3,1024; \
779 + cmplwi cr0,r3,1024; \
780 rlwinm r3,r3,4,18,27; \
781 lis r5,table@h; \
782 ori r5,r5,table@l; \
783 diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
784 index 0195c3983f540..65f802f705475 100644
785 --- a/arch/s390/mm/gmap.c
786 +++ b/arch/s390/mm/gmap.c
787 @@ -662,9 +662,10 @@ void __gmap_zap(struct gmap *gmap, unsigned long gaddr)
788 vmaddr |= gaddr & ~PMD_MASK;
789 /* Get pointer to the page table entry */
790 ptep = get_locked_pte(gmap->mm, vmaddr, &ptl);
791 - if (likely(ptep))
792 + if (likely(ptep)) {
793 ptep_zap_unused(gmap->mm, vmaddr, ptep, 0);
794 - pte_unmap_unlock(ptep, ptl);
795 + pte_unmap_unlock(ptep, ptl);
796 + }
797 }
798 }
799 EXPORT_SYMBOL_GPL(__gmap_zap);
800 diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
801 index 5f2bb4242c0f7..c50c397cbcf75 100644
802 --- a/arch/sh/Kconfig.debug
803 +++ b/arch/sh/Kconfig.debug
804 @@ -60,6 +60,7 @@ config DUMP_CODE
805
806 config DWARF_UNWINDER
807 bool "Enable the DWARF unwinder for stacktraces"
808 + depends on DEBUG_KERNEL
809 select FRAME_POINTER
810 depends on SUPERH32
811 default n
812 diff --git a/arch/sh/include/asm/sfp-machine.h b/arch/sh/include/asm/sfp-machine.h
813 index d3c548443f2a6..dd195c6f3b9d8 100644
814 --- a/arch/sh/include/asm/sfp-machine.h
815 +++ b/arch/sh/include/asm/sfp-machine.h
816 @@ -25,6 +25,14 @@
817 #ifndef _SFP_MACHINE_H
818 #define _SFP_MACHINE_H
819
820 +#ifdef __BIG_ENDIAN__
821 +#define __BYTE_ORDER __BIG_ENDIAN
822 +#define __LITTLE_ENDIAN 0
823 +#else
824 +#define __BYTE_ORDER __LITTLE_ENDIAN
825 +#define __BIG_ENDIAN 0
826 +#endif
827 +
828 #define _FP_W_TYPE_SIZE 32
829 #define _FP_W_TYPE unsigned long
830 #define _FP_WS_TYPE signed long
831 diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
832 index 0d3637c494bfe..c1f66c35e0c12 100644
833 --- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
834 +++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
835 @@ -76,8 +76,9 @@ static void shx3_prepare_cpus(unsigned int max_cpus)
836 BUILD_BUG_ON(SMP_MSG_NR >= 8);
837
838 for (i = 0; i < SMP_MSG_NR; i++)
839 - request_irq(104 + i, ipi_interrupt_handler,
840 - IRQF_PERCPU, "IPI", (void *)(long)i);
841 + if (request_irq(104 + i, ipi_interrupt_handler,
842 + IRQF_PERCPU, "IPI", (void *)(long)i))
843 + pr_err("Failed to request irq %d\n", i);
844
845 for (i = 0; i < max_cpus; i++)
846 set_cpu_present(i, true);
847 diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
848 index 686dd4339370f..e94d547e9d248 100644
849 --- a/arch/x86/events/intel/uncore_snbep.c
850 +++ b/arch/x86/events/intel/uncore_snbep.c
851 @@ -3363,6 +3363,9 @@ static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *ev
852 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
853 struct extra_reg *er;
854 int idx = 0;
855 + /* Any of the CHA events may be filtered by Thread/Core-ID.*/
856 + if (event->hw.config & SNBEP_CBO_PMON_CTL_TID_EN)
857 + idx = SKX_CHA_MSR_PMON_BOX_FILTER_TID;
858
859 for (er = skx_uncore_cha_extra_regs; er->msr; er++) {
860 if (er->event != (event->hw.config & er->config_mask))
861 @@ -3430,6 +3433,7 @@ static struct event_constraint skx_uncore_iio_constraints[] = {
862 UNCORE_EVENT_CONSTRAINT(0xc0, 0xc),
863 UNCORE_EVENT_CONSTRAINT(0xc5, 0xc),
864 UNCORE_EVENT_CONSTRAINT(0xd4, 0xc),
865 + UNCORE_EVENT_CONSTRAINT(0xd5, 0xc),
866 EVENT_CONSTRAINT_END
867 };
868
869 diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
870 index 390fdd39e0e21..5a69eee673536 100644
871 --- a/arch/x86/include/asm/page_64_types.h
872 +++ b/arch/x86/include/asm/page_64_types.h
873 @@ -19,7 +19,7 @@
874 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
875 #define CURRENT_MASK (~(THREAD_SIZE - 1))
876
877 -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER)
878 +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)
879 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
880
881 #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
882 diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
883 index c6f0ef1d9ab78..a1aecdc305da3 100644
884 --- a/arch/x86/kernel/irq.c
885 +++ b/arch/x86/kernel/irq.c
886 @@ -284,8 +284,10 @@ void kvm_set_posted_intr_wakeup_handler(void (*handler)(void))
887 {
888 if (handler)
889 kvm_posted_intr_wakeup_handler = handler;
890 - else
891 + else {
892 kvm_posted_intr_wakeup_handler = dummy_handler;
893 + synchronize_rcu();
894 + }
895 }
896 EXPORT_SYMBOL_GPL(kvm_set_posted_intr_wakeup_handler);
897
898 diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
899 index 85082574c5154..62e11835f220e 100644
900 --- a/crypto/pcrypt.c
901 +++ b/crypto/pcrypt.c
902 @@ -138,12 +138,14 @@ static void pcrypt_aead_enc(struct padata_priv *padata)
903 {
904 struct pcrypt_request *preq = pcrypt_padata_request(padata);
905 struct aead_request *req = pcrypt_request_ctx(preq);
906 + int ret;
907
908 - padata->info = crypto_aead_encrypt(req);
909 + ret = crypto_aead_encrypt(req);
910
911 - if (padata->info == -EINPROGRESS)
912 + if (ret == -EINPROGRESS)
913 return;
914
915 + padata->info = ret;
916 padata_do_serial(padata);
917 }
918
919 @@ -180,12 +182,14 @@ static void pcrypt_aead_dec(struct padata_priv *padata)
920 {
921 struct pcrypt_request *preq = pcrypt_padata_request(padata);
922 struct aead_request *req = pcrypt_request_ctx(preq);
923 + int ret;
924
925 - padata->info = crypto_aead_decrypt(req);
926 + ret = crypto_aead_decrypt(req);
927
928 - if (padata->info == -EINPROGRESS)
929 + if (ret == -EINPROGRESS)
930 return;
931
932 + padata->info = ret;
933 padata_do_serial(padata);
934 }
935
936 diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
937 index 750fa824d42c4..a04bb91d56ca6 100644
938 --- a/drivers/acpi/acpica/acglobal.h
939 +++ b/drivers/acpi/acpica/acglobal.h
940 @@ -259,6 +259,8 @@ extern struct acpi_bit_register_info
941
942 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
943 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
944 +ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a_s0);
945 +ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b_s0);
946
947 /*****************************************************************************
948 *
949 diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
950 index 3f2fb4b31fdc0..7e2f9b0e66eea 100644
951 --- a/drivers/acpi/acpica/hwesleep.c
952 +++ b/drivers/acpi/acpica/hwesleep.c
953 @@ -184,17 +184,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
954
955 acpi_status acpi_hw_extended_wake_prep(u8 sleep_state)
956 {
957 - acpi_status status;
958 u8 sleep_type_value;
959
960 ACPI_FUNCTION_TRACE(hw_extended_wake_prep);
961
962 - status = acpi_get_sleep_type_data(ACPI_STATE_S0,
963 - &acpi_gbl_sleep_type_a,
964 - &acpi_gbl_sleep_type_b);
965 - if (ACPI_SUCCESS(status)) {
966 + if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) {
967 sleep_type_value =
968 - ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
969 + ((acpi_gbl_sleep_type_a_s0 << ACPI_X_SLEEP_TYPE_POSITION) &
970 ACPI_X_SLEEP_TYPE_MASK);
971
972 (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
973 diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
974 index d00c9810845b2..ddf198de87295 100644
975 --- a/drivers/acpi/acpica/hwsleep.c
976 +++ b/drivers/acpi/acpica/hwsleep.c
977 @@ -217,7 +217,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
978
979 acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
980 {
981 - acpi_status status;
982 + acpi_status status = AE_OK;
983 struct acpi_bit_register_info *sleep_type_reg_info;
984 struct acpi_bit_register_info *sleep_enable_reg_info;
985 u32 pm1a_control;
986 @@ -230,10 +230,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
987 * This is unclear from the ACPI Spec, but it is required
988 * by some machines.
989 */
990 - status = acpi_get_sleep_type_data(ACPI_STATE_S0,
991 - &acpi_gbl_sleep_type_a,
992 - &acpi_gbl_sleep_type_b);
993 - if (ACPI_SUCCESS(status)) {
994 + if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) {
995 sleep_type_reg_info =
996 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
997 sleep_enable_reg_info =
998 @@ -254,9 +251,9 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
999
1000 /* Insert the SLP_TYP bits */
1001
1002 - pm1a_control |= (acpi_gbl_sleep_type_a <<
1003 + pm1a_control |= (acpi_gbl_sleep_type_a_s0 <<
1004 sleep_type_reg_info->bit_position);
1005 - pm1b_control |= (acpi_gbl_sleep_type_b <<
1006 + pm1b_control |= (acpi_gbl_sleep_type_b_s0 <<
1007 sleep_type_reg_info->bit_position);
1008
1009 /* Write the control registers and ignore any errors */
1010 diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
1011 index f76e0eab32b8e..53f9f4c359579 100644
1012 --- a/drivers/acpi/acpica/hwxfsleep.c
1013 +++ b/drivers/acpi/acpica/hwxfsleep.c
1014 @@ -315,6 +315,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
1015 return_ACPI_STATUS(status);
1016 }
1017
1018 + status = acpi_get_sleep_type_data(ACPI_STATE_S0,
1019 + &acpi_gbl_sleep_type_a_s0,
1020 + &acpi_gbl_sleep_type_b_s0);
1021 + if (ACPI_FAILURE(status)) {
1022 + acpi_gbl_sleep_type_a_s0 = ACPI_SLEEP_TYPE_INVALID;
1023 + }
1024 +
1025 /* Execute the _PTS method (Prepare To Sleep) */
1026
1027 arg_list.count = 1;
1028 diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
1029 index 93ecae55fe6a0..69c6f02f16b5b 100644
1030 --- a/drivers/acpi/battery.c
1031 +++ b/drivers/acpi/battery.c
1032 @@ -187,7 +187,7 @@ static int acpi_battery_is_charged(struct acpi_battery *battery)
1033 return 1;
1034
1035 /* fallback to using design values for broken batteries */
1036 - if (battery->design_capacity == battery->capacity_now)
1037 + if (battery->design_capacity <= battery->capacity_now)
1038 return 1;
1039
1040 /* we don't do any sort of metric based on percentages */
1041 diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
1042 index ca18e0d23df97..db63d3463617a 100644
1043 --- a/drivers/acpi/pmic/intel_pmic.c
1044 +++ b/drivers/acpi/pmic/intel_pmic.c
1045 @@ -216,31 +216,36 @@ static acpi_status intel_pmic_regs_handler(u32 function,
1046 void *handler_context, void *region_context)
1047 {
1048 struct intel_pmic_opregion *opregion = region_context;
1049 - int result = 0;
1050 + int result = -EINVAL;
1051 +
1052 + if (function == ACPI_WRITE) {
1053 + switch (address) {
1054 + case 0:
1055 + return AE_OK;
1056 + case 1:
1057 + opregion->ctx.addr |= (*value64 & 0xff) << 8;
1058 + return AE_OK;
1059 + case 2:
1060 + opregion->ctx.addr |= *value64 & 0xff;
1061 + return AE_OK;
1062 + case 3:
1063 + opregion->ctx.val = *value64 & 0xff;
1064 + return AE_OK;
1065 + case 4:
1066 + if (*value64) {
1067 + result = regmap_write(opregion->regmap, opregion->ctx.addr,
1068 + opregion->ctx.val);
1069 + } else {
1070 + result = regmap_read(opregion->regmap, opregion->ctx.addr,
1071 + &opregion->ctx.val);
1072 + }
1073 + opregion->ctx.addr = 0;
1074 + }
1075 + }
1076
1077 - switch (address) {
1078 - case 0:
1079 - return AE_OK;
1080 - case 1:
1081 - opregion->ctx.addr |= (*value64 & 0xff) << 8;
1082 + if (function == ACPI_READ && address == 3) {
1083 + *value64 = opregion->ctx.val;
1084 return AE_OK;
1085 - case 2:
1086 - opregion->ctx.addr |= *value64 & 0xff;
1087 - return AE_OK;
1088 - case 3:
1089 - opregion->ctx.val = *value64 & 0xff;
1090 - return AE_OK;
1091 - case 4:
1092 - if (*value64) {
1093 - result = regmap_write(opregion->regmap, opregion->ctx.addr,
1094 - opregion->ctx.val);
1095 - } else {
1096 - result = regmap_read(opregion->regmap, opregion->ctx.addr,
1097 - &opregion->ctx.val);
1098 - if (result == 0)
1099 - *value64 = opregion->ctx.val;
1100 - }
1101 - memset(&opregion->ctx, 0x00, sizeof(opregion->ctx));
1102 }
1103
1104 if (result < 0) {
1105 diff --git a/drivers/android/binder.c b/drivers/android/binder.c
1106 index f4c0b62959450..f78f7d06ad9fc 100644
1107 --- a/drivers/android/binder.c
1108 +++ b/drivers/android/binder.c
1109 @@ -303,6 +303,7 @@ struct binder_proc {
1110 struct task_struct *tsk;
1111 struct files_struct *files;
1112 struct mutex files_lock;
1113 + const struct cred *cred;
1114 struct hlist_node deferred_work_node;
1115 int deferred_work;
1116 void *buffer;
1117 @@ -1431,8 +1432,8 @@ static void binder_transaction(struct binder_proc *proc,
1118 return_error = BR_FAILED_REPLY;
1119 goto err_invalid_target_handle;
1120 }
1121 - if (security_binder_transaction(proc->tsk,
1122 - target_proc->tsk) < 0) {
1123 + if (security_binder_transaction(proc->cred,
1124 + target_proc->cred) < 0) {
1125 return_error = BR_FAILED_REPLY;
1126 goto err_invalid_target_handle;
1127 }
1128 @@ -1505,7 +1506,7 @@ static void binder_transaction(struct binder_proc *proc,
1129 t->from = thread;
1130 else
1131 t->from = NULL;
1132 - t->sender_euid = task_euid(proc->tsk);
1133 + t->sender_euid = proc->cred->euid;
1134 t->to_proc = target_proc;
1135 t->to_thread = target_thread;
1136 t->code = tr->code;
1137 @@ -1593,8 +1594,8 @@ static void binder_transaction(struct binder_proc *proc,
1138 return_error = BR_FAILED_REPLY;
1139 goto err_binder_get_ref_for_node_failed;
1140 }
1141 - if (security_binder_transfer_binder(proc->tsk,
1142 - target_proc->tsk)) {
1143 + if (security_binder_transfer_binder(proc->cred,
1144 + target_proc->cred)) {
1145 return_error = BR_FAILED_REPLY;
1146 goto err_binder_get_ref_for_node_failed;
1147 }
1148 @@ -1633,8 +1634,8 @@ static void binder_transaction(struct binder_proc *proc,
1149 return_error = BR_FAILED_REPLY;
1150 goto err_binder_get_ref_failed;
1151 }
1152 - if (security_binder_transfer_binder(proc->tsk,
1153 - target_proc->tsk)) {
1154 + if (security_binder_transfer_binder(proc->cred,
1155 + target_proc->cred)) {
1156 return_error = BR_FAILED_REPLY;
1157 goto err_binder_get_ref_failed;
1158 }
1159 @@ -1697,8 +1698,8 @@ static void binder_transaction(struct binder_proc *proc,
1160 return_error = BR_FAILED_REPLY;
1161 goto err_fget_failed;
1162 }
1163 - if (security_binder_transfer_file(proc->tsk,
1164 - target_proc->tsk,
1165 + if (security_binder_transfer_file(proc->cred,
1166 + target_proc->cred,
1167 file) < 0) {
1168 fput(file);
1169 return_error = BR_FAILED_REPLY;
1170 @@ -2780,7 +2781,7 @@ static int binder_ioctl_set_ctx_mgr(struct file *filp)
1171 ret = -EBUSY;
1172 goto out;
1173 }
1174 - ret = security_binder_set_context_mgr(proc->tsk);
1175 + ret = security_binder_set_context_mgr(proc->cred);
1176 if (ret < 0)
1177 goto out;
1178 if (uid_valid(binder_context_mgr_uid)) {
1179 @@ -3036,6 +3037,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
1180 get_task_struct(current->group_leader);
1181 proc->tsk = current->group_leader;
1182 mutex_init(&proc->files_lock);
1183 + proc->cred = get_cred(filp->f_cred);
1184 INIT_LIST_HEAD(&proc->todo);
1185 init_waitqueue_head(&proc->wait);
1186 proc->default_priority = task_nice(current);
1187 @@ -3241,6 +3243,7 @@ static void binder_deferred_release(struct binder_proc *proc)
1188 }
1189
1190 put_task_struct(proc->tsk);
1191 + put_cred(proc->cred);
1192
1193 binder_debug(BINDER_DEBUG_OPEN_CLOSE,
1194 "%s: %d threads %d, nodes %d (ref %d), refs %d, active transactions %d, buffers %d, pages %d\n",
1195 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
1196 index 16f8fda899815..07f96a0321498 100644
1197 --- a/drivers/ata/libata-eh.c
1198 +++ b/drivers/ata/libata-eh.c
1199 @@ -114,6 +114,12 @@ static const unsigned long ata_eh_identify_timeouts[] = {
1200 ULONG_MAX,
1201 };
1202
1203 +static const unsigned long ata_eh_revalidate_timeouts[] = {
1204 + 15000, /* Some drives are slow to read log pages when waking-up */
1205 + 15000, /* combined time till here is enough even for media access */
1206 + ULONG_MAX,
1207 +};
1208 +
1209 static const unsigned long ata_eh_flush_timeouts[] = {
1210 15000, /* be generous with flush */
1211 15000, /* ditto */
1212 @@ -150,6 +156,8 @@ static const struct ata_eh_cmd_timeout_ent
1213 ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = {
1214 { .commands = CMDS(ATA_CMD_ID_ATA, ATA_CMD_ID_ATAPI),
1215 .timeouts = ata_eh_identify_timeouts, },
1216 + { .commands = CMDS(ATA_CMD_READ_LOG_EXT, ATA_CMD_READ_LOG_DMA_EXT),
1217 + .timeouts = ata_eh_revalidate_timeouts, },
1218 { .commands = CMDS(ATA_CMD_READ_NATIVE_MAX, ATA_CMD_READ_NATIVE_MAX_EXT),
1219 .timeouts = ata_eh_other_timeouts, },
1220 { .commands = CMDS(ATA_CMD_SET_MAX, ATA_CMD_SET_MAX_EXT),
1221 diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c
1222 index 6e8eaa7fe7a6f..b5f849d2f7623 100644
1223 --- a/drivers/auxdisplay/img-ascii-lcd.c
1224 +++ b/drivers/auxdisplay/img-ascii-lcd.c
1225 @@ -283,6 +283,16 @@ static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,
1226 if (msg[count - 1] == '\n')
1227 count--;
1228
1229 + if (!count) {
1230 + /* clear the LCD */
1231 + devm_kfree(&ctx->pdev->dev, ctx->message);
1232 + ctx->message = NULL;
1233 + ctx->message_len = 0;
1234 + memset(ctx->curr, ' ', ctx->cfg->num_chars);
1235 + ctx->cfg->update(ctx);
1236 + return 0;
1237 + }
1238 +
1239 new_msg = devm_kmalloc(&ctx->pdev->dev, count + 1, GFP_KERNEL);
1240 if (!new_msg)
1241 return -ENOMEM;
1242 diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
1243 index e7e92ed34f0c6..34c4a61a954fc 100644
1244 --- a/drivers/cpuidle/sysfs.c
1245 +++ b/drivers/cpuidle/sysfs.c
1246 @@ -413,6 +413,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
1247 &kdev->kobj, "state%d", i);
1248 if (ret) {
1249 kobject_put(&kobj->kobj);
1250 + kfree(kobj);
1251 goto error_state;
1252 }
1253 kobject_uevent(&kobj->kobj, KOBJ_ADD);
1254 @@ -543,6 +544,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev)
1255 &kdev->kobj, "driver");
1256 if (ret) {
1257 kobject_put(&kdrv->kobj);
1258 + kfree(kdrv);
1259 return ret;
1260 }
1261
1262 @@ -629,7 +631,6 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
1263 if (!kdev)
1264 return -ENOMEM;
1265 kdev->dev = dev;
1266 - dev->kobj_dev = kdev;
1267
1268 init_completion(&kdev->kobj_unregister);
1269
1270 @@ -637,9 +638,11 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
1271 "cpuidle");
1272 if (error) {
1273 kobject_put(&kdev->kobj);
1274 + kfree(kdev);
1275 return error;
1276 }
1277
1278 + dev->kobj_dev = kdev;
1279 kobject_uevent(&kdev->kobj, KOBJ_ADD);
1280
1281 return 0;
1282 diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
1283 index c64481160b711..180016e157771 100644
1284 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
1285 +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
1286 @@ -195,6 +195,13 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)
1287 val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset);
1288 } while ((val & int_bit) && (count++ < ADF_IOV_MSG_ACK_MAX_RETRY));
1289
1290 + if (val != msg) {
1291 + dev_dbg(&GET_DEV(accel_dev),
1292 + "Collision - PFVF CSR overwritten by remote function\n");
1293 + ret = -EIO;
1294 + goto out;
1295 + }
1296 +
1297 if (val & int_bit) {
1298 dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n");
1299 val &= ~int_bit;
1300 @@ -243,6 +250,11 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
1301
1302 /* Read message from the VF */
1303 msg = ADF_CSR_RD(pmisc_addr, hw_data->get_pf2vf_offset(vf_nr));
1304 + if (!(msg & ADF_VF2PF_INT)) {
1305 + dev_info(&GET_DEV(accel_dev),
1306 + "Spurious VF2PF interrupt, msg %X. Ignored\n", msg);
1307 + goto out;
1308 + }
1309
1310 /* To ACK, clear the VF2PFINT bit */
1311 msg &= ~ADF_VF2PF_INT;
1312 @@ -326,6 +338,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
1313 if (resp && adf_iov_putmsg(accel_dev, resp, vf_nr))
1314 dev_err(&GET_DEV(accel_dev), "Failed to send response to VF\n");
1315
1316 +out:
1317 /* re-enable interrupt on PF from this VF */
1318 adf_enable_vf2pf_interrupts(accel_dev, (1 << vf_nr));
1319 return;
1320 diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
1321 index 36db3c443e7e4..6fa1447d05829 100644
1322 --- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
1323 +++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
1324 @@ -123,6 +123,11 @@ static void adf_pf2vf_bh_handler(void *data)
1325
1326 /* Read the message from PF */
1327 msg = ADF_CSR_RD(pmisc_bar_addr, hw_data->get_pf2vf_offset(0));
1328 + if (!(msg & ADF_PF2VF_INT)) {
1329 + dev_info(&GET_DEV(accel_dev),
1330 + "Spurious PF2VF interrupt, msg %X. Ignored\n", msg);
1331 + goto out;
1332 + }
1333
1334 if (!(msg & ADF_PF2VF_MSGORIGIN_SYSTEM))
1335 /* Ignore legacy non-system (non-kernel) PF2VF messages */
1336 @@ -171,6 +176,7 @@ static void adf_pf2vf_bh_handler(void *data)
1337 msg &= ~BIT(0);
1338 ADF_CSR_WR(pmisc_bar_addr, hw_data->get_pf2vf_offset(0), msg);
1339
1340 +out:
1341 /* Re-enable PF2VF interrupts */
1342 adf_enable_pf2vf_interrupts(accel_dev);
1343 return;
1344 diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
1345 index 12d9048293245..a505be9ef96da 100644
1346 --- a/drivers/dma/at_xdmac.c
1347 +++ b/drivers/dma/at_xdmac.c
1348 @@ -156,7 +156,7 @@
1349 #define AT_XDMAC_CC_WRIP (0x1 << 23) /* Write in Progress (read only) */
1350 #define AT_XDMAC_CC_WRIP_DONE (0x0 << 23)
1351 #define AT_XDMAC_CC_WRIP_IN_PROGRESS (0x1 << 23)
1352 -#define AT_XDMAC_CC_PERID(i) (0x7f & (i) << 24) /* Channel Peripheral Identifier */
1353 +#define AT_XDMAC_CC_PERID(i) ((0x7f & (i)) << 24) /* Channel Peripheral Identifier */
1354 #define AT_XDMAC_CDS_MSP 0x2C /* Channel Data Stride Memory Set Pattern */
1355 #define AT_XDMAC_CSUS 0x30 /* Channel Source Microblock Stride */
1356 #define AT_XDMAC_CDUS 0x34 /* Channel Destination Microblock Stride */
1357 diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
1358 index 882ff9448c3ba..6537b8ec03934 100644
1359 --- a/drivers/dma/dmaengine.h
1360 +++ b/drivers/dma/dmaengine.h
1361 @@ -167,7 +167,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx,
1362 static inline bool
1363 dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb)
1364 {
1365 - return (cb->callback) ? true : false;
1366 + return cb->callback || cb->callback_result;
1367 }
1368
1369 #endif
1370 diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
1371 index e9391950a8437..94194ead73636 100644
1372 --- a/drivers/edac/sb_edac.c
1373 +++ b/drivers/edac/sb_edac.c
1374 @@ -1009,7 +1009,7 @@ static u64 haswell_get_tohm(struct sbridge_pvt *pvt)
1375 pci_read_config_dword(pvt->info.pci_vtd, HASWELL_TOHM_1, &reg);
1376 rc = ((reg << 6) | rc) << 26;
1377
1378 - return rc | 0x1ffffff;
1379 + return rc | 0x3ffffff;
1380 }
1381
1382 static u64 knl_get_tolm(struct sbridge_pvt *pvt)
1383 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1384 index 694f631d9c90d..eb79d0d3d34f1 100644
1385 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1386 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1387 @@ -844,6 +844,7 @@ static int amdgpu_connector_vga_get_modes(struct drm_connector *connector)
1388
1389 amdgpu_connector_get_edid(connector);
1390 ret = amdgpu_connector_ddc_get_modes(connector);
1391 + amdgpu_get_native_mode(connector);
1392
1393 return ret;
1394 }
1395 diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
1396 index 7899fc1dcdb08..c4fd742ff917a 100644
1397 --- a/drivers/gpu/drm/drm_plane_helper.c
1398 +++ b/drivers/gpu/drm/drm_plane_helper.c
1399 @@ -246,7 +246,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
1400 .crtc_w = drm_rect_width(dst),
1401 .crtc_h = drm_rect_height(dst),
1402 .rotation = rotation,
1403 - .visible = *visible,
1404 };
1405 int ret;
1406
1407 diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
1408 index 983ce7965c7ff..dfce39f02f8d4 100644
1409 --- a/drivers/gpu/drm/msm/msm_gem.c
1410 +++ b/drivers/gpu/drm/msm/msm_gem.c
1411 @@ -871,7 +871,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev,
1412
1413 ret = msm_gem_new_impl(dev, size, flags, NULL, &obj);
1414 if (ret)
1415 - goto fail;
1416 + return ERR_PTR(ret);
1417
1418 if (use_pages(obj)) {
1419 ret = drm_gem_object_init(dev, obj, size);
1420 @@ -910,7 +910,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
1421 mutex_unlock(&dev->struct_mutex);
1422
1423 if (ret)
1424 - goto fail;
1425 + return ERR_PTR(ret);
1426
1427 drm_gem_private_object_init(dev, obj, size);
1428
1429 diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
1430 index d2f57c52f7db2..c001ed8e7dd90 100644
1431 --- a/drivers/gpu/drm/udl/udl_connector.c
1432 +++ b/drivers/gpu/drm/udl/udl_connector.c
1433 @@ -37,7 +37,7 @@ static u8 *udl_get_edid(struct udl_device *udl)
1434 ret = usb_control_msg(udl->udev,
1435 usb_rcvctrlpipe(udl->udev, 0), (0x02),
1436 (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2,
1437 - HZ);
1438 + 1000);
1439 if (ret < 1) {
1440 DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
1441 goto error;
1442 diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
1443 index 8d7f865c1133f..9d3605df1f489 100644
1444 --- a/drivers/hv/hyperv_vmbus.h
1445 +++ b/drivers/hv/hyperv_vmbus.h
1446 @@ -26,6 +26,7 @@
1447 #define _HYPERV_VMBUS_H
1448
1449 #include <linux/list.h>
1450 +#include <linux/bitops.h>
1451 #include <asm/sync_bitops.h>
1452 #include <linux/atomic.h>
1453 #include <linux/hyperv.h>
1454 diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
1455 index e0a1a118514f9..8b11d2fdf80ab 100644
1456 --- a/drivers/hwmon/hwmon.c
1457 +++ b/drivers/hwmon/hwmon.c
1458 @@ -592,8 +592,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
1459 dev_set_drvdata(hdev, drvdata);
1460 dev_set_name(hdev, HWMON_ID_FORMAT, id);
1461 err = device_register(hdev);
1462 - if (err)
1463 - goto free_hwmon;
1464 + if (err) {
1465 + put_device(hdev);
1466 + goto ida_remove;
1467 + }
1468
1469 if (chip && chip->ops->is_visible && chip->ops->read &&
1470 chip->info[0]->type == hwmon_chip &&
1471 diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
1472 index a3d912cd3b8d7..5081fd7e8fddc 100644
1473 --- a/drivers/hwmon/pmbus/lm25066.c
1474 +++ b/drivers/hwmon/pmbus/lm25066.c
1475 @@ -69,22 +69,27 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = {
1476 [lm25056] = {
1477 [PSC_VOLTAGE_IN] = {
1478 .m = 16296,
1479 + .b = 1343,
1480 .R = -2,
1481 },
1482 [PSC_CURRENT_IN] = {
1483 .m = 13797,
1484 + .b = -1833,
1485 .R = -2,
1486 },
1487 [PSC_CURRENT_IN_L] = {
1488 .m = 6726,
1489 + .b = -537,
1490 .R = -2,
1491 },
1492 [PSC_POWER] = {
1493 .m = 5501,
1494 + .b = -2908,
1495 .R = -3,
1496 },
1497 [PSC_POWER_L] = {
1498 .m = 26882,
1499 + .b = -5646,
1500 .R = -4,
1501 },
1502 [PSC_TEMPERATURE] = {
1503 @@ -96,26 +101,32 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = {
1504 [lm25066] = {
1505 [PSC_VOLTAGE_IN] = {
1506 .m = 22070,
1507 + .b = -1800,
1508 .R = -2,
1509 },
1510 [PSC_VOLTAGE_OUT] = {
1511 .m = 22070,
1512 + .b = -1800,
1513 .R = -2,
1514 },
1515 [PSC_CURRENT_IN] = {
1516 .m = 13661,
1517 + .b = -5200,
1518 .R = -2,
1519 },
1520 [PSC_CURRENT_IN_L] = {
1521 .m = 6852,
1522 + .b = -3100,
1523 .R = -2,
1524 },
1525 [PSC_POWER] = {
1526 .m = 736,
1527 + .b = -3300,
1528 .R = -2,
1529 },
1530 [PSC_POWER_L] = {
1531 .m = 369,
1532 + .b = -1900,
1533 .R = -2,
1534 },
1535 [PSC_TEMPERATURE] = {
1536 @@ -155,26 +166,32 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = {
1537 [lm5064] = {
1538 [PSC_VOLTAGE_IN] = {
1539 .m = 4611,
1540 + .b = -642,
1541 .R = -2,
1542 },
1543 [PSC_VOLTAGE_OUT] = {
1544 .m = 4621,
1545 + .b = 423,
1546 .R = -2,
1547 },
1548 [PSC_CURRENT_IN] = {
1549 .m = 10742,
1550 + .b = 1552,
1551 .R = -2,
1552 },
1553 [PSC_CURRENT_IN_L] = {
1554 .m = 5456,
1555 + .b = 2118,
1556 .R = -2,
1557 },
1558 [PSC_POWER] = {
1559 .m = 1204,
1560 + .b = 8524,
1561 .R = -3,
1562 },
1563 [PSC_POWER_L] = {
1564 .m = 612,
1565 + .b = 11202,
1566 .R = -3,
1567 },
1568 [PSC_TEMPERATURE] = {
1569 @@ -184,26 +201,32 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = {
1570 [lm5066] = {
1571 [PSC_VOLTAGE_IN] = {
1572 .m = 4587,
1573 + .b = -1200,
1574 .R = -2,
1575 },
1576 [PSC_VOLTAGE_OUT] = {
1577 .m = 4587,
1578 + .b = -2400,
1579 .R = -2,
1580 },
1581 [PSC_CURRENT_IN] = {
1582 .m = 10753,
1583 + .b = -1200,
1584 .R = -2,
1585 },
1586 [PSC_CURRENT_IN_L] = {
1587 .m = 5405,
1588 + .b = -600,
1589 .R = -2,
1590 },
1591 [PSC_POWER] = {
1592 .m = 1204,
1593 + .b = -6000,
1594 .R = -3,
1595 },
1596 [PSC_POWER_L] = {
1597 .m = 605,
1598 + .b = -8000,
1599 .R = -3,
1600 },
1601 [PSC_TEMPERATURE] = {
1602 diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
1603 index ad17d88d85736..63f47e07345c0 100644
1604 --- a/drivers/i2c/busses/i2c-xlr.c
1605 +++ b/drivers/i2c/busses/i2c-xlr.c
1606 @@ -434,11 +434,15 @@ static int xlr_i2c_probe(struct platform_device *pdev)
1607 i2c_set_adapdata(&priv->adap, priv);
1608 ret = i2c_add_numbered_adapter(&priv->adap);
1609 if (ret < 0)
1610 - return ret;
1611 + goto err_unprepare_clk;
1612
1613 platform_set_drvdata(pdev, priv);
1614 dev_info(&priv->adap.dev, "Added I2C Bus.\n");
1615 return 0;
1616 +
1617 +err_unprepare_clk:
1618 + clk_unprepare(clk);
1619 + return ret;
1620 }
1621
1622 static int xlr_i2c_remove(struct platform_device *pdev)
1623 diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
1624 index b555552a0d803..d3a3d62869d83 100644
1625 --- a/drivers/iio/dac/ad5446.c
1626 +++ b/drivers/iio/dac/ad5446.c
1627 @@ -510,8 +510,15 @@ static int ad5622_write(struct ad5446_state *st, unsigned val)
1628 {
1629 struct i2c_client *client = to_i2c_client(st->dev);
1630 __be16 data = cpu_to_be16(val);
1631 + int ret;
1632 +
1633 + ret = i2c_master_send(client, (char *)&data, sizeof(data));
1634 + if (ret < 0)
1635 + return ret;
1636 + if (ret != sizeof(data))
1637 + return -EIO;
1638
1639 - return i2c_master_send(client, (char *)&data, sizeof(data));
1640 + return 0;
1641 }
1642
1643 /**
1644 diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
1645 index 7284a9176844e..718d817265795 100644
1646 --- a/drivers/infiniband/hw/mlx4/qp.c
1647 +++ b/drivers/infiniband/hw/mlx4/qp.c
1648 @@ -773,8 +773,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
1649 if (dev->steering_support ==
1650 MLX4_STEERING_MODE_DEVICE_MANAGED)
1651 qp->flags |= MLX4_IB_QP_NETIF;
1652 - else
1653 + else {
1654 + err = -EINVAL;
1655 goto err;
1656 + }
1657 }
1658
1659 memcpy(&backup_cap, &init_attr->cap, sizeof(backup_cap));
1660 diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
1661 index 7603a1641c7d8..38c651f1a606b 100644
1662 --- a/drivers/infiniband/hw/qedr/verbs.c
1663 +++ b/drivers/infiniband/hw/qedr/verbs.c
1664 @@ -2015,15 +2015,18 @@ int qedr_query_qp(struct ib_qp *ibqp,
1665 int rc = 0;
1666
1667 memset(&params, 0, sizeof(params));
1668 -
1669 - rc = dev->ops->rdma_query_qp(dev->rdma_ctx, qp->qed_qp, &params);
1670 - if (rc)
1671 - goto err;
1672 -
1673 memset(qp_attr, 0, sizeof(*qp_attr));
1674 memset(qp_init_attr, 0, sizeof(*qp_init_attr));
1675
1676 - qp_attr->qp_state = qedr_get_ibqp_state(params.state);
1677 + if (qp->qp_type != IB_QPT_GSI) {
1678 + rc = dev->ops->rdma_query_qp(dev->rdma_ctx, qp->qed_qp, &params);
1679 + if (rc)
1680 + goto err;
1681 + qp_attr->qp_state = qedr_get_ibqp_state(params.state);
1682 + } else {
1683 + qp_attr->qp_state = qedr_get_ibqp_state(QED_ROCE_QP_STATE_RTS);
1684 + }
1685 +
1686 qp_attr->cur_qp_state = qedr_get_ibqp_state(params.state);
1687 qp_attr->path_mtu = iboe_get_mtu(params.mtu);
1688 qp_attr->path_mig_state = IB_MIG_MIGRATED;
1689 diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
1690 index 13ed2cc6eaa2a..9f7817e12775a 100644
1691 --- a/drivers/infiniband/sw/rxe/rxe_param.h
1692 +++ b/drivers/infiniband/sw/rxe/rxe_param.h
1693 @@ -144,7 +144,7 @@ enum rxe_port_param {
1694 RXE_PORT_MAX_MTU = IB_MTU_4096,
1695 RXE_PORT_ACTIVE_MTU = IB_MTU_256,
1696 RXE_PORT_GID_TBL_LEN = 1024,
1697 - RXE_PORT_PORT_CAP_FLAGS = RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP,
1698 + RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP,
1699 RXE_PORT_MAX_MSG_SZ = 0x800000,
1700 RXE_PORT_BAD_PKEY_CNTR = 0,
1701 RXE_PORT_QKEY_VIOL_CNTR = 0,
1702 diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
1703 index 15be3ee6cc501..4aba40c881a73 100644
1704 --- a/drivers/input/mouse/elantech.c
1705 +++ b/drivers/input/mouse/elantech.c
1706 @@ -431,6 +431,19 @@ static void elantech_report_trackpoint(struct psmouse *psmouse,
1707 case 0x16008020U:
1708 case 0x26800010U:
1709 case 0x36808000U:
1710 +
1711 + /*
1712 + * This firmware misreport coordinates for trackpoint
1713 + * occasionally. Discard packets outside of [-127, 127] range
1714 + * to prevent cursor jumps.
1715 + */
1716 + if (packet[4] == 0x80 || packet[5] == 0x80 ||
1717 + packet[1] >> 7 == packet[4] >> 7 ||
1718 + packet[2] >> 7 == packet[5] >> 7) {
1719 + elantech_debug("discarding packet [%6ph]\n", packet);
1720 + break;
1721 +
1722 + }
1723 x = packet[4] - (int)((packet[1]^0x80) << 1);
1724 y = (int)((packet[2]^0x80) << 1) - packet[5];
1725
1726 diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
1727 index 3049bccf24227..323b86b38b3a3 100644
1728 --- a/drivers/input/serio/i8042-x86ia64io.h
1729 +++ b/drivers/input/serio/i8042-x86ia64io.h
1730 @@ -276,6 +276,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
1731 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
1732 },
1733 },
1734 + {
1735 + /* Fujitsu Lifebook T725 laptop */
1736 + .matches = {
1737 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1738 + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"),
1739 + },
1740 + },
1741 {
1742 /* Fujitsu Lifebook U745 */
1743 .matches = {
1744 @@ -916,6 +923,13 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
1745 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"),
1746 },
1747 },
1748 + {
1749 + /* Fujitsu Lifebook T725 laptop */
1750 + .matches = {
1751 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
1752 + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"),
1753 + },
1754 + },
1755 {
1756 /* Fujitsu U574 laptop */
1757 /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
1758 diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c
1759 index daa4ae89e466e..7ed976d436b25 100644
1760 --- a/drivers/irqchip/irq-bcm6345-l1.c
1761 +++ b/drivers/irqchip/irq-bcm6345-l1.c
1762 @@ -143,7 +143,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)
1763 for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) {
1764 irq = irq_linear_revmap(intc->domain, base + hwirq);
1765 if (irq)
1766 - do_IRQ(irq);
1767 + generic_handle_irq(irq);
1768 else
1769 spurious_interrupt();
1770 }
1771 diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
1772 index c25ce5af091ad..e92ab62cc87d9 100644
1773 --- a/drivers/irqchip/irq-s3c24xx.c
1774 +++ b/drivers/irqchip/irq-s3c24xx.c
1775 @@ -368,11 +368,25 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
1776 asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
1777 {
1778 do {
1779 - if (likely(s3c_intc[0]))
1780 - if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
1781 - continue;
1782 + /*
1783 + * For platform based machines, neither ERR nor NULL can happen here.
1784 + * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds:
1785 + *
1786 + * s3c_intc[0] = s3c24xx_init_intc()
1787 + *
1788 + * If this fails, the next calls to s3c24xx_init_intc() won't be executed.
1789 + *
1790 + * For DT machine, s3c_init_intc_of() could set the IRQ handler without
1791 + * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no
1792 + * such code path, so again the s3c_intc[0] will have a valid pointer if
1793 + * set_handle_irq() is called.
1794 + *
1795 + * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something.
1796 + */
1797 + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
1798 + continue;
1799
1800 - if (s3c_intc[2])
1801 + if (!IS_ERR_OR_NULL(s3c_intc[2]))
1802 if (s3c24xx_handle_intc(s3c_intc[2], regs, 64))
1803 continue;
1804
1805 diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
1806 index 237737fec09c1..e6159faff45af 100644
1807 --- a/drivers/media/i2c/mt9p031.c
1808 +++ b/drivers/media/i2c/mt9p031.c
1809 @@ -81,7 +81,9 @@
1810 #define MT9P031_PIXEL_CLOCK_INVERT (1 << 15)
1811 #define MT9P031_PIXEL_CLOCK_SHIFT(n) ((n) << 8)
1812 #define MT9P031_PIXEL_CLOCK_DIVIDE(n) ((n) << 0)
1813 -#define MT9P031_FRAME_RESTART 0x0b
1814 +#define MT9P031_RESTART 0x0b
1815 +#define MT9P031_FRAME_PAUSE_RESTART (1 << 1)
1816 +#define MT9P031_FRAME_RESTART (1 << 0)
1817 #define MT9P031_SHUTTER_DELAY 0x0c
1818 #define MT9P031_RST 0x0d
1819 #define MT9P031_RST_ENABLE 1
1820 @@ -448,9 +450,23 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)
1821 static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
1822 {
1823 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
1824 + struct i2c_client *client = v4l2_get_subdevdata(subdev);
1825 + int val;
1826 int ret;
1827
1828 if (!enable) {
1829 + /* enable pause restart */
1830 + val = MT9P031_FRAME_PAUSE_RESTART;
1831 + ret = mt9p031_write(client, MT9P031_RESTART, val);
1832 + if (ret < 0)
1833 + return ret;
1834 +
1835 + /* enable restart + keep pause restart set */
1836 + val |= MT9P031_FRAME_RESTART;
1837 + ret = mt9p031_write(client, MT9P031_RESTART, val);
1838 + if (ret < 0)
1839 + return ret;
1840 +
1841 /* Stop sensor readout */
1842 ret = mt9p031_set_output_control(mt9p031,
1843 MT9P031_OUTPUT_CONTROL_CEN, 0);
1844 @@ -470,6 +486,16 @@ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
1845 if (ret < 0)
1846 return ret;
1847
1848 + /*
1849 + * - clear pause restart
1850 + * - don't clear restart as clearing restart manually can cause
1851 + * undefined behavior
1852 + */
1853 + val = MT9P031_FRAME_RESTART;
1854 + ret = mt9p031_write(client, MT9P031_RESTART, val);
1855 + if (ret < 0)
1856 + return ret;
1857 +
1858 return mt9p031_pll_enable(mt9p031);
1859 }
1860
1861 diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
1862 index b078ac2a682cf..48e1f4a128019 100644
1863 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
1864 +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
1865 @@ -266,19 +266,24 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id)
1866 if ((reg40 & AVL_IRQ_ASSERTED) != 0) {
1867 /* IRQ is being signaled */
1868 reg_isr = readw(ndev->bmmio0 + REG_ISR);
1869 - if (reg_isr & NETUP_UNIDVB_IRQ_I2C0) {
1870 - iret = netup_i2c_interrupt(&ndev->i2c[0]);
1871 - } else if (reg_isr & NETUP_UNIDVB_IRQ_I2C1) {
1872 - iret = netup_i2c_interrupt(&ndev->i2c[1]);
1873 - } else if (reg_isr & NETUP_UNIDVB_IRQ_SPI) {
1874 + if (reg_isr & NETUP_UNIDVB_IRQ_SPI)
1875 iret = netup_spi_interrupt(ndev->spi);
1876 - } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA1) {
1877 - iret = netup_dma_interrupt(&ndev->dma[0]);
1878 - } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA2) {
1879 - iret = netup_dma_interrupt(&ndev->dma[1]);
1880 - } else if (reg_isr & NETUP_UNIDVB_IRQ_CI) {
1881 - iret = netup_ci_interrupt(ndev);
1882 + else if (!ndev->old_fw) {
1883 + if (reg_isr & NETUP_UNIDVB_IRQ_I2C0) {
1884 + iret = netup_i2c_interrupt(&ndev->i2c[0]);
1885 + } else if (reg_isr & NETUP_UNIDVB_IRQ_I2C1) {
1886 + iret = netup_i2c_interrupt(&ndev->i2c[1]);
1887 + } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA1) {
1888 + iret = netup_dma_interrupt(&ndev->dma[0]);
1889 + } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA2) {
1890 + iret = netup_dma_interrupt(&ndev->dma[1]);
1891 + } else if (reg_isr & NETUP_UNIDVB_IRQ_CI) {
1892 + iret = netup_ci_interrupt(ndev);
1893 + } else {
1894 + goto err;
1895 + }
1896 } else {
1897 +err:
1898 dev_err(&pci_dev->dev,
1899 "%s(): unknown interrupt 0x%x\n",
1900 __func__, reg_isr);
1901 diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c
1902 index c9bf58c978780..9c332ce8cdfec 100644
1903 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
1904 +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
1905 @@ -801,7 +801,8 @@ static int mtk_vpu_probe(struct platform_device *pdev)
1906 vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt");
1907 if (!vpu->wdt.wq) {
1908 dev_err(dev, "initialize wdt workqueue failed\n");
1909 - return -ENOMEM;
1910 + ret = -ENOMEM;
1911 + goto clk_unprepare;
1912 }
1913 INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func);
1914 mutex_init(&vpu->vpu_mutex);
1915 @@ -900,6 +901,8 @@ disable_vpu_clk:
1916 vpu_clock_disable(vpu);
1917 workqueue_destroy:
1918 destroy_workqueue(vpu->wdt.wq);
1919 +clk_unprepare:
1920 + clk_unprepare(vpu->clk);
1921
1922 return ret;
1923 }
1924 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
1925 index 8051c13456922..0ff972b8d9671 100644
1926 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
1927 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
1928 @@ -1160,7 +1160,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
1929 spin_lock_init(&dev->condlock);
1930 dev->plat_dev = pdev;
1931 if (!dev->plat_dev) {
1932 - dev_err(&pdev->dev, "No platform data specified\n");
1933 + mfc_err("No platform data specified\n");
1934 return -ENODEV;
1935 }
1936
1937 diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
1938 index 8f3086773db46..6162aa5758428 100644
1939 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c
1940 +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
1941 @@ -24,7 +24,7 @@
1942
1943 /* driver definitions */
1944 #define DRIVER_AUTHOR "Joonyoung Shim <jy0922.shim@samsung.com>";
1945 -#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
1946 +#define DRIVER_CARD "Silicon Labs Si470x FM Radio"
1947 #define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers"
1948 #define DRIVER_VERSION "1.0.2"
1949
1950 diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
1951 index 1d045a8c29e21..a8a0ff9a1f838 100644
1952 --- a/drivers/media/radio/si470x/radio-si470x-usb.c
1953 +++ b/drivers/media/radio/si470x/radio-si470x-usb.c
1954 @@ -29,7 +29,7 @@
1955
1956 /* driver definitions */
1957 #define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>"
1958 -#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
1959 +#define DRIVER_CARD "Silicon Labs Si470x FM Radio"
1960 #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers"
1961 #define DRIVER_VERSION "1.0.10"
1962
1963 diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
1964 index 7d3e50d94d86a..e8bc02ce9b2ff 100644
1965 --- a/drivers/media/rc/ite-cir.c
1966 +++ b/drivers/media/rc/ite-cir.c
1967 @@ -299,7 +299,7 @@ static irqreturn_t ite_cir_isr(int irq, void *data)
1968 }
1969
1970 /* check for the receive interrupt */
1971 - if (iflags & ITE_IRQ_RX_FIFO) {
1972 + if (iflags & (ITE_IRQ_RX_FIFO | ITE_IRQ_RX_FIFO_OVERRUN)) {
1973 /* read the FIFO bytes */
1974 rx_bytes =
1975 dev->params.get_rx_bytes(dev, rx_buf,
1976 diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
1977 index d9f88a4a96bd1..b78d70685b1c3 100644
1978 --- a/drivers/media/rc/mceusb.c
1979 +++ b/drivers/media/rc/mceusb.c
1980 @@ -1090,6 +1090,7 @@ static void mceusb_dev_recv(struct urb *urb)
1981 case -ECONNRESET:
1982 case -ENOENT:
1983 case -EILSEQ:
1984 + case -EPROTO:
1985 case -ESHUTDOWN:
1986 usb_unlink_urb(urb);
1987 return;
1988 diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c
1989 index 2e711362847e4..382c8075ef524 100644
1990 --- a/drivers/media/usb/dvb-usb/az6027.c
1991 +++ b/drivers/media/usb/dvb-usb/az6027.c
1992 @@ -394,6 +394,7 @@ static struct rc_map_table rc_map_az6027_table[] = {
1993 /* remote control stuff (does not work with my box) */
1994 static int az6027_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
1995 {
1996 + *state = REMOTE_NO_KEY_PRESSED;
1997 return 0;
1998 }
1999
2000 diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c
2001 index bcacb0f220282..3e45642ae186b 100644
2002 --- a/drivers/media/usb/dvb-usb/dibusb-common.c
2003 +++ b/drivers/media/usb/dvb-usb/dibusb-common.c
2004 @@ -226,7 +226,7 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
2005 u8 *buf;
2006 int rc;
2007
2008 - buf = kmalloc(2, GFP_KERNEL);
2009 + buf = kzalloc(2, GFP_KERNEL);
2010 if (!buf)
2011 return -ENOMEM;
2012
2013 diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
2014 index 4a270f88aa18c..2b1e06e825f0d 100644
2015 --- a/drivers/media/usb/uvc/uvc_v4l2.c
2016 +++ b/drivers/media/usb/uvc/uvc_v4l2.c
2017 @@ -451,10 +451,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
2018 uvc_simplify_fraction(&timeperframe.numerator,
2019 &timeperframe.denominator, 8, 333);
2020
2021 - if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
2022 + if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
2023 parm->parm.capture.timeperframe = timeperframe;
2024 - else
2025 + parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
2026 + } else {
2027 parm->parm.output.timeperframe = timeperframe;
2028 + parm->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
2029 + }
2030
2031 return 0;
2032 }
2033 diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
2034 index 38b945eb410f3..9c0e70b047c39 100644
2035 --- a/drivers/memory/fsl_ifc.c
2036 +++ b/drivers/memory/fsl_ifc.c
2037 @@ -276,7 +276,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
2038
2039 ret = fsl_ifc_ctrl_init(fsl_ifc_ctrl_dev);
2040 if (ret < 0)
2041 - goto err;
2042 + goto err_unmap_nandirq;
2043
2044 init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
2045
2046 @@ -285,7 +285,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
2047 if (ret != 0) {
2048 dev_err(&dev->dev, "failed to install irq (%d)\n",
2049 fsl_ifc_ctrl_dev->irq);
2050 - goto err_irq;
2051 + goto err_unmap_nandirq;
2052 }
2053
2054 if (fsl_ifc_ctrl_dev->nand_irq) {
2055 @@ -294,17 +294,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
2056 if (ret != 0) {
2057 dev_err(&dev->dev, "failed to install irq (%d)\n",
2058 fsl_ifc_ctrl_dev->nand_irq);
2059 - goto err_nandirq;
2060 + goto err_free_irq;
2061 }
2062 }
2063
2064 return 0;
2065
2066 -err_nandirq:
2067 - free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev);
2068 - irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
2069 -err_irq:
2070 +err_free_irq:
2071 free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
2072 +err_unmap_nandirq:
2073 + irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
2074 irq_dispose_mapping(fsl_ifc_ctrl_dev->irq);
2075 err:
2076 iounmap(fsl_ifc_ctrl_dev->gregs);
2077 diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
2078 index aacf584f2a42e..45136b700d2c4 100644
2079 --- a/drivers/memstick/core/ms_block.c
2080 +++ b/drivers/memstick/core/ms_block.c
2081 @@ -1730,7 +1730,7 @@ static int msb_init_card(struct memstick_dev *card)
2082 msb->pages_in_block = boot_block->attr.block_size * 2;
2083 msb->block_size = msb->page_size * msb->pages_in_block;
2084
2085 - if (msb->page_size > PAGE_SIZE) {
2086 + if ((size_t)msb->page_size > PAGE_SIZE) {
2087 /* this isn't supported by linux at all, anyway*/
2088 dbg("device page %d size isn't supported", msb->page_size);
2089 return -EINVAL;
2090 diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
2091 index 08fa6400d2558..ba6cd576e9979 100644
2092 --- a/drivers/memstick/host/jmb38x_ms.c
2093 +++ b/drivers/memstick/host/jmb38x_ms.c
2094 @@ -905,7 +905,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
2095
2096 iounmap(host->addr);
2097 err_out_free:
2098 - kfree(msh);
2099 + memstick_free_host(msh);
2100 return NULL;
2101 }
2102
2103 diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
2104 index 2539984c1db1c..256634ec58b63 100644
2105 --- a/drivers/memstick/host/r592.c
2106 +++ b/drivers/memstick/host/r592.c
2107 @@ -841,15 +841,15 @@ static void r592_remove(struct pci_dev *pdev)
2108 }
2109 memstick_remove_host(dev->host);
2110
2111 + if (dev->dummy_dma_page)
2112 + dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page,
2113 + dev->dummy_dma_page_physical_address);
2114 +
2115 free_irq(dev->irq, dev);
2116 iounmap(dev->mmio);
2117 pci_release_regions(pdev);
2118 pci_disable_device(pdev);
2119 memstick_free_host(dev->host);
2120 -
2121 - if (dev->dummy_dma_page)
2122 - dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page,
2123 - dev->dummy_dma_page_physical_address);
2124 }
2125
2126 #ifdef CONFIG_PM_SLEEP
2127 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
2128 index 5274f503a39ad..5c0bc817019f7 100644
2129 --- a/drivers/mmc/host/Kconfig
2130 +++ b/drivers/mmc/host/Kconfig
2131 @@ -367,7 +367,7 @@ config MMC_OMAP_HS
2132
2133 config MMC_WBSD
2134 tristate "Winbond W83L51xD SD/MMC Card Interface support"
2135 - depends on ISA_DMA_API
2136 + depends on ISA_DMA_API && !M68K
2137 help
2138 This selects the Winbond(R) W83L51xD Secure digital and
2139 Multimedia card Interface.
2140 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
2141 index 209bdf0317b34..1c80717af333e 100644
2142 --- a/drivers/mmc/host/dw_mmc.c
2143 +++ b/drivers/mmc/host/dw_mmc.c
2144 @@ -1862,7 +1862,8 @@ static void dw_mci_tasklet_func(unsigned long priv)
2145 * delayed. Allowing the transfer to take place
2146 * avoids races and keeps things simple.
2147 */
2148 - if (err != -ETIMEDOUT) {
2149 + if (err != -ETIMEDOUT &&
2150 + host->dir_status == DW_MCI_RECV_STATUS) {
2151 state = STATE_SENDING_DATA;
2152 continue;
2153 }
2154 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
2155 index 687fd68fbbcd1..77a03301b2a58 100644
2156 --- a/drivers/mmc/host/mxs-mmc.c
2157 +++ b/drivers/mmc/host/mxs-mmc.c
2158 @@ -571,6 +571,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = {
2159 };
2160 MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids);
2161
2162 +static void mxs_mmc_regulator_disable(void *regulator)
2163 +{
2164 + regulator_disable(regulator);
2165 +}
2166 +
2167 static int mxs_mmc_probe(struct platform_device *pdev)
2168 {
2169 const struct of_device_id *of_id =
2170 @@ -614,6 +619,11 @@ static int mxs_mmc_probe(struct platform_device *pdev)
2171 "Failed to enable vmmc regulator: %d\n", ret);
2172 goto out_mmc_free;
2173 }
2174 +
2175 + ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable,
2176 + reg_vmmc);
2177 + if (ret)
2178 + goto out_mmc_free;
2179 }
2180
2181 ssp->clk = devm_clk_get(&pdev->dev, NULL);
2182 diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c
2183 index 68be79ba571df..a0c2101f0b486 100644
2184 --- a/drivers/mtd/spi-nor/hisi-sfc.c
2185 +++ b/drivers/mtd/spi-nor/hisi-sfc.c
2186 @@ -467,7 +467,6 @@ static int hisi_spi_nor_remove(struct platform_device *pdev)
2187
2188 hisi_spi_nor_unregister_all(host);
2189 mutex_destroy(&host->lock);
2190 - clk_disable_unprepare(host->clk);
2191 return 0;
2192 }
2193
2194 diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
2195 index 68bbac4715c35..1e1e77a40f182 100644
2196 --- a/drivers/net/bonding/bond_sysfs_slave.c
2197 +++ b/drivers/net/bonding/bond_sysfs_slave.c
2198 @@ -112,15 +112,15 @@ static ssize_t ad_partner_oper_port_state_show(struct slave *slave, char *buf)
2199 }
2200 static SLAVE_ATTR_RO(ad_partner_oper_port_state);
2201
2202 -static const struct slave_attribute *slave_attrs[] = {
2203 - &slave_attr_state,
2204 - &slave_attr_mii_status,
2205 - &slave_attr_link_failure_count,
2206 - &slave_attr_perm_hwaddr,
2207 - &slave_attr_queue_id,
2208 - &slave_attr_ad_aggregator_id,
2209 - &slave_attr_ad_actor_oper_port_state,
2210 - &slave_attr_ad_partner_oper_port_state,
2211 +static const struct attribute *slave_attrs[] = {
2212 + &slave_attr_state.attr,
2213 + &slave_attr_mii_status.attr,
2214 + &slave_attr_link_failure_count.attr,
2215 + &slave_attr_perm_hwaddr.attr,
2216 + &slave_attr_queue_id.attr,
2217 + &slave_attr_ad_aggregator_id.attr,
2218 + &slave_attr_ad_actor_oper_port_state.attr,
2219 + &slave_attr_ad_partner_oper_port_state.attr,
2220 NULL
2221 };
2222
2223 @@ -141,24 +141,10 @@ const struct sysfs_ops slave_sysfs_ops = {
2224
2225 int bond_sysfs_slave_add(struct slave *slave)
2226 {
2227 - const struct slave_attribute **a;
2228 - int err;
2229 -
2230 - for (a = slave_attrs; *a; ++a) {
2231 - err = sysfs_create_file(&slave->kobj, &((*a)->attr));
2232 - if (err) {
2233 - kobject_put(&slave->kobj);
2234 - return err;
2235 - }
2236 - }
2237 -
2238 - return 0;
2239 + return sysfs_create_files(&slave->kobj, slave_attrs);
2240 }
2241
2242 void bond_sysfs_slave_del(struct slave *slave)
2243 {
2244 - const struct slave_attribute **a;
2245 -
2246 - for (a = slave_attrs; *a; ++a)
2247 - sysfs_remove_file(&slave->kobj, &((*a)->attr));
2248 + sysfs_remove_files(&slave->kobj, slave_attrs);
2249 }
2250 diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
2251 index 1835d2e451c01..fc7fce642666c 100644
2252 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
2253 +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
2254 @@ -635,11 +635,13 @@ static int bnx2x_ilt_client_mem_op(struct bnx2x *bp, int cli_num,
2255 {
2256 int i, rc;
2257 struct bnx2x_ilt *ilt = BP_ILT(bp);
2258 - struct ilt_client_info *ilt_cli = &ilt->clients[cli_num];
2259 + struct ilt_client_info *ilt_cli;
2260
2261 if (!ilt || !ilt->lines)
2262 return -1;
2263
2264 + ilt_cli = &ilt->clients[cli_num];
2265 +
2266 if (ilt_cli->flags & (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM))
2267 return 0;
2268
2269 diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
2270 index 537776a3e5de1..9ba36425a3ddd 100644
2271 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
2272 +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
2273 @@ -1889,7 +1889,7 @@ static void i40evf_adminq_task(struct work_struct *work)
2274
2275 /* check for error indications */
2276 val = rd32(hw, hw->aq.arq.len);
2277 - if (val == 0xdeadbeef) /* indicates device in reset */
2278 + if (val == 0xdeadbeef || val == 0xffffffff) /* device in reset */
2279 goto freedom;
2280 oldval = val;
2281 if (val & I40E_VF_ARQLEN1_ARQVFE_MASK) {
2282 diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
2283 index 04cbff7f1b23d..a48ff6fc66b44 100644
2284 --- a/drivers/net/ethernet/sfc/ptp.c
2285 +++ b/drivers/net/ethernet/sfc/ptp.c
2286 @@ -494,7 +494,7 @@ static int efx_ptp_get_attributes(struct efx_nic *efx)
2287 } else if (rc == -EINVAL) {
2288 fmt = MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS;
2289 } else if (rc == -EPERM) {
2290 - netif_info(efx, probe, efx->net_dev, "no PTP support\n");
2291 + pci_info(efx->pci_dev, "no PTP support\n");
2292 return rc;
2293 } else {
2294 efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf),
2295 @@ -613,7 +613,7 @@ static int efx_ptp_disable(struct efx_nic *efx)
2296 * should only have been called during probe.
2297 */
2298 if (rc == -ENOSYS || rc == -EPERM)
2299 - netif_info(efx, probe, efx->net_dev, "no PTP support\n");
2300 + pci_info(efx->pci_dev, "no PTP support\n");
2301 else if (rc)
2302 efx_mcdi_display_error(efx, MC_CMD_PTP,
2303 MC_CMD_PTP_IN_DISABLE_LEN,
2304 diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena_sriov.c
2305 index da7b94f346049..30d58f72725df 100644
2306 --- a/drivers/net/ethernet/sfc/siena_sriov.c
2307 +++ b/drivers/net/ethernet/sfc/siena_sriov.c
2308 @@ -1059,7 +1059,7 @@ void efx_siena_sriov_probe(struct efx_nic *efx)
2309 return;
2310
2311 if (efx_siena_sriov_cmd(efx, false, &efx->vi_scale, &count)) {
2312 - netif_info(efx, probe, efx->net_dev, "no SR-IOV VFs probed\n");
2313 + pci_info(efx->pci_dev, "no SR-IOV VFs probed\n");
2314 return;
2315 }
2316 if (count > 0 && count > max_vfs)
2317 diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
2318 index 8b7596fef42a6..37162492e2635 100644
2319 --- a/drivers/net/ethernet/ti/davinci_emac.c
2320 +++ b/drivers/net/ethernet/ti/davinci_emac.c
2321 @@ -426,8 +426,20 @@ static int emac_set_coalesce(struct net_device *ndev,
2322 u32 int_ctrl, num_interrupts = 0;
2323 u32 prescale = 0, addnl_dvdr = 1, coal_intvl = 0;
2324
2325 - if (!coal->rx_coalesce_usecs)
2326 - return -EINVAL;
2327 + if (!coal->rx_coalesce_usecs) {
2328 + priv->coal_intvl = 0;
2329 +
2330 + switch (priv->version) {
2331 + case EMAC_VERSION_2:
2332 + emac_ctrl_write(EMAC_DM646X_CMINTCTRL, 0);
2333 + break;
2334 + default:
2335 + emac_ctrl_write(EMAC_CTRL_EWINTTCNT, 0);
2336 + break;
2337 + }
2338 +
2339 + return 0;
2340 + }
2341
2342 coal_intvl = coal->rx_coalesce_usecs;
2343
2344 diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
2345 index 599ce24c514f1..456b64248e5da 100644
2346 --- a/drivers/net/phy/mdio-mux.c
2347 +++ b/drivers/net/phy/mdio-mux.c
2348 @@ -117,6 +117,7 @@ int mdio_mux_init(struct device *dev,
2349 } else {
2350 parent_bus_node = NULL;
2351 parent_bus = mux_bus;
2352 + get_device(&parent_bus->dev);
2353 }
2354
2355 pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL);
2356 @@ -182,9 +183,7 @@ int mdio_mux_init(struct device *dev,
2357
2358 devm_kfree(dev, pb);
2359 err_pb_kz:
2360 - /* balance the reference of_mdio_find_bus() took */
2361 - if (!mux_bus)
2362 - put_device(&parent_bus->dev);
2363 + put_device(&parent_bus->dev);
2364 err_parent_bus:
2365 of_node_put(parent_bus_node);
2366 return ret_val;
2367 @@ -202,7 +201,6 @@ void mdio_mux_uninit(void *mux_handle)
2368 cb = cb->next;
2369 }
2370
2371 - /* balance the reference of_mdio_find_bus() in mdio_mux_init() took */
2372 put_device(&pb->mii_bus->dev);
2373 }
2374 EXPORT_SYMBOL_GPL(mdio_mux_uninit);
2375 diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
2376 index 1704d9e2ca8d1..c21328e1e3cca 100644
2377 --- a/drivers/net/phy/micrel.c
2378 +++ b/drivers/net/phy/micrel.c
2379 @@ -876,8 +876,9 @@ static struct phy_driver ksphy_driver[] = {
2380 .get_sset_count = kszphy_get_sset_count,
2381 .get_strings = kszphy_get_strings,
2382 .get_stats = kszphy_get_stats,
2383 - .suspend = genphy_suspend,
2384 - .resume = genphy_resume,
2385 + /* No suspend/resume callbacks because of errata DS80000700A,
2386 + * receiver error following software power down.
2387 + */
2388 }, {
2389 .phy_id = PHY_ID_KSZ8041RNLI,
2390 .phy_id_mask = MICREL_PHY_ID_MASK,
2391 diff --git a/drivers/net/tun.c b/drivers/net/tun.c
2392 index dc0349d13f86a..966e2f03c1296 100644
2393 --- a/drivers/net/tun.c
2394 +++ b/drivers/net/tun.c
2395 @@ -855,6 +855,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
2396 {
2397 struct tun_struct *tun = netdev_priv(dev);
2398 int txq = skb->queue_mapping;
2399 + struct netdev_queue *queue;
2400 struct tun_file *tfile;
2401 u32 numqueues = 0;
2402
2403 @@ -920,6 +921,10 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
2404 if (skb_array_produce(&tfile->tx_array, skb))
2405 goto drop;
2406
2407 + /* NETIF_F_LLTX requires to do our own update of trans_start */
2408 + queue = netdev_get_tx_queue(dev, txq);
2409 + queue->trans_start = jiffies;
2410 +
2411 /* Notify and wake up reader process */
2412 if (tfile->flags & TUN_FASYNC)
2413 kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
2414 diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
2415 index c999b10531c59..56a8031b56b37 100644
2416 --- a/drivers/net/vmxnet3/vmxnet3_drv.c
2417 +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
2418 @@ -3622,7 +3622,6 @@ vmxnet3_suspend(struct device *device)
2419 vmxnet3_free_intr_resources(adapter);
2420
2421 netif_device_detach(netdev);
2422 - netif_tx_stop_all_queues(netdev);
2423
2424 /* Create wake-up filters. */
2425 pmConf = adapter->pm_conf;
2426 diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
2427 index 314cac2ce0879..41fb17cece622 100644
2428 --- a/drivers/net/wireless/ath/ath10k/mac.c
2429 +++ b/drivers/net/wireless/ath/ath10k/mac.c
2430 @@ -980,7 +980,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
2431 arg.channel.min_power = 0;
2432 arg.channel.max_power = channel->max_power * 2;
2433 arg.channel.max_reg_power = channel->max_reg_power * 2;
2434 - arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
2435 + arg.channel.max_antenna_gain = channel->max_antenna_gain;
2436
2437 reinit_completion(&ar->vdev_setup_done);
2438
2439 @@ -1416,7 +1416,7 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif,
2440 arg.channel.min_power = 0;
2441 arg.channel.max_power = chandef->chan->max_power * 2;
2442 arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
2443 - arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2;
2444 + arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain;
2445
2446 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
2447 arg.ssid = arvif->u.ap.ssid;
2448 @@ -3019,7 +3019,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
2449 ch->min_power = 0;
2450 ch->max_power = channel->max_power * 2;
2451 ch->max_reg_power = channel->max_reg_power * 2;
2452 - ch->max_antenna_gain = channel->max_antenna_gain * 2;
2453 + ch->max_antenna_gain = channel->max_antenna_gain;
2454 ch->reg_class_id = 0; /* FIXME */
2455
2456 /* FIXME: why use only legacy modes, why not any
2457 diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
2458 index cce028ea9b57d..5f718210ce682 100644
2459 --- a/drivers/net/wireless/ath/ath10k/wmi.h
2460 +++ b/drivers/net/wireless/ath/ath10k/wmi.h
2461 @@ -1802,7 +1802,9 @@ struct wmi_channel {
2462 union {
2463 __le32 reginfo1;
2464 struct {
2465 + /* note: power unit is 1 dBm */
2466 u8 antenna_max;
2467 + /* note: power unit is 0.5 dBm */
2468 u8 max_tx_power;
2469 } __packed;
2470 } __packed;
2471 @@ -1821,6 +1823,7 @@ struct wmi_channel_arg {
2472 u32 min_power;
2473 u32 max_power;
2474 u32 max_reg_power;
2475 + /* note: power unit is 1 dBm */
2476 u32 max_antenna_gain;
2477 u32 reg_class_id;
2478 enum wmi_phy_mode mode;
2479 diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
2480 index fc22c5f479276..3d0dfcf2c2462 100644
2481 --- a/drivers/net/wireless/ath/ath6kl/usb.c
2482 +++ b/drivers/net/wireless/ath/ath6kl/usb.c
2483 @@ -340,6 +340,11 @@ static int ath6kl_usb_setup_pipe_resources(struct ath6kl_usb *ar_usb)
2484 le16_to_cpu(endpoint->wMaxPacketSize),
2485 endpoint->bInterval);
2486 }
2487 +
2488 + /* Ignore broken descriptors. */
2489 + if (usb_endpoint_maxp(endpoint) == 0)
2490 + continue;
2491 +
2492 urbcount = 0;
2493
2494 pipe_num =
2495 @@ -907,7 +912,7 @@ static int ath6kl_usb_submit_ctrl_in(struct ath6kl_usb *ar_usb,
2496 req,
2497 USB_DIR_IN | USB_TYPE_VENDOR |
2498 USB_RECIP_DEVICE, value, index, buf,
2499 - size, 2 * HZ);
2500 + size, 2000);
2501
2502 if (ret < 0) {
2503 ath6kl_warn("Failed to read usb control message: %d\n", ret);
2504 diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
2505 index 7776f4a8630e4..ca0877f0e6392 100644
2506 --- a/drivers/net/wireless/ath/ath9k/main.c
2507 +++ b/drivers/net/wireless/ath/ath9k/main.c
2508 @@ -528,8 +528,10 @@ irqreturn_t ath_isr(int irq, void *dev)
2509 ath9k_debug_sync_cause(sc, sync_cause);
2510 status &= ah->imask; /* discard unasked-for bits */
2511
2512 - if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
2513 + if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) {
2514 + ath9k_hw_kill_interrupts(sc->sc_ah);
2515 return IRQ_HANDLED;
2516 + }
2517
2518 /*
2519 * If there are no status bits set, then this interrupt was not
2520 diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c
2521 index 78146607f16e8..acd85e5069346 100644
2522 --- a/drivers/net/wireless/ath/dfs_pattern_detector.c
2523 +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
2524 @@ -182,10 +182,12 @@ static void channel_detector_exit(struct dfs_pattern_detector *dpd,
2525 if (cd == NULL)
2526 return;
2527 list_del(&cd->head);
2528 - for (i = 0; i < dpd->num_radar_types; i++) {
2529 - struct pri_detector *de = cd->detectors[i];
2530 - if (de != NULL)
2531 - de->exit(de);
2532 + if (cd->detectors) {
2533 + for (i = 0; i < dpd->num_radar_types; i++) {
2534 + struct pri_detector *de = cd->detectors[i];
2535 + if (de != NULL)
2536 + de->exit(de);
2537 + }
2538 }
2539 kfree(cd->detectors);
2540 kfree(cd);
2541 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
2542 index 86beadf0f2493..b5a885a8301cc 100644
2543 --- a/drivers/net/wireless/ath/wcn36xx/main.c
2544 +++ b/drivers/net/wireless/ath/wcn36xx/main.c
2545 @@ -129,7 +129,9 @@ static struct ieee80211_supported_band wcn_band_2ghz = {
2546 .cap = IEEE80211_HT_CAP_GRN_FLD |
2547 IEEE80211_HT_CAP_SGI_20 |
2548 IEEE80211_HT_CAP_DSSSCCK40 |
2549 - IEEE80211_HT_CAP_LSIG_TXOP_PROT,
2550 + IEEE80211_HT_CAP_LSIG_TXOP_PROT |
2551 + IEEE80211_HT_CAP_SGI_40 |
2552 + IEEE80211_HT_CAP_SUP_WIDTH_20_40,
2553 .ht_supported = true,
2554 .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
2555 .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
2556 diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
2557 index a443992320f2e..914c210c9e605 100644
2558 --- a/drivers/net/wireless/ath/wcn36xx/smd.c
2559 +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
2560 @@ -2081,30 +2081,52 @@ static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
2561 size_t len)
2562 {
2563 struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
2564 - struct wcn36xx_vif *tmp;
2565 + struct wcn36xx_vif *vif_priv;
2566 + struct ieee80211_vif *vif;
2567 + struct ieee80211_bss_conf *bss_conf;
2568 struct ieee80211_sta *sta;
2569 + bool found = false;
2570
2571 if (len != sizeof(*rsp)) {
2572 wcn36xx_warn("Corrupted delete sta indication\n");
2573 return -EIO;
2574 }
2575
2576 - wcn36xx_dbg(WCN36XX_DBG_HAL, "delete station indication %pM index %d\n",
2577 - rsp->addr2, rsp->sta_id);
2578 + wcn36xx_dbg(WCN36XX_DBG_HAL,
2579 + "delete station indication %pM index %d reason %d\n",
2580 + rsp->addr2, rsp->sta_id, rsp->reason_code);
2581
2582 - list_for_each_entry(tmp, &wcn->vif_list, list) {
2583 + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
2584 rcu_read_lock();
2585 - sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2);
2586 - if (sta)
2587 - ieee80211_report_low_ack(sta, 0);
2588 + vif = wcn36xx_priv_to_vif(vif_priv);
2589 +
2590 + if (vif->type == NL80211_IFTYPE_STATION) {
2591 + /* We could call ieee80211_find_sta too, but checking
2592 + * bss_conf is clearer.
2593 + */
2594 + bss_conf = &vif->bss_conf;
2595 + if (vif_priv->sta_assoc &&
2596 + !memcmp(bss_conf->bssid, rsp->addr2, ETH_ALEN)) {
2597 + found = true;
2598 + wcn36xx_dbg(WCN36XX_DBG_HAL,
2599 + "connection loss bss_index %d\n",
2600 + vif_priv->bss_index);
2601 + ieee80211_connection_loss(vif);
2602 + }
2603 + } else {
2604 + sta = ieee80211_find_sta(vif, rsp->addr2);
2605 + if (sta) {
2606 + found = true;
2607 + ieee80211_report_low_ack(sta, 0);
2608 + }
2609 + }
2610 +
2611 rcu_read_unlock();
2612 - if (sta)
2613 + if (found)
2614 return 0;
2615 }
2616
2617 - wcn36xx_warn("STA with addr %pM and index %d not found\n",
2618 - rsp->addr2,
2619 - rsp->sta_id);
2620 + wcn36xx_warn("BSS or STA with addr %pM not found\n", rsp->addr2);
2621 return -ENOENT;
2622 }
2623
2624 diff --git a/drivers/net/wireless/broadcom/b43/phy_g.c b/drivers/net/wireless/broadcom/b43/phy_g.c
2625 index 822dcaa8ace63..35ff139b1496e 100644
2626 --- a/drivers/net/wireless/broadcom/b43/phy_g.c
2627 +++ b/drivers/net/wireless/broadcom/b43/phy_g.c
2628 @@ -2310,7 +2310,7 @@ static u8 b43_gphy_aci_scan(struct b43_wldev *dev)
2629 b43_phy_mask(dev, B43_PHY_G_CRS, 0x7FFF);
2630 b43_set_all_gains(dev, 3, 8, 1);
2631
2632 - start = (channel - 5 > 0) ? channel - 5 : 1;
2633 + start = (channel > 5) ? channel - 5 : 1;
2634 end = (channel + 5 < 14) ? channel + 5 : 13;
2635
2636 for (i = start; i <= end; i++) {
2637 diff --git a/drivers/net/wireless/broadcom/b43legacy/radio.c b/drivers/net/wireless/broadcom/b43legacy/radio.c
2638 index 9501420340a91..5b1e8890305c1 100644
2639 --- a/drivers/net/wireless/broadcom/b43legacy/radio.c
2640 +++ b/drivers/net/wireless/broadcom/b43legacy/radio.c
2641 @@ -299,7 +299,7 @@ u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev)
2642 & 0x7FFF);
2643 b43legacy_set_all_gains(dev, 3, 8, 1);
2644
2645 - start = (channel - 5 > 0) ? channel - 5 : 1;
2646 + start = (channel > 5) ? channel - 5 : 1;
2647 end = (channel + 5 < 14) ? channel + 5 : 13;
2648
2649 for (i = start; i <= end; i++) {
2650 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
2651 index ff5ce1ed03c42..4746f4b096c56 100644
2652 --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
2653 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
2654 @@ -913,6 +913,9 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)
2655
2656 lockdep_assert_held(&mvm->mutex);
2657
2658 + if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM)
2659 + return false;
2660 +
2661 if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1)
2662 return false;
2663
2664 diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c
2665 index 9d147b11ee516..9f19fd5c18d07 100644
2666 --- a/drivers/net/wireless/marvell/libertas/if_usb.c
2667 +++ b/drivers/net/wireless/marvell/libertas/if_usb.c
2668 @@ -292,6 +292,7 @@ err_add_card:
2669 if_usb_reset_device(cardp);
2670 dealloc:
2671 if_usb_free(cardp);
2672 + kfree(cardp);
2673
2674 error:
2675 return r;
2676 @@ -318,6 +319,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
2677
2678 /* Unlink and free urb */
2679 if_usb_free(cardp);
2680 + kfree(cardp);
2681
2682 usb_set_intfdata(intf, NULL);
2683 usb_put_dev(interface_to_usbdev(intf));
2684 diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
2685 index 4b539209999b4..aaba324dbc39b 100644
2686 --- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
2687 +++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
2688 @@ -234,6 +234,7 @@ static int if_usb_probe(struct usb_interface *intf,
2689
2690 dealloc:
2691 if_usb_free(cardp);
2692 + kfree(cardp);
2693 error:
2694 lbtf_deb_leave(LBTF_DEB_MAIN);
2695 return -ENOMEM;
2696 @@ -258,6 +259,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
2697
2698 /* Unlink and free urb */
2699 if_usb_free(cardp);
2700 + kfree(cardp);
2701
2702 usb_set_intfdata(intf, NULL);
2703 usb_put_dev(interface_to_usbdev(intf));
2704 diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c
2705 index c174e79e6df2b..b70eac7d2dd79 100644
2706 --- a/drivers/net/wireless/marvell/mwifiex/11n.c
2707 +++ b/drivers/net/wireless/marvell/mwifiex/11n.c
2708 @@ -630,14 +630,15 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
2709 uint16_t del_ba_param_set;
2710
2711 memset(&delba, 0, sizeof(delba));
2712 - delba.del_ba_param_set = cpu_to_le16(tid << DELBA_TID_POS);
2713
2714 - del_ba_param_set = le16_to_cpu(delba.del_ba_param_set);
2715 + del_ba_param_set = tid << DELBA_TID_POS;
2716 +
2717 if (initiator)
2718 del_ba_param_set |= IEEE80211_DELBA_PARAM_INITIATOR_MASK;
2719 else
2720 del_ba_param_set &= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK;
2721
2722 + delba.del_ba_param_set = cpu_to_le16(del_ba_param_set);
2723 memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN);
2724
2725 /* We don't wait for the response of this command */
2726 diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
2727 index d0743bd25ba95..aaabd8454794e 100644
2728 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
2729 +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
2730 @@ -1265,6 +1265,14 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb,
2731 ret = -1;
2732 goto done_unmap;
2733 }
2734 +
2735 + /* The firmware (latest version 15.68.19.p21) of the 88W8897 PCIe+USB card
2736 + * seems to crash randomly after setting the TX ring write pointer when
2737 + * ASPM powersaving is enabled. A workaround seems to be keeping the bus
2738 + * busy by reading a random register afterwards.
2739 + */
2740 + mwifiex_read_reg(adapter, PCI_VENDOR_ID, &rx_val);
2741 +
2742 if ((mwifiex_pcie_txbd_not_full(card)) &&
2743 tx_param->next_pkt_len) {
2744 /* have more packets and TxBD still can hold more */
2745 diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
2746 index 09185a1f7379c..2c4225e57c396 100644
2747 --- a/drivers/net/wireless/marvell/mwifiex/usb.c
2748 +++ b/drivers/net/wireless/marvell/mwifiex/usb.c
2749 @@ -473,6 +473,22 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
2750 }
2751 }
2752
2753 + switch (card->usb_boot_state) {
2754 + case USB8XXX_FW_DNLD:
2755 + /* Reject broken descriptors. */
2756 + if (!card->rx_cmd_ep || !card->tx_cmd_ep)
2757 + return -ENODEV;
2758 + if (card->bulk_out_maxpktsize == 0)
2759 + return -ENODEV;
2760 + break;
2761 + case USB8XXX_FW_READY:
2762 + /* Assume the driver can handle missing endpoints for now. */
2763 + break;
2764 + default:
2765 + WARN_ON(1);
2766 + return -ENODEV;
2767 + }
2768 +
2769 usb_set_intfdata(intf, card);
2770
2771 ret = mwifiex_add_card(card, &add_remove_card_sem, &usb_ops,
2772 diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c
2773 index 66cd38d4f199b..c6f008796ff16 100644
2774 --- a/drivers/net/wireless/marvell/mwl8k.c
2775 +++ b/drivers/net/wireless/marvell/mwl8k.c
2776 @@ -5783,8 +5783,8 @@ static void mwl8k_fw_state_machine(const struct firmware *fw, void *context)
2777 fail:
2778 priv->fw_state = FW_STATE_ERROR;
2779 complete(&priv->firmware_loading_complete);
2780 - device_release_driver(&priv->pdev->dev);
2781 mwl8k_release_firmware(priv);
2782 + device_release_driver(&priv->pdev->dev);
2783 }
2784
2785 #define MAX_RESTART_ATTEMPTS 1
2786 diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
2787 index e6668ffb77e65..49fb8bba3d91a 100644
2788 --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
2789 +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
2790 @@ -31,7 +31,7 @@ u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
2791 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
2792 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
2793 (unsigned long)addr, idx & 0x03,
2794 - &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
2795 + &priv->io_dmabuf->bits8, sizeof(val), 500);
2796
2797 val = priv->io_dmabuf->bits8;
2798 mutex_unlock(&priv->io_mutex);
2799 @@ -48,7 +48,7 @@ u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
2800 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
2801 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
2802 (unsigned long)addr, idx & 0x03,
2803 - &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
2804 + &priv->io_dmabuf->bits16, sizeof(val), 500);
2805
2806 val = priv->io_dmabuf->bits16;
2807 mutex_unlock(&priv->io_mutex);
2808 @@ -65,7 +65,7 @@ u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
2809 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
2810 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
2811 (unsigned long)addr, idx & 0x03,
2812 - &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
2813 + &priv->io_dmabuf->bits32, sizeof(val), 500);
2814
2815 val = priv->io_dmabuf->bits32;
2816 mutex_unlock(&priv->io_mutex);
2817 @@ -82,7 +82,7 @@ void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
2818 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
2819 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
2820 (unsigned long)addr, idx & 0x03,
2821 - &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
2822 + &priv->io_dmabuf->bits8, sizeof(val), 500);
2823
2824 mutex_unlock(&priv->io_mutex);
2825 }
2826 @@ -96,7 +96,7 @@ void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
2827 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
2828 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
2829 (unsigned long)addr, idx & 0x03,
2830 - &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
2831 + &priv->io_dmabuf->bits16, sizeof(val), 500);
2832
2833 mutex_unlock(&priv->io_mutex);
2834 }
2835 @@ -110,7 +110,7 @@ void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
2836 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
2837 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
2838 (unsigned long)addr, idx & 0x03,
2839 - &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
2840 + &priv->io_dmabuf->bits32, sizeof(val), 500);
2841
2842 mutex_unlock(&priv->io_mutex);
2843 }
2844 @@ -186,7 +186,7 @@ static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
2845 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
2846 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
2847 addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data),
2848 - HZ / 2);
2849 + 500);
2850
2851 mutex_unlock(&priv->io_mutex);
2852
2853 diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
2854 index ceaf6b30d683d..0971c09363cbf 100644
2855 --- a/drivers/net/xen-netfront.c
2856 +++ b/drivers/net/xen-netfront.c
2857 @@ -1460,6 +1460,10 @@ static int netfront_resume(struct xenbus_device *dev)
2858
2859 dev_dbg(&dev->dev, "%s\n", dev->nodename);
2860
2861 + netif_tx_lock_bh(info->netdev);
2862 + netif_device_detach(info->netdev);
2863 + netif_tx_unlock_bh(info->netdev);
2864 +
2865 xennet_disconnect_backend(info);
2866 return 0;
2867 }
2868 @@ -2020,6 +2024,10 @@ static int xennet_connect(struct net_device *dev)
2869 * domain a kick because we've probably just requeued some
2870 * packets.
2871 */
2872 + netif_tx_lock_bh(np->netdev);
2873 + netif_device_attach(np->netdev);
2874 + netif_tx_unlock_bh(np->netdev);
2875 +
2876 netif_carrier_on(np->netdev);
2877 for (j = 0; j < num_queues; ++j) {
2878 queue = &np->queues[j];
2879 diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
2880 index 6c495664d2cb7..806309ee41657 100644
2881 --- a/drivers/nfc/pn533/pn533.c
2882 +++ b/drivers/nfc/pn533/pn533.c
2883 @@ -2075,7 +2075,7 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb)
2884 frag = pn533_alloc_skb(dev, frag_size);
2885 if (!frag) {
2886 skb_queue_purge(&dev->fragment_skb);
2887 - break;
2888 + return -ENOMEM;
2889 }
2890
2891 if (!dev->tgt_mode) {
2892 @@ -2145,7 +2145,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,
2893 /* jumbo frame ? */
2894 if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
2895 rc = pn533_fill_fragment_skbs(dev, skb);
2896 - if (rc <= 0)
2897 + if (rc < 0)
2898 goto error;
2899
2900 skb = skb_dequeue(&dev->fragment_skb);
2901 @@ -2217,7 +2217,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
2902 /* let's split in multiple chunks if size's too big */
2903 if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
2904 rc = pn533_fill_fragment_skbs(dev, skb);
2905 - if (rc <= 0)
2906 + if (rc < 0)
2907 goto error;
2908
2909 /* get the first skb */
2910 diff --git a/drivers/pci/host/pci-aardvark.c b/drivers/pci/host/pci-aardvark.c
2911 index 736d9f58438ec..08375e68f1c30 100644
2912 --- a/drivers/pci/host/pci-aardvark.c
2913 +++ b/drivers/pci/host/pci-aardvark.c
2914 @@ -110,6 +110,7 @@
2915 #define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58)
2916 #define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C)
2917 #define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C)
2918 +#define PCIE_MSI_DATA_MASK GENMASK(15, 0)
2919
2920 /* PCIe window configuration */
2921 #define OB_WIN_BASE_ADDR 0x4c00
2922 @@ -404,7 +405,7 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie)
2923 else
2924 str_posted = "Posted";
2925
2926 - dev_err(dev, "%s PIO Response Status: %s, %#x @ %#x\n",
2927 + dev_dbg(dev, "%s PIO Response Status: %s, %#x @ %#x\n",
2928 str_posted, strcomp_status, reg, advk_readl(pcie, PIO_ADDR_LS));
2929 }
2930
2931 @@ -785,8 +786,12 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)
2932 if (!(BIT(msi_idx) & msi_status))
2933 continue;
2934
2935 + /*
2936 + * msi_idx contains bits [4:0] of the msi_data and msi_data
2937 + * contains 16bit MSI interrupt number
2938 + */
2939 advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG);
2940 - msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & 0xFF;
2941 + msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK;
2942 generic_handle_irq(msi_data);
2943 }
2944
2945 diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
2946 index 97c3515e3b543..be2f1402c84c2 100644
2947 --- a/drivers/pci/msi.c
2948 +++ b/drivers/pci/msi.c
2949 @@ -391,18 +391,6 @@ static void free_msi_irqs(struct pci_dev *dev)
2950 for (i = 0; i < entry->nvec_used; i++)
2951 BUG_ON(irq_has_action(entry->irq + i));
2952
2953 - pci_msi_teardown_msi_irqs(dev);
2954 -
2955 - list_for_each_entry_safe(entry, tmp, msi_list, list) {
2956 - if (entry->msi_attrib.is_msix) {
2957 - if (list_is_last(&entry->list, msi_list))
2958 - iounmap(entry->mask_base);
2959 - }
2960 -
2961 - list_del(&entry->list);
2962 - kfree(entry);
2963 - }
2964 -
2965 if (dev->msi_irq_groups) {
2966 sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
2967 msi_attrs = dev->msi_irq_groups[0]->attrs;
2968 @@ -418,6 +406,18 @@ static void free_msi_irqs(struct pci_dev *dev)
2969 kfree(dev->msi_irq_groups);
2970 dev->msi_irq_groups = NULL;
2971 }
2972 +
2973 + pci_msi_teardown_msi_irqs(dev);
2974 +
2975 + list_for_each_entry_safe(entry, tmp, msi_list, list) {
2976 + if (entry->msi_attrib.is_msix) {
2977 + if (list_is_last(&entry->list, msi_list))
2978 + iounmap(entry->mask_base);
2979 + }
2980 +
2981 + list_del(&entry->list);
2982 + free_msi_entry(entry);
2983 + }
2984 }
2985
2986 static void pci_intx_for_msi(struct pci_dev *dev, int enable)
2987 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
2988 index 66e5bb7bfb67b..3ff2971102b61 100644
2989 --- a/drivers/pci/quirks.c
2990 +++ b/drivers/pci/quirks.c
2991 @@ -3370,6 +3370,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset);
2992 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);
2993 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset);
2994 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset);
2995 +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003e, quirk_no_bus_reset);
2996
2997 /*
2998 * Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS
2999 diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
3000 index 403d966223ee9..76cb361b623cb 100644
3001 --- a/drivers/platform/x86/hp_accel.c
3002 +++ b/drivers/platform/x86/hp_accel.c
3003 @@ -382,9 +382,11 @@ static int lis3lv02d_add(struct acpi_device *device)
3004 INIT_WORK(&hpled_led.work, delayed_set_status_worker);
3005 ret = led_classdev_register(NULL, &hpled_led.led_classdev);
3006 if (ret) {
3007 + i8042_remove_filter(hp_accel_i8042_filter);
3008 lis3lv02d_joystick_disable(&lis3_dev);
3009 lis3lv02d_poweroff(&lis3_dev);
3010 flush_work(&hpled_led.work);
3011 + lis3lv02d_remove_fs(&lis3_dev);
3012 return ret;
3013 }
3014
3015 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
3016 index 84bfecded84d9..9c929b5ce58e2 100644
3017 --- a/drivers/platform/x86/thinkpad_acpi.c
3018 +++ b/drivers/platform/x86/thinkpad_acpi.c
3019 @@ -8884,7 +8884,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
3020
3021 if (strlencmp(cmd, "level auto") == 0)
3022 level = TP_EC_FAN_AUTO;
3023 - else if ((strlencmp(cmd, "level disengaged") == 0) |
3024 + else if ((strlencmp(cmd, "level disengaged") == 0) ||
3025 (strlencmp(cmd, "level full-speed") == 0))
3026 level = TP_EC_FAN_FULLSPEED;
3027 else if (sscanf(cmd, "level %d", &level) != 1)
3028 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
3029 index 00d82e8443bdd..da06284c455dc 100644
3030 --- a/drivers/platform/x86/wmi.c
3031 +++ b/drivers/platform/x86/wmi.c
3032 @@ -289,7 +289,14 @@ struct acpi_buffer *out)
3033 * the WQxx method failed - we should disable collection anyway.
3034 */
3035 if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) {
3036 - status = acpi_execute_simple_method(handle, wc_method, 0);
3037 + /*
3038 + * Ignore whether this WCxx call succeeds or not since
3039 + * the previously executed WQxx method call might have
3040 + * succeeded, and returning the failing status code
3041 + * of this call would throw away the result of the WQxx
3042 + * call, potentially leaking memory.
3043 + */
3044 + acpi_execute_simple_method(handle, wc_method, 0);
3045 }
3046
3047 return status;
3048 diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
3049 index 5c5c3a6f99234..91fabe9e6efd0 100644
3050 --- a/drivers/power/supply/bq27xxx_battery_i2c.c
3051 +++ b/drivers/power/supply/bq27xxx_battery_i2c.c
3052 @@ -115,7 +115,8 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client,
3053 dev_err(&client->dev,
3054 "Unable to register IRQ %d error %d\n",
3055 client->irq, ret);
3056 - return ret;
3057 + bq27xxx_battery_teardown(di);
3058 + goto err_failed;
3059 }
3060 }
3061
3062 diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
3063 index f18d845b3b92d..01ca03c809d05 100644
3064 --- a/drivers/power/supply/max17042_battery.c
3065 +++ b/drivers/power/supply/max17042_battery.c
3066 @@ -246,7 +246,10 @@ static int max17042_get_property(struct power_supply *psy,
3067 val->intval = data * 625 / 8;
3068 break;
3069 case POWER_SUPPLY_PROP_CAPACITY:
3070 - ret = regmap_read(map, MAX17042_RepSOC, &data);
3071 + if (chip->pdata->enable_current_sense)
3072 + ret = regmap_read(map, MAX17042_RepSOC, &data);
3073 + else
3074 + ret = regmap_read(map, MAX17042_VFSOC, &data);
3075 if (ret < 0)
3076 return ret;
3077
3078 @@ -752,7 +755,8 @@ static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off)
3079 regmap_read(map, MAX17042_RepSOC, &soc);
3080 soc >>= 8;
3081 soc_tr = (soc + off) << 8;
3082 - soc_tr |= (soc - off);
3083 + if (off < soc)
3084 + soc_tr |= soc - off;
3085 regmap_write(map, MAX17042_SALRT_Th, soc_tr);
3086 }
3087
3088 diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c
3089 index 9310b85f3405e..7eec7014086d8 100644
3090 --- a/drivers/power/supply/rt5033_battery.c
3091 +++ b/drivers/power/supply/rt5033_battery.c
3092 @@ -63,7 +63,7 @@ static int rt5033_battery_get_watt_prop(struct i2c_client *client,
3093 regmap_read(battery->regmap, regh, &msb);
3094 regmap_read(battery->regmap, regl, &lsb);
3095
3096 - ret = ((msb << 4) + (lsb >> 4)) * 1250 / 1000;
3097 + ret = ((msb << 4) + (lsb >> 4)) * 1250;
3098
3099 return ret;
3100 }
3101 diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
3102 index 27343e1c43ef8..45fad246c27e3 100644
3103 --- a/drivers/regulator/s5m8767.c
3104 +++ b/drivers/regulator/s5m8767.c
3105 @@ -845,18 +845,15 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
3106 /* DS4 GPIO */
3107 gpio_direction_output(pdata->buck_ds[2], 0x0);
3108
3109 - if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
3110 - pdata->buck4_gpiodvs) {
3111 - regmap_update_bits(s5m8767->iodev->regmap_pmic,
3112 - S5M8767_REG_BUCK2CTRL, 1 << 1,
3113 - (pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
3114 - regmap_update_bits(s5m8767->iodev->regmap_pmic,
3115 - S5M8767_REG_BUCK3CTRL, 1 << 1,
3116 - (pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
3117 - regmap_update_bits(s5m8767->iodev->regmap_pmic,
3118 - S5M8767_REG_BUCK4CTRL, 1 << 1,
3119 - (pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
3120 - }
3121 + regmap_update_bits(s5m8767->iodev->regmap_pmic,
3122 + S5M8767_REG_BUCK2CTRL, 1 << 1,
3123 + (pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
3124 + regmap_update_bits(s5m8767->iodev->regmap_pmic,
3125 + S5M8767_REG_BUCK3CTRL, 1 << 1,
3126 + (pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
3127 + regmap_update_bits(s5m8767->iodev->regmap_pmic,
3128 + S5M8767_REG_BUCK4CTRL, 1 << 1,
3129 + (pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
3130
3131 /* Initialize GPIO DVS registers */
3132 for (i = 0; i < 8; i++) {
3133 diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
3134 index 24e57e770432b..6efd17692a55a 100644
3135 --- a/drivers/scsi/advansys.c
3136 +++ b/drivers/scsi/advansys.c
3137 @@ -3370,8 +3370,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
3138 shost->host_no);
3139
3140 seq_printf(m,
3141 - " iop_base 0x%lx, cable_detect: %X, err_code %u\n",
3142 - (unsigned long)v->iop_base,
3143 + " iop_base 0x%p, cable_detect: %X, err_code %u\n",
3144 + v->iop_base,
3145 AdvReadWordRegister(iop_base,IOPW_SCSI_CFG1) & CABLE_DETECT,
3146 v->err_code);
3147
3148 diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c
3149 index 957767d383610..d1df694d9ed00 100644
3150 --- a/drivers/scsi/csiostor/csio_lnode.c
3151 +++ b/drivers/scsi/csiostor/csio_lnode.c
3152 @@ -611,7 +611,7 @@ csio_ln_vnp_read_cbfn(struct csio_hw *hw, struct csio_mb *mbp)
3153 struct fc_els_csp *csp;
3154 struct fc_els_cssp *clsp;
3155 enum fw_retval retval;
3156 - __be32 nport_id;
3157 + __be32 nport_id = 0;
3158
3159 retval = FW_CMD_RETVAL_G(ntohl(rsp->alloc_to_len16));
3160 if (retval != FW_SUCCESS) {
3161 diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
3162 index 830b2d2dcf206..8490d0ff04ca7 100644
3163 --- a/drivers/scsi/dc395x.c
3164 +++ b/drivers/scsi/dc395x.c
3165 @@ -4809,6 +4809,7 @@ static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
3166 /* initialise the adapter and everything we need */
3167 if (adapter_init(acb, io_port_base, io_port_len, irq)) {
3168 dprintkl(KERN_INFO, "adapter init failed\n");
3169 + acb = NULL;
3170 goto fail;
3171 }
3172
3173 diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
3174 index 0e7915ecb85a5..5c847ef459cd1 100644
3175 --- a/drivers/scsi/lpfc/lpfc_sli.c
3176 +++ b/drivers/scsi/lpfc/lpfc_sli.c
3177 @@ -17274,6 +17274,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
3178 fail_msg,
3179 piocbq->iotag, piocbq->sli4_xritag);
3180 list_add_tail(&piocbq->list, &completions);
3181 + fail_msg = NULL;
3182 }
3183 spin_unlock_irqrestore(&pring->ring_lock, iflags);
3184 }
3185 diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
3186 index 6ca00813c71f0..4a1a16e6a8204 100644
3187 --- a/drivers/scsi/qla2xxx/qla_gbl.h
3188 +++ b/drivers/scsi/qla2xxx/qla_gbl.h
3189 @@ -115,7 +115,6 @@ extern int ql2xasynctmfenable;
3190 extern int ql2xgffidenable;
3191 extern int ql2xenabledif;
3192 extern int ql2xenablehba_err_chk;
3193 -extern int ql2xtargetreset;
3194 extern int ql2xdontresethba;
3195 extern uint64_t ql2xmaxlun;
3196 extern int ql2xmdcapmask;
3197 @@ -655,7 +654,6 @@ extern void qlafx00_abort_iocb(srb_t *, struct abort_iocb_entry_fx00 *);
3198 extern void qlafx00_fxdisc_iocb(srb_t *, struct fxdisc_entry_fx00 *);
3199 extern void qlafx00_timer_routine(scsi_qla_host_t *);
3200 extern int qlafx00_rescan_isp(scsi_qla_host_t *);
3201 -extern int qlafx00_loop_reset(scsi_qla_host_t *vha);
3202
3203 /* qla82xx related functions */
3204
3205 diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
3206 index 15dff7099955b..b72cc4b1287d9 100644
3207 --- a/drivers/scsi/qla2xxx/qla_mr.c
3208 +++ b/drivers/scsi/qla2xxx/qla_mr.c
3209 @@ -738,29 +738,6 @@ qlafx00_lun_reset(fc_port_t *fcport, uint64_t l, int tag)
3210 return qla2x00_async_tm_cmd(fcport, TCF_LUN_RESET, l, tag);
3211 }
3212
3213 -int
3214 -qlafx00_loop_reset(scsi_qla_host_t *vha)
3215 -{
3216 - int ret;
3217 - struct fc_port *fcport;
3218 - struct qla_hw_data *ha = vha->hw;
3219 -
3220 - if (ql2xtargetreset) {
3221 - list_for_each_entry(fcport, &vha->vp_fcports, list) {
3222 - if (fcport->port_type != FCT_TARGET)
3223 - continue;
3224 -
3225 - ret = ha->isp_ops->target_reset(fcport, 0, 0);
3226 - if (ret != QLA_SUCCESS) {
3227 - ql_dbg(ql_dbg_taskm, vha, 0x803d,
3228 - "Bus Reset failed: Reset=%d "
3229 - "d_id=%x.\n", ret, fcport->d_id.b24);
3230 - }
3231 - }
3232 - }
3233 - return QLA_SUCCESS;
3234 -}
3235 -
3236 int
3237 qlafx00_iospace_config(struct qla_hw_data *ha)
3238 {
3239 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
3240 index 65bbca715f57d..274b61ddee04a 100644
3241 --- a/drivers/scsi/qla2xxx/qla_os.c
3242 +++ b/drivers/scsi/qla2xxx/qla_os.c
3243 @@ -180,12 +180,6 @@ MODULE_PARM_DESC(ql2xdbwr,
3244 " 0 -- Regular doorbell.\n"
3245 " 1 -- CAMRAM doorbell (faster).\n");
3246
3247 -int ql2xtargetreset = 1;
3248 -module_param(ql2xtargetreset, int, S_IRUGO);
3249 -MODULE_PARM_DESC(ql2xtargetreset,
3250 - "Enable target reset."
3251 - "Default is 1 - use hw defaults.");
3252 -
3253 int ql2xgffidenable;
3254 module_param(ql2xgffidenable, int, S_IRUGO);
3255 MODULE_PARM_DESC(ql2xgffidenable,
3256 @@ -1401,27 +1395,10 @@ int
3257 qla2x00_loop_reset(scsi_qla_host_t *vha)
3258 {
3259 int ret;
3260 - struct fc_port *fcport;
3261 struct qla_hw_data *ha = vha->hw;
3262
3263 - if (IS_QLAFX00(ha)) {
3264 - return qlafx00_loop_reset(vha);
3265 - }
3266 -
3267 - if (ql2xtargetreset == 1 && ha->flags.enable_target_reset) {
3268 - list_for_each_entry(fcport, &vha->vp_fcports, list) {
3269 - if (fcport->port_type != FCT_TARGET)
3270 - continue;
3271 -
3272 - ret = ha->isp_ops->target_reset(fcport, 0, 0);
3273 - if (ret != QLA_SUCCESS) {
3274 - ql_dbg(ql_dbg_taskm, vha, 0x802c,
3275 - "Bus Reset failed: Reset=%d "
3276 - "d_id=%x.\n", ret, fcport->d_id.b24);
3277 - }
3278 - }
3279 - }
3280 -
3281 + if (IS_QLAFX00(ha))
3282 + return QLA_SUCCESS;
3283
3284 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) {
3285 atomic_set(&vha->loop_state, LOOP_DOWN);
3286 diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
3287 index bec81c2404f78..1682fa3671bc3 100644
3288 --- a/drivers/sh/maple/maple.c
3289 +++ b/drivers/sh/maple/maple.c
3290 @@ -835,8 +835,10 @@ static int __init maple_bus_init(void)
3291
3292 maple_queue_cache = KMEM_CACHE(maple_buffer, SLAB_HWCACHE_ALIGN);
3293
3294 - if (!maple_queue_cache)
3295 + if (!maple_queue_cache) {
3296 + retval = -ENOMEM;
3297 goto cleanup_bothirqs;
3298 + }
3299
3300 INIT_LIST_HEAD(&maple_waitq);
3301 INIT_LIST_HEAD(&maple_sentq);
3302 @@ -849,6 +851,7 @@ static int __init maple_bus_init(void)
3303 if (!mdev[i]) {
3304 while (i-- > 0)
3305 maple_free_dev(mdev[i]);
3306 + retval = -ENOMEM;
3307 goto cleanup_cache;
3308 }
3309 baseunits[i] = mdev[i];
3310 diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
3311 index a12710c917a14..93da935130397 100644
3312 --- a/drivers/soc/tegra/pmc.c
3313 +++ b/drivers/soc/tegra/pmc.c
3314 @@ -384,7 +384,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg,
3315
3316 err = tegra_powergate_enable_clocks(pg);
3317 if (err)
3318 - goto disable_clks;
3319 + goto powergate_off;
3320
3321 usleep_range(10, 20);
3322
3323 @@ -396,7 +396,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg,
3324
3325 err = tegra_powergate_reset_deassert(pg);
3326 if (err)
3327 - goto powergate_off;
3328 + goto disable_clks;
3329
3330 usleep_range(10, 20);
3331
3332 diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
3333 index 5453910d8abc3..d521adf6ac245 100644
3334 --- a/drivers/spi/spi-bcm-qspi.c
3335 +++ b/drivers/spi/spi-bcm-qspi.c
3336 @@ -1266,7 +1266,7 @@ int bcm_qspi_probe(struct platform_device *pdev,
3337 &qspi->dev_ids[val]);
3338 if (ret < 0) {
3339 dev_err(&pdev->dev, "IRQ %s not found\n", name);
3340 - goto qspi_probe_err;
3341 + goto qspi_unprepare_err;
3342 }
3343
3344 qspi->dev_ids[val].dev = qspi;
3345 @@ -1281,7 +1281,7 @@ int bcm_qspi_probe(struct platform_device *pdev,
3346 if (!num_ints) {
3347 dev_err(&pdev->dev, "no IRQs registered, cannot init driver\n");
3348 ret = -EINVAL;
3349 - goto qspi_probe_err;
3350 + goto qspi_unprepare_err;
3351 }
3352
3353 /*
3354 @@ -1332,6 +1332,7 @@ int bcm_qspi_probe(struct platform_device *pdev,
3355
3356 qspi_reg_err:
3357 bcm_qspi_hw_uninit(qspi);
3358 +qspi_unprepare_err:
3359 clk_disable_unprepare(qspi->clk);
3360 qspi_probe_err:
3361 kfree(qspi->dev_ids);
3362 diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
3363 index f7f7ba17b40e9..27cf77dfc6038 100644
3364 --- a/drivers/spi/spi-pl022.c
3365 +++ b/drivers/spi/spi-pl022.c
3366 @@ -1703,12 +1703,13 @@ static int verify_controller_parameters(struct pl022 *pl022,
3367 return -EINVAL;
3368 }
3369 } else {
3370 - if (chip_info->duplex != SSP_MICROWIRE_CHANNEL_FULL_DUPLEX)
3371 + if (chip_info->duplex != SSP_MICROWIRE_CHANNEL_FULL_DUPLEX) {
3372 dev_err(&pl022->adev->dev,
3373 "Microwire half duplex mode requested,"
3374 " but this is only available in the"
3375 " ST version of PL022\n");
3376 - return -EINVAL;
3377 + return -EINVAL;
3378 + }
3379 }
3380 }
3381 return 0;
3382 diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
3383 index ee5b29aed54bd..fa28fd89add6c 100644
3384 --- a/drivers/target/target_core_alua.c
3385 +++ b/drivers/target/target_core_alua.c
3386 @@ -1735,7 +1735,6 @@ int core_alua_set_tg_pt_gp_id(
3387 pr_err("Maximum ALUA alua_tg_pt_gps_count:"
3388 " 0x0000ffff reached\n");
3389 spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
3390 - kmem_cache_free(t10_alua_tg_pt_gp_cache, tg_pt_gp);
3391 return -ENOSPC;
3392 }
3393 again:
3394 diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
3395 index c3d576ed6f135..d8c3c72da7464 100644
3396 --- a/drivers/target/target_core_device.c
3397 +++ b/drivers/target/target_core_device.c
3398 @@ -787,6 +787,8 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
3399 INIT_LIST_HEAD(&dev->t10_alua.lba_map_list);
3400 spin_lock_init(&dev->t10_alua.lba_map_lock);
3401
3402 + INIT_WORK(&dev->delayed_cmd_work, target_do_delayed_work);
3403 +
3404 dev->t10_wwn.t10_dev = dev;
3405 dev->t10_alua.t10_dev = dev;
3406
3407 diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h
3408 index be52838cc1a88..48a631ab449e9 100644
3409 --- a/drivers/target/target_core_internal.h
3410 +++ b/drivers/target/target_core_internal.h
3411 @@ -144,6 +144,7 @@ void transport_clear_lun_ref(struct se_lun *);
3412 void transport_send_task_abort(struct se_cmd *);
3413 sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size);
3414 void target_qf_do_work(struct work_struct *work);
3415 +void target_do_delayed_work(struct work_struct *work);
3416 bool target_check_wce(struct se_device *dev);
3417 bool target_check_fua(struct se_device *dev);
3418 void __target_execute_cmd(struct se_cmd *, bool);
3419 diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
3420 index 6afb65387be6c..0e9383fbdd4dc 100644
3421 --- a/drivers/target/target_core_transport.c
3422 +++ b/drivers/target/target_core_transport.c
3423 @@ -1883,32 +1883,35 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
3424 */
3425 switch (cmd->sam_task_attr) {
3426 case TCM_HEAD_TAG:
3427 + atomic_inc_mb(&dev->non_ordered);
3428 pr_debug("Added HEAD_OF_QUEUE for CDB: 0x%02x\n",
3429 cmd->t_task_cdb[0]);
3430 return false;
3431 case TCM_ORDERED_TAG:
3432 - atomic_inc_mb(&dev->dev_ordered_sync);
3433 + atomic_inc_mb(&dev->delayed_cmd_count);
3434
3435 pr_debug("Added ORDERED for CDB: 0x%02x to ordered list\n",
3436 cmd->t_task_cdb[0]);
3437 -
3438 - /*
3439 - * Execute an ORDERED command if no other older commands
3440 - * exist that need to be completed first.
3441 - */
3442 - if (!atomic_read(&dev->simple_cmds))
3443 - return false;
3444 break;
3445 default:
3446 /*
3447 * For SIMPLE and UNTAGGED Task Attribute commands
3448 */
3449 - atomic_inc_mb(&dev->simple_cmds);
3450 + atomic_inc_mb(&dev->non_ordered);
3451 +
3452 + if (atomic_read(&dev->delayed_cmd_count) == 0)
3453 + return false;
3454 break;
3455 }
3456
3457 - if (atomic_read(&dev->dev_ordered_sync) == 0)
3458 - return false;
3459 + if (cmd->sam_task_attr != TCM_ORDERED_TAG) {
3460 + atomic_inc_mb(&dev->delayed_cmd_count);
3461 + /*
3462 + * We will account for this when we dequeue from the delayed
3463 + * list.
3464 + */
3465 + atomic_dec_mb(&dev->non_ordered);
3466 + }
3467
3468 spin_lock(&dev->delayed_cmd_lock);
3469 list_add_tail(&cmd->se_delayed_node, &dev->delayed_cmd_list);
3470 @@ -1916,6 +1919,12 @@ static bool target_handle_task_attr(struct se_cmd *cmd)
3471
3472 pr_debug("Added CDB: 0x%02x Task Attr: 0x%02x to delayed CMD listn",
3473 cmd->t_task_cdb[0], cmd->sam_task_attr);
3474 + /*
3475 + * We may have no non ordered cmds when this function started or we
3476 + * could have raced with the last simple/head cmd completing, so kick
3477 + * the delayed handler here.
3478 + */
3479 + schedule_work(&dev->delayed_cmd_work);
3480 return true;
3481 }
3482
3483 @@ -1966,29 +1975,48 @@ EXPORT_SYMBOL(target_execute_cmd);
3484 * Process all commands up to the last received ORDERED task attribute which
3485 * requires another blocking boundary
3486 */
3487 -static void target_restart_delayed_cmds(struct se_device *dev)
3488 +void target_do_delayed_work(struct work_struct *work)
3489 {
3490 - for (;;) {
3491 + struct se_device *dev = container_of(work, struct se_device,
3492 + delayed_cmd_work);
3493 +
3494 + spin_lock(&dev->delayed_cmd_lock);
3495 + while (!dev->ordered_sync_in_progress) {
3496 struct se_cmd *cmd;
3497
3498 - spin_lock(&dev->delayed_cmd_lock);
3499 - if (list_empty(&dev->delayed_cmd_list)) {
3500 - spin_unlock(&dev->delayed_cmd_lock);
3501 + if (list_empty(&dev->delayed_cmd_list))
3502 break;
3503 - }
3504
3505 cmd = list_entry(dev->delayed_cmd_list.next,
3506 struct se_cmd, se_delayed_node);
3507 +
3508 + if (cmd->sam_task_attr == TCM_ORDERED_TAG) {
3509 + /*
3510 + * Check if we started with:
3511 + * [ordered] [simple] [ordered]
3512 + * and we are now at the last ordered so we have to wait
3513 + * for the simple cmd.
3514 + */
3515 + if (atomic_read(&dev->non_ordered) > 0)
3516 + break;
3517 +
3518 + dev->ordered_sync_in_progress = true;
3519 + }
3520 +
3521 list_del(&cmd->se_delayed_node);
3522 + atomic_dec_mb(&dev->delayed_cmd_count);
3523 spin_unlock(&dev->delayed_cmd_lock);
3524
3525 + if (cmd->sam_task_attr != TCM_ORDERED_TAG)
3526 + atomic_inc_mb(&dev->non_ordered);
3527 +
3528 cmd->transport_state |= CMD_T_SENT;
3529
3530 __target_execute_cmd(cmd, true);
3531
3532 - if (cmd->sam_task_attr == TCM_ORDERED_TAG)
3533 - break;
3534 + spin_lock(&dev->delayed_cmd_lock);
3535 }
3536 + spin_unlock(&dev->delayed_cmd_lock);
3537 }
3538
3539 /*
3540 @@ -2006,16 +2034,19 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
3541 goto restart;
3542
3543 if (cmd->sam_task_attr == TCM_SIMPLE_TAG) {
3544 - atomic_dec_mb(&dev->simple_cmds);
3545 + atomic_dec_mb(&dev->non_ordered);
3546 dev->dev_cur_ordered_id++;
3547 pr_debug("Incremented dev->dev_cur_ordered_id: %u for SIMPLE\n",
3548 dev->dev_cur_ordered_id);
3549 } else if (cmd->sam_task_attr == TCM_HEAD_TAG) {
3550 + atomic_dec_mb(&dev->non_ordered);
3551 dev->dev_cur_ordered_id++;
3552 pr_debug("Incremented dev_cur_ordered_id: %u for HEAD_OF_QUEUE\n",
3553 dev->dev_cur_ordered_id);
3554 } else if (cmd->sam_task_attr == TCM_ORDERED_TAG) {
3555 - atomic_dec_mb(&dev->dev_ordered_sync);
3556 + spin_lock(&dev->delayed_cmd_lock);
3557 + dev->ordered_sync_in_progress = false;
3558 + spin_unlock(&dev->delayed_cmd_lock);
3559
3560 dev->dev_cur_ordered_id++;
3561 pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED\n",
3562 @@ -2024,7 +2055,8 @@ static void transport_complete_task_attr(struct se_cmd *cmd)
3563 cmd->se_cmd_flags &= ~SCF_TASK_ATTR_SET;
3564
3565 restart:
3566 - target_restart_delayed_cmds(dev);
3567 + if (atomic_read(&dev->delayed_cmd_count) > 0)
3568 + schedule_work(&dev->delayed_cmd_work);
3569 }
3570
3571 static void transport_complete_qf(struct se_cmd *cmd)
3572 diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
3573 index 22d65a33059e1..aa9cc5e1c91cc 100644
3574 --- a/drivers/tty/serial/8250/8250_dw.c
3575 +++ b/drivers/tty/serial/8250/8250_dw.c
3576 @@ -637,7 +637,7 @@ static struct platform_driver dw8250_platform_driver = {
3577 .name = "dw-apb-uart",
3578 .pm = &dw8250_pm_ops,
3579 .of_match_table = dw8250_of_match,
3580 - .acpi_match_table = ACPI_PTR(dw8250_acpi_match),
3581 + .acpi_match_table = dw8250_acpi_match,
3582 },
3583 .probe = dw8250_probe,
3584 .remove = dw8250_remove,
3585 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
3586 index 74a1a97a77b28..bbba2174d6e75 100644
3587 --- a/drivers/tty/serial/serial_core.c
3588 +++ b/drivers/tty/serial/serial_core.c
3589 @@ -209,7 +209,11 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
3590 if (retval == 0) {
3591 if (uart_console(uport) && uport->cons->cflag) {
3592 tty->termios.c_cflag = uport->cons->cflag;
3593 + tty->termios.c_ispeed = uport->cons->ispeed;
3594 + tty->termios.c_ospeed = uport->cons->ospeed;
3595 uport->cons->cflag = 0;
3596 + uport->cons->ispeed = 0;
3597 + uport->cons->ospeed = 0;
3598 }
3599 /*
3600 * Initialise the hardware port settings.
3601 @@ -277,8 +281,11 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
3602 /*
3603 * Turn off DTR and RTS early.
3604 */
3605 - if (uport && uart_console(uport) && tty)
3606 + if (uport && uart_console(uport) && tty) {
3607 uport->cons->cflag = tty->termios.c_cflag;
3608 + uport->cons->ispeed = tty->termios.c_ispeed;
3609 + uport->cons->ospeed = tty->termios.c_ospeed;
3610 + }
3611
3612 if (!tty || C_HUPCL(tty))
3613 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
3614 @@ -2059,8 +2066,11 @@ uart_set_options(struct uart_port *port, struct console *co,
3615 * Allow the setting of the UART parameters with a NULL console
3616 * too:
3617 */
3618 - if (co)
3619 + if (co) {
3620 co->cflag = termios.c_cflag;
3621 + co->ispeed = termios.c_ispeed;
3622 + co->ospeed = termios.c_ospeed;
3623 + }
3624
3625 return 0;
3626 }
3627 @@ -2198,6 +2208,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
3628 */
3629 memset(&termios, 0, sizeof(struct ktermios));
3630 termios.c_cflag = uport->cons->cflag;
3631 + termios.c_ispeed = uport->cons->ispeed;
3632 + termios.c_ospeed = uport->cons->ospeed;
3633
3634 /*
3635 * If that's unset, use the tty termios setting.
3636 diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
3637 index eb61a07fcbbc3..b92700fdfd512 100644
3638 --- a/drivers/tty/serial/xilinx_uartps.c
3639 +++ b/drivers/tty/serial/xilinx_uartps.c
3640 @@ -589,9 +589,10 @@ static void cdns_uart_start_tx(struct uart_port *port)
3641 if (uart_circ_empty(&port->state->xmit))
3642 return;
3643
3644 + writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR);
3645 +
3646 cdns_uart_handle_tx(port);
3647
3648 - writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR);
3649 /* Enable the TX Empty interrupt */
3650 writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IER);
3651 }
3652 diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
3653 index ca9c82ee6c35d..dfccc102c1ddd 100644
3654 --- a/drivers/tty/tty_buffer.c
3655 +++ b/drivers/tty/tty_buffer.c
3656 @@ -536,6 +536,9 @@ static void flush_to_ldisc(struct work_struct *work)
3657 if (!count)
3658 break;
3659 head->read += count;
3660 +
3661 + if (need_resched())
3662 + cond_resched();
3663 }
3664
3665 mutex_unlock(&buf->lock);
3666 diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
3667 index 6062a5d816a63..f4b13f0637ea3 100644
3668 --- a/drivers/usb/chipidea/core.c
3669 +++ b/drivers/usb/chipidea/core.c
3670 @@ -516,7 +516,7 @@ int hw_device_reset(struct ci_hdrc *ci)
3671 return 0;
3672 }
3673
3674 -static irqreturn_t ci_irq(int irq, void *data)
3675 +static irqreturn_t ci_irq_handler(int irq, void *data)
3676 {
3677 struct ci_hdrc *ci = data;
3678 irqreturn_t ret = IRQ_NONE;
3679 @@ -569,6 +569,15 @@ static irqreturn_t ci_irq(int irq, void *data)
3680 return ret;
3681 }
3682
3683 +static void ci_irq(struct ci_hdrc *ci)
3684 +{
3685 + unsigned long flags;
3686 +
3687 + local_irq_save(flags);
3688 + ci_irq_handler(ci->irq, ci);
3689 + local_irq_restore(flags);
3690 +}
3691 +
3692 static int ci_vbus_notifier(struct notifier_block *nb, unsigned long event,
3693 void *ptr)
3694 {
3695 @@ -582,7 +591,7 @@ static int ci_vbus_notifier(struct notifier_block *nb, unsigned long event,
3696
3697 vbus->changed = true;
3698
3699 - ci_irq(ci->irq, ci);
3700 + ci_irq(ci);
3701 return NOTIFY_DONE;
3702 }
3703
3704 @@ -599,7 +608,7 @@ static int ci_id_notifier(struct notifier_block *nb, unsigned long event,
3705
3706 id->changed = true;
3707
3708 - ci_irq(ci->irq, ci);
3709 + ci_irq(ci);
3710 return NOTIFY_DONE;
3711 }
3712
3713 @@ -1011,7 +1020,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
3714 }
3715
3716 platform_set_drvdata(pdev, ci);
3717 - ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED,
3718 + ret = devm_request_irq(dev, ci->irq, ci_irq_handler, IRQF_SHARED,
3719 ci->platdata->name, ci);
3720 if (ret)
3721 goto stop;
3722 @@ -1126,11 +1135,11 @@ static void ci_extcon_wakeup_int(struct ci_hdrc *ci)
3723
3724 if (!IS_ERR(cable_id->edev) && ci->is_otg &&
3725 (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS))
3726 - ci_irq(ci->irq, ci);
3727 + ci_irq(ci);
3728
3729 if (!IS_ERR(cable_vbus->edev) && ci->is_otg &&
3730 (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS))
3731 - ci_irq(ci->irq, ci);
3732 + ci_irq(ci);
3733 }
3734
3735 static int ci_controller_resume(struct device *dev)
3736 diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
3737 index cccbb948821b2..a55d3761d777c 100644
3738 --- a/drivers/usb/gadget/legacy/hid.c
3739 +++ b/drivers/usb/gadget/legacy/hid.c
3740 @@ -103,8 +103,10 @@ static int do_config(struct usb_configuration *c)
3741
3742 list_for_each_entry(e, &hidg_func_list, node) {
3743 e->f = usb_get_function(e->fi);
3744 - if (IS_ERR(e->f))
3745 + if (IS_ERR(e->f)) {
3746 + status = PTR_ERR(e->f);
3747 goto put;
3748 + }
3749 status = usb_add_function(c, e->f);
3750 if (status < 0) {
3751 usb_put_function(e->f);
3752 diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
3753 index 1654a1bc64141..88aa5acac6fd9 100644
3754 --- a/drivers/usb/host/max3421-hcd.c
3755 +++ b/drivers/usb/host/max3421-hcd.c
3756 @@ -121,8 +121,6 @@ struct max3421_hcd {
3757
3758 struct task_struct *spi_thread;
3759
3760 - struct max3421_hcd *next;
3761 -
3762 enum max3421_rh_state rh_state;
3763 /* lower 16 bits contain port status, upper 16 bits the change mask: */
3764 u32 port_status;
3765 @@ -170,8 +168,6 @@ struct max3421_ep {
3766 u8 retransmit; /* packet needs retransmission */
3767 };
3768
3769 -static struct max3421_hcd *max3421_hcd_list;
3770 -
3771 #define MAX3421_FIFO_SIZE 64
3772
3773 #define MAX3421_SPI_DIR_RD 0 /* read register from MAX3421 */
3774 @@ -1835,9 +1831,8 @@ max3421_probe(struct spi_device *spi)
3775 }
3776 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
3777 max3421_hcd = hcd_to_max3421(hcd);
3778 - max3421_hcd->next = max3421_hcd_list;
3779 - max3421_hcd_list = max3421_hcd;
3780 INIT_LIST_HEAD(&max3421_hcd->ep_list);
3781 + spi_set_drvdata(spi, max3421_hcd);
3782
3783 max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL);
3784 if (!max3421_hcd->tx)
3785 @@ -1882,28 +1877,18 @@ error:
3786 static int
3787 max3421_remove(struct spi_device *spi)
3788 {
3789 - struct max3421_hcd *max3421_hcd = NULL, **prev;
3790 - struct usb_hcd *hcd = NULL;
3791 + struct max3421_hcd *max3421_hcd;
3792 + struct usb_hcd *hcd;
3793 unsigned long flags;
3794
3795 - for (prev = &max3421_hcd_list; *prev; prev = &(*prev)->next) {
3796 - max3421_hcd = *prev;
3797 - hcd = max3421_to_hcd(max3421_hcd);
3798 - if (hcd->self.controller == &spi->dev)
3799 - break;
3800 - }
3801 - if (!max3421_hcd) {
3802 - dev_err(&spi->dev, "no MAX3421 HCD found for SPI device %p\n",
3803 - spi);
3804 - return -ENODEV;
3805 - }
3806 + max3421_hcd = spi_get_drvdata(spi);
3807 + hcd = max3421_to_hcd(max3421_hcd);
3808
3809 usb_remove_hcd(hcd);
3810
3811 spin_lock_irqsave(&max3421_hcd->lock, flags);
3812
3813 kthread_stop(max3421_hcd->spi_thread);
3814 - *prev = max3421_hcd->next;
3815
3816 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
3817
3818 diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
3819 index 9c9e97294c18d..4d42ae3b2fd6d 100644
3820 --- a/drivers/usb/host/ohci-tmio.c
3821 +++ b/drivers/usb/host/ohci-tmio.c
3822 @@ -199,7 +199,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
3823 if (usb_disabled())
3824 return -ENODEV;
3825
3826 - if (!cell)
3827 + if (!cell || !regs || !config || !sram)
3828 return -EINVAL;
3829
3830 if (irq < 0)
3831 diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
3832 index dc8f54a68bdbc..9708dbb52b702 100644
3833 --- a/drivers/usb/host/xhci-hub.c
3834 +++ b/drivers/usb/host/xhci-hub.c
3835 @@ -174,7 +174,6 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
3836 {
3837 u16 temp;
3838
3839 - desc->bPwrOn2PwrGood = 10; /* xhci section 5.4.9 says 20ms max */
3840 desc->bHubContrCurrent = 0;
3841
3842 desc->bNbrPorts = ports;
3843 @@ -208,6 +207,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
3844 desc->bDescriptorType = USB_DT_HUB;
3845 temp = 1 + (ports / 8);
3846 desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp;
3847 + desc->bPwrOn2PwrGood = 10; /* xhci section 5.4.8 says 20ms */
3848
3849 /* The Device Removable bits are reported on a byte granularity.
3850 * If the port doesn't exist within that byte, the bit is set to 0.
3851 @@ -258,6 +258,7 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
3852 xhci_common_hub_descriptor(xhci, desc, ports);
3853 desc->bDescriptorType = USB_DT_SS_HUB;
3854 desc->bDescLength = USB_DT_SS_HUB_SIZE;
3855 + desc->bPwrOn2PwrGood = 50; /* usb 3.1 may fail if less than 100ms */
3856
3857 /* header decode latency should be zero for roothubs,
3858 * see section 4.23.5.2.
3859 diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
3860 index 1b83946bfb18d..1ea48590bf3b1 100644
3861 --- a/drivers/usb/misc/iowarrior.c
3862 +++ b/drivers/usb/misc/iowarrior.c
3863 @@ -96,10 +96,6 @@ struct iowarrior {
3864 /* globals */
3865 /*--------------*/
3866
3867 -/*
3868 - * USB spec identifies 5 second timeouts.
3869 - */
3870 -#define GET_TIMEOUT 5
3871 #define USB_REQ_GET_REPORT 0x01
3872 //#if 0
3873 static int usb_get_report(struct usb_device *dev,
3874 @@ -111,7 +107,7 @@ static int usb_get_report(struct usb_device *dev,
3875 USB_DIR_IN | USB_TYPE_CLASS |
3876 USB_RECIP_INTERFACE, (type << 8) + id,
3877 inter->desc.bInterfaceNumber, buf, size,
3878 - GET_TIMEOUT*HZ);
3879 + USB_CTRL_GET_TIMEOUT);
3880 }
3881 //#endif
3882
3883 @@ -126,7 +122,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type,
3884 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
3885 (type << 8) + id,
3886 intf->cur_altsetting->desc.bInterfaceNumber, buf,
3887 - size, HZ);
3888 + size, 1000);
3889 }
3890
3891 /*---------------------*/
3892 diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
3893 index 7e9204fdba4a8..fb4239b5286fb 100644
3894 --- a/drivers/usb/musb/tusb6010.c
3895 +++ b/drivers/usb/musb/tusb6010.c
3896 @@ -1120,6 +1120,11 @@ static int tusb_musb_init(struct musb *musb)
3897
3898 /* dma address for async dma */
3899 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
3900 + if (!mem) {
3901 + pr_debug("no async dma resource?\n");
3902 + ret = -ENODEV;
3903 + goto done;
3904 + }
3905 musb->async = mem->start;
3906
3907 /* dma address for sync dma */
3908 diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
3909 index e08755e9b6129..9c825d4e564e8 100644
3910 --- a/drivers/usb/serial/keyspan.c
3911 +++ b/drivers/usb/serial/keyspan.c
3912 @@ -2419,22 +2419,22 @@ static int keyspan_port_probe(struct usb_serial_port *port)
3913 for (i = 0; i < ARRAY_SIZE(p_priv->in_buffer); ++i) {
3914 p_priv->in_buffer[i] = kzalloc(IN_BUFLEN, GFP_KERNEL);
3915 if (!p_priv->in_buffer[i])
3916 - goto err_in_buffer;
3917 + goto err_free_in_buffer;
3918 }
3919
3920 for (i = 0; i < ARRAY_SIZE(p_priv->out_buffer); ++i) {
3921 p_priv->out_buffer[i] = kzalloc(OUT_BUFLEN, GFP_KERNEL);
3922 if (!p_priv->out_buffer[i])
3923 - goto err_out_buffer;
3924 + goto err_free_out_buffer;
3925 }
3926
3927 p_priv->inack_buffer = kzalloc(INACK_BUFLEN, GFP_KERNEL);
3928 if (!p_priv->inack_buffer)
3929 - goto err_inack_buffer;
3930 + goto err_free_out_buffer;
3931
3932 p_priv->outcont_buffer = kzalloc(OUTCONT_BUFLEN, GFP_KERNEL);
3933 if (!p_priv->outcont_buffer)
3934 - goto err_outcont_buffer;
3935 + goto err_free_inack_buffer;
3936
3937 p_priv->device_details = d_details;
3938
3939 @@ -2480,15 +2480,14 @@ static int keyspan_port_probe(struct usb_serial_port *port)
3940
3941 return 0;
3942
3943 -err_outcont_buffer:
3944 +err_free_inack_buffer:
3945 kfree(p_priv->inack_buffer);
3946 -err_inack_buffer:
3947 +err_free_out_buffer:
3948 for (i = 0; i < ARRAY_SIZE(p_priv->out_buffer); ++i)
3949 kfree(p_priv->out_buffer[i]);
3950 -err_out_buffer:
3951 +err_free_in_buffer:
3952 for (i = 0; i < ARRAY_SIZE(p_priv->in_buffer); ++i)
3953 kfree(p_priv->in_buffer[i]);
3954 -err_in_buffer:
3955 kfree(p_priv);
3956
3957 return -ENOMEM;
3958 diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
3959 index 3a10ac19598fa..8827e0ec5995c 100644
3960 --- a/drivers/video/console/sticon.c
3961 +++ b/drivers/video/console/sticon.c
3962 @@ -290,13 +290,13 @@ static unsigned long sticon_getxy(struct vc_data *conp, unsigned long pos,
3963 static u8 sticon_build_attr(struct vc_data *conp, u8 color, u8 intens,
3964 u8 blink, u8 underline, u8 reverse, u8 italic)
3965 {
3966 - u8 attr = ((color & 0x70) >> 1) | ((color & 7));
3967 + u8 fg = color & 7;
3968 + u8 bg = (color & 0x70) >> 4;
3969
3970 - if (reverse) {
3971 - color = ((color >> 3) & 0x7) | ((color & 0x7) << 3);
3972 - }
3973 -
3974 - return attr;
3975 + if (reverse)
3976 + return (fg << 3) | bg;
3977 + else
3978 + return (bg << 3) | fg;
3979 }
3980
3981 static void sticon_invert_region(struct vc_data *conp, u16 *p, int count)
3982 diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
3983 index 314b7eceb81c5..84a3778552eba 100644
3984 --- a/drivers/video/fbdev/chipsfb.c
3985 +++ b/drivers/video/fbdev/chipsfb.c
3986 @@ -332,7 +332,7 @@ static struct fb_var_screeninfo chipsfb_var = {
3987
3988 static void init_chips(struct fb_info *p, unsigned long addr)
3989 {
3990 - memset(p->screen_base, 0, 0x100000);
3991 + fb_memset(p->screen_base, 0, 0x100000);
3992
3993 p->fix = chipsfb_fix;
3994 p->fix.smem_start = addr;
3995 diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c
3996 index ae4974701e5c7..6fe9daf2367b5 100644
3997 --- a/drivers/watchdog/f71808e_wdt.c
3998 +++ b/drivers/watchdog/f71808e_wdt.c
3999 @@ -237,15 +237,17 @@ static int watchdog_set_timeout(int timeout)
4000
4001 mutex_lock(&watchdog.lock);
4002
4003 - watchdog.timeout = timeout;
4004 if (timeout > 0xff) {
4005 watchdog.timer_val = DIV_ROUND_UP(timeout, 60);
4006 watchdog.minutes_mode = true;
4007 + timeout = watchdog.timer_val * 60;
4008 } else {
4009 watchdog.timer_val = timeout;
4010 watchdog.minutes_mode = false;
4011 }
4012
4013 + watchdog.timeout = timeout;
4014 +
4015 mutex_unlock(&watchdog.lock);
4016
4017 return 0;
4018 diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
4019 index 1b02bfa81b296..40c006ee8492d 100644
4020 --- a/drivers/watchdog/omap_wdt.c
4021 +++ b/drivers/watchdog/omap_wdt.c
4022 @@ -271,8 +271,12 @@ static int omap_wdt_probe(struct platform_device *pdev)
4023 wdev->wdog.bootstatus = WDIOF_CARDRESET;
4024 }
4025
4026 - if (!early_enable)
4027 + if (early_enable) {
4028 + omap_wdt_start(&wdev->wdog);
4029 + set_bit(WDOG_HW_RUNNING, &wdev->wdog.status);
4030 + } else {
4031 omap_wdt_disable(wdev);
4032 + }
4033
4034 ret = watchdog_register_device(&wdev->wdog);
4035 if (ret) {
4036 diff --git a/drivers/xen/xen-pciback/conf_space_capability.c b/drivers/xen/xen-pciback/conf_space_capability.c
4037 index b1a1d7de0894e..daa2e89a50fa3 100644
4038 --- a/drivers/xen/xen-pciback/conf_space_capability.c
4039 +++ b/drivers/xen/xen-pciback/conf_space_capability.c
4040 @@ -159,7 +159,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset)
4041 }
4042
4043 out:
4044 - return ERR_PTR(err);
4045 + return err ? ERR_PTR(err) : NULL;
4046 }
4047
4048 static const struct config_field caplist_pm[] = {
4049 diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
4050 index 5456937836b86..033cb85ce9b51 100644
4051 --- a/fs/btrfs/async-thread.c
4052 +++ b/fs/btrfs/async-thread.c
4053 @@ -283,6 +283,13 @@ static void run_ordered_work(struct __btrfs_workqueue *wq,
4054 ordered_list);
4055 if (!test_bit(WORK_DONE_BIT, &work->flags))
4056 break;
4057 + /*
4058 + * Orders all subsequent loads after reading WORK_DONE_BIT,
4059 + * paired with the smp_mb__before_atomic in btrfs_work_helper
4060 + * this guarantees that the ordered function will see all
4061 + * updates from ordinary work function.
4062 + */
4063 + smp_rmb();
4064
4065 /*
4066 * we are going to call the ordered done function, but
4067 @@ -368,6 +375,13 @@ static void normal_work_helper(struct btrfs_work *work)
4068 thresh_exec_hook(wq);
4069 work->func(work);
4070 if (need_order) {
4071 + /*
4072 + * Ensures all memory accesses done in the work function are
4073 + * ordered before setting the WORK_DONE_BIT. Ensuring the thread
4074 + * which is going to executed the ordered work sees them.
4075 + * Pairs with the smp_rmb in run_ordered_work.
4076 + */
4077 + smp_mb__before_atomic();
4078 set_bit(WORK_DONE_BIT, &work->flags);
4079 run_ordered_work(wq, work);
4080 }
4081 diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
4082 index 11ecd798864c8..cc91b0c564a38 100644
4083 --- a/fs/btrfs/tree-log.c
4084 +++ b/fs/btrfs/tree-log.c
4085 @@ -2225,7 +2225,9 @@ again:
4086 else {
4087 ret = find_dir_range(log, path, dirid, key_type,
4088 &range_start, &range_end);
4089 - if (ret != 0)
4090 + if (ret < 0)
4091 + goto out;
4092 + else if (ret > 0)
4093 break;
4094 }
4095
4096 diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c
4097 index 103788ecc28c1..0c2aabba1fdbb 100644
4098 --- a/fs/jfs/jfs_mount.c
4099 +++ b/fs/jfs/jfs_mount.c
4100 @@ -93,14 +93,14 @@ int jfs_mount(struct super_block *sb)
4101 * (initialize mount inode from the superblock)
4102 */
4103 if ((rc = chkSuper(sb))) {
4104 - goto errout20;
4105 + goto out;
4106 }
4107
4108 ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
4109 if (ipaimap == NULL) {
4110 jfs_err("jfs_mount: Failed to read AGGREGATE_I");
4111 rc = -EIO;
4112 - goto errout20;
4113 + goto out;
4114 }
4115 sbi->ipaimap = ipaimap;
4116
4117 @@ -111,7 +111,7 @@ int jfs_mount(struct super_block *sb)
4118 */
4119 if ((rc = diMount(ipaimap))) {
4120 jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc);
4121 - goto errout21;
4122 + goto err_ipaimap;
4123 }
4124
4125 /*
4126 @@ -120,7 +120,7 @@ int jfs_mount(struct super_block *sb)
4127 ipbmap = diReadSpecial(sb, BMAP_I, 0);
4128 if (ipbmap == NULL) {
4129 rc = -EIO;
4130 - goto errout22;
4131 + goto err_umount_ipaimap;
4132 }
4133
4134 jfs_info("jfs_mount: ipbmap:0x%p", ipbmap);
4135 @@ -132,7 +132,7 @@ int jfs_mount(struct super_block *sb)
4136 */
4137 if ((rc = dbMount(ipbmap))) {
4138 jfs_err("jfs_mount: dbMount failed w/rc = %d", rc);
4139 - goto errout22;
4140 + goto err_ipbmap;
4141 }
4142
4143 /*
4144 @@ -151,7 +151,7 @@ int jfs_mount(struct super_block *sb)
4145 if (!ipaimap2) {
4146 jfs_err("jfs_mount: Failed to read AGGREGATE_I");
4147 rc = -EIO;
4148 - goto errout35;
4149 + goto err_umount_ipbmap;
4150 }
4151 sbi->ipaimap2 = ipaimap2;
4152
4153 @@ -163,7 +163,7 @@ int jfs_mount(struct super_block *sb)
4154 if ((rc = diMount(ipaimap2))) {
4155 jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d",
4156 rc);
4157 - goto errout35;
4158 + goto err_ipaimap2;
4159 }
4160 } else
4161 /* Secondary aggregate inode table is not valid */
4162 @@ -180,7 +180,7 @@ int jfs_mount(struct super_block *sb)
4163 jfs_err("jfs_mount: Failed to read FILESYSTEM_I");
4164 /* open fileset secondary inode allocation map */
4165 rc = -EIO;
4166 - goto errout40;
4167 + goto err_umount_ipaimap2;
4168 }
4169 jfs_info("jfs_mount: ipimap:0x%p", ipimap);
4170
4171 @@ -190,41 +190,34 @@ int jfs_mount(struct super_block *sb)
4172 /* initialize fileset inode allocation map */
4173 if ((rc = diMount(ipimap))) {
4174 jfs_err("jfs_mount: diMount failed w/rc = %d", rc);
4175 - goto errout41;
4176 + goto err_ipimap;
4177 }
4178
4179 - goto out;
4180 + return rc;
4181
4182 /*
4183 * unwind on error
4184 */
4185 - errout41: /* close fileset inode allocation map inode */
4186 +err_ipimap:
4187 + /* close fileset inode allocation map inode */
4188 diFreeSpecial(ipimap);
4189 -
4190 - errout40: /* fileset closed */
4191 -
4192 +err_umount_ipaimap2:
4193 /* close secondary aggregate inode allocation map */
4194 - if (ipaimap2) {
4195 + if (ipaimap2)
4196 diUnmount(ipaimap2, 1);
4197 +err_ipaimap2:
4198 + /* close aggregate inodes */
4199 + if (ipaimap2)
4200 diFreeSpecial(ipaimap2);
4201 - }
4202 -
4203 - errout35:
4204 -
4205 - /* close aggregate block allocation map */
4206 +err_umount_ipbmap: /* close aggregate block allocation map */
4207 dbUnmount(ipbmap, 1);
4208 +err_ipbmap: /* close aggregate inodes */
4209 diFreeSpecial(ipbmap);
4210 -
4211 - errout22: /* close aggregate inode allocation map */
4212 -
4213 +err_umount_ipaimap: /* close aggregate inode allocation map */
4214 diUnmount(ipaimap, 1);
4215 -
4216 - errout21: /* close aggregate inodes */
4217 +err_ipaimap: /* close aggregate inodes */
4218 diFreeSpecial(ipaimap);
4219 - errout20: /* aggregate closed */
4220 -
4221 - out:
4222 -
4223 +out:
4224 if (rc)
4225 jfs_err("Mount JFS Failure: %d", rc);
4226
4227 diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
4228 index c8863563c6350..287ed99a7e513 100644
4229 --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
4230 +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
4231 @@ -383,10 +383,10 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx,
4232 goto out_fail;
4233
4234 ds = mirror->mirror_ds->ds;
4235 + if (READ_ONCE(ds->ds_clp))
4236 + goto out;
4237 /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */
4238 smp_rmb();
4239 - if (ds->ds_clp)
4240 - goto out;
4241
4242 /* FIXME: For now we assume the server sent only one version of NFS
4243 * to use for the DS.
4244 diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
4245 index 53b4705abcc76..1f2da20946640 100644
4246 --- a/fs/nfs/pnfs_nfs.c
4247 +++ b/fs/nfs/pnfs_nfs.c
4248 @@ -666,7 +666,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv,
4249 }
4250
4251 smp_wmb();
4252 - ds->ds_clp = clp;
4253 + WRITE_ONCE(ds->ds_clp, clp);
4254 dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr);
4255 out:
4256 return status;
4257 @@ -742,7 +742,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv,
4258 }
4259
4260 smp_wmb();
4261 - ds->ds_clp = clp;
4262 + WRITE_ONCE(ds->ds_clp, clp);
4263 dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr);
4264 out:
4265 return status;
4266 diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
4267 index d526e86cf5bbe..f584ef6e754a7 100644
4268 --- a/fs/ocfs2/file.c
4269 +++ b/fs/ocfs2/file.c
4270 @@ -490,10 +490,11 @@ int ocfs2_truncate_file(struct inode *inode,
4271 * greater than page size, so we have to truncate them
4272 * anyway.
4273 */
4274 - unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1);
4275 - truncate_inode_pages(inode->i_mapping, new_i_size);
4276
4277 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
4278 + unmap_mapping_range(inode->i_mapping,
4279 + new_i_size + PAGE_SIZE - 1, 0, 1);
4280 + truncate_inode_pages(inode->i_mapping, new_i_size);
4281 status = ocfs2_truncate_inline(inode, di_bh, new_i_size,
4282 i_size_read(inode), 1);
4283 if (status)
4284 @@ -512,6 +513,9 @@ int ocfs2_truncate_file(struct inode *inode,
4285 goto bail_unlock_sem;
4286 }
4287
4288 + unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1);
4289 + truncate_inode_pages(inode->i_mapping, new_i_size);
4290 +
4291 status = ocfs2_commit_truncate(osb, inode, di_bh);
4292 if (status < 0) {
4293 mlog_errno(status);
4294 diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c
4295 index 5355efba4bc8c..1942f9946ab77 100644
4296 --- a/fs/orangefs/dcache.c
4297 +++ b/fs/orangefs/dcache.c
4298 @@ -25,8 +25,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
4299 gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: attempting lookup.\n", __func__);
4300
4301 new_op = op_alloc(ORANGEFS_VFS_OP_LOOKUP);
4302 - if (!new_op)
4303 + if (!new_op) {
4304 + ret = -ENOMEM;
4305 goto out_put_parent;
4306 + }
4307
4308 new_op->upcall.req.lookup.sym_follow = ORANGEFS_LOOKUP_LINK_NO_FOLLOW;
4309 new_op->upcall.req.lookup.parent_refn = parent->refn;
4310 diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c
4311 index ecd9887b0d1fe..8c7705b50e5dd 100644
4312 --- a/fs/quota/quota_tree.c
4313 +++ b/fs/quota/quota_tree.c
4314 @@ -422,6 +422,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
4315 quota_error(dquot->dq_sb, "Quota structure has offset to "
4316 "other block (%u) than it should (%u)", blk,
4317 (uint)(dquot->dq_off >> info->dqi_blocksize_bits));
4318 + ret = -EIO;
4319 goto out_buf;
4320 }
4321 ret = read_blk(info, blk, buf);
4322 @@ -487,6 +488,13 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
4323 goto out_buf;
4324 }
4325 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
4326 + if (newblk < QT_TREEOFF || newblk >= info->dqi_blocks) {
4327 + quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)",
4328 + newblk, info->dqi_blocks);
4329 + ret = -EUCLEAN;
4330 + goto out_buf;
4331 + }
4332 +
4333 if (depth == info->dqi_qtree_depth - 1) {
4334 ret = free_dqentry(info, dquot, newblk);
4335 newblk = 0;
4336 @@ -586,6 +594,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
4337 blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
4338 if (!blk) /* No reference? */
4339 goto out_buf;
4340 + if (blk < QT_TREEOFF || blk >= info->dqi_blocks) {
4341 + quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)",
4342 + blk, info->dqi_blocks);
4343 + ret = -EUCLEAN;
4344 + goto out_buf;
4345 + }
4346 +
4347 if (depth < info->dqi_qtree_depth - 1)
4348 ret = find_tree_dqentry(info, dquot, blk, depth+1);
4349 else
4350 diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
4351 index 21d36d2847356..985cccfcedad9 100644
4352 --- a/fs/tracefs/inode.c
4353 +++ b/fs/tracefs/inode.c
4354 @@ -429,7 +429,8 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
4355 if (unlikely(!inode))
4356 return failed_creating(dentry);
4357
4358 - inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
4359 + /* Do not set bits for OTH */
4360 + inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP;
4361 inode->i_op = ops;
4362 inode->i_fop = &simple_dir_operations;
4363
4364 diff --git a/include/linux/console.h b/include/linux/console.h
4365 index d530c4627e54e..118c33aa5ecfa 100644
4366 --- a/include/linux/console.h
4367 +++ b/include/linux/console.h
4368 @@ -135,6 +135,8 @@ struct console {
4369 short flags;
4370 short index;
4371 int cflag;
4372 + uint ispeed;
4373 + uint ospeed;
4374 void *data;
4375 struct console *next;
4376 };
4377 diff --git a/include/linux/filter.h b/include/linux/filter.h
4378 index 0837d904405a3..05be3d84655e4 100644
4379 --- a/include/linux/filter.h
4380 +++ b/include/linux/filter.h
4381 @@ -600,6 +600,7 @@ void bpf_warn_invalid_xdp_action(u32 act);
4382 extern int bpf_jit_enable;
4383 extern int bpf_jit_harden;
4384 extern long bpf_jit_limit;
4385 +extern long bpf_jit_limit_max;
4386
4387 typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size);
4388
4389 diff --git a/include/linux/libata.h b/include/linux/libata.h
4390 index de770d11a5c18..208534322bcdc 100644
4391 --- a/include/linux/libata.h
4392 +++ b/include/linux/libata.h
4393 @@ -404,7 +404,7 @@ enum {
4394 /* This should match the actual table size of
4395 * ata_eh_cmd_timeout_table in libata-eh.c.
4396 */
4397 - ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6,
4398 + ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 7,
4399
4400 /* Horkage types. May be set by libata or controller on drives
4401 (some horkage may be drive/controller pair dependent */
4402 diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
4403 index 558adfa5c8a87..53ac461f342bb 100644
4404 --- a/include/linux/lsm_hooks.h
4405 +++ b/include/linux/lsm_hooks.h
4406 @@ -1147,22 +1147,22 @@
4407 *
4408 * @binder_set_context_mgr
4409 * Check whether @mgr is allowed to be the binder context manager.
4410 - * @mgr contains the task_struct for the task being registered.
4411 + * @mgr contains the struct cred for the current binder process.
4412 * Return 0 if permission is granted.
4413 * @binder_transaction
4414 * Check whether @from is allowed to invoke a binder transaction call
4415 * to @to.
4416 - * @from contains the task_struct for the sending task.
4417 - * @to contains the task_struct for the receiving task.
4418 - * @binder_transfer_binder
4419 + * @from contains the struct cred for the sending process.
4420 + * @to contains the struct cred for the receiving process.
4421 + * @binder_transfer_binder:
4422 * Check whether @from is allowed to transfer a binder reference to @to.
4423 - * @from contains the task_struct for the sending task.
4424 - * @to contains the task_struct for the receiving task.
4425 - * @binder_transfer_file
4426 + * @from contains the struct cred for the sending process.
4427 + * @to contains the struct cred for the receiving process.
4428 + * @binder_transfer_file:
4429 * Check whether @from is allowed to transfer @file to @to.
4430 - * @from contains the task_struct for the sending task.
4431 + * @from contains the struct cred for the sending process.
4432 * @file contains the struct file being transferred.
4433 - * @to contains the task_struct for the receiving task.
4434 + * @to contains the struct cred for the receiving process.
4435 *
4436 * @ptrace_access_check:
4437 * Check permission before allowing the current process to trace the
4438 @@ -1332,13 +1332,13 @@
4439 */
4440
4441 union security_list_options {
4442 - int (*binder_set_context_mgr)(struct task_struct *mgr);
4443 - int (*binder_transaction)(struct task_struct *from,
4444 - struct task_struct *to);
4445 - int (*binder_transfer_binder)(struct task_struct *from,
4446 - struct task_struct *to);
4447 - int (*binder_transfer_file)(struct task_struct *from,
4448 - struct task_struct *to,
4449 + int (*binder_set_context_mgr)(const struct cred *mgr);
4450 + int (*binder_transaction)(const struct cred *from,
4451 + const struct cred *to);
4452 + int (*binder_transfer_binder)(const struct cred *from,
4453 + const struct cred *to);
4454 + int (*binder_transfer_file)(const struct cred *from,
4455 + const struct cred *to,
4456 struct file *file);
4457
4458 int (*ptrace_access_check)(struct task_struct *child,
4459 diff --git a/include/linux/security.h b/include/linux/security.h
4460 index c2125e9093e8e..2f5d282bd3eca 100644
4461 --- a/include/linux/security.h
4462 +++ b/include/linux/security.h
4463 @@ -184,13 +184,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
4464 extern int security_init(void);
4465
4466 /* Security operations */
4467 -int security_binder_set_context_mgr(struct task_struct *mgr);
4468 -int security_binder_transaction(struct task_struct *from,
4469 - struct task_struct *to);
4470 -int security_binder_transfer_binder(struct task_struct *from,
4471 - struct task_struct *to);
4472 -int security_binder_transfer_file(struct task_struct *from,
4473 - struct task_struct *to, struct file *file);
4474 +int security_binder_set_context_mgr(const struct cred *mgr);
4475 +int security_binder_transaction(const struct cred *from,
4476 + const struct cred *to);
4477 +int security_binder_transfer_binder(const struct cred *from,
4478 + const struct cred *to);
4479 +int security_binder_transfer_file(const struct cred *from,
4480 + const struct cred *to, struct file *file);
4481 int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
4482 int security_ptrace_traceme(struct task_struct *parent);
4483 int security_capget(struct task_struct *target,
4484 @@ -394,25 +394,25 @@ static inline int security_init(void)
4485 return 0;
4486 }
4487
4488 -static inline int security_binder_set_context_mgr(struct task_struct *mgr)
4489 +static inline int security_binder_set_context_mgr(const struct cred *mgr)
4490 {
4491 return 0;
4492 }
4493
4494 -static inline int security_binder_transaction(struct task_struct *from,
4495 - struct task_struct *to)
4496 +static inline int security_binder_transaction(const struct cred *from,
4497 + const struct cred *to)
4498 {
4499 return 0;
4500 }
4501
4502 -static inline int security_binder_transfer_binder(struct task_struct *from,
4503 - struct task_struct *to)
4504 +static inline int security_binder_transfer_binder(const struct cred *from,
4505 + const struct cred *to)
4506 {
4507 return 0;
4508 }
4509
4510 -static inline int security_binder_transfer_file(struct task_struct *from,
4511 - struct task_struct *to,
4512 +static inline int security_binder_transfer_file(const struct cred *from,
4513 + const struct cred *to,
4514 struct file *file)
4515 {
4516 return 0;
4517 diff --git a/include/net/llc.h b/include/net/llc.h
4518 index 95e5ced4c1339..18dfd3e49a69f 100644
4519 --- a/include/net/llc.h
4520 +++ b/include/net/llc.h
4521 @@ -72,7 +72,9 @@ struct llc_sap {
4522 static inline
4523 struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
4524 {
4525 - return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
4526 + u32 bucket = hash_32(ifindex, LLC_SK_DEV_HASH_BITS);
4527 +
4528 + return &sap->sk_dev_hash[bucket];
4529 }
4530
4531 static inline
4532 diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
4533 index 8a70d38f13329..0c7dd6dd23957 100644
4534 --- a/include/target/target_core_base.h
4535 +++ b/include/target/target_core_base.h
4536 @@ -779,8 +779,9 @@ struct se_device {
4537 atomic_long_t read_bytes;
4538 atomic_long_t write_bytes;
4539 /* Active commands on this virtual SE device */
4540 - atomic_t simple_cmds;
4541 - atomic_t dev_ordered_sync;
4542 + atomic_t non_ordered;
4543 + bool ordered_sync_in_progress;
4544 + atomic_t delayed_cmd_count;
4545 atomic_t dev_qf_count;
4546 u32 export_count;
4547 spinlock_t delayed_cmd_lock;
4548 @@ -803,6 +804,7 @@ struct se_device {
4549 struct list_head dev_tmr_list;
4550 struct workqueue_struct *tmr_wq;
4551 struct work_struct qf_work_queue;
4552 + struct work_struct delayed_cmd_work;
4553 struct list_head delayed_cmd_list;
4554 struct list_head state_list;
4555 struct list_head qf_cmd_list;
4556 diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
4557 index ecc8e01c56163..9d846dfb9e904 100644
4558 --- a/include/uapi/linux/pci_regs.h
4559 +++ b/include/uapi/linux/pci_regs.h
4560 @@ -488,6 +488,12 @@
4561 #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */
4562 #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
4563 #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */
4564 +#define PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
4565 +#define PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
4566 +#define PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
4567 +#define PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
4568 +#define PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
4569 +#define PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00a0 /* 4096 Bytes */
4570 #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */
4571 #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */
4572 #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
4573 diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
4574 index df2ebce927ec4..3ce69c0276c09 100644
4575 --- a/kernel/bpf/core.c
4576 +++ b/kernel/bpf/core.c
4577 @@ -212,6 +212,7 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
4578 int bpf_jit_enable __read_mostly = IS_BUILTIN(CONFIG_BPF_JIT_ALWAYS_ON);
4579 int bpf_jit_harden __read_mostly;
4580 long bpf_jit_limit __read_mostly;
4581 +long bpf_jit_limit_max __read_mostly;
4582
4583 static atomic_long_t bpf_jit_current;
4584
4585 @@ -231,7 +232,8 @@ u64 __weak bpf_jit_alloc_exec_limit(void)
4586 static int __init bpf_jit_charge_init(void)
4587 {
4588 /* Only used as heuristic here to derive limit. */
4589 - bpf_jit_limit = min_t(u64, round_up(bpf_jit_alloc_exec_limit() >> 2,
4590 + bpf_jit_limit_max = bpf_jit_alloc_exec_limit();
4591 + bpf_jit_limit = min_t(u64, round_up(bpf_jit_limit_max >> 2,
4592 PAGE_SIZE), LONG_MAX);
4593 return 0;
4594 }
4595 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
4596 index 3378c44e147e6..248b0bf5d6795 100644
4597 --- a/kernel/cgroup.c
4598 +++ b/kernel/cgroup.c
4599 @@ -1564,6 +1564,7 @@ static int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
4600 struct cgroup *dcgrp = &dst_root->cgrp;
4601 struct cgroup_subsys *ss;
4602 int ssid, i, ret;
4603 + u16 dfl_disable_ss_mask = 0;
4604
4605 lockdep_assert_held(&cgroup_mutex);
4606
4607 @@ -1580,8 +1581,28 @@ static int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
4608 /* can't move between two non-dummy roots either */
4609 if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root)
4610 return -EBUSY;
4611 +
4612 + /*
4613 + * Collect ssid's that need to be disabled from default
4614 + * hierarchy.
4615 + */
4616 + if (ss->root == &cgrp_dfl_root)
4617 + dfl_disable_ss_mask |= 1 << ssid;
4618 +
4619 } while_each_subsys_mask();
4620
4621 + if (dfl_disable_ss_mask) {
4622 + struct cgroup *scgrp = &cgrp_dfl_root.cgrp;
4623 +
4624 + /*
4625 + * Controllers from default hierarchy that need to be rebound
4626 + * are all disabled together in one go.
4627 + */
4628 + cgrp_dfl_root.subsys_mask &= ~dfl_disable_ss_mask;
4629 + WARN_ON(cgroup_apply_control(scgrp));
4630 + cgroup_finalize_control(scgrp, 0);
4631 + }
4632 +
4633 do_each_subsys_mask(ss, ssid, ss_mask) {
4634 struct cgroup_root *src_root = ss->root;
4635 struct cgroup *scgrp = &src_root->cgrp;
4636 @@ -1590,10 +1611,12 @@ static int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
4637
4638 WARN_ON(!css || cgroup_css(dcgrp, ss));
4639
4640 - /* disable from the source */
4641 - src_root->subsys_mask &= ~(1 << ssid);
4642 - WARN_ON(cgroup_apply_control(scgrp));
4643 - cgroup_finalize_control(scgrp, 0);
4644 + if (src_root != &cgrp_dfl_root) {
4645 + /* disable from the source */
4646 + src_root->subsys_mask &= ~(1 << ssid);
4647 + WARN_ON(cgroup_apply_control(scgrp));
4648 + cgroup_finalize_control(scgrp, 0);
4649 + }
4650
4651 /* rebind */
4652 RCU_INIT_POINTER(scgrp->subsys[ssid], NULL);
4653 diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
4654 index 9f56e3fac795a..05dd765e2cbca 100644
4655 --- a/kernel/locking/lockdep.c
4656 +++ b/kernel/locking/lockdep.c
4657 @@ -695,7 +695,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
4658 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
4659 return NULL;
4660
4661 - hlist_for_each_entry_rcu(class, hash_head, hash_entry) {
4662 + hlist_for_each_entry_rcu_notrace(class, hash_head, hash_entry) {
4663 if (class->key == key) {
4664 /*
4665 * Huh! same key, different name? Did someone trample
4666 diff --git a/kernel/power/swap.c b/kernel/power/swap.c
4667 index a3b1e617bcdc3..8009cd308fcc6 100644
4668 --- a/kernel/power/swap.c
4669 +++ b/kernel/power/swap.c
4670 @@ -1528,9 +1528,10 @@ end:
4671 int swsusp_check(void)
4672 {
4673 int error;
4674 + void *holder;
4675
4676 hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device,
4677 - FMODE_READ, NULL);
4678 + FMODE_READ | FMODE_EXCL, &holder);
4679 if (!IS_ERR(hib_resume_bdev)) {
4680 set_blocksize(hib_resume_bdev, PAGE_SIZE);
4681 clear_page(swsusp_header);
4682 @@ -1552,7 +1553,7 @@ int swsusp_check(void)
4683
4684 put:
4685 if (error)
4686 - blkdev_put(hib_resume_bdev, FMODE_READ);
4687 + blkdev_put(hib_resume_bdev, FMODE_READ | FMODE_EXCL);
4688 else
4689 pr_debug("PM: Image signature found, resuming\n");
4690 } else {
4691 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
4692 index c7c7ba8807f83..b1bfd44aa9f01 100644
4693 --- a/kernel/sched/core.c
4694 +++ b/kernel/sched/core.c
4695 @@ -1875,6 +1875,9 @@ out:
4696
4697 bool cpus_share_cache(int this_cpu, int that_cpu)
4698 {
4699 + if (this_cpu == that_cpu)
4700 + return true;
4701 +
4702 return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu);
4703 }
4704 #endif /* CONFIG_SMP */
4705 diff --git a/kernel/signal.c b/kernel/signal.c
4706 index bedca1629f260..2c26af848e682 100644
4707 --- a/kernel/signal.c
4708 +++ b/kernel/signal.c
4709 @@ -1823,16 +1823,6 @@ static inline int may_ptrace_stop(void)
4710 return 1;
4711 }
4712
4713 -/*
4714 - * Return non-zero if there is a SIGKILL that should be waking us up.
4715 - * Called with the siglock held.
4716 - */
4717 -static int sigkill_pending(struct task_struct *tsk)
4718 -{
4719 - return sigismember(&tsk->pending.signal, SIGKILL) ||
4720 - sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
4721 -}
4722 -
4723 /*
4724 * This must be called with current->sighand->siglock held.
4725 *
4726 @@ -1858,15 +1848,10 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
4727 * calling arch_ptrace_stop, so we must release it now.
4728 * To preserve proper semantics, we must do this before
4729 * any signal bookkeeping like checking group_stop_count.
4730 - * Meanwhile, a SIGKILL could come in before we retake the
4731 - * siglock. That must prevent us from sleeping in TASK_TRACED.
4732 - * So after regaining the lock, we must check for SIGKILL.
4733 */
4734 spin_unlock_irq(&current->sighand->siglock);
4735 arch_ptrace_stop(exit_code, info);
4736 spin_lock_irq(&current->sighand->siglock);
4737 - if (sigkill_pending(current))
4738 - return;
4739 }
4740
4741 /*
4742 @@ -1875,6 +1860,8 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
4743 * Also, transition to TRACED and updates to ->jobctl should be
4744 * atomic with respect to siglock and should be done after the arch
4745 * hook as siglock is released and regrabbed across it.
4746 + * schedule() will not sleep if there is a pending signal that
4747 + * can awaken the task.
4748 */
4749 set_current_state(TASK_TRACED);
4750
4751 diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c
4752 index 35b2ba07f3c6f..379db35838b64 100644
4753 --- a/kernel/trace/tracing_map.c
4754 +++ b/kernel/trace/tracing_map.c
4755 @@ -703,29 +703,35 @@ int tracing_map_init(struct tracing_map *map)
4756 return err;
4757 }
4758
4759 -static int cmp_entries_dup(const struct tracing_map_sort_entry **a,
4760 - const struct tracing_map_sort_entry **b)
4761 +static int cmp_entries_dup(const void *A, const void *B)
4762 {
4763 + const struct tracing_map_sort_entry *a, *b;
4764 int ret = 0;
4765
4766 - if (memcmp((*a)->key, (*b)->key, (*a)->elt->map->key_size))
4767 + a = *(const struct tracing_map_sort_entry **)A;
4768 + b = *(const struct tracing_map_sort_entry **)B;
4769 +
4770 + if (memcmp(a->key, b->key, a->elt->map->key_size))
4771 ret = 1;
4772
4773 return ret;
4774 }
4775
4776 -static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
4777 - const struct tracing_map_sort_entry **b)
4778 +static int cmp_entries_sum(const void *A, const void *B)
4779 {
4780 const struct tracing_map_elt *elt_a, *elt_b;
4781 + const struct tracing_map_sort_entry *a, *b;
4782 struct tracing_map_sort_key *sort_key;
4783 struct tracing_map_field *field;
4784 tracing_map_cmp_fn_t cmp_fn;
4785 void *val_a, *val_b;
4786 int ret = 0;
4787
4788 - elt_a = (*a)->elt;
4789 - elt_b = (*b)->elt;
4790 + a = *(const struct tracing_map_sort_entry **)A;
4791 + b = *(const struct tracing_map_sort_entry **)B;
4792 +
4793 + elt_a = a->elt;
4794 + elt_b = b->elt;
4795
4796 sort_key = &elt_a->map->sort_key;
4797
4798 @@ -742,18 +748,21 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a,
4799 return ret;
4800 }
4801
4802 -static int cmp_entries_key(const struct tracing_map_sort_entry **a,
4803 - const struct tracing_map_sort_entry **b)
4804 +static int cmp_entries_key(const void *A, const void *B)
4805 {
4806 const struct tracing_map_elt *elt_a, *elt_b;
4807 + const struct tracing_map_sort_entry *a, *b;
4808 struct tracing_map_sort_key *sort_key;
4809 struct tracing_map_field *field;
4810 tracing_map_cmp_fn_t cmp_fn;
4811 void *val_a, *val_b;
4812 int ret = 0;
4813
4814 - elt_a = (*a)->elt;
4815 - elt_b = (*b)->elt;
4816 + a = *(const struct tracing_map_sort_entry **)A;
4817 + b = *(const struct tracing_map_sort_entry **)B;
4818 +
4819 + elt_a = a->elt;
4820 + elt_b = b->elt;
4821
4822 sort_key = &elt_a->map->sort_key;
4823
4824 @@ -926,10 +935,8 @@ static void sort_secondary(struct tracing_map *map,
4825 struct tracing_map_sort_key *primary_key,
4826 struct tracing_map_sort_key *secondary_key)
4827 {
4828 - int (*primary_fn)(const struct tracing_map_sort_entry **,
4829 - const struct tracing_map_sort_entry **);
4830 - int (*secondary_fn)(const struct tracing_map_sort_entry **,
4831 - const struct tracing_map_sort_entry **);
4832 + int (*primary_fn)(const void *, const void *);
4833 + int (*secondary_fn)(const void *, const void *);
4834 unsigned i, start = 0, n_sub = 1;
4835
4836 if (is_key(map, primary_key->field_idx))
4837 @@ -998,8 +1005,7 @@ int tracing_map_sort_entries(struct tracing_map *map,
4838 unsigned int n_sort_keys,
4839 struct tracing_map_sort_entry ***sort_entries)
4840 {
4841 - int (*cmp_entries_fn)(const struct tracing_map_sort_entry **,
4842 - const struct tracing_map_sort_entry **);
4843 + int (*cmp_entries_fn)(const void *, const void *);
4844 struct tracing_map_sort_entry *sort_entry, **entries;
4845 int i, n_entries, ret;
4846
4847 diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
4848 index 25d59a95bd668..abea25310ac73 100644
4849 --- a/lib/decompress_unxz.c
4850 +++ b/lib/decompress_unxz.c
4851 @@ -167,7 +167,7 @@
4852 * memeq and memzero are not used much and any remotely sane implementation
4853 * is fast enough. memcpy/memmove speed matters in multi-call mode, but
4854 * the kernel image is decompressed in single-call mode, in which only
4855 - * memcpy speed can matter and only if there is a lot of uncompressible data
4856 + * memmove speed can matter and only if there is a lot of uncompressible data
4857 * (LZMA2 stores uncompressible chunks in uncompressed form). Thus, the
4858 * functions below should just be kept small; it's probably not worth
4859 * optimizing for speed.
4860 diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
4861 index 08c3c80499983..2c5197d6b944d 100644
4862 --- a/lib/xz/xz_dec_lzma2.c
4863 +++ b/lib/xz/xz_dec_lzma2.c
4864 @@ -387,7 +387,14 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
4865
4866 *left -= copy_size;
4867
4868 - memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
4869 + /*
4870 + * If doing in-place decompression in single-call mode and the
4871 + * uncompressed size of the file is larger than the caller
4872 + * thought (i.e. it is invalid input!), the buffers below may
4873 + * overlap and cause undefined behavior with memcpy().
4874 + * With valid inputs memcpy() would be fine here.
4875 + */
4876 + memmove(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
4877 dict->pos += copy_size;
4878
4879 if (dict->full < dict->pos)
4880 @@ -397,7 +404,11 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
4881 if (dict->pos == dict->end)
4882 dict->pos = 0;
4883
4884 - memcpy(b->out + b->out_pos, b->in + b->in_pos,
4885 + /*
4886 + * Like above but for multi-call mode: use memmove()
4887 + * to avoid undefined behavior with invalid input.
4888 + */
4889 + memmove(b->out + b->out_pos, b->in + b->in_pos,
4890 copy_size);
4891 }
4892
4893 @@ -421,6 +432,12 @@ static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b)
4894 if (dict->pos == dict->end)
4895 dict->pos = 0;
4896
4897 + /*
4898 + * These buffers cannot overlap even if doing in-place
4899 + * decompression because in multi-call mode dict->buf
4900 + * has been allocated by us in this file; it's not
4901 + * provided by the caller like in single-call mode.
4902 + */
4903 memcpy(b->out + b->out_pos, dict->buf + dict->start,
4904 copy_size);
4905 }
4906 diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
4907 index ac809b1e64f78..9e5b9ab537fea 100644
4908 --- a/lib/xz/xz_dec_stream.c
4909 +++ b/lib/xz/xz_dec_stream.c
4910 @@ -402,12 +402,12 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
4911 * we will accept other check types too, but then the check won't
4912 * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given.
4913 */
4914 + if (s->temp.buf[HEADER_MAGIC_SIZE + 1] > XZ_CHECK_MAX)
4915 + return XZ_OPTIONS_ERROR;
4916 +
4917 s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1];
4918
4919 #ifdef XZ_DEC_ANY_CHECK
4920 - if (s->check_type > XZ_CHECK_MAX)
4921 - return XZ_OPTIONS_ERROR;
4922 -
4923 if (s->check_type > XZ_CHECK_CRC32)
4924 return XZ_UNSUPPORTED_CHECK;
4925 #else
4926 diff --git a/mm/oom_kill.c b/mm/oom_kill.c
4927 index d514eebad905e..c78a6abb6f2b6 100644
4928 --- a/mm/oom_kill.c
4929 +++ b/mm/oom_kill.c
4930 @@ -1078,25 +1078,22 @@ bool out_of_memory(struct oom_control *oc)
4931 }
4932
4933 /*
4934 - * The pagefault handler calls here because it is out of memory, so kill a
4935 - * memory-hogging task. If oom_lock is held by somebody else, a parallel oom
4936 - * killing is already in progress so do nothing.
4937 + * The pagefault handler calls here because some allocation has failed. We have
4938 + * to take care of the memcg OOM here because this is the only safe context without
4939 + * any locks held but let the oom killer triggered from the allocation context care
4940 + * about the global OOM.
4941 */
4942 void pagefault_out_of_memory(void)
4943 {
4944 - struct oom_control oc = {
4945 - .zonelist = NULL,
4946 - .nodemask = NULL,
4947 - .memcg = NULL,
4948 - .gfp_mask = 0,
4949 - .order = 0,
4950 - };
4951 + static DEFINE_RATELIMIT_STATE(pfoom_rs, DEFAULT_RATELIMIT_INTERVAL,
4952 + DEFAULT_RATELIMIT_BURST);
4953
4954 if (mem_cgroup_oom_synchronize(true))
4955 return;
4956
4957 - if (!mutex_trylock(&oom_lock))
4958 + if (fatal_signal_pending(current))
4959 return;
4960 - out_of_memory(&oc);
4961 - mutex_unlock(&oom_lock);
4962 +
4963 + if (__ratelimit(&pfoom_rs))
4964 + pr_warn("Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF\n");
4965 }
4966 diff --git a/mm/slab.h b/mm/slab.h
4967 index ceb7d70cdb764..34929ac0ebead 100644
4968 --- a/mm/slab.h
4969 +++ b/mm/slab.h
4970 @@ -139,7 +139,7 @@ static inline unsigned long kmem_cache_flags(unsigned long object_size,
4971 #define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE | SLAB_RECLAIM_ACCOUNT | \
4972 SLAB_TEMPORARY | SLAB_NOTRACK | SLAB_ACCOUNT)
4973 #else
4974 -#define SLAB_CACHE_FLAGS (0)
4975 +#define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE)
4976 #endif
4977
4978 #define CACHE_CREATE_MASK (SLAB_CORE_FLAGS | SLAB_DEBUG_FLAGS | SLAB_CACHE_FLAGS)
4979 diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
4980 index 2b7bfd97587a0..b5c1cd4ba2a15 100644
4981 --- a/mm/zsmalloc.c
4982 +++ b/mm/zsmalloc.c
4983 @@ -1962,10 +1962,11 @@ static inline void zs_pool_dec_isolated(struct zs_pool *pool)
4984 VM_BUG_ON(atomic_long_read(&pool->isolated_pages) <= 0);
4985 atomic_long_dec(&pool->isolated_pages);
4986 /*
4987 - * There's no possibility of racing, since wait_for_isolated_drain()
4988 - * checks the isolated count under &class->lock after enqueuing
4989 - * on migration_wait.
4990 + * Checking pool->destroying must happen after atomic_long_dec()
4991 + * for pool->isolated_pages above. Paired with the smp_mb() in
4992 + * zs_unregister_migration().
4993 */
4994 + smp_mb__after_atomic();
4995 if (atomic_long_read(&pool->isolated_pages) == 0 && pool->destroying)
4996 wake_up_all(&pool->migration_wait);
4997 }
4998 diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
4999 index d2e6885479cb1..cb94ac9886181 100644
5000 --- a/net/batman-adv/bat_v_ogm.c
5001 +++ b/net/batman-adv/bat_v_ogm.c
5002 @@ -690,6 +690,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
5003 ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl,
5004 ogm_packet->version, ntohs(ogm_packet->tvlv_len));
5005
5006 + if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) {
5007 + batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
5008 + "Drop packet: originator packet from ourself\n");
5009 + return;
5010 + }
5011 +
5012 /* If the troughput metric is 0, immediately drop the packet. No need to
5013 * create orig_node / neigh_node for an unusable route.
5014 */
5015 @@ -788,11 +794,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
5016 if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
5017 return NET_RX_DROP;
5018
5019 - ogm_packet = (struct batadv_ogm2_packet *)skb->data;
5020 -
5021 - if (batadv_is_my_mac(bat_priv, ogm_packet->orig))
5022 - return NET_RX_DROP;
5023 -
5024 batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
5025 batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES,
5026 skb->len + ETH_HLEN);
5027 diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
5028 index dc635bd935846..a087f559f93e5 100644
5029 --- a/net/batman-adv/bridge_loop_avoidance.c
5030 +++ b/net/batman-adv/bridge_loop_avoidance.c
5031 @@ -1593,13 +1593,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
5032 }
5033
5034 /**
5035 - * batadv_bla_check_bcast_duplist - Check if a frame is in the broadcast dup.
5036 + * batadv_bla_check_duplist() - Check if a frame is in the broadcast dup.
5037 * @bat_priv: the bat priv with all the soft interface information
5038 - * @skb: contains the bcast_packet to be checked
5039 + * @skb: contains the multicast packet to be checked
5040 + * @payload_ptr: pointer to position inside the head buffer of the skb
5041 + * marking the start of the data to be CRC'ed
5042 + * @orig: originator mac address, NULL if unknown
5043 *
5044 - * check if it is on our broadcast list. Another gateway might
5045 - * have sent the same packet because it is connected to the same backbone,
5046 - * so we have to remove this duplicate.
5047 + * Check if it is on our broadcast list. Another gateway might have sent the
5048 + * same packet because it is connected to the same backbone, so we have to
5049 + * remove this duplicate.
5050 *
5051 * This is performed by checking the CRC, which will tell us
5052 * with a good chance that it is the same packet. If it is furthermore
5053 @@ -1608,19 +1611,17 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
5054 *
5055 * Return: true if a packet is in the duplicate list, false otherwise.
5056 */
5057 -bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
5058 - struct sk_buff *skb)
5059 +static bool batadv_bla_check_duplist(struct batadv_priv *bat_priv,
5060 + struct sk_buff *skb, u8 *payload_ptr,
5061 + const u8 *orig)
5062 {
5063 - int i, curr;
5064 - __be32 crc;
5065 - struct batadv_bcast_packet *bcast_packet;
5066 struct batadv_bcast_duplist_entry *entry;
5067 bool ret = false;
5068 -
5069 - bcast_packet = (struct batadv_bcast_packet *)skb->data;
5070 + int i, curr;
5071 + __be32 crc;
5072
5073 /* calculate the crc ... */
5074 - crc = batadv_skb_crc32(skb, (u8 *)(bcast_packet + 1));
5075 + crc = batadv_skb_crc32(skb, payload_ptr);
5076
5077 spin_lock_bh(&bat_priv->bla.bcast_duplist_lock);
5078
5079 @@ -1639,8 +1640,21 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
5080 if (entry->crc != crc)
5081 continue;
5082
5083 - if (batadv_compare_eth(entry->orig, bcast_packet->orig))
5084 - continue;
5085 + /* are the originators both known and not anonymous? */
5086 + if (orig && !is_zero_ether_addr(orig) &&
5087 + !is_zero_ether_addr(entry->orig)) {
5088 + /* If known, check if the new frame came from
5089 + * the same originator:
5090 + * We are safe to take identical frames from the
5091 + * same orig, if known, as multiplications in
5092 + * the mesh are detected via the (orig, seqno) pair.
5093 + * So we can be a bit more liberal here and allow
5094 + * identical frames from the same orig which the source
5095 + * host might have sent multiple times on purpose.
5096 + */
5097 + if (batadv_compare_eth(entry->orig, orig))
5098 + continue;
5099 + }
5100
5101 /* this entry seems to match: same crc, not too old,
5102 * and from another gw. therefore return true to forbid it.
5103 @@ -1656,7 +1670,14 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
5104 entry = &bat_priv->bla.bcast_duplist[curr];
5105 entry->crc = crc;
5106 entry->entrytime = jiffies;
5107 - ether_addr_copy(entry->orig, bcast_packet->orig);
5108 +
5109 + /* known originator */
5110 + if (orig)
5111 + ether_addr_copy(entry->orig, orig);
5112 + /* anonymous originator */
5113 + else
5114 + eth_zero_addr(entry->orig);
5115 +
5116 bat_priv->bla.bcast_duplist_curr = curr;
5117
5118 out:
5119 @@ -1665,6 +1686,48 @@ out:
5120 return ret;
5121 }
5122
5123 +/**
5124 + * batadv_bla_check_ucast_duplist() - Check if a frame is in the broadcast dup.
5125 + * @bat_priv: the bat priv with all the soft interface information
5126 + * @skb: contains the multicast packet to be checked, decapsulated from a
5127 + * unicast_packet
5128 + *
5129 + * Check if it is on our broadcast list. Another gateway might have sent the
5130 + * same packet because it is connected to the same backbone, so we have to
5131 + * remove this duplicate.
5132 + *
5133 + * Return: true if a packet is in the duplicate list, false otherwise.
5134 + */
5135 +static bool batadv_bla_check_ucast_duplist(struct batadv_priv *bat_priv,
5136 + struct sk_buff *skb)
5137 +{
5138 + return batadv_bla_check_duplist(bat_priv, skb, (u8 *)skb->data, NULL);
5139 +}
5140 +
5141 +/**
5142 + * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.
5143 + * @bat_priv: the bat priv with all the soft interface information
5144 + * @skb: contains the bcast_packet to be checked
5145 + *
5146 + * Check if it is on our broadcast list. Another gateway might have sent the
5147 + * same packet because it is connected to the same backbone, so we have to
5148 + * remove this duplicate.
5149 + *
5150 + * Return: true if a packet is in the duplicate list, false otherwise.
5151 + */
5152 +bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
5153 + struct sk_buff *skb)
5154 +{
5155 + struct batadv_bcast_packet *bcast_packet;
5156 + u8 *payload_ptr;
5157 +
5158 + bcast_packet = (struct batadv_bcast_packet *)skb->data;
5159 + payload_ptr = (u8 *)(bcast_packet + 1);
5160 +
5161 + return batadv_bla_check_duplist(bat_priv, skb, payload_ptr,
5162 + bcast_packet->orig);
5163 +}
5164 +
5165 /**
5166 * batadv_bla_is_backbone_gw_orig - Check if the originator is a gateway for
5167 * the VLAN identified by vid.
5168 @@ -1879,6 +1942,14 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
5169 packet_type == BATADV_UNICAST)
5170 goto handled;
5171
5172 + /* potential duplicates from foreign BLA backbone gateways via
5173 + * multicast-in-unicast packets
5174 + */
5175 + if (is_multicast_ether_addr(ethhdr->h_dest) &&
5176 + packet_type == BATADV_UNICAST &&
5177 + batadv_bla_check_ucast_duplist(bat_priv, skb))
5178 + goto handled;
5179 +
5180 ether_addr_copy(search_claim.addr, ethhdr->h_source);
5181 search_claim.vid = vid;
5182 claim = batadv_claim_hash_find(bat_priv, &search_claim);
5183 diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
5184 index fef21f75892e4..343f4fc5909d7 100644
5185 --- a/net/batman-adv/fragmentation.c
5186 +++ b/net/batman-adv/fragmentation.c
5187 @@ -394,9 +394,10 @@ out:
5188
5189 /**
5190 * batadv_frag_create - create a fragment from skb
5191 + * @net_dev: outgoing device for fragment
5192 * @skb: skb to create fragment from
5193 * @frag_head: header to use in new fragment
5194 - * @mtu: size of new fragment
5195 + * @fragment_size: size of new fragment
5196 *
5197 * Split the passed skb into two fragments: A new one with size matching the
5198 * passed mtu and the old one with the rest. The new skb contains data from the
5199 @@ -404,22 +405,25 @@ out:
5200 *
5201 * Return: the new fragment, NULL on error.
5202 */
5203 -static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
5204 +static struct sk_buff *batadv_frag_create(struct net_device *net_dev,
5205 + struct sk_buff *skb,
5206 struct batadv_frag_packet *frag_head,
5207 - unsigned int mtu)
5208 + unsigned int fragment_size)
5209 {
5210 + unsigned int ll_reserved = LL_RESERVED_SPACE(net_dev);
5211 + unsigned int tailroom = net_dev->needed_tailroom;
5212 struct sk_buff *skb_fragment;
5213 unsigned int header_size = sizeof(*frag_head);
5214 - unsigned int fragment_size = mtu - header_size;
5215 + unsigned int mtu = fragment_size + header_size;
5216
5217 - skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN);
5218 + skb_fragment = dev_alloc_skb(ll_reserved + mtu + tailroom);
5219 if (!skb_fragment)
5220 goto err;
5221
5222 skb_fragment->priority = skb->priority;
5223
5224 /* Eat the last mtu-bytes of the skb */
5225 - skb_reserve(skb_fragment, header_size + ETH_HLEN);
5226 + skb_reserve(skb_fragment, ll_reserved + header_size);
5227 skb_split(skb, skb_fragment, skb->len - fragment_size);
5228
5229 /* Add the header */
5230 @@ -443,13 +447,14 @@ int batadv_frag_send_packet(struct sk_buff *skb,
5231 struct batadv_orig_node *orig_node,
5232 struct batadv_neigh_node *neigh_node)
5233 {
5234 + struct net_device *net_dev = neigh_node->if_incoming->net_dev;
5235 struct batadv_priv *bat_priv;
5236 struct batadv_hard_iface *primary_if = NULL;
5237 struct batadv_frag_packet frag_header;
5238 struct sk_buff *skb_fragment;
5239 - unsigned int mtu = neigh_node->if_incoming->net_dev->mtu;
5240 + unsigned int mtu = net_dev->mtu;
5241 unsigned int header_size = sizeof(frag_header);
5242 - unsigned int max_fragment_size, max_packet_size;
5243 + unsigned int max_fragment_size, num_fragments;
5244 int ret = -1;
5245
5246 /* To avoid merge and refragmentation at next-hops we never send
5247 @@ -457,10 +462,15 @@ int batadv_frag_send_packet(struct sk_buff *skb,
5248 */
5249 mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE);
5250 max_fragment_size = mtu - header_size;
5251 - max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS;
5252 +
5253 + if (skb->len == 0 || max_fragment_size == 0)
5254 + return -EINVAL;
5255 +
5256 + num_fragments = (skb->len - 1) / max_fragment_size + 1;
5257 + max_fragment_size = (skb->len - 1) / num_fragments + 1;
5258
5259 /* Don't even try to fragment, if we need more than 16 fragments */
5260 - if (skb->len > max_packet_size)
5261 + if (num_fragments > BATADV_FRAG_MAX_FRAGMENTS)
5262 goto out;
5263
5264 bat_priv = orig_node->bat_priv;
5265 @@ -498,7 +508,8 @@ int batadv_frag_send_packet(struct sk_buff *skb,
5266 goto out;
5267 }
5268
5269 - skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
5270 + skb_fragment = batadv_frag_create(net_dev, skb, &frag_header,
5271 + max_fragment_size);
5272 if (!skb_fragment)
5273 goto out;
5274
5275 @@ -517,11 +528,14 @@ int batadv_frag_send_packet(struct sk_buff *skb,
5276 frag_header.no++;
5277 }
5278
5279 - /* Make room for the fragment header. */
5280 - if (batadv_skb_head_push(skb, header_size) < 0 ||
5281 - pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0)
5282 + /* make sure that there is at least enough head for the fragmentation
5283 + * and ethernet headers
5284 + */
5285 + ret = skb_cow_head(skb, ETH_HLEN + header_size);
5286 + if (ret < 0)
5287 goto out;
5288
5289 + skb_push(skb, header_size);
5290 memcpy(skb->data, &frag_header, header_size);
5291
5292 /* Send the last fragment */
5293 diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
5294 index f528761674df9..4f384abb4cedd 100644
5295 --- a/net/batman-adv/hard-interface.c
5296 +++ b/net/batman-adv/hard-interface.c
5297 @@ -359,6 +359,9 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
5298 needed_headroom = lower_headroom + (lower_header_len - ETH_HLEN);
5299 needed_headroom += batadv_max_header_len();
5300
5301 + /* fragmentation headers don't strip the unicast/... header */
5302 + needed_headroom += sizeof(struct batadv_frag_packet);
5303 +
5304 soft_iface->needed_headroom = needed_headroom;
5305 soft_iface->needed_tailroom = lower_tailroom;
5306 }
5307 diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
5308 index 5a2aac17805ba..283ac3fb94293 100644
5309 --- a/net/batman-adv/multicast.c
5310 +++ b/net/batman-adv/multicast.c
5311 @@ -53,10 +53,12 @@
5312 #include <net/ip.h>
5313 #include <net/ipv6.h>
5314
5315 +#include "bridge_loop_avoidance.h"
5316 #include "hard-interface.h"
5317 #include "hash.h"
5318 #include "log.h"
5319 #include "packet.h"
5320 +#include "send.h"
5321 #include "translation-table.h"
5322 #include "tvlv.h"
5323
5324 @@ -1251,6 +1253,35 @@ void batadv_mcast_free(struct batadv_priv *bat_priv)
5325 spin_unlock_bh(&bat_priv->tt.commit_lock);
5326 }
5327
5328 +/**
5329 + * batadv_mcast_forw_send_orig() - send a multicast packet to an originator
5330 + * @bat_priv: the bat priv with all the soft interface information
5331 + * @skb: the multicast packet to send
5332 + * @vid: the vlan identifier
5333 + * @orig_node: the originator to send the packet to
5334 + *
5335 + * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
5336 + */
5337 +int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
5338 + struct sk_buff *skb,
5339 + unsigned short vid,
5340 + struct batadv_orig_node *orig_node)
5341 +{
5342 + /* Avoid sending multicast-in-unicast packets to other BLA
5343 + * gateways - they already got the frame from the LAN side
5344 + * we share with them.
5345 + * TODO: Refactor to take BLA into account earlier, to avoid
5346 + * reducing the mcast_fanout count.
5347 + */
5348 + if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) {
5349 + dev_kfree_skb(skb);
5350 + return NET_XMIT_SUCCESS;
5351 + }
5352 +
5353 + return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
5354 + orig_node, vid);
5355 +}
5356 +
5357 /**
5358 * batadv_mcast_purge_orig - reset originator global mcast state modifications
5359 * @orig: the originator which is going to get purged
5360 diff --git a/net/batman-adv/multicast.h b/net/batman-adv/multicast.h
5361 index 1fb00ba84907a..751f547561643 100644
5362 --- a/net/batman-adv/multicast.h
5363 +++ b/net/batman-adv/multicast.h
5364 @@ -45,6 +45,11 @@ enum batadv_forw_mode
5365 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
5366 struct batadv_orig_node **mcast_single_orig);
5367
5368 +int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
5369 + struct sk_buff *skb,
5370 + unsigned short vid,
5371 + struct batadv_orig_node *orig_node);
5372 +
5373 void batadv_mcast_init(struct batadv_priv *bat_priv);
5374
5375 int batadv_mcast_flags_seq_print_text(struct seq_file *seq, void *offset);
5376 @@ -71,6 +76,16 @@ static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
5377 return 0;
5378 }
5379
5380 +static inline int
5381 +batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
5382 + struct sk_buff *skb,
5383 + unsigned short vid,
5384 + struct batadv_orig_node *orig_node)
5385 +{
5386 + kfree_skb(skb);
5387 + return NET_XMIT_DROP;
5388 +}
5389 +
5390 static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
5391 {
5392 }
5393 diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
5394 index af0a8439cf08a..4805c98588dc1 100644
5395 --- a/net/batman-adv/soft-interface.c
5396 +++ b/net/batman-adv/soft-interface.c
5397 @@ -356,9 +356,8 @@ send:
5398 goto dropped;
5399 ret = batadv_send_skb_via_gw(bat_priv, skb, vid);
5400 } else if (mcast_single_orig) {
5401 - ret = batadv_send_skb_unicast(bat_priv, skb,
5402 - BATADV_UNICAST, 0,
5403 - mcast_single_orig, vid);
5404 + ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid,
5405 + mcast_single_orig);
5406 } else {
5407 if (batadv_dat_snoop_outgoing_arp_request(bat_priv,
5408 skb))
5409 diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
5410 index f46f59129bf39..a47430d843dcf 100644
5411 --- a/net/bluetooth/l2cap_sock.c
5412 +++ b/net/bluetooth/l2cap_sock.c
5413 @@ -1319,6 +1319,9 @@ static void l2cap_sock_close_cb(struct l2cap_chan *chan)
5414 {
5415 struct sock *sk = chan->data;
5416
5417 + if (!sk)
5418 + return;
5419 +
5420 l2cap_sock_kill(sk);
5421 }
5422
5423 @@ -1327,6 +1330,9 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)
5424 struct sock *sk = chan->data;
5425 struct sock *parent;
5426
5427 + if (!sk)
5428 + return;
5429 +
5430 BT_DBG("chan %p state %s", chan, state_to_string(chan->state));
5431
5432 /* This callback can be called both for server (BT_LISTEN)
5433 @@ -1510,8 +1516,10 @@ static void l2cap_sock_destruct(struct sock *sk)
5434 {
5435 BT_DBG("sk %p", sk);
5436
5437 - if (l2cap_pi(sk)->chan)
5438 + if (l2cap_pi(sk)->chan) {
5439 + l2cap_pi(sk)->chan->data = NULL;
5440 l2cap_chan_put(l2cap_pi(sk)->chan);
5441 + }
5442
5443 if (l2cap_pi(sk)->rx_busy_skb) {
5444 kfree_skb(l2cap_pi(sk)->rx_busy_skb);
5445 diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
5446 index 77f88c7df6053..b3b4ffaa394f6 100644
5447 --- a/net/bluetooth/sco.c
5448 +++ b/net/bluetooth/sco.c
5449 @@ -254,7 +254,8 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk)
5450 return err;
5451 }
5452
5453 -static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
5454 +static int sco_send_frame(struct sock *sk, void *buf, int len,
5455 + unsigned int msg_flags)
5456 {
5457 struct sco_conn *conn = sco_pi(sk)->conn;
5458 struct sk_buff *skb;
5459 @@ -266,15 +267,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
5460
5461 BT_DBG("sk %p len %d", sk, len);
5462
5463 - skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
5464 + skb = bt_skb_send_alloc(sk, len, msg_flags & MSG_DONTWAIT, &err);
5465 if (!skb)
5466 return err;
5467
5468 - if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
5469 - kfree_skb(skb);
5470 - return -EFAULT;
5471 - }
5472 -
5473 + memcpy(skb_put(skb, len), buf, len);
5474 hci_send_sco(conn->hcon, skb);
5475
5476 return len;
5477 @@ -693,6 +690,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
5478 size_t len)
5479 {
5480 struct sock *sk = sock->sk;
5481 + void *buf;
5482 int err;
5483
5484 BT_DBG("sock %p, sk %p", sock, sk);
5485 @@ -704,14 +702,24 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
5486 if (msg->msg_flags & MSG_OOB)
5487 return -EOPNOTSUPP;
5488
5489 + buf = kmalloc(len, GFP_KERNEL);
5490 + if (!buf)
5491 + return -ENOMEM;
5492 +
5493 + if (memcpy_from_msg(buf, msg, len)) {
5494 + kfree(buf);
5495 + return -EFAULT;
5496 + }
5497 +
5498 lock_sock(sk);
5499
5500 if (sk->sk_state == BT_CONNECTED)
5501 - err = sco_send_frame(sk, msg, len);
5502 + err = sco_send_frame(sk, buf, len, msg->msg_flags);
5503 else
5504 err = -ENOTCONN;
5505
5506 release_sock(sk);
5507 + kfree(buf);
5508 return err;
5509 }
5510
5511 diff --git a/net/core/stream.c b/net/core/stream.c
5512 index 6e41b20bf9f86..05b63feac7e57 100644
5513 --- a/net/core/stream.c
5514 +++ b/net/core/stream.c
5515 @@ -193,9 +193,6 @@ void sk_stream_kill_queues(struct sock *sk)
5516 /* First the read buffer. */
5517 __skb_queue_purge(&sk->sk_receive_queue);
5518
5519 - /* Next, the error queue. */
5520 - __skb_queue_purge(&sk->sk_error_queue);
5521 -
5522 /* Next, the write queue. */
5523 WARN_ON(!skb_queue_empty(&sk->sk_write_queue));
5524
5525 diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
5526 index b4318c1b5b960..f62e177267c34 100644
5527 --- a/net/core/sysctl_net_core.c
5528 +++ b/net/core/sysctl_net_core.c
5529 @@ -368,7 +368,7 @@ static struct ctl_table net_core_table[] = {
5530 .mode = 0600,
5531 .proc_handler = proc_dolongvec_minmax_bpf_restricted,
5532 .extra1 = &long_one,
5533 - .extra2 = &long_max,
5534 + .extra2 = &bpf_jit_limit_max,
5535 },
5536 #endif
5537 {
5538 diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
5539 index 2a811b5634d46..a35510565d4d1 100644
5540 --- a/net/netfilter/nfnetlink_queue.c
5541 +++ b/net/netfilter/nfnetlink_queue.c
5542 @@ -539,7 +539,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
5543 goto nla_put_failure;
5544
5545 if (indev && entskb->dev &&
5546 - entskb->mac_header != entskb->network_header) {
5547 + skb_mac_header_was_set(entskb)) {
5548 struct nfqnl_msg_packet_hw phw;
5549 int len;
5550
5551 diff --git a/net/nfc/core.c b/net/nfc/core.c
5552 index c699d64a0753a..32a2dfc08f480 100644
5553 --- a/net/nfc/core.c
5554 +++ b/net/nfc/core.c
5555 @@ -106,13 +106,13 @@ int nfc_dev_up(struct nfc_dev *dev)
5556
5557 device_lock(&dev->dev);
5558
5559 - if (dev->rfkill && rfkill_blocked(dev->rfkill)) {
5560 - rc = -ERFKILL;
5561 + if (!device_is_registered(&dev->dev)) {
5562 + rc = -ENODEV;
5563 goto error;
5564 }
5565
5566 - if (!device_is_registered(&dev->dev)) {
5567 - rc = -ENODEV;
5568 + if (dev->rfkill && rfkill_blocked(dev->rfkill)) {
5569 + rc = -ERFKILL;
5570 goto error;
5571 }
5572
5573 @@ -1133,11 +1133,7 @@ int nfc_register_device(struct nfc_dev *dev)
5574 if (rc)
5575 pr_err("Could not register llcp device\n");
5576
5577 - rc = nfc_genl_device_added(dev);
5578 - if (rc)
5579 - pr_debug("The userspace won't be notified that the device %s was added\n",
5580 - dev_name(&dev->dev));
5581 -
5582 + device_lock(&dev->dev);
5583 dev->rfkill = rfkill_alloc(dev_name(&dev->dev), &dev->dev,
5584 RFKILL_TYPE_NFC, &nfc_rfkill_ops, dev);
5585 if (dev->rfkill) {
5586 @@ -1146,6 +1142,12 @@ int nfc_register_device(struct nfc_dev *dev)
5587 dev->rfkill = NULL;
5588 }
5589 }
5590 + device_unlock(&dev->dev);
5591 +
5592 + rc = nfc_genl_device_added(dev);
5593 + if (rc)
5594 + pr_debug("The userspace won't be notified that the device %s was added\n",
5595 + dev_name(&dev->dev));
5596
5597 return 0;
5598 }
5599 @@ -1162,10 +1164,17 @@ void nfc_unregister_device(struct nfc_dev *dev)
5600
5601 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
5602
5603 + rc = nfc_genl_device_removed(dev);
5604 + if (rc)
5605 + pr_debug("The userspace won't be notified that the device %s "
5606 + "was removed\n", dev_name(&dev->dev));
5607 +
5608 + device_lock(&dev->dev);
5609 if (dev->rfkill) {
5610 rfkill_unregister(dev->rfkill);
5611 rfkill_destroy(dev->rfkill);
5612 }
5613 + device_unlock(&dev->dev);
5614
5615 if (dev->ops->check_presence) {
5616 device_lock(&dev->dev);
5617 @@ -1175,11 +1184,6 @@ void nfc_unregister_device(struct nfc_dev *dev)
5618 cancel_work_sync(&dev->check_pres_work);
5619 }
5620
5621 - rc = nfc_genl_device_removed(dev);
5622 - if (rc)
5623 - pr_debug("The userspace won't be notified that the device %s "
5624 - "was removed\n", dev_name(&dev->dev));
5625 -
5626 nfc_llcp_unregister_device(dev);
5627
5628 mutex_lock(&nfc_devlist_mutex);
5629 diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
5630 index bff6ba84d3979..19518a231e571 100644
5631 --- a/net/nfc/nci/core.c
5632 +++ b/net/nfc/nci/core.c
5633 @@ -157,12 +157,15 @@ inline int nci_request(struct nci_dev *ndev,
5634 {
5635 int rc;
5636
5637 - if (!test_bit(NCI_UP, &ndev->flags))
5638 - return -ENETDOWN;
5639 -
5640 /* Serialize all requests */
5641 mutex_lock(&ndev->req_lock);
5642 - rc = __nci_request(ndev, req, opt, timeout);
5643 + /* check the state after obtaing the lock against any races
5644 + * from nci_close_device when the device gets removed.
5645 + */
5646 + if (test_bit(NCI_UP, &ndev->flags))
5647 + rc = __nci_request(ndev, req, opt, timeout);
5648 + else
5649 + rc = -ENETDOWN;
5650 mutex_unlock(&ndev->req_lock);
5651
5652 return rc;
5653 diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
5654 index 2fecdfe49bae3..95470d628d34b 100644
5655 --- a/net/vmw_vsock/af_vsock.c
5656 +++ b/net/vmw_vsock/af_vsock.c
5657 @@ -1173,6 +1173,8 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,
5658 * non-blocking call.
5659 */
5660 err = -EALREADY;
5661 + if (flags & O_NONBLOCK)
5662 + goto out;
5663 break;
5664 default:
5665 if ((sk->sk_state == VSOCK_SS_LISTEN) ||
5666 diff --git a/net/wireless/util.c b/net/wireless/util.c
5667 index a16e805c4857f..71f9c14174b55 100644
5668 --- a/net/wireless/util.c
5669 +++ b/net/wireless/util.c
5670 @@ -1035,6 +1035,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
5671
5672 switch (otype) {
5673 case NL80211_IFTYPE_AP:
5674 + case NL80211_IFTYPE_P2P_GO:
5675 cfg80211_stop_ap(rdev, dev, true);
5676 break;
5677 case NL80211_IFTYPE_ADHOC:
5678 diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c
5679 index 7f9060f435cde..da6de5e78e1dd 100644
5680 --- a/samples/kprobes/kretprobe_example.c
5681 +++ b/samples/kprobes/kretprobe_example.c
5682 @@ -83,7 +83,7 @@ static int __init kretprobe_init(void)
5683 ret = register_kretprobe(&my_kretprobe);
5684 if (ret < 0) {
5685 pr_err("register_kretprobe failed, returned %d\n", ret);
5686 - return -1;
5687 + return ret;
5688 }
5689 pr_info("Planted return probe at %s: %p\n",
5690 my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
5691 diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
5692 index 976b8dce64966..0138932ef34de 100644
5693 --- a/security/integrity/evm/evm_main.c
5694 +++ b/security/integrity/evm/evm_main.c
5695 @@ -54,7 +54,7 @@ char *evm_config_xattrnames[] = {
5696 NULL
5697 };
5698
5699 -static int evm_fixmode;
5700 +static int evm_fixmode __ro_after_init;
5701 static int __init evm_set_fixmode(char *str)
5702 {
5703 if (strncmp(str, "fix", 3) == 0)
5704 diff --git a/security/security.c b/security/security.c
5705 index 112df16be770d..9a13d72a64465 100644
5706 --- a/security/security.c
5707 +++ b/security/security.c
5708 @@ -131,25 +131,25 @@ int __init security_module_enable(const char *module)
5709
5710 /* Security operations */
5711
5712 -int security_binder_set_context_mgr(struct task_struct *mgr)
5713 +int security_binder_set_context_mgr(const struct cred *mgr)
5714 {
5715 return call_int_hook(binder_set_context_mgr, 0, mgr);
5716 }
5717
5718 -int security_binder_transaction(struct task_struct *from,
5719 - struct task_struct *to)
5720 +int security_binder_transaction(const struct cred *from,
5721 + const struct cred *to)
5722 {
5723 return call_int_hook(binder_transaction, 0, from, to);
5724 }
5725
5726 -int security_binder_transfer_binder(struct task_struct *from,
5727 - struct task_struct *to)
5728 +int security_binder_transfer_binder(const struct cred *from,
5729 + const struct cred *to)
5730 {
5731 return call_int_hook(binder_transfer_binder, 0, from, to);
5732 }
5733
5734 -int security_binder_transfer_file(struct task_struct *from,
5735 - struct task_struct *to, struct file *file)
5736 +int security_binder_transfer_file(const struct cred *from,
5737 + const struct cred *to, struct file *file)
5738 {
5739 return call_int_hook(binder_transfer_file, 0, from, to, file);
5740 }
5741 diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
5742 index a2b63a6a33c7e..607c7fc4f24d3 100644
5743 --- a/security/selinux/hooks.c
5744 +++ b/security/selinux/hooks.c
5745 @@ -2065,21 +2065,18 @@ static inline u32 open_file_to_av(struct file *file)
5746
5747 /* Hook functions begin here. */
5748
5749 -static int selinux_binder_set_context_mgr(struct task_struct *mgr)
5750 +static int selinux_binder_set_context_mgr(const struct cred *mgr)
5751 {
5752 - u32 mysid = current_sid();
5753 - u32 mgrsid = task_sid(mgr);
5754 -
5755 - return avc_has_perm(mysid, mgrsid, SECCLASS_BINDER,
5756 + return avc_has_perm(current_sid(), cred_sid(mgr), SECCLASS_BINDER,
5757 BINDER__SET_CONTEXT_MGR, NULL);
5758 }
5759
5760 -static int selinux_binder_transaction(struct task_struct *from,
5761 - struct task_struct *to)
5762 +static int selinux_binder_transaction(const struct cred *from,
5763 + const struct cred *to)
5764 {
5765 u32 mysid = current_sid();
5766 - u32 fromsid = task_sid(from);
5767 - u32 tosid = task_sid(to);
5768 + u32 fromsid = cred_sid(from);
5769 + u32 tosid = cred_sid(to);
5770 int rc;
5771
5772 if (mysid != fromsid) {
5773 @@ -2093,21 +2090,19 @@ static int selinux_binder_transaction(struct task_struct *from,
5774 NULL);
5775 }
5776
5777 -static int selinux_binder_transfer_binder(struct task_struct *from,
5778 - struct task_struct *to)
5779 +static int selinux_binder_transfer_binder(const struct cred *from,
5780 + const struct cred *to)
5781 {
5782 - u32 fromsid = task_sid(from);
5783 - u32 tosid = task_sid(to);
5784 -
5785 - return avc_has_perm(fromsid, tosid, SECCLASS_BINDER, BINDER__TRANSFER,
5786 + return avc_has_perm(cred_sid(from), cred_sid(to),
5787 + SECCLASS_BINDER, BINDER__TRANSFER,
5788 NULL);
5789 }
5790
5791 -static int selinux_binder_transfer_file(struct task_struct *from,
5792 - struct task_struct *to,
5793 +static int selinux_binder_transfer_file(const struct cred *from,
5794 + const struct cred *to,
5795 struct file *file)
5796 {
5797 - u32 sid = task_sid(to);
5798 + u32 sid = cred_sid(to);
5799 struct file_security_struct *fsec = file->f_security;
5800 struct dentry *dentry = file->f_path.dentry;
5801 struct inode_security_struct *isec;
5802 diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
5803 index 966d30bf2e388..ed5b89fbbd96f 100644
5804 --- a/security/smack/smackfs.c
5805 +++ b/security/smack/smackfs.c
5806 @@ -716,9 +716,7 @@ static void smk_cipso_doi(void)
5807 printk(KERN_WARNING "%s:%d remove rc = %d\n",
5808 __func__, __LINE__, rc);
5809
5810 - doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL);
5811 - if (doip == NULL)
5812 - panic("smack: Failed to initialize cipso DOI.\n");
5813 + doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL | __GFP_NOFAIL);
5814 doip->map.std = NULL;
5815 doip->doi = smk_cipso_doi_value;
5816 doip->type = CIPSO_V4_MAP_PASS;
5817 @@ -737,7 +735,7 @@ static void smk_cipso_doi(void)
5818 if (rc != 0) {
5819 printk(KERN_WARNING "%s:%d map add rc = %d\n",
5820 __func__, __LINE__, rc);
5821 - kfree(doip);
5822 + netlbl_cfg_cipsov4_del(doip->doi, &nai);
5823 return;
5824 }
5825 }
5826 @@ -854,6 +852,7 @@ static int smk_open_cipso(struct inode *inode, struct file *file)
5827 static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
5828 size_t count, loff_t *ppos, int format)
5829 {
5830 + struct netlbl_lsm_catmap *old_cat;
5831 struct smack_known *skp;
5832 struct netlbl_lsm_secattr ncats;
5833 char mapcatset[SMK_CIPSOLEN];
5834 @@ -943,9 +942,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
5835
5836 rc = smk_netlbl_mls(maplevel, mapcatset, &ncats, SMK_CIPSOLEN);
5837 if (rc >= 0) {
5838 - netlbl_catmap_free(skp->smk_netlabel.attr.mls.cat);
5839 + old_cat = skp->smk_netlabel.attr.mls.cat;
5840 skp->smk_netlabel.attr.mls.cat = ncats.attr.mls.cat;
5841 skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl;
5842 + synchronize_rcu();
5843 + netlbl_catmap_free(old_cat);
5844 rc = count;
5845 }
5846
5847 diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
5848 index 2ff9c12d664a8..1845db338d0f6 100644
5849 --- a/sound/core/oss/mixer_oss.c
5850 +++ b/sound/core/oss/mixer_oss.c
5851 @@ -145,11 +145,13 @@ static int snd_mixer_oss_devmask(struct snd_mixer_oss_file *fmixer)
5852
5853 if (mixer == NULL)
5854 return -EIO;
5855 + mutex_lock(&mixer->reg_mutex);
5856 for (chn = 0; chn < 31; chn++) {
5857 pslot = &mixer->slots[chn];
5858 if (pslot->put_volume || pslot->put_recsrc)
5859 result |= 1 << chn;
5860 }
5861 + mutex_unlock(&mixer->reg_mutex);
5862 return result;
5863 }
5864
5865 @@ -161,11 +163,13 @@ static int snd_mixer_oss_stereodevs(struct snd_mixer_oss_file *fmixer)
5866
5867 if (mixer == NULL)
5868 return -EIO;
5869 + mutex_lock(&mixer->reg_mutex);
5870 for (chn = 0; chn < 31; chn++) {
5871 pslot = &mixer->slots[chn];
5872 if (pslot->put_volume && pslot->stereo)
5873 result |= 1 << chn;
5874 }
5875 + mutex_unlock(&mixer->reg_mutex);
5876 return result;
5877 }
5878
5879 @@ -176,6 +180,7 @@ static int snd_mixer_oss_recmask(struct snd_mixer_oss_file *fmixer)
5880
5881 if (mixer == NULL)
5882 return -EIO;
5883 + mutex_lock(&mixer->reg_mutex);
5884 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */
5885 result = mixer->mask_recsrc;
5886 } else {
5887 @@ -187,6 +192,7 @@ static int snd_mixer_oss_recmask(struct snd_mixer_oss_file *fmixer)
5888 result |= 1 << chn;
5889 }
5890 }
5891 + mutex_unlock(&mixer->reg_mutex);
5892 return result;
5893 }
5894
5895 @@ -197,11 +203,12 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer)
5896
5897 if (mixer == NULL)
5898 return -EIO;
5899 + mutex_lock(&mixer->reg_mutex);
5900 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */
5901 - int err;
5902 unsigned int index;
5903 - if ((err = mixer->get_recsrc(fmixer, &index)) < 0)
5904 - return err;
5905 + result = mixer->get_recsrc(fmixer, &index);
5906 + if (result < 0)
5907 + goto unlock;
5908 result = 1 << index;
5909 } else {
5910 struct snd_mixer_oss_slot *pslot;
5911 @@ -216,7 +223,10 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer)
5912 }
5913 }
5914 }
5915 - return mixer->oss_recsrc = result;
5916 + mixer->oss_recsrc = result;
5917 + unlock:
5918 + mutex_unlock(&mixer->reg_mutex);
5919 + return result;
5920 }
5921
5922 static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsrc)
5923 @@ -229,6 +239,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr
5924
5925 if (mixer == NULL)
5926 return -EIO;
5927 + mutex_lock(&mixer->reg_mutex);
5928 if (mixer->get_recsrc && mixer->put_recsrc) { /* exclusive input */
5929 if (recsrc & ~mixer->oss_recsrc)
5930 recsrc &= ~mixer->oss_recsrc;
5931 @@ -254,6 +265,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr
5932 }
5933 }
5934 }
5935 + mutex_unlock(&mixer->reg_mutex);
5936 return result;
5937 }
5938
5939 @@ -265,6 +277,7 @@ static int snd_mixer_oss_get_volume(struct snd_mixer_oss_file *fmixer, int slot)
5940
5941 if (mixer == NULL || slot > 30)
5942 return -EIO;
5943 + mutex_lock(&mixer->reg_mutex);
5944 pslot = &mixer->slots[slot];
5945 left = pslot->volume[0];
5946 right = pslot->volume[1];
5947 @@ -272,15 +285,21 @@ static int snd_mixer_oss_get_volume(struct snd_mixer_oss_file *fmixer, int slot)
5948 result = pslot->get_volume(fmixer, pslot, &left, &right);
5949 if (!pslot->stereo)
5950 right = left;
5951 - if (snd_BUG_ON(left < 0 || left > 100))
5952 - return -EIO;
5953 - if (snd_BUG_ON(right < 0 || right > 100))
5954 - return -EIO;
5955 + if (snd_BUG_ON(left < 0 || left > 100)) {
5956 + result = -EIO;
5957 + goto unlock;
5958 + }
5959 + if (snd_BUG_ON(right < 0 || right > 100)) {
5960 + result = -EIO;
5961 + goto unlock;
5962 + }
5963 if (result >= 0) {
5964 pslot->volume[0] = left;
5965 pslot->volume[1] = right;
5966 result = (left & 0xff) | ((right & 0xff) << 8);
5967 }
5968 + unlock:
5969 + mutex_unlock(&mixer->reg_mutex);
5970 return result;
5971 }
5972
5973 @@ -293,6 +312,7 @@ static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer,
5974
5975 if (mixer == NULL || slot > 30)
5976 return -EIO;
5977 + mutex_lock(&mixer->reg_mutex);
5978 pslot = &mixer->slots[slot];
5979 if (left > 100)
5980 left = 100;
5981 @@ -303,10 +323,13 @@ static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer,
5982 if (pslot->put_volume)
5983 result = pslot->put_volume(fmixer, pslot, left, right);
5984 if (result < 0)
5985 - return result;
5986 + goto unlock;
5987 pslot->volume[0] = left;
5988 pslot->volume[1] = right;
5989 - return (left & 0xff) | ((right & 0xff) << 8);
5990 + result = (left & 0xff) | ((right & 0xff) << 8);
5991 + unlock:
5992 + mutex_unlock(&mixer->reg_mutex);
5993 + return result;
5994 }
5995
5996 static int snd_mixer_oss_ioctl1(struct snd_mixer_oss_file *fmixer, unsigned int cmd, unsigned long arg)
5997 diff --git a/sound/core/timer.c b/sound/core/timer.c
5998 index 6475b85599364..596ba572d6c49 100644
5999 --- a/sound/core/timer.c
6000 +++ b/sound/core/timer.c
6001 @@ -581,13 +581,13 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop)
6002 if (!timer)
6003 return -EINVAL;
6004 spin_lock_irqsave(&timer->lock, flags);
6005 + list_del_init(&timeri->ack_list);
6006 + list_del_init(&timeri->active_list);
6007 if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING |
6008 SNDRV_TIMER_IFLG_START))) {
6009 result = -EBUSY;
6010 goto unlock;
6011 }
6012 - list_del_init(&timeri->ack_list);
6013 - list_del_init(&timeri->active_list);
6014 if (timer->card && timer->card->shutdown)
6015 goto unlock;
6016 if (stop) {
6017 @@ -622,23 +622,22 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop)
6018 static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop)
6019 {
6020 unsigned long flags;
6021 + bool running;
6022
6023 spin_lock_irqsave(&slave_active_lock, flags);
6024 - if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) {
6025 - spin_unlock_irqrestore(&slave_active_lock, flags);
6026 - return -EBUSY;
6027 - }
6028 + running = timeri->flags & SNDRV_TIMER_IFLG_RUNNING;
6029 timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
6030 if (timeri->timer) {
6031 spin_lock(&timeri->timer->lock);
6032 list_del_init(&timeri->ack_list);
6033 list_del_init(&timeri->active_list);
6034 - snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
6035 - SNDRV_TIMER_EVENT_PAUSE);
6036 + if (running)
6037 + snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
6038 + SNDRV_TIMER_EVENT_PAUSE);
6039 spin_unlock(&timeri->timer->lock);
6040 }
6041 spin_unlock_irqrestore(&slave_active_lock, flags);
6042 - return 0;
6043 + return running ? 0 : -EBUSY;
6044 }
6045
6046 /*
6047 diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c
6048 index 36c27c8323601..2e27cd3427c87 100644
6049 --- a/sound/isa/gus/gus_dma.c
6050 +++ b/sound/isa/gus/gus_dma.c
6051 @@ -141,6 +141,8 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
6052 }
6053 block = snd_gf1_dma_next_block(gus);
6054 spin_unlock(&gus->dma_lock);
6055 + if (!block)
6056 + return;
6057 snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd);
6058 kfree(block);
6059 #if 0
6060 diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
6061 index 5451705f429e0..21b0368c2a3bc 100644
6062 --- a/sound/soc/soc-dapm.c
6063 +++ b/sound/soc/soc-dapm.c
6064 @@ -2406,8 +2406,13 @@ static struct snd_soc_dapm_widget *dapm_find_widget(
6065 return NULL;
6066 }
6067
6068 -static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
6069 - const char *pin, int status)
6070 +/*
6071 + * set the DAPM pin status:
6072 + * returns 1 when the value has been updated, 0 when unchanged, or a negative
6073 + * error code; called from kcontrol put callback
6074 + */
6075 +static int __snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
6076 + const char *pin, int status)
6077 {
6078 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
6079 int ret = 0;
6080 @@ -2433,6 +2438,18 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
6081 return ret;
6082 }
6083
6084 +/*
6085 + * similar as __snd_soc_dapm_set_pin(), but returns 0 when successful;
6086 + * called from several API functions below
6087 + */
6088 +static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
6089 + const char *pin, int status)
6090 +{
6091 + int ret = __snd_soc_dapm_set_pin(dapm, pin, status);
6092 +
6093 + return ret < 0 ? ret : 0;
6094 +}
6095 +
6096 /**
6097 * snd_soc_dapm_sync_unlocked - scan and power dapm paths
6098 * @dapm: DAPM context
6099 @@ -3327,10 +3344,10 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
6100 const char *pin = (const char *)kcontrol->private_value;
6101 int ret;
6102
6103 - if (ucontrol->value.integer.value[0])
6104 - ret = snd_soc_dapm_enable_pin(&card->dapm, pin);
6105 - else
6106 - ret = snd_soc_dapm_disable_pin(&card->dapm, pin);
6107 + mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
6108 + ret = __snd_soc_dapm_set_pin(&card->dapm, pin,
6109 + !!ucontrol->value.integer.value[0]);
6110 + mutex_unlock(&card->dapm_mutex);
6111
6112 snd_soc_dapm_sync(&card->dapm);
6113 return ret;
6114 diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
6115 index 9312cd8a6fdd1..c5c6d360843aa 100644
6116 --- a/sound/synth/emux/emux.c
6117 +++ b/sound/synth/emux/emux.c
6118 @@ -101,7 +101,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch
6119 emu->name = kstrdup(name, GFP_KERNEL);
6120 emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
6121 GFP_KERNEL);
6122 - if (emu->voices == NULL)
6123 + if (emu->name == NULL || emu->voices == NULL)
6124 return -ENOMEM;
6125
6126 /* create soundfont list */
6127 diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c
6128 index 161215d78d952..f29c115b9d564 100644
6129 --- a/sound/usb/6fire/comm.c
6130 +++ b/sound/usb/6fire/comm.c
6131 @@ -99,7 +99,7 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev)
6132 int actual_len;
6133
6134 ret = usb_interrupt_msg(dev, usb_sndintpipe(dev, COMM_EP),
6135 - buffer, buffer[1] + 2, &actual_len, HZ);
6136 + buffer, buffer[1] + 2, &actual_len, 1000);
6137 if (ret < 0)
6138 return ret;
6139 else if (actual_len != buffer[1] + 2)
6140 diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
6141 index 9520b4cd70385..7a89111041edc 100644
6142 --- a/sound/usb/6fire/firmware.c
6143 +++ b/sound/usb/6fire/firmware.c
6144 @@ -166,7 +166,7 @@ static int usb6fire_fw_ezusb_write(struct usb_device *device,
6145
6146 ret = usb_control_msg(device, usb_sndctrlpipe(device, 0), type,
6147 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
6148 - value, 0, data, len, HZ);
6149 + value, 0, data, len, 1000);
6150 if (ret < 0)
6151 return ret;
6152 else if (ret != len)
6153 @@ -179,7 +179,7 @@ static int usb6fire_fw_ezusb_read(struct usb_device *device,
6154 {
6155 int ret = usb_control_msg(device, usb_rcvctrlpipe(device, 0), type,
6156 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value,
6157 - 0, data, len, HZ);
6158 + 0, data, len, 1000);
6159 if (ret < 0)
6160 return ret;
6161 else if (ret != len)
6162 @@ -194,7 +194,7 @@ static int usb6fire_fw_fpga_write(struct usb_device *device,
6163 int ret;
6164
6165 ret = usb_bulk_msg(device, usb_sndbulkpipe(device, FPGA_EP), data, len,
6166 - &actual_len, HZ);
6167 + &actual_len, 1000);
6168 if (ret < 0)
6169 return ret;
6170 else if (actual_len != len)
6171 diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
6172 index 0107bbfeb17d1..8cca0befcf013 100644
6173 --- a/sound/usb/line6/driver.c
6174 +++ b/sound/usb/line6/driver.c
6175 @@ -110,12 +110,12 @@ static int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
6176 retval = usb_interrupt_msg(line6->usbdev,
6177 usb_sndintpipe(line6->usbdev, properties->ep_ctrl_w),
6178 (char *)frag_buf, frag_size,
6179 - &partial, LINE6_TIMEOUT * HZ);
6180 + &partial, LINE6_TIMEOUT);
6181 } else {
6182 retval = usb_bulk_msg(line6->usbdev,
6183 usb_sndbulkpipe(line6->usbdev, properties->ep_ctrl_w),
6184 (char *)frag_buf, frag_size,
6185 - &partial, LINE6_TIMEOUT * HZ);
6186 + &partial, LINE6_TIMEOUT);
6187 }
6188
6189 if (retval) {
6190 @@ -351,7 +351,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data,
6191 ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
6192 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
6193 (datalen << 8) | 0x21, address,
6194 - NULL, 0, LINE6_TIMEOUT * HZ);
6195 + NULL, 0, LINE6_TIMEOUT);
6196
6197 if (ret < 0) {
6198 dev_err(line6->ifcdev, "read request failed (error %d)\n", ret);
6199 @@ -366,7 +366,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data,
6200 USB_TYPE_VENDOR | USB_RECIP_DEVICE |
6201 USB_DIR_IN,
6202 0x0012, 0x0000, len, 1,
6203 - LINE6_TIMEOUT * HZ);
6204 + LINE6_TIMEOUT);
6205 if (ret < 0) {
6206 dev_err(line6->ifcdev,
6207 "receive length failed (error %d)\n", ret);
6208 @@ -394,7 +394,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data,
6209 ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67,
6210 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
6211 0x0013, 0x0000, data, datalen,
6212 - LINE6_TIMEOUT * HZ);
6213 + LINE6_TIMEOUT);
6214
6215 if (ret < 0)
6216 dev_err(line6->ifcdev, "read failed (error %d)\n", ret);
6217 @@ -426,7 +426,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data,
6218 ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
6219 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
6220 0x0022, address, data, datalen,
6221 - LINE6_TIMEOUT * HZ);
6222 + LINE6_TIMEOUT);
6223
6224 if (ret < 0) {
6225 dev_err(line6->ifcdev,
6226 @@ -442,7 +442,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data,
6227 USB_TYPE_VENDOR | USB_RECIP_DEVICE |
6228 USB_DIR_IN,
6229 0x0012, 0x0000,
6230 - status, 1, LINE6_TIMEOUT * HZ);
6231 + status, 1, LINE6_TIMEOUT);
6232
6233 if (ret < 0) {
6234 dev_err(line6->ifcdev,
6235 diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
6236 index 7e3a3aada2220..395f4e2c570a3 100644
6237 --- a/sound/usb/line6/driver.h
6238 +++ b/sound/usb/line6/driver.h
6239 @@ -31,7 +31,7 @@
6240 #define LINE6_FALLBACK_INTERVAL 10
6241 #define LINE6_FALLBACK_MAXPACKETSIZE 16
6242
6243 -#define LINE6_TIMEOUT 1
6244 +#define LINE6_TIMEOUT 1000
6245 #define LINE6_BUFSIZE_LISTEN 64
6246 #define LINE6_MIDI_MESSAGE_MAXLEN 256
6247
6248 diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
6249 index 8c4375bf34ab7..7133c36f99b6c 100644
6250 --- a/sound/usb/line6/podhd.c
6251 +++ b/sound/usb/line6/podhd.c
6252 @@ -232,7 +232,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod)
6253 ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0),
6254 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
6255 0x11, 0,
6256 - NULL, 0, LINE6_TIMEOUT * HZ);
6257 + NULL, 0, LINE6_TIMEOUT);
6258 if (ret < 0) {
6259 dev_err(pod->line6.ifcdev, "read request failed (error %d)\n", ret);
6260 goto exit;
6261 @@ -242,7 +242,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod)
6262 ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67,
6263 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
6264 0x11, 0x0,
6265 - init_bytes, 3, LINE6_TIMEOUT * HZ);
6266 + init_bytes, 3, LINE6_TIMEOUT);
6267 if (ret < 0) {
6268 dev_err(pod->line6.ifcdev,
6269 "receive length failed (error %d)\n", ret);
6270 @@ -262,7 +262,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod)
6271 USB_REQ_SET_FEATURE,
6272 USB_TYPE_STANDARD | USB_RECIP_DEVICE | USB_DIR_OUT,
6273 1, 0,
6274 - NULL, 0, LINE6_TIMEOUT * HZ);
6275 + NULL, 0, LINE6_TIMEOUT);
6276 exit:
6277 kfree(init_bytes);
6278 return ret;
6279 diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
6280 index d3871d99ade4e..d7336333a7fba 100644
6281 --- a/sound/usb/line6/toneport.c
6282 +++ b/sound/usb/line6/toneport.c
6283 @@ -133,7 +133,7 @@ static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2)
6284
6285 ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
6286 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
6287 - cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ);
6288 + cmd1, cmd2, NULL, 0, LINE6_TIMEOUT);
6289
6290 if (ret < 0) {
6291 dev_err(&usbdev->dev, "send failed (error %d)\n", ret);
6292 diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
6293 index c19a5dd056317..8c00157c0fcb2 100644
6294 --- a/sound/usb/misc/ua101.c
6295 +++ b/sound/usb/misc/ua101.c
6296 @@ -1032,7 +1032,7 @@ static int detect_usb_format(struct ua101 *ua)
6297 fmt_playback->bSubframeSize * ua->playback.channels;
6298
6299 epd = &ua->intf[INTF_CAPTURE]->altsetting[1].endpoint[0].desc;
6300 - if (!usb_endpoint_is_isoc_in(epd)) {
6301 + if (!usb_endpoint_is_isoc_in(epd) || usb_endpoint_maxp(epd) == 0) {
6302 dev_err(&ua->dev->dev, "invalid capture endpoint\n");
6303 return -ENXIO;
6304 }
6305 @@ -1040,7 +1040,7 @@ static int detect_usb_format(struct ua101 *ua)
6306 ua->capture.max_packet_bytes = usb_endpoint_maxp(epd);
6307
6308 epd = &ua->intf[INTF_PLAYBACK]->altsetting[1].endpoint[0].desc;
6309 - if (!usb_endpoint_is_isoc_out(epd)) {
6310 + if (!usb_endpoint_is_isoc_out(epd) || usb_endpoint_maxp(epd) == 0) {
6311 dev_err(&ua->dev->dev, "invalid playback endpoint\n");
6312 return -ENXIO;
6313 }