Annotation of /trunk/kernel-magellan/patches-4.14/0107-4.14.8-all-fixes.patch
Parent Directory | Revision Log
Revision 3068 -
(hide annotations)
(download)
Wed Jan 17 13:26:46 2018 UTC (6 years, 8 months ago) by niro
File size: 157738 byte(s)
Wed Jan 17 13:26:46 2018 UTC (6 years, 8 months ago) by niro
File size: 157738 byte(s)
-linux-4.14.8
1 | niro | 3068 | diff --git a/Makefile b/Makefile |
2 | index 39d7af0165a8..97b5ae76ac8c 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,7 +1,7 @@ | ||
6 | # SPDX-License-Identifier: GPL-2.0 | ||
7 | VERSION = 4 | ||
8 | PATCHLEVEL = 14 | ||
9 | -SUBLEVEL = 7 | ||
10 | +SUBLEVEL = 8 | ||
11 | EXTRAVERSION = | ||
12 | NAME = Petit Gorille | ||
13 | |||
14 | diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile | ||
15 | index 3eb4397150df..7318165cfc90 100644 | ||
16 | --- a/arch/arm64/Makefile | ||
17 | +++ b/arch/arm64/Makefile | ||
18 | @@ -14,8 +14,12 @@ LDFLAGS_vmlinux :=-p --no-undefined -X | ||
19 | CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) | ||
20 | GZFLAGS :=-9 | ||
21 | |||
22 | -ifneq ($(CONFIG_RELOCATABLE),) | ||
23 | -LDFLAGS_vmlinux += -pie -shared -Bsymbolic | ||
24 | +ifeq ($(CONFIG_RELOCATABLE), y) | ||
25 | +# Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour | ||
26 | +# for relative relocs, since this leads to better Image compression | ||
27 | +# with the relocation offsets always being zero. | ||
28 | +LDFLAGS_vmlinux += -pie -shared -Bsymbolic \ | ||
29 | + $(call ld-option, --no-apply-dynamic-relocs) | ||
30 | endif | ||
31 | |||
32 | ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) | ||
33 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | ||
34 | index 1ffa1c238a72..08b7bb7f5b74 100644 | ||
35 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | ||
36 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | ||
37 | @@ -301,6 +301,7 @@ | ||
38 | |||
39 | &usb1_phy { | ||
40 | status = "okay"; | ||
41 | + phy-supply = <&usb_otg_pwr>; | ||
42 | }; | ||
43 | |||
44 | &usb0 { | ||
45 | diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h | ||
46 | index c9530b5b5ca8..960d05c8816a 100644 | ||
47 | --- a/arch/arm64/include/asm/pgtable.h | ||
48 | +++ b/arch/arm64/include/asm/pgtable.h | ||
49 | @@ -149,12 +149,20 @@ static inline pte_t pte_mkwrite(pte_t pte) | ||
50 | |||
51 | static inline pte_t pte_mkclean(pte_t pte) | ||
52 | { | ||
53 | - return clear_pte_bit(pte, __pgprot(PTE_DIRTY)); | ||
54 | + pte = clear_pte_bit(pte, __pgprot(PTE_DIRTY)); | ||
55 | + pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); | ||
56 | + | ||
57 | + return pte; | ||
58 | } | ||
59 | |||
60 | static inline pte_t pte_mkdirty(pte_t pte) | ||
61 | { | ||
62 | - return set_pte_bit(pte, __pgprot(PTE_DIRTY)); | ||
63 | + pte = set_pte_bit(pte, __pgprot(PTE_DIRTY)); | ||
64 | + | ||
65 | + if (pte_write(pte)) | ||
66 | + pte = clear_pte_bit(pte, __pgprot(PTE_RDONLY)); | ||
67 | + | ||
68 | + return pte; | ||
69 | } | ||
70 | |||
71 | static inline pte_t pte_mkold(pte_t pte) | ||
72 | @@ -642,28 +650,23 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, | ||
73 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
74 | |||
75 | /* | ||
76 | - * ptep_set_wrprotect - mark read-only while preserving the hardware update of | ||
77 | - * the Access Flag. | ||
78 | + * ptep_set_wrprotect - mark read-only while trasferring potential hardware | ||
79 | + * dirty status (PTE_DBM && !PTE_RDONLY) to the software PTE_DIRTY bit. | ||
80 | */ | ||
81 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
82 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep) | ||
83 | { | ||
84 | pte_t old_pte, pte; | ||
85 | |||
86 | - /* | ||
87 | - * ptep_set_wrprotect() is only called on CoW mappings which are | ||
88 | - * private (!VM_SHARED) with the pte either read-only (!PTE_WRITE && | ||
89 | - * PTE_RDONLY) or writable and software-dirty (PTE_WRITE && | ||
90 | - * !PTE_RDONLY && PTE_DIRTY); see is_cow_mapping() and | ||
91 | - * protection_map[]. There is no race with the hardware update of the | ||
92 | - * dirty state: clearing of PTE_RDONLY when PTE_WRITE (a.k.a. PTE_DBM) | ||
93 | - * is set. | ||
94 | - */ | ||
95 | - VM_WARN_ONCE(pte_write(*ptep) && !pte_dirty(*ptep), | ||
96 | - "%s: potential race with hardware DBM", __func__); | ||
97 | pte = READ_ONCE(*ptep); | ||
98 | do { | ||
99 | old_pte = pte; | ||
100 | + /* | ||
101 | + * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY | ||
102 | + * clear), set the PTE_DIRTY bit. | ||
103 | + */ | ||
104 | + if (pte_hw_dirty(pte)) | ||
105 | + pte = pte_mkdirty(pte); | ||
106 | pte = pte_wrprotect(pte); | ||
107 | pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep), | ||
108 | pte_val(old_pte), pte_val(pte)); | ||
109 | diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c | ||
110 | index ca74a2aace42..7b60d62ac593 100644 | ||
111 | --- a/arch/arm64/mm/dump.c | ||
112 | +++ b/arch/arm64/mm/dump.c | ||
113 | @@ -389,7 +389,7 @@ void ptdump_check_wx(void) | ||
114 | .check_wx = true, | ||
115 | }; | ||
116 | |||
117 | - walk_pgd(&st, &init_mm, 0); | ||
118 | + walk_pgd(&st, &init_mm, VA_START); | ||
119 | note_page(&st, 0, 0, 0); | ||
120 | if (st.wx_pages || st.uxn_pages) | ||
121 | pr_warn("Checked W+X mappings: FAILED, %lu W+X pages found, %lu non-UXN pages found\n", | ||
122 | diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c | ||
123 | index 5960bef0170d..00e7b900ca41 100644 | ||
124 | --- a/arch/arm64/mm/init.c | ||
125 | +++ b/arch/arm64/mm/init.c | ||
126 | @@ -476,6 +476,8 @@ void __init arm64_memblock_init(void) | ||
127 | |||
128 | reserve_elfcorehdr(); | ||
129 | |||
130 | + high_memory = __va(memblock_end_of_DRAM() - 1) + 1; | ||
131 | + | ||
132 | dma_contiguous_reserve(arm64_dma_phys_limit); | ||
133 | |||
134 | memblock_allow_resize(); | ||
135 | @@ -502,7 +504,6 @@ void __init bootmem_init(void) | ||
136 | sparse_init(); | ||
137 | zone_sizes_init(min, max); | ||
138 | |||
139 | - high_memory = __va((max << PAGE_SHIFT) - 1) + 1; | ||
140 | memblock_dump_all(); | ||
141 | } | ||
142 | |||
143 | diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig | ||
144 | index af5369422032..d9c2866ba618 100644 | ||
145 | --- a/arch/blackfin/Kconfig | ||
146 | +++ b/arch/blackfin/Kconfig | ||
147 | @@ -321,11 +321,14 @@ config BF53x | ||
148 | |||
149 | config GPIO_ADI | ||
150 | def_bool y | ||
151 | + depends on !PINCTRL | ||
152 | depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561) | ||
153 | |||
154 | -config PINCTRL | ||
155 | +config PINCTRL_BLACKFIN_ADI2 | ||
156 | def_bool y | ||
157 | - depends on BF54x || BF60x | ||
158 | + depends on (BF54x || BF60x) | ||
159 | + select PINCTRL | ||
160 | + select PINCTRL_ADI2 | ||
161 | |||
162 | config MEM_MT48LC64M4A2FB_7E | ||
163 | bool | ||
164 | diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug | ||
165 | index 4ddd1b73ee3e..c8d957274cc2 100644 | ||
166 | --- a/arch/blackfin/Kconfig.debug | ||
167 | +++ b/arch/blackfin/Kconfig.debug | ||
168 | @@ -18,6 +18,7 @@ config DEBUG_VERBOSE | ||
169 | |||
170 | config DEBUG_MMRS | ||
171 | tristate "Generate Blackfin MMR tree" | ||
172 | + depends on !PINCTRL | ||
173 | select DEBUG_FS | ||
174 | help | ||
175 | Create a tree of Blackfin MMRs via the debugfs tree. If | ||
176 | diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c | ||
177 | index 9c88b82f6229..72238eedc360 100644 | ||
178 | --- a/arch/powerpc/perf/hv-24x7.c | ||
179 | +++ b/arch/powerpc/perf/hv-24x7.c | ||
180 | @@ -540,7 +540,7 @@ static int memord(const void *d1, size_t s1, const void *d2, size_t s2) | ||
181 | { | ||
182 | if (s1 < s2) | ||
183 | return 1; | ||
184 | - if (s2 > s1) | ||
185 | + if (s1 > s2) | ||
186 | return -1; | ||
187 | |||
188 | return memcmp(d1, d2, s1); | ||
189 | diff --git a/arch/powerpc/platforms/powernv/opal-async.c b/arch/powerpc/platforms/powernv/opal-async.c | ||
190 | index cf33769a7b72..45b3feb8aa2f 100644 | ||
191 | --- a/arch/powerpc/platforms/powernv/opal-async.c | ||
192 | +++ b/arch/powerpc/platforms/powernv/opal-async.c | ||
193 | @@ -39,18 +39,18 @@ int __opal_async_get_token(void) | ||
194 | int token; | ||
195 | |||
196 | spin_lock_irqsave(&opal_async_comp_lock, flags); | ||
197 | - token = find_first_bit(opal_async_complete_map, opal_max_async_tokens); | ||
198 | + token = find_first_zero_bit(opal_async_token_map, opal_max_async_tokens); | ||
199 | if (token >= opal_max_async_tokens) { | ||
200 | token = -EBUSY; | ||
201 | goto out; | ||
202 | } | ||
203 | |||
204 | - if (__test_and_set_bit(token, opal_async_token_map)) { | ||
205 | + if (!__test_and_clear_bit(token, opal_async_complete_map)) { | ||
206 | token = -EBUSY; | ||
207 | goto out; | ||
208 | } | ||
209 | |||
210 | - __clear_bit(token, opal_async_complete_map); | ||
211 | + __set_bit(token, opal_async_token_map); | ||
212 | |||
213 | out: | ||
214 | spin_unlock_irqrestore(&opal_async_comp_lock, flags); | ||
215 | diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c | ||
216 | index bbb73aa0eb8f..bfe2aa702973 100644 | ||
217 | --- a/arch/powerpc/platforms/powernv/setup.c | ||
218 | +++ b/arch/powerpc/platforms/powernv/setup.c | ||
219 | @@ -319,7 +319,7 @@ static unsigned long pnv_get_proc_freq(unsigned int cpu) | ||
220 | { | ||
221 | unsigned long ret_freq; | ||
222 | |||
223 | - ret_freq = cpufreq_quick_get(cpu) * 1000ul; | ||
224 | + ret_freq = cpufreq_get(cpu) * 1000ul; | ||
225 | |||
226 | /* | ||
227 | * If the backend cpufreq driver does not exist, | ||
228 | diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c | ||
229 | index 12277bc9fd9e..d86938260a86 100644 | ||
230 | --- a/arch/powerpc/platforms/pseries/vio.c | ||
231 | +++ b/arch/powerpc/platforms/pseries/vio.c | ||
232 | @@ -1592,6 +1592,8 @@ ATTRIBUTE_GROUPS(vio_dev); | ||
233 | void vio_unregister_device(struct vio_dev *viodev) | ||
234 | { | ||
235 | device_unregister(&viodev->dev); | ||
236 | + if (viodev->family == VDEVICE) | ||
237 | + irq_dispose_mapping(viodev->irq); | ||
238 | } | ||
239 | EXPORT_SYMBOL(vio_unregister_device); | ||
240 | |||
241 | diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c | ||
242 | index 16f1edd78c40..535cf1f6941c 100644 | ||
243 | --- a/arch/powerpc/sysdev/ipic.c | ||
244 | +++ b/arch/powerpc/sysdev/ipic.c | ||
245 | @@ -846,12 +846,12 @@ void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq) | ||
246 | |||
247 | u32 ipic_get_mcp_status(void) | ||
248 | { | ||
249 | - return ipic_read(primary_ipic->regs, IPIC_SERMR); | ||
250 | + return ipic_read(primary_ipic->regs, IPIC_SERSR); | ||
251 | } | ||
252 | |||
253 | void ipic_clear_mcp_status(u32 mask) | ||
254 | { | ||
255 | - ipic_write(primary_ipic->regs, IPIC_SERMR, mask); | ||
256 | + ipic_write(primary_ipic->regs, IPIC_SERSR, mask); | ||
257 | } | ||
258 | |||
259 | /* Return an interrupt vector or 0 if no interrupt is pending. */ | ||
260 | diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c | ||
261 | index 33351c6704b1..c008083fbc4f 100644 | ||
262 | --- a/arch/powerpc/xmon/xmon.c | ||
263 | +++ b/arch/powerpc/xmon/xmon.c | ||
264 | @@ -2475,6 +2475,11 @@ static void dump_xives(void) | ||
265 | unsigned long num; | ||
266 | int c; | ||
267 | |||
268 | + if (!xive_enabled()) { | ||
269 | + printf("Xive disabled on this system\n"); | ||
270 | + return; | ||
271 | + } | ||
272 | + | ||
273 | c = inchar(); | ||
274 | if (c == 'a') { | ||
275 | dump_all_xives(); | ||
276 | diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c | ||
277 | index f04db3779b34..59eea9c65d3e 100644 | ||
278 | --- a/arch/s390/kernel/compat_linux.c | ||
279 | +++ b/arch/s390/kernel/compat_linux.c | ||
280 | @@ -263,6 +263,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setgroups16, int, gidsetsize, u16 __user *, grouplis | ||
281 | return retval; | ||
282 | } | ||
283 | |||
284 | + groups_sort(group_info); | ||
285 | retval = set_current_groups(group_info); | ||
286 | put_group_info(group_info); | ||
287 | |||
288 | diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile | ||
289 | index 4b7575b00563..98018a621f6b 100644 | ||
290 | --- a/arch/x86/boot/compressed/Makefile | ||
291 | +++ b/arch/x86/boot/compressed/Makefile | ||
292 | @@ -78,6 +78,7 @@ vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o | ||
293 | vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/kaslr.o | ||
294 | ifdef CONFIG_X86_64 | ||
295 | vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/pagetable.o | ||
296 | + vmlinux-objs-y += $(obj)/pgtable_64.o | ||
297 | endif | ||
298 | |||
299 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone | ||
300 | diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S | ||
301 | index beb255b66447..4b3d92a37c80 100644 | ||
302 | --- a/arch/x86/boot/compressed/head_64.S | ||
303 | +++ b/arch/x86/boot/compressed/head_64.S | ||
304 | @@ -289,10 +289,18 @@ ENTRY(startup_64) | ||
305 | leaq boot_stack_end(%rbx), %rsp | ||
306 | |||
307 | #ifdef CONFIG_X86_5LEVEL | ||
308 | - /* Check if 5-level paging has already enabled */ | ||
309 | - movq %cr4, %rax | ||
310 | - testl $X86_CR4_LA57, %eax | ||
311 | - jnz lvl5 | ||
312 | + /* | ||
313 | + * Check if we need to enable 5-level paging. | ||
314 | + * RSI holds real mode data and need to be preserved across | ||
315 | + * a function call. | ||
316 | + */ | ||
317 | + pushq %rsi | ||
318 | + call l5_paging_required | ||
319 | + popq %rsi | ||
320 | + | ||
321 | + /* If l5_paging_required() returned zero, we're done here. */ | ||
322 | + cmpq $0, %rax | ||
323 | + je lvl5 | ||
324 | |||
325 | /* | ||
326 | * At this point we are in long mode with 4-level paging enabled, | ||
327 | diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c | ||
328 | index b50c42455e25..98761a1576ce 100644 | ||
329 | --- a/arch/x86/boot/compressed/misc.c | ||
330 | +++ b/arch/x86/boot/compressed/misc.c | ||
331 | @@ -169,6 +169,16 @@ void __puthex(unsigned long value) | ||
332 | } | ||
333 | } | ||
334 | |||
335 | +static bool l5_supported(void) | ||
336 | +{ | ||
337 | + /* Check if leaf 7 is supported. */ | ||
338 | + if (native_cpuid_eax(0) < 7) | ||
339 | + return 0; | ||
340 | + | ||
341 | + /* Check if la57 is supported. */ | ||
342 | + return native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31)); | ||
343 | +} | ||
344 | + | ||
345 | #if CONFIG_X86_NEED_RELOCS | ||
346 | static void handle_relocations(void *output, unsigned long output_len, | ||
347 | unsigned long virt_addr) | ||
348 | @@ -362,6 +372,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, | ||
349 | console_init(); | ||
350 | debug_putstr("early console in extract_kernel\n"); | ||
351 | |||
352 | + if (IS_ENABLED(CONFIG_X86_5LEVEL) && !l5_supported()) { | ||
353 | + error("This linux kernel as configured requires 5-level paging\n" | ||
354 | + "This CPU does not support the required 'cr4.la57' feature\n" | ||
355 | + "Unable to boot - please use a kernel appropriate for your CPU\n"); | ||
356 | + } | ||
357 | + | ||
358 | free_mem_ptr = heap; /* Heap */ | ||
359 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; | ||
360 | |||
361 | diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c | ||
362 | new file mode 100644 | ||
363 | index 000000000000..b4469a37e9a1 | ||
364 | --- /dev/null | ||
365 | +++ b/arch/x86/boot/compressed/pgtable_64.c | ||
366 | @@ -0,0 +1,28 @@ | ||
367 | +#include <asm/processor.h> | ||
368 | + | ||
369 | +/* | ||
370 | + * __force_order is used by special_insns.h asm code to force instruction | ||
371 | + * serialization. | ||
372 | + * | ||
373 | + * It is not referenced from the code, but GCC < 5 with -fPIE would fail | ||
374 | + * due to an undefined symbol. Define it to make these ancient GCCs work. | ||
375 | + */ | ||
376 | +unsigned long __force_order; | ||
377 | + | ||
378 | +int l5_paging_required(void) | ||
379 | +{ | ||
380 | + /* Check if leaf 7 is supported. */ | ||
381 | + | ||
382 | + if (native_cpuid_eax(0) < 7) | ||
383 | + return 0; | ||
384 | + | ||
385 | + /* Check if la57 is supported. */ | ||
386 | + if (!(native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31)))) | ||
387 | + return 0; | ||
388 | + | ||
389 | + /* Check if 5-level paging has already been enabled. */ | ||
390 | + if (native_read_cr4() & X86_CR4_LA57) | ||
391 | + return 0; | ||
392 | + | ||
393 | + return 1; | ||
394 | +} | ||
395 | diff --git a/arch/x86/crypto/salsa20_glue.c b/arch/x86/crypto/salsa20_glue.c | ||
396 | index 399a29d067d6..cb91a64a99e7 100644 | ||
397 | --- a/arch/x86/crypto/salsa20_glue.c | ||
398 | +++ b/arch/x86/crypto/salsa20_glue.c | ||
399 | @@ -59,13 +59,6 @@ static int encrypt(struct blkcipher_desc *desc, | ||
400 | |||
401 | salsa20_ivsetup(ctx, walk.iv); | ||
402 | |||
403 | - if (likely(walk.nbytes == nbytes)) | ||
404 | - { | ||
405 | - salsa20_encrypt_bytes(ctx, walk.src.virt.addr, | ||
406 | - walk.dst.virt.addr, nbytes); | ||
407 | - return blkcipher_walk_done(desc, &walk, 0); | ||
408 | - } | ||
409 | - | ||
410 | while (walk.nbytes >= 64) { | ||
411 | salsa20_encrypt_bytes(ctx, walk.src.virt.addr, | ||
412 | walk.dst.virt.addr, | ||
413 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c | ||
414 | index f366e6d3a5e1..bc5921c1e2f2 100644 | ||
415 | --- a/arch/x86/kvm/vmx.c | ||
416 | +++ b/arch/x86/kvm/vmx.c | ||
417 | @@ -2845,8 +2845,9 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx) | ||
418 | * Advertise EPTP switching unconditionally | ||
419 | * since we emulate it | ||
420 | */ | ||
421 | - vmx->nested.nested_vmx_vmfunc_controls = | ||
422 | - VMX_VMFUNC_EPTP_SWITCHING; | ||
423 | + if (enable_ept) | ||
424 | + vmx->nested.nested_vmx_vmfunc_controls = | ||
425 | + VMX_VMFUNC_EPTP_SWITCHING; | ||
426 | } | ||
427 | |||
428 | /* | ||
429 | diff --git a/block/badblocks.c b/block/badblocks.c | ||
430 | index 43c71166e1e2..91f7bcf979d3 100644 | ||
431 | --- a/block/badblocks.c | ||
432 | +++ b/block/badblocks.c | ||
433 | @@ -178,7 +178,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors, | ||
434 | |||
435 | if (bb->shift < 0) | ||
436 | /* badblocks are disabled */ | ||
437 | - return 0; | ||
438 | + return 1; | ||
439 | |||
440 | if (bb->shift) { | ||
441 | /* round the start down, and the end up */ | ||
442 | diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c | ||
443 | index 4ab69435708c..eca011fdfa0e 100644 | ||
444 | --- a/block/blk-mq-sched.c | ||
445 | +++ b/block/blk-mq-sched.c | ||
446 | @@ -94,7 +94,7 @@ void blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx) | ||
447 | struct request_queue *q = hctx->queue; | ||
448 | struct elevator_queue *e = q->elevator; | ||
449 | const bool has_sched_dispatch = e && e->type->ops.mq.dispatch_request; | ||
450 | - bool did_work = false; | ||
451 | + bool do_sched_dispatch = true; | ||
452 | LIST_HEAD(rq_list); | ||
453 | |||
454 | /* RCU or SRCU read lock is needed before checking quiesced flag */ | ||
455 | @@ -125,18 +125,18 @@ void blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx) | ||
456 | */ | ||
457 | if (!list_empty(&rq_list)) { | ||
458 | blk_mq_sched_mark_restart_hctx(hctx); | ||
459 | - did_work = blk_mq_dispatch_rq_list(q, &rq_list); | ||
460 | + do_sched_dispatch = blk_mq_dispatch_rq_list(q, &rq_list); | ||
461 | } else if (!has_sched_dispatch) { | ||
462 | blk_mq_flush_busy_ctxs(hctx, &rq_list); | ||
463 | blk_mq_dispatch_rq_list(q, &rq_list); | ||
464 | } | ||
465 | |||
466 | /* | ||
467 | - * We want to dispatch from the scheduler if we had no work left | ||
468 | - * on the dispatch list, OR if we did have work but weren't able | ||
469 | - * to make progress. | ||
470 | + * We want to dispatch from the scheduler if there was nothing | ||
471 | + * on the dispatch list or we were able to dispatch from the | ||
472 | + * dispatch list. | ||
473 | */ | ||
474 | - if (!did_work && has_sched_dispatch) { | ||
475 | + if (do_sched_dispatch && has_sched_dispatch) { | ||
476 | do { | ||
477 | struct request *rq; | ||
478 | |||
479 | diff --git a/crypto/af_alg.c b/crypto/af_alg.c | ||
480 | index a72659f452a5..e181073ef64d 100644 | ||
481 | --- a/crypto/af_alg.c | ||
482 | +++ b/crypto/af_alg.c | ||
483 | @@ -699,14 +699,15 @@ void af_alg_free_areq_sgls(struct af_alg_async_req *areq) | ||
484 | } | ||
485 | |||
486 | tsgl = areq->tsgl; | ||
487 | - for_each_sg(tsgl, sg, areq->tsgl_entries, i) { | ||
488 | - if (!sg_page(sg)) | ||
489 | - continue; | ||
490 | - put_page(sg_page(sg)); | ||
491 | - } | ||
492 | + if (tsgl) { | ||
493 | + for_each_sg(tsgl, sg, areq->tsgl_entries, i) { | ||
494 | + if (!sg_page(sg)) | ||
495 | + continue; | ||
496 | + put_page(sg_page(sg)); | ||
497 | + } | ||
498 | |||
499 | - if (areq->tsgl && areq->tsgl_entries) | ||
500 | sock_kfree_s(sk, tsgl, areq->tsgl_entries * sizeof(*tsgl)); | ||
501 | + } | ||
502 | } | ||
503 | EXPORT_SYMBOL_GPL(af_alg_free_areq_sgls); | ||
504 | |||
505 | diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c | ||
506 | index d0b45145cb30..3d793bc2aa82 100644 | ||
507 | --- a/crypto/algif_aead.c | ||
508 | +++ b/crypto/algif_aead.c | ||
509 | @@ -503,6 +503,7 @@ static void aead_release(void *private) | ||
510 | struct aead_tfm *tfm = private; | ||
511 | |||
512 | crypto_free_aead(tfm->aead); | ||
513 | + crypto_put_default_null_skcipher2(); | ||
514 | kfree(tfm); | ||
515 | } | ||
516 | |||
517 | @@ -535,7 +536,6 @@ static void aead_sock_destruct(struct sock *sk) | ||
518 | unsigned int ivlen = crypto_aead_ivsize(tfm); | ||
519 | |||
520 | af_alg_pull_tsgl(sk, ctx->used, NULL, 0); | ||
521 | - crypto_put_default_null_skcipher2(); | ||
522 | sock_kzfree_s(sk, ctx->iv, ivlen); | ||
523 | sock_kfree_s(sk, ctx, ctx->len); | ||
524 | af_alg_release_parent(sk); | ||
525 | diff --git a/crypto/hmac.c b/crypto/hmac.c | ||
526 | index 92871dc2a63e..e74730224f0a 100644 | ||
527 | --- a/crypto/hmac.c | ||
528 | +++ b/crypto/hmac.c | ||
529 | @@ -195,11 +195,15 @@ static int hmac_create(struct crypto_template *tmpl, struct rtattr **tb) | ||
530 | salg = shash_attr_alg(tb[1], 0, 0); | ||
531 | if (IS_ERR(salg)) | ||
532 | return PTR_ERR(salg); | ||
533 | + alg = &salg->base; | ||
534 | |||
535 | + /* The underlying hash algorithm must be unkeyed */ | ||
536 | err = -EINVAL; | ||
537 | + if (crypto_shash_alg_has_setkey(salg)) | ||
538 | + goto out_put_alg; | ||
539 | + | ||
540 | ds = salg->digestsize; | ||
541 | ss = salg->statesize; | ||
542 | - alg = &salg->base; | ||
543 | if (ds > alg->cra_blocksize || | ||
544 | ss < alg->cra_blocksize) | ||
545 | goto out_put_alg; | ||
546 | diff --git a/crypto/rsa_helper.c b/crypto/rsa_helper.c | ||
547 | index 0b66dc824606..cad395d70d78 100644 | ||
548 | --- a/crypto/rsa_helper.c | ||
549 | +++ b/crypto/rsa_helper.c | ||
550 | @@ -30,7 +30,7 @@ int rsa_get_n(void *context, size_t hdrlen, unsigned char tag, | ||
551 | return -EINVAL; | ||
552 | |||
553 | if (fips_enabled) { | ||
554 | - while (!*ptr && n_sz) { | ||
555 | + while (n_sz && !*ptr) { | ||
556 | ptr++; | ||
557 | n_sz--; | ||
558 | } | ||
559 | diff --git a/crypto/salsa20_generic.c b/crypto/salsa20_generic.c | ||
560 | index f550b5d94630..d7da0eea5622 100644 | ||
561 | --- a/crypto/salsa20_generic.c | ||
562 | +++ b/crypto/salsa20_generic.c | ||
563 | @@ -188,13 +188,6 @@ static int encrypt(struct blkcipher_desc *desc, | ||
564 | |||
565 | salsa20_ivsetup(ctx, walk.iv); | ||
566 | |||
567 | - if (likely(walk.nbytes == nbytes)) | ||
568 | - { | ||
569 | - salsa20_encrypt_bytes(ctx, walk.dst.virt.addr, | ||
570 | - walk.src.virt.addr, nbytes); | ||
571 | - return blkcipher_walk_done(desc, &walk, 0); | ||
572 | - } | ||
573 | - | ||
574 | while (walk.nbytes >= 64) { | ||
575 | salsa20_encrypt_bytes(ctx, walk.dst.virt.addr, | ||
576 | walk.src.virt.addr, | ||
577 | diff --git a/crypto/shash.c b/crypto/shash.c | ||
578 | index 325a14da5827..e849d3ee2e27 100644 | ||
579 | --- a/crypto/shash.c | ||
580 | +++ b/crypto/shash.c | ||
581 | @@ -25,11 +25,12 @@ | ||
582 | |||
583 | static const struct crypto_type crypto_shash_type; | ||
584 | |||
585 | -static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, | ||
586 | - unsigned int keylen) | ||
587 | +int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, | ||
588 | + unsigned int keylen) | ||
589 | { | ||
590 | return -ENOSYS; | ||
591 | } | ||
592 | +EXPORT_SYMBOL_GPL(shash_no_setkey); | ||
593 | |||
594 | static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, | ||
595 | unsigned int keylen) | ||
596 | diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c | ||
597 | index 0022a18d36ee..f5f58a6eee5d 100644 | ||
598 | --- a/crypto/tcrypt.c | ||
599 | +++ b/crypto/tcrypt.c | ||
600 | @@ -340,7 +340,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, | ||
601 | } | ||
602 | |||
603 | sg_init_aead(sg, xbuf, | ||
604 | - *b_size + (enc ? authsize : 0)); | ||
605 | + *b_size + (enc ? 0 : authsize)); | ||
606 | |||
607 | sg_init_aead(sgout, xoutbuf, | ||
608 | *b_size + (enc ? authsize : 0)); | ||
609 | @@ -348,7 +348,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, | ||
610 | sg_set_buf(&sg[0], assoc, aad_size); | ||
611 | sg_set_buf(&sgout[0], assoc, aad_size); | ||
612 | |||
613 | - aead_request_set_crypt(req, sg, sgout, *b_size, iv); | ||
614 | + aead_request_set_crypt(req, sg, sgout, | ||
615 | + *b_size + (enc ? 0 : authsize), | ||
616 | + iv); | ||
617 | aead_request_set_ad(req, aad_size); | ||
618 | |||
619 | if (secs) | ||
620 | diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c | ||
621 | index 8042c26ea9e6..4d55af5c6e5b 100644 | ||
622 | --- a/drivers/block/null_blk.c | ||
623 | +++ b/drivers/block/null_blk.c | ||
624 | @@ -1985,8 +1985,10 @@ static int __init null_init(void) | ||
625 | |||
626 | for (i = 0; i < nr_devices; i++) { | ||
627 | dev = null_alloc_dev(); | ||
628 | - if (!dev) | ||
629 | + if (!dev) { | ||
630 | + ret = -ENOMEM; | ||
631 | goto err_dev; | ||
632 | + } | ||
633 | ret = null_add_dev(dev); | ||
634 | if (ret) { | ||
635 | null_free_dev(dev); | ||
636 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c | ||
637 | index 7a5c06aaa181..513a7a59d421 100644 | ||
638 | --- a/drivers/bluetooth/btusb.c | ||
639 | +++ b/drivers/bluetooth/btusb.c | ||
640 | @@ -272,6 +272,7 @@ static const struct usb_device_id blacklist_table[] = { | ||
641 | { USB_DEVICE(0x0cf3, 0xe301), .driver_info = BTUSB_QCA_ROME }, | ||
642 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, | ||
643 | { USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME }, | ||
644 | + { USB_DEVICE(0x0489, 0xe09f), .driver_info = BTUSB_QCA_ROME }, | ||
645 | { USB_DEVICE(0x0489, 0xe0a2), .driver_info = BTUSB_QCA_ROME }, | ||
646 | { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME }, | ||
647 | { USB_DEVICE(0x04ca, 0x3016), .driver_info = BTUSB_QCA_ROME }, | ||
648 | diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c | ||
649 | index a746627e784e..6e2403805784 100644 | ||
650 | --- a/drivers/bluetooth/hci_ldisc.c | ||
651 | +++ b/drivers/bluetooth/hci_ldisc.c | ||
652 | @@ -510,13 +510,13 @@ static void hci_uart_tty_close(struct tty_struct *tty) | ||
653 | if (hdev) | ||
654 | hci_uart_close(hdev); | ||
655 | |||
656 | - cancel_work_sync(&hu->write_work); | ||
657 | - | ||
658 | if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) { | ||
659 | write_lock_irqsave(&hu->proto_lock, flags); | ||
660 | clear_bit(HCI_UART_PROTO_READY, &hu->flags); | ||
661 | write_unlock_irqrestore(&hu->proto_lock, flags); | ||
662 | |||
663 | + cancel_work_sync(&hu->write_work); | ||
664 | + | ||
665 | if (hdev) { | ||
666 | if (test_bit(HCI_UART_REGISTERED, &hu->flags)) | ||
667 | hci_unregister_dev(hdev); | ||
668 | diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c | ||
669 | index 03d7faf51c2b..72fd1750134d 100644 | ||
670 | --- a/drivers/bus/arm-ccn.c | ||
671 | +++ b/drivers/bus/arm-ccn.c | ||
672 | @@ -1280,6 +1280,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) | ||
673 | |||
674 | /* Perf driver registration */ | ||
675 | ccn->dt.pmu = (struct pmu) { | ||
676 | + .module = THIS_MODULE, | ||
677 | .attr_groups = arm_ccn_pmu_attr_groups, | ||
678 | .task_ctx_nr = perf_invalid_context, | ||
679 | .event_init = arm_ccn_pmu_event_init, | ||
680 | diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c | ||
681 | index c04aa11f0e21..e1cbb78c6806 100644 | ||
682 | --- a/drivers/char/ipmi/ipmi_si_intf.c | ||
683 | +++ b/drivers/char/ipmi/ipmi_si_intf.c | ||
684 | @@ -3469,6 +3469,7 @@ static int add_smi(struct smi_info *new_smi) | ||
685 | ipmi_addr_src_to_str(new_smi->addr_source), | ||
686 | si_to_str[new_smi->si_type]); | ||
687 | rv = -EBUSY; | ||
688 | + kfree(new_smi); | ||
689 | goto out_err; | ||
690 | } | ||
691 | } | ||
692 | diff --git a/drivers/clk/hisilicon/clk-hi6220.c b/drivers/clk/hisilicon/clk-hi6220.c | ||
693 | index e786d717f75d..a87809d4bd52 100644 | ||
694 | --- a/drivers/clk/hisilicon/clk-hi6220.c | ||
695 | +++ b/drivers/clk/hisilicon/clk-hi6220.c | ||
696 | @@ -145,7 +145,7 @@ static struct hisi_gate_clock hi6220_separated_gate_clks_sys[] __initdata = { | ||
697 | { HI6220_BBPPLL_SEL, "bbppll_sel", "pll0_bbp_gate", CLK_SET_RATE_PARENT|CLK_IGNORE_UNUSED, 0x270, 9, 0, }, | ||
698 | { HI6220_MEDIA_PLL_SRC, "media_pll_src", "pll_media_gate", CLK_SET_RATE_PARENT|CLK_IGNORE_UNUSED, 0x270, 10, 0, }, | ||
699 | { HI6220_MMC2_SEL, "mmc2_sel", "mmc2_mux1", CLK_SET_RATE_PARENT|CLK_IGNORE_UNUSED, 0x270, 11, 0, }, | ||
700 | - { HI6220_CS_ATB_SYSPLL, "cs_atb_syspll", "syspll", CLK_SET_RATE_PARENT|CLK_IGNORE_UNUSED, 0x270, 12, 0, }, | ||
701 | + { HI6220_CS_ATB_SYSPLL, "cs_atb_syspll", "syspll", CLK_SET_RATE_PARENT|CLK_IS_CRITICAL, 0x270, 12, 0, }, | ||
702 | }; | ||
703 | |||
704 | static struct hisi_mux_clock hi6220_mux_clks_sys[] __initdata = { | ||
705 | diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c | ||
706 | index c07df719b8a3..8d518ad5dc13 100644 | ||
707 | --- a/drivers/clk/imx/clk-imx6q.c | ||
708 | +++ b/drivers/clk/imx/clk-imx6q.c | ||
709 | @@ -761,7 +761,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) | ||
710 | clk[IMX6QDL_CLK_GPU2D_CORE] = imx_clk_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24); | ||
711 | clk[IMX6QDL_CLK_GPU3D_CORE] = imx_clk_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26); | ||
712 | clk[IMX6QDL_CLK_HDMI_IAHB] = imx_clk_gate2("hdmi_iahb", "ahb", base + 0x70, 0); | ||
713 | - clk[IMX6QDL_CLK_HDMI_ISFR] = imx_clk_gate2("hdmi_isfr", "video_27m", base + 0x70, 4); | ||
714 | + clk[IMX6QDL_CLK_HDMI_ISFR] = imx_clk_gate2("hdmi_isfr", "mipi_core_cfg", base + 0x70, 4); | ||
715 | clk[IMX6QDL_CLK_I2C1] = imx_clk_gate2("i2c1", "ipg_per", base + 0x70, 6); | ||
716 | clk[IMX6QDL_CLK_I2C2] = imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8); | ||
717 | clk[IMX6QDL_CLK_I2C3] = imx_clk_gate2("i2c3", "ipg_per", base + 0x70, 10); | ||
718 | diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c | ||
719 | index 2305699db467..0ac9b30c8b90 100644 | ||
720 | --- a/drivers/clk/imx/clk-imx7d.c | ||
721 | +++ b/drivers/clk/imx/clk-imx7d.c | ||
722 | @@ -797,7 +797,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) | ||
723 | clks[IMX7D_MAIN_AXI_ROOT_CLK] = imx_clk_gate4("main_axi_root_clk", "axi_post_div", base + 0x4040, 0); | ||
724 | clks[IMX7D_DISP_AXI_ROOT_CLK] = imx_clk_gate4("disp_axi_root_clk", "disp_axi_post_div", base + 0x4050, 0); | ||
725 | clks[IMX7D_ENET_AXI_ROOT_CLK] = imx_clk_gate4("enet_axi_root_clk", "enet_axi_post_div", base + 0x4060, 0); | ||
726 | - clks[IMX7D_OCRAM_CLK] = imx_clk_gate4("ocram_clk", "axi_post_div", base + 0x4110, 0); | ||
727 | + clks[IMX7D_OCRAM_CLK] = imx_clk_gate4("ocram_clk", "main_axi_root_clk", base + 0x4110, 0); | ||
728 | clks[IMX7D_OCRAM_S_CLK] = imx_clk_gate4("ocram_s_clk", "ahb_root_clk", base + 0x4120, 0); | ||
729 | clks[IMX7D_DRAM_ROOT_CLK] = imx_clk_gate4("dram_root_clk", "dram_post_div", base + 0x4130, 0); | ||
730 | clks[IMX7D_DRAM_PHYM_ROOT_CLK] = imx_clk_gate4("dram_phym_root_clk", "dram_phym_cg", base + 0x4130, 0); | ||
731 | diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h | ||
732 | index f5d6b70ce189..210ce8e8025e 100644 | ||
733 | --- a/drivers/clk/mediatek/clk-mtk.h | ||
734 | +++ b/drivers/clk/mediatek/clk-mtk.h | ||
735 | @@ -216,6 +216,7 @@ struct mtk_pll_data { | ||
736 | uint32_t pcw_reg; | ||
737 | int pcw_shift; | ||
738 | const struct mtk_pll_div_table *div_table; | ||
739 | + const char *parent_name; | ||
740 | }; | ||
741 | |||
742 | void mtk_clk_register_plls(struct device_node *node, | ||
743 | diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c | ||
744 | index a409142e9346..7598477ff60f 100644 | ||
745 | --- a/drivers/clk/mediatek/clk-pll.c | ||
746 | +++ b/drivers/clk/mediatek/clk-pll.c | ||
747 | @@ -303,7 +303,10 @@ static struct clk *mtk_clk_register_pll(const struct mtk_pll_data *data, | ||
748 | init.name = data->name; | ||
749 | init.flags = (data->flags & PLL_AO) ? CLK_IS_CRITICAL : 0; | ||
750 | init.ops = &mtk_pll_ops; | ||
751 | - init.parent_names = &parent_name; | ||
752 | + if (data->parent_name) | ||
753 | + init.parent_names = &data->parent_name; | ||
754 | + else | ||
755 | + init.parent_names = &parent_name; | ||
756 | init.num_parents = 1; | ||
757 | |||
758 | clk = clk_register(NULL, &pll->hw); | ||
759 | diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c | ||
760 | index 6d7a613f2656..b92867814e2d 100644 | ||
761 | --- a/drivers/clk/tegra/clk-tegra210.c | ||
762 | +++ b/drivers/clk/tegra/clk-tegra210.c | ||
763 | @@ -2566,8 +2566,8 @@ static int tegra210_enable_pllu(void) | ||
764 | reg |= PLL_ENABLE; | ||
765 | writel(reg, clk_base + PLLU_BASE); | ||
766 | |||
767 | - readl_relaxed_poll_timeout(clk_base + PLLU_BASE, reg, | ||
768 | - reg & PLL_BASE_LOCK, 2, 1000); | ||
769 | + readl_relaxed_poll_timeout_atomic(clk_base + PLLU_BASE, reg, | ||
770 | + reg & PLL_BASE_LOCK, 2, 1000); | ||
771 | if (!(reg & PLL_BASE_LOCK)) { | ||
772 | pr_err("Timed out waiting for PLL_U to lock\n"); | ||
773 | return -ETIMEDOUT; | ||
774 | diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c | ||
775 | index a2d163f759b4..07f5203df01c 100644 | ||
776 | --- a/drivers/clk/tegra/clk-tegra30.c | ||
777 | +++ b/drivers/clk/tegra/clk-tegra30.c | ||
778 | @@ -964,7 +964,7 @@ static void __init tegra30_super_clk_init(void) | ||
779 | * U71 divider of cclk_lp. | ||
780 | */ | ||
781 | clk = tegra_clk_register_divider("pll_p_out3_cclklp", "pll_p_out3", | ||
782 | - clk_base + SUPER_CCLKG_DIVIDER, 0, | ||
783 | + clk_base + SUPER_CCLKLP_DIVIDER, 0, | ||
784 | TEGRA_DIVIDER_INT, 16, 8, 1, NULL); | ||
785 | clk_register_clkdev(clk, "pll_p_out3_cclklp", NULL); | ||
786 | |||
787 | diff --git a/drivers/dax/device.c b/drivers/dax/device.c | ||
788 | index 375b99bca002..7b0bf825c4e7 100644 | ||
789 | --- a/drivers/dax/device.c | ||
790 | +++ b/drivers/dax/device.c | ||
791 | @@ -222,7 +222,8 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, | ||
792 | unsigned long size) | ||
793 | { | ||
794 | struct resource *res; | ||
795 | - phys_addr_t phys; | ||
796 | + /* gcc-4.6.3-nolibc for i386 complains that this is uninitialized */ | ||
797 | + phys_addr_t uninitialized_var(phys); | ||
798 | int i; | ||
799 | |||
800 | for (i = 0; i < dev_dax->num_resources; i++) { | ||
801 | diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c | ||
802 | index 47edc7fbf91f..ec5f9d2bc820 100644 | ||
803 | --- a/drivers/dma/dmatest.c | ||
804 | +++ b/drivers/dma/dmatest.c | ||
805 | @@ -155,6 +155,12 @@ MODULE_PARM_DESC(run, "Run the test (default: false)"); | ||
806 | #define PATTERN_COUNT_MASK 0x1f | ||
807 | #define PATTERN_MEMSET_IDX 0x01 | ||
808 | |||
809 | +/* poor man's completion - we want to use wait_event_freezable() on it */ | ||
810 | +struct dmatest_done { | ||
811 | + bool done; | ||
812 | + wait_queue_head_t *wait; | ||
813 | +}; | ||
814 | + | ||
815 | struct dmatest_thread { | ||
816 | struct list_head node; | ||
817 | struct dmatest_info *info; | ||
818 | @@ -165,6 +171,8 @@ struct dmatest_thread { | ||
819 | u8 **dsts; | ||
820 | u8 **udsts; | ||
821 | enum dma_transaction_type type; | ||
822 | + wait_queue_head_t done_wait; | ||
823 | + struct dmatest_done test_done; | ||
824 | bool done; | ||
825 | }; | ||
826 | |||
827 | @@ -342,18 +350,25 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start, | ||
828 | return error_count; | ||
829 | } | ||
830 | |||
831 | -/* poor man's completion - we want to use wait_event_freezable() on it */ | ||
832 | -struct dmatest_done { | ||
833 | - bool done; | ||
834 | - wait_queue_head_t *wait; | ||
835 | -}; | ||
836 | |||
837 | static void dmatest_callback(void *arg) | ||
838 | { | ||
839 | struct dmatest_done *done = arg; | ||
840 | - | ||
841 | - done->done = true; | ||
842 | - wake_up_all(done->wait); | ||
843 | + struct dmatest_thread *thread = | ||
844 | + container_of(arg, struct dmatest_thread, done_wait); | ||
845 | + if (!thread->done) { | ||
846 | + done->done = true; | ||
847 | + wake_up_all(done->wait); | ||
848 | + } else { | ||
849 | + /* | ||
850 | + * If thread->done, it means that this callback occurred | ||
851 | + * after the parent thread has cleaned up. This can | ||
852 | + * happen in the case that driver doesn't implement | ||
853 | + * the terminate_all() functionality and a dma operation | ||
854 | + * did not occur within the timeout period | ||
855 | + */ | ||
856 | + WARN(1, "dmatest: Kernel memory may be corrupted!!\n"); | ||
857 | + } | ||
858 | } | ||
859 | |||
860 | static unsigned int min_odd(unsigned int x, unsigned int y) | ||
861 | @@ -424,9 +439,8 @@ static unsigned long long dmatest_KBs(s64 runtime, unsigned long long len) | ||
862 | */ | ||
863 | static int dmatest_func(void *data) | ||
864 | { | ||
865 | - DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_wait); | ||
866 | struct dmatest_thread *thread = data; | ||
867 | - struct dmatest_done done = { .wait = &done_wait }; | ||
868 | + struct dmatest_done *done = &thread->test_done; | ||
869 | struct dmatest_info *info; | ||
870 | struct dmatest_params *params; | ||
871 | struct dma_chan *chan; | ||
872 | @@ -673,9 +687,9 @@ static int dmatest_func(void *data) | ||
873 | continue; | ||
874 | } | ||
875 | |||
876 | - done.done = false; | ||
877 | + done->done = false; | ||
878 | tx->callback = dmatest_callback; | ||
879 | - tx->callback_param = &done; | ||
880 | + tx->callback_param = done; | ||
881 | cookie = tx->tx_submit(tx); | ||
882 | |||
883 | if (dma_submit_error(cookie)) { | ||
884 | @@ -688,21 +702,12 @@ static int dmatest_func(void *data) | ||
885 | } | ||
886 | dma_async_issue_pending(chan); | ||
887 | |||
888 | - wait_event_freezable_timeout(done_wait, done.done, | ||
889 | + wait_event_freezable_timeout(thread->done_wait, done->done, | ||
890 | msecs_to_jiffies(params->timeout)); | ||
891 | |||
892 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); | ||
893 | |||
894 | - if (!done.done) { | ||
895 | - /* | ||
896 | - * We're leaving the timed out dma operation with | ||
897 | - * dangling pointer to done_wait. To make this | ||
898 | - * correct, we'll need to allocate wait_done for | ||
899 | - * each test iteration and perform "who's gonna | ||
900 | - * free it this time?" dancing. For now, just | ||
901 | - * leave it dangling. | ||
902 | - */ | ||
903 | - WARN(1, "dmatest: Kernel stack may be corrupted!!\n"); | ||
904 | + if (!done->done) { | ||
905 | dmaengine_unmap_put(um); | ||
906 | result("test timed out", total_tests, src_off, dst_off, | ||
907 | len, 0); | ||
908 | @@ -789,7 +794,7 @@ static int dmatest_func(void *data) | ||
909 | dmatest_KBs(runtime, total_len), ret); | ||
910 | |||
911 | /* terminate all transfers on specified channels */ | ||
912 | - if (ret) | ||
913 | + if (ret || failed_tests) | ||
914 | dmaengine_terminate_all(chan); | ||
915 | |||
916 | thread->done = true; | ||
917 | @@ -849,6 +854,8 @@ static int dmatest_add_threads(struct dmatest_info *info, | ||
918 | thread->info = info; | ||
919 | thread->chan = dtc->chan; | ||
920 | thread->type = type; | ||
921 | + thread->test_done.wait = &thread->done_wait; | ||
922 | + init_waitqueue_head(&thread->done_wait); | ||
923 | smp_wmb(); | ||
924 | thread->task = kthread_create(dmatest_func, thread, "%s-%s%u", | ||
925 | dma_chan_name(chan), op, i); | ||
926 | diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c | ||
927 | index f1d04b70ee67..7df910e7c348 100644 | ||
928 | --- a/drivers/dma/ti-dma-crossbar.c | ||
929 | +++ b/drivers/dma/ti-dma-crossbar.c | ||
930 | @@ -49,12 +49,12 @@ struct ti_am335x_xbar_data { | ||
931 | |||
932 | struct ti_am335x_xbar_map { | ||
933 | u16 dma_line; | ||
934 | - u16 mux_val; | ||
935 | + u8 mux_val; | ||
936 | }; | ||
937 | |||
938 | -static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u16 val) | ||
939 | +static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u8 val) | ||
940 | { | ||
941 | - writeb_relaxed(val & 0x1f, iomem + event); | ||
942 | + writeb_relaxed(val, iomem + event); | ||
943 | } | ||
944 | |||
945 | static void ti_am335x_xbar_free(struct device *dev, void *route_data) | ||
946 | @@ -105,7 +105,7 @@ static void *ti_am335x_xbar_route_allocate(struct of_phandle_args *dma_spec, | ||
947 | } | ||
948 | |||
949 | map->dma_line = (u16)dma_spec->args[0]; | ||
950 | - map->mux_val = (u16)dma_spec->args[2]; | ||
951 | + map->mux_val = (u8)dma_spec->args[2]; | ||
952 | |||
953 | dma_spec->args[2] = 0; | ||
954 | dma_spec->args_count = 2; | ||
955 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | ||
956 | index 5ce65280b396..90adff83e489 100644 | ||
957 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | ||
958 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | ||
959 | @@ -136,7 +136,8 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring) | ||
960 | if (ring->funcs->end_use) | ||
961 | ring->funcs->end_use(ring); | ||
962 | |||
963 | - amdgpu_ring_lru_touch(ring->adev, ring); | ||
964 | + if (ring->funcs->type != AMDGPU_RING_TYPE_KIQ) | ||
965 | + amdgpu_ring_lru_touch(ring->adev, ring); | ||
966 | } | ||
967 | |||
968 | /** | ||
969 | diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c | ||
970 | index 078026f63b6f..4e940a096b2a 100644 | ||
971 | --- a/drivers/hid/hid-cp2112.c | ||
972 | +++ b/drivers/hid/hid-cp2112.c | ||
973 | @@ -196,6 +196,8 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
974 | HID_REQ_GET_REPORT); | ||
975 | if (ret != CP2112_GPIO_CONFIG_LENGTH) { | ||
976 | hid_err(hdev, "error requesting GPIO config: %d\n", ret); | ||
977 | + if (ret >= 0) | ||
978 | + ret = -EIO; | ||
979 | goto exit; | ||
980 | } | ||
981 | |||
982 | @@ -205,8 +207,10 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
983 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, | ||
984 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, | ||
985 | HID_REQ_SET_REPORT); | ||
986 | - if (ret < 0) { | ||
987 | + if (ret != CP2112_GPIO_CONFIG_LENGTH) { | ||
988 | hid_err(hdev, "error setting GPIO config: %d\n", ret); | ||
989 | + if (ret >= 0) | ||
990 | + ret = -EIO; | ||
991 | goto exit; | ||
992 | } | ||
993 | |||
994 | @@ -214,7 +218,7 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
995 | |||
996 | exit: | ||
997 | mutex_unlock(&dev->lock); | ||
998 | - return ret < 0 ? ret : -EIO; | ||
999 | + return ret; | ||
1000 | } | ||
1001 | |||
1002 | static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | ||
1003 | diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c | ||
1004 | index 12523f630b61..d2f74721b3ba 100644 | ||
1005 | --- a/drivers/infiniband/core/addr.c | ||
1006 | +++ b/drivers/infiniband/core/addr.c | ||
1007 | @@ -852,7 +852,7 @@ static struct notifier_block nb = { | ||
1008 | |||
1009 | int addr_init(void) | ||
1010 | { | ||
1011 | - addr_wq = alloc_ordered_workqueue("ib_addr", WQ_MEM_RECLAIM); | ||
1012 | + addr_wq = alloc_ordered_workqueue("ib_addr", 0); | ||
1013 | if (!addr_wq) | ||
1014 | return -ENOMEM; | ||
1015 | |||
1016 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c | ||
1017 | index 852c8fec8088..fa79c7076ccd 100644 | ||
1018 | --- a/drivers/infiniband/core/cma.c | ||
1019 | +++ b/drivers/infiniband/core/cma.c | ||
1020 | @@ -1540,7 +1540,7 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id, | ||
1021 | return id_priv; | ||
1022 | } | ||
1023 | |||
1024 | -static inline int cma_user_data_offset(struct rdma_id_private *id_priv) | ||
1025 | +static inline u8 cma_user_data_offset(struct rdma_id_private *id_priv) | ||
1026 | { | ||
1027 | return cma_family(id_priv) == AF_IB ? 0 : sizeof(struct cma_hdr); | ||
1028 | } | ||
1029 | @@ -1942,7 +1942,8 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) | ||
1030 | struct rdma_id_private *listen_id, *conn_id = NULL; | ||
1031 | struct rdma_cm_event event; | ||
1032 | struct net_device *net_dev; | ||
1033 | - int offset, ret; | ||
1034 | + u8 offset; | ||
1035 | + int ret; | ||
1036 | |||
1037 | listen_id = cma_id_from_event(cm_id, ib_event, &net_dev); | ||
1038 | if (IS_ERR(listen_id)) | ||
1039 | @@ -3440,7 +3441,8 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | ||
1040 | struct ib_cm_sidr_req_param req; | ||
1041 | struct ib_cm_id *id; | ||
1042 | void *private_data; | ||
1043 | - int offset, ret; | ||
1044 | + u8 offset; | ||
1045 | + int ret; | ||
1046 | |||
1047 | memset(&req, 0, sizeof req); | ||
1048 | offset = cma_user_data_offset(id_priv); | ||
1049 | @@ -3497,7 +3499,8 @@ static int cma_connect_ib(struct rdma_id_private *id_priv, | ||
1050 | struct rdma_route *route; | ||
1051 | void *private_data; | ||
1052 | struct ib_cm_id *id; | ||
1053 | - int offset, ret; | ||
1054 | + u8 offset; | ||
1055 | + int ret; | ||
1056 | |||
1057 | memset(&req, 0, sizeof req); | ||
1058 | offset = cma_user_data_offset(id_priv); | ||
1059 | diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c | ||
1060 | index a337386652b0..feafdb961c48 100644 | ||
1061 | --- a/drivers/infiniband/core/security.c | ||
1062 | +++ b/drivers/infiniband/core/security.c | ||
1063 | @@ -739,8 +739,11 @@ int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index) | ||
1064 | if (!rdma_protocol_ib(map->agent.device, map->agent.port_num)) | ||
1065 | return 0; | ||
1066 | |||
1067 | - if (map->agent.qp->qp_type == IB_QPT_SMI && !map->agent.smp_allowed) | ||
1068 | - return -EACCES; | ||
1069 | + if (map->agent.qp->qp_type == IB_QPT_SMI) { | ||
1070 | + if (!map->agent.smp_allowed) | ||
1071 | + return -EACCES; | ||
1072 | + return 0; | ||
1073 | + } | ||
1074 | |||
1075 | return ib_security_pkey_access(map->agent.device, | ||
1076 | map->agent.port_num, | ||
1077 | diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c | ||
1078 | index 52a2cf2d83aa..d8f540054392 100644 | ||
1079 | --- a/drivers/infiniband/core/uverbs_cmd.c | ||
1080 | +++ b/drivers/infiniband/core/uverbs_cmd.c | ||
1081 | @@ -1982,6 +1982,12 @@ static int modify_qp(struct ib_uverbs_file *file, | ||
1082 | goto release_qp; | ||
1083 | } | ||
1084 | |||
1085 | + if ((cmd->base.attr_mask & IB_QP_ALT_PATH) && | ||
1086 | + !rdma_is_port_valid(qp->device, cmd->base.alt_port_num)) { | ||
1087 | + ret = -EINVAL; | ||
1088 | + goto release_qp; | ||
1089 | + } | ||
1090 | + | ||
1091 | attr->qp_state = cmd->base.qp_state; | ||
1092 | attr->cur_qp_state = cmd->base.cur_qp_state; | ||
1093 | attr->path_mtu = cmd->base.path_mtu; | ||
1094 | diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c | ||
1095 | index be07da1997e6..eae8ea81c6e2 100644 | ||
1096 | --- a/drivers/infiniband/hw/cxgb4/cq.c | ||
1097 | +++ b/drivers/infiniband/hw/cxgb4/cq.c | ||
1098 | @@ -410,6 +410,11 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp) | ||
1099 | |||
1100 | static int cqe_completes_wr(struct t4_cqe *cqe, struct t4_wq *wq) | ||
1101 | { | ||
1102 | + if (CQE_OPCODE(cqe) == C4IW_DRAIN_OPCODE) { | ||
1103 | + WARN_ONCE(1, "Unexpected DRAIN CQE qp id %u!\n", wq->sq.qid); | ||
1104 | + return 0; | ||
1105 | + } | ||
1106 | + | ||
1107 | if (CQE_OPCODE(cqe) == FW_RI_TERMINATE) | ||
1108 | return 0; | ||
1109 | |||
1110 | diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c | ||
1111 | index cb7fc0d35d1d..e69453665a17 100644 | ||
1112 | --- a/drivers/infiniband/hw/cxgb4/qp.c | ||
1113 | +++ b/drivers/infiniband/hw/cxgb4/qp.c | ||
1114 | @@ -868,7 +868,12 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | ||
1115 | |||
1116 | qhp = to_c4iw_qp(ibqp); | ||
1117 | spin_lock_irqsave(&qhp->lock, flag); | ||
1118 | - if (t4_wq_in_error(&qhp->wq)) { | ||
1119 | + | ||
1120 | + /* | ||
1121 | + * If the qp has been flushed, then just insert a special | ||
1122 | + * drain cqe. | ||
1123 | + */ | ||
1124 | + if (qhp->wq.flushed) { | ||
1125 | spin_unlock_irqrestore(&qhp->lock, flag); | ||
1126 | complete_sq_drain_wr(qhp, wr); | ||
1127 | return err; | ||
1128 | @@ -1012,7 +1017,12 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | ||
1129 | |||
1130 | qhp = to_c4iw_qp(ibqp); | ||
1131 | spin_lock_irqsave(&qhp->lock, flag); | ||
1132 | - if (t4_wq_in_error(&qhp->wq)) { | ||
1133 | + | ||
1134 | + /* | ||
1135 | + * If the qp has been flushed, then just insert a special | ||
1136 | + * drain cqe. | ||
1137 | + */ | ||
1138 | + if (qhp->wq.flushed) { | ||
1139 | spin_unlock_irqrestore(&qhp->lock, flag); | ||
1140 | complete_rq_drain_wr(qhp, wr); | ||
1141 | return err; | ||
1142 | diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h | ||
1143 | index e765c00303cd..bcb80ca67d3d 100644 | ||
1144 | --- a/drivers/infiniband/hw/cxgb4/t4.h | ||
1145 | +++ b/drivers/infiniband/hw/cxgb4/t4.h | ||
1146 | @@ -171,7 +171,7 @@ struct t4_cqe { | ||
1147 | __be32 msn; | ||
1148 | } rcqe; | ||
1149 | struct { | ||
1150 | - u32 stag; | ||
1151 | + __be32 stag; | ||
1152 | u16 nada2; | ||
1153 | u16 cidx; | ||
1154 | } scqe; | ||
1155 | diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c | ||
1156 | index 312444386f54..0e17d03ef1cb 100644 | ||
1157 | --- a/drivers/infiniband/hw/hfi1/chip.c | ||
1158 | +++ b/drivers/infiniband/hw/hfi1/chip.c | ||
1159 | @@ -9952,7 +9952,7 @@ int hfi1_get_ib_cfg(struct hfi1_pportdata *ppd, int which) | ||
1160 | goto unimplemented; | ||
1161 | |||
1162 | case HFI1_IB_CFG_OP_VLS: | ||
1163 | - val = ppd->vls_operational; | ||
1164 | + val = ppd->actual_vls_operational; | ||
1165 | break; | ||
1166 | case HFI1_IB_CFG_VL_HIGH_CAP: /* VL arb high priority table size */ | ||
1167 | val = VL_ARB_HIGH_PRIO_TABLE_SIZE; | ||
1168 | diff --git a/drivers/infiniband/hw/hfi1/trace.c b/drivers/infiniband/hw/hfi1/trace.c | ||
1169 | index 9938bb983ce6..9749ec9dd9f2 100644 | ||
1170 | --- a/drivers/infiniband/hw/hfi1/trace.c | ||
1171 | +++ b/drivers/infiniband/hw/hfi1/trace.c | ||
1172 | @@ -154,7 +154,7 @@ void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr, | ||
1173 | *opcode = ib_bth_get_opcode(ohdr); | ||
1174 | *tver = ib_bth_get_tver(ohdr); | ||
1175 | *pkey = ib_bth_get_pkey(ohdr); | ||
1176 | - *psn = ib_bth_get_psn(ohdr); | ||
1177 | + *psn = mask_psn(ib_bth_get_psn(ohdr)); | ||
1178 | *qpn = ib_bth_get_qpn(ohdr); | ||
1179 | } | ||
1180 | |||
1181 | @@ -169,7 +169,7 @@ void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr, | ||
1182 | *pad = ib_bth_get_pad(ohdr); | ||
1183 | *se = ib_bth_get_se(ohdr); | ||
1184 | *tver = ib_bth_get_tver(ohdr); | ||
1185 | - *psn = ib_bth_get_psn(ohdr); | ||
1186 | + *psn = mask_psn(ib_bth_get_psn(ohdr)); | ||
1187 | *qpn = ib_bth_get_qpn(ohdr); | ||
1188 | } | ||
1189 | |||
1190 | diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c | ||
1191 | index 17e44c86577a..fcfa08747899 100644 | ||
1192 | --- a/drivers/infiniband/hw/mlx4/qp.c | ||
1193 | +++ b/drivers/infiniband/hw/mlx4/qp.c | ||
1194 | @@ -2182,11 +2182,6 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type, | ||
1195 | context->flags = cpu_to_be32((to_mlx4_state(new_state) << 28) | | ||
1196 | (to_mlx4_st(dev, qp->mlx4_ib_qp_type) << 16)); | ||
1197 | |||
1198 | - if (rwq_ind_tbl) { | ||
1199 | - fill_qp_rss_context(context, qp); | ||
1200 | - context->flags |= cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET); | ||
1201 | - } | ||
1202 | - | ||
1203 | if (!(attr_mask & IB_QP_PATH_MIG_STATE)) | ||
1204 | context->flags |= cpu_to_be32(MLX4_QP_PM_MIGRATED << 11); | ||
1205 | else { | ||
1206 | @@ -2387,6 +2382,7 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type, | ||
1207 | context->pd = cpu_to_be32(pd->pdn); | ||
1208 | |||
1209 | if (!rwq_ind_tbl) { | ||
1210 | + context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28); | ||
1211 | get_cqs(qp, src_type, &send_cq, &recv_cq); | ||
1212 | } else { /* Set dummy CQs to be compatible with HV and PRM */ | ||
1213 | send_cq = to_mcq(rwq_ind_tbl->ind_tbl[0]->cq); | ||
1214 | @@ -2394,7 +2390,6 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type, | ||
1215 | } | ||
1216 | context->cqn_send = cpu_to_be32(send_cq->mcq.cqn); | ||
1217 | context->cqn_recv = cpu_to_be32(recv_cq->mcq.cqn); | ||
1218 | - context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28); | ||
1219 | |||
1220 | /* Set "fast registration enabled" for all kernel QPs */ | ||
1221 | if (!ibuobject) | ||
1222 | @@ -2513,7 +2508,7 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type, | ||
1223 | MLX4_IB_LINK_TYPE_ETH; | ||
1224 | if (dev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | ||
1225 | /* set QP to receive both tunneled & non-tunneled packets */ | ||
1226 | - if (!(context->flags & cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET))) | ||
1227 | + if (!rwq_ind_tbl) | ||
1228 | context->srqn = cpu_to_be32(7 << 28); | ||
1229 | } | ||
1230 | } | ||
1231 | @@ -2562,6 +2557,13 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type, | ||
1232 | } | ||
1233 | } | ||
1234 | |||
1235 | + if (rwq_ind_tbl && | ||
1236 | + cur_state == IB_QPS_RESET && | ||
1237 | + new_state == IB_QPS_INIT) { | ||
1238 | + fill_qp_rss_context(context, qp); | ||
1239 | + context->flags |= cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET); | ||
1240 | + } | ||
1241 | + | ||
1242 | err = mlx4_qp_modify(dev->dev, &qp->mtt, to_mlx4_state(cur_state), | ||
1243 | to_mlx4_state(new_state), context, optpar, | ||
1244 | sqd_event, &qp->mqp); | ||
1245 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | ||
1246 | index 6cd61638b441..c97384c914a4 100644 | ||
1247 | --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c | ||
1248 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | ||
1249 | @@ -1203,10 +1203,15 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | ||
1250 | ipoib_ib_dev_down(dev); | ||
1251 | |||
1252 | if (level == IPOIB_FLUSH_HEAVY) { | ||
1253 | + rtnl_lock(); | ||
1254 | if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) | ||
1255 | ipoib_ib_dev_stop(dev); | ||
1256 | - if (ipoib_ib_dev_open(dev) != 0) | ||
1257 | + | ||
1258 | + result = ipoib_ib_dev_open(dev); | ||
1259 | + rtnl_unlock(); | ||
1260 | + if (result) | ||
1261 | return; | ||
1262 | + | ||
1263 | if (netif_queue_stopped(dev)) | ||
1264 | netif_start_queue(dev); | ||
1265 | } | ||
1266 | diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c | ||
1267 | index 8e8874d23717..99a2a57b6cfd 100644 | ||
1268 | --- a/drivers/iommu/amd_iommu.c | ||
1269 | +++ b/drivers/iommu/amd_iommu.c | ||
1270 | @@ -3155,7 +3155,7 @@ static void amd_iommu_apply_resv_region(struct device *dev, | ||
1271 | unsigned long start, end; | ||
1272 | |||
1273 | start = IOVA_PFN(region->start); | ||
1274 | - end = IOVA_PFN(region->start + region->length); | ||
1275 | + end = IOVA_PFN(region->start + region->length - 1); | ||
1276 | |||
1277 | WARN_ON_ONCE(reserve_iova(&dma_dom->iovad, start, end) == NULL); | ||
1278 | } | ||
1279 | diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c | ||
1280 | index bc1efbfb9ddf..542930cd183d 100644 | ||
1281 | --- a/drivers/iommu/mtk_iommu_v1.c | ||
1282 | +++ b/drivers/iommu/mtk_iommu_v1.c | ||
1283 | @@ -708,7 +708,7 @@ static struct platform_driver mtk_iommu_driver = { | ||
1284 | .probe = mtk_iommu_probe, | ||
1285 | .remove = mtk_iommu_remove, | ||
1286 | .driver = { | ||
1287 | - .name = "mtk-iommu", | ||
1288 | + .name = "mtk-iommu-v1", | ||
1289 | .of_match_table = mtk_iommu_of_ids, | ||
1290 | .pm = &mtk_iommu_pm_ops, | ||
1291 | } | ||
1292 | diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c | ||
1293 | index 81501644fb15..3f0ddc0d7393 100644 | ||
1294 | --- a/drivers/lightnvm/pblk-core.c | ||
1295 | +++ b/drivers/lightnvm/pblk-core.c | ||
1296 | @@ -193,7 +193,7 @@ void pblk_bio_free_pages(struct pblk *pblk, struct bio *bio, int off, | ||
1297 | bio_advance(bio, off * PBLK_EXPOSED_PAGE_SIZE); | ||
1298 | for (i = off; i < nr_pages + off; i++) { | ||
1299 | bv = bio->bi_io_vec[i]; | ||
1300 | - mempool_free(bv.bv_page, pblk->page_pool); | ||
1301 | + mempool_free(bv.bv_page, pblk->page_bio_pool); | ||
1302 | } | ||
1303 | } | ||
1304 | |||
1305 | @@ -205,14 +205,14 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags, | ||
1306 | int i, ret; | ||
1307 | |||
1308 | for (i = 0; i < nr_pages; i++) { | ||
1309 | - page = mempool_alloc(pblk->page_pool, flags); | ||
1310 | + page = mempool_alloc(pblk->page_bio_pool, flags); | ||
1311 | if (!page) | ||
1312 | goto err; | ||
1313 | |||
1314 | ret = bio_add_pc_page(q, bio, page, PBLK_EXPOSED_PAGE_SIZE, 0); | ||
1315 | if (ret != PBLK_EXPOSED_PAGE_SIZE) { | ||
1316 | pr_err("pblk: could not add page to bio\n"); | ||
1317 | - mempool_free(page, pblk->page_pool); | ||
1318 | + mempool_free(page, pblk->page_bio_pool); | ||
1319 | goto err; | ||
1320 | } | ||
1321 | } | ||
1322 | @@ -486,12 +486,14 @@ void pblk_dealloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs) | ||
1323 | u64 addr; | ||
1324 | int i; | ||
1325 | |||
1326 | + spin_lock(&line->lock); | ||
1327 | addr = find_next_zero_bit(line->map_bitmap, | ||
1328 | pblk->lm.sec_per_line, line->cur_sec); | ||
1329 | line->cur_sec = addr - nr_secs; | ||
1330 | |||
1331 | for (i = 0; i < nr_secs; i++, line->cur_sec--) | ||
1332 | WARN_ON(!test_and_clear_bit(line->cur_sec, line->map_bitmap)); | ||
1333 | + spin_unlock(&line->lock); | ||
1334 | } | ||
1335 | |||
1336 | u64 __pblk_alloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs) | ||
1337 | diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c | ||
1338 | index 6090d28f7995..d6bae085e1d2 100644 | ||
1339 | --- a/drivers/lightnvm/pblk-gc.c | ||
1340 | +++ b/drivers/lightnvm/pblk-gc.c | ||
1341 | @@ -486,10 +486,10 @@ void pblk_gc_should_start(struct pblk *pblk) | ||
1342 | { | ||
1343 | struct pblk_gc *gc = &pblk->gc; | ||
1344 | |||
1345 | - if (gc->gc_enabled && !gc->gc_active) | ||
1346 | + if (gc->gc_enabled && !gc->gc_active) { | ||
1347 | pblk_gc_start(pblk); | ||
1348 | - | ||
1349 | - pblk_gc_kick(pblk); | ||
1350 | + pblk_gc_kick(pblk); | ||
1351 | + } | ||
1352 | } | ||
1353 | |||
1354 | /* | ||
1355 | @@ -628,7 +628,8 @@ void pblk_gc_exit(struct pblk *pblk) | ||
1356 | flush_workqueue(gc->gc_reader_wq); | ||
1357 | flush_workqueue(gc->gc_line_reader_wq); | ||
1358 | |||
1359 | - del_timer(&gc->gc_timer); | ||
1360 | + gc->gc_enabled = 0; | ||
1361 | + del_timer_sync(&gc->gc_timer); | ||
1362 | pblk_gc_stop(pblk, 1); | ||
1363 | |||
1364 | if (gc->gc_ts) | ||
1365 | diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c | ||
1366 | index 1b0f61233c21..1b75675ee67b 100644 | ||
1367 | --- a/drivers/lightnvm/pblk-init.c | ||
1368 | +++ b/drivers/lightnvm/pblk-init.c | ||
1369 | @@ -132,7 +132,6 @@ static int pblk_rwb_init(struct pblk *pblk) | ||
1370 | } | ||
1371 | |||
1372 | /* Minimum pages needed within a lun */ | ||
1373 | -#define PAGE_POOL_SIZE 16 | ||
1374 | #define ADDR_POOL_SIZE 64 | ||
1375 | |||
1376 | static int pblk_set_ppaf(struct pblk *pblk) | ||
1377 | @@ -247,14 +246,16 @@ static int pblk_core_init(struct pblk *pblk) | ||
1378 | if (pblk_init_global_caches(pblk)) | ||
1379 | return -ENOMEM; | ||
1380 | |||
1381 | - pblk->page_pool = mempool_create_page_pool(PAGE_POOL_SIZE, 0); | ||
1382 | - if (!pblk->page_pool) | ||
1383 | + /* internal bios can be at most the sectors signaled by the device. */ | ||
1384 | + pblk->page_bio_pool = mempool_create_page_pool(nvm_max_phys_sects(dev), | ||
1385 | + 0); | ||
1386 | + if (!pblk->page_bio_pool) | ||
1387 | return -ENOMEM; | ||
1388 | |||
1389 | pblk->line_ws_pool = mempool_create_slab_pool(PBLK_WS_POOL_SIZE, | ||
1390 | pblk_blk_ws_cache); | ||
1391 | if (!pblk->line_ws_pool) | ||
1392 | - goto free_page_pool; | ||
1393 | + goto free_page_bio_pool; | ||
1394 | |||
1395 | pblk->rec_pool = mempool_create_slab_pool(geo->nr_luns, pblk_rec_cache); | ||
1396 | if (!pblk->rec_pool) | ||
1397 | @@ -309,8 +310,8 @@ static int pblk_core_init(struct pblk *pblk) | ||
1398 | mempool_destroy(pblk->rec_pool); | ||
1399 | free_blk_ws_pool: | ||
1400 | mempool_destroy(pblk->line_ws_pool); | ||
1401 | -free_page_pool: | ||
1402 | - mempool_destroy(pblk->page_pool); | ||
1403 | +free_page_bio_pool: | ||
1404 | + mempool_destroy(pblk->page_bio_pool); | ||
1405 | return -ENOMEM; | ||
1406 | } | ||
1407 | |||
1408 | @@ -322,7 +323,7 @@ static void pblk_core_free(struct pblk *pblk) | ||
1409 | if (pblk->bb_wq) | ||
1410 | destroy_workqueue(pblk->bb_wq); | ||
1411 | |||
1412 | - mempool_destroy(pblk->page_pool); | ||
1413 | + mempool_destroy(pblk->page_bio_pool); | ||
1414 | mempool_destroy(pblk->line_ws_pool); | ||
1415 | mempool_destroy(pblk->rec_pool); | ||
1416 | mempool_destroy(pblk->g_rq_pool); | ||
1417 | @@ -681,8 +682,8 @@ static int pblk_lines_init(struct pblk *pblk) | ||
1418 | lm->blk_bitmap_len = BITS_TO_LONGS(geo->nr_luns) * sizeof(long); | ||
1419 | lm->sec_bitmap_len = BITS_TO_LONGS(lm->sec_per_line) * sizeof(long); | ||
1420 | lm->lun_bitmap_len = BITS_TO_LONGS(geo->nr_luns) * sizeof(long); | ||
1421 | - lm->high_thrs = lm->sec_per_line / 2; | ||
1422 | - lm->mid_thrs = lm->sec_per_line / 4; | ||
1423 | + lm->mid_thrs = lm->sec_per_line / 2; | ||
1424 | + lm->high_thrs = lm->sec_per_line / 4; | ||
1425 | lm->meta_distance = (geo->nr_luns / 2) * pblk->min_write_pgs; | ||
1426 | |||
1427 | /* Calculate necessary pages for smeta. See comment over struct | ||
1428 | @@ -923,6 +924,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk, | ||
1429 | pblk->dev = dev; | ||
1430 | pblk->disk = tdisk; | ||
1431 | pblk->state = PBLK_STATE_RUNNING; | ||
1432 | + pblk->gc.gc_enabled = 0; | ||
1433 | |||
1434 | spin_lock_init(&pblk->trans_lock); | ||
1435 | spin_lock_init(&pblk->lock); | ||
1436 | @@ -944,6 +946,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk, | ||
1437 | atomic_long_set(&pblk->recov_writes, 0); | ||
1438 | atomic_long_set(&pblk->recov_writes, 0); | ||
1439 | atomic_long_set(&pblk->recov_gc_writes, 0); | ||
1440 | + atomic_long_set(&pblk->recov_gc_reads, 0); | ||
1441 | #endif | ||
1442 | |||
1443 | atomic_long_set(&pblk->read_failed, 0); | ||
1444 | diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c | ||
1445 | index d682e89e6493..402c732f0970 100644 | ||
1446 | --- a/drivers/lightnvm/pblk-read.c | ||
1447 | +++ b/drivers/lightnvm/pblk-read.c | ||
1448 | @@ -238,7 +238,7 @@ static int pblk_fill_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd, | ||
1449 | kunmap_atomic(src_p); | ||
1450 | kunmap_atomic(dst_p); | ||
1451 | |||
1452 | - mempool_free(src_bv.bv_page, pblk->page_pool); | ||
1453 | + mempool_free(src_bv.bv_page, pblk->page_bio_pool); | ||
1454 | |||
1455 | hole = find_next_zero_bit(read_bitmap, nr_secs, hole + 1); | ||
1456 | } while (hole < nr_secs); | ||
1457 | @@ -499,7 +499,7 @@ int pblk_submit_read_gc(struct pblk *pblk, u64 *lba_list, void *data, | ||
1458 | |||
1459 | data_len = (*secs_to_gc) * geo->sec_size; | ||
1460 | bio = pblk_bio_map_addr(pblk, data, *secs_to_gc, data_len, | ||
1461 | - PBLK_KMALLOC_META, GFP_KERNEL); | ||
1462 | + PBLK_VMALLOC_META, GFP_KERNEL); | ||
1463 | if (IS_ERR(bio)) { | ||
1464 | pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio)); | ||
1465 | goto err_free_dma; | ||
1466 | @@ -519,7 +519,7 @@ int pblk_submit_read_gc(struct pblk *pblk, u64 *lba_list, void *data, | ||
1467 | if (ret) { | ||
1468 | bio_endio(bio); | ||
1469 | pr_err("pblk: GC read request failed\n"); | ||
1470 | - goto err_free_dma; | ||
1471 | + goto err_free_bio; | ||
1472 | } | ||
1473 | |||
1474 | if (!wait_for_completion_io_timeout(&wait, | ||
1475 | @@ -541,10 +541,13 @@ int pblk_submit_read_gc(struct pblk *pblk, u64 *lba_list, void *data, | ||
1476 | atomic_long_sub(*secs_to_gc, &pblk->inflight_reads); | ||
1477 | #endif | ||
1478 | |||
1479 | + bio_put(bio); | ||
1480 | out: | ||
1481 | nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list); | ||
1482 | return NVM_IO_OK; | ||
1483 | |||
1484 | +err_free_bio: | ||
1485 | + bio_put(bio); | ||
1486 | err_free_dma: | ||
1487 | nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list); | ||
1488 | return NVM_IO_ERR; | ||
1489 | diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h | ||
1490 | index 67e623bd5c2d..053164deb072 100644 | ||
1491 | --- a/drivers/lightnvm/pblk.h | ||
1492 | +++ b/drivers/lightnvm/pblk.h | ||
1493 | @@ -618,7 +618,7 @@ struct pblk { | ||
1494 | |||
1495 | struct list_head compl_list; | ||
1496 | |||
1497 | - mempool_t *page_pool; | ||
1498 | + mempool_t *page_bio_pool; | ||
1499 | mempool_t *line_ws_pool; | ||
1500 | mempool_t *rec_pool; | ||
1501 | mempool_t *g_rq_pool; | ||
1502 | diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c | ||
1503 | index 14d13cab5cda..e9fbf2bcd122 100644 | ||
1504 | --- a/drivers/md/bcache/request.c | ||
1505 | +++ b/drivers/md/bcache/request.c | ||
1506 | @@ -463,6 +463,7 @@ struct search { | ||
1507 | unsigned recoverable:1; | ||
1508 | unsigned write:1; | ||
1509 | unsigned read_dirty_data:1; | ||
1510 | + unsigned cache_missed:1; | ||
1511 | |||
1512 | unsigned long start_time; | ||
1513 | |||
1514 | @@ -649,6 +650,7 @@ static inline struct search *search_alloc(struct bio *bio, | ||
1515 | |||
1516 | s->orig_bio = bio; | ||
1517 | s->cache_miss = NULL; | ||
1518 | + s->cache_missed = 0; | ||
1519 | s->d = d; | ||
1520 | s->recoverable = 1; | ||
1521 | s->write = op_is_write(bio_op(bio)); | ||
1522 | @@ -767,7 +769,7 @@ static void cached_dev_read_done_bh(struct closure *cl) | ||
1523 | struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); | ||
1524 | |||
1525 | bch_mark_cache_accounting(s->iop.c, s->d, | ||
1526 | - !s->cache_miss, s->iop.bypass); | ||
1527 | + !s->cache_missed, s->iop.bypass); | ||
1528 | trace_bcache_read(s->orig_bio, !s->cache_miss, s->iop.bypass); | ||
1529 | |||
1530 | if (s->iop.status) | ||
1531 | @@ -786,6 +788,8 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, | ||
1532 | struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); | ||
1533 | struct bio *miss, *cache_bio; | ||
1534 | |||
1535 | + s->cache_missed = 1; | ||
1536 | + | ||
1537 | if (s->cache_miss || s->iop.bypass) { | ||
1538 | miss = bio_next_split(bio, sectors, GFP_NOIO, s->d->bio_split); | ||
1539 | ret = miss == bio ? MAP_DONE : MAP_CONTINUE; | ||
1540 | diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c | ||
1541 | index fc0a31b13ac4..25bf003fb198 100644 | ||
1542 | --- a/drivers/md/bcache/super.c | ||
1543 | +++ b/drivers/md/bcache/super.c | ||
1544 | @@ -2085,6 +2085,7 @@ static void bcache_exit(void) | ||
1545 | if (bcache_major) | ||
1546 | unregister_blkdev(bcache_major, "bcache"); | ||
1547 | unregister_reboot_notifier(&reboot); | ||
1548 | + mutex_destroy(&bch_register_lock); | ||
1549 | } | ||
1550 | |||
1551 | static int __init bcache_init(void) | ||
1552 | @@ -2103,14 +2104,15 @@ static int __init bcache_init(void) | ||
1553 | bcache_major = register_blkdev(0, "bcache"); | ||
1554 | if (bcache_major < 0) { | ||
1555 | unregister_reboot_notifier(&reboot); | ||
1556 | + mutex_destroy(&bch_register_lock); | ||
1557 | return bcache_major; | ||
1558 | } | ||
1559 | |||
1560 | if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) || | ||
1561 | !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) || | ||
1562 | - sysfs_create_files(bcache_kobj, files) || | ||
1563 | bch_request_init() || | ||
1564 | - bch_debug_init(bcache_kobj)) | ||
1565 | + bch_debug_init(bcache_kobj) || | ||
1566 | + sysfs_create_files(bcache_kobj, files)) | ||
1567 | goto err; | ||
1568 | |||
1569 | return 0; | ||
1570 | diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c | ||
1571 | index 0b7edfd0b454..71c3507df9a0 100644 | ||
1572 | --- a/drivers/md/dm-cache-target.c | ||
1573 | +++ b/drivers/md/dm-cache-target.c | ||
1574 | @@ -3554,18 +3554,18 @@ static int __init dm_cache_init(void) | ||
1575 | { | ||
1576 | int r; | ||
1577 | |||
1578 | - r = dm_register_target(&cache_target); | ||
1579 | - if (r) { | ||
1580 | - DMERR("cache target registration failed: %d", r); | ||
1581 | - return r; | ||
1582 | - } | ||
1583 | - | ||
1584 | migration_cache = KMEM_CACHE(dm_cache_migration, 0); | ||
1585 | if (!migration_cache) { | ||
1586 | dm_unregister_target(&cache_target); | ||
1587 | return -ENOMEM; | ||
1588 | } | ||
1589 | |||
1590 | + r = dm_register_target(&cache_target); | ||
1591 | + if (r) { | ||
1592 | + DMERR("cache target registration failed: %d", r); | ||
1593 | + return r; | ||
1594 | + } | ||
1595 | + | ||
1596 | return 0; | ||
1597 | } | ||
1598 | |||
1599 | diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c | ||
1600 | index e8094d8fbe0d..35e82b14ded7 100644 | ||
1601 | --- a/drivers/md/dm-mpath.c | ||
1602 | +++ b/drivers/md/dm-mpath.c | ||
1603 | @@ -1965,13 +1965,6 @@ static int __init dm_multipath_init(void) | ||
1604 | { | ||
1605 | int r; | ||
1606 | |||
1607 | - r = dm_register_target(&multipath_target); | ||
1608 | - if (r < 0) { | ||
1609 | - DMERR("request-based register failed %d", r); | ||
1610 | - r = -EINVAL; | ||
1611 | - goto bad_register_target; | ||
1612 | - } | ||
1613 | - | ||
1614 | kmultipathd = alloc_workqueue("kmpathd", WQ_MEM_RECLAIM, 0); | ||
1615 | if (!kmultipathd) { | ||
1616 | DMERR("failed to create workqueue kmpathd"); | ||
1617 | @@ -1993,13 +1986,20 @@ static int __init dm_multipath_init(void) | ||
1618 | goto bad_alloc_kmpath_handlerd; | ||
1619 | } | ||
1620 | |||
1621 | + r = dm_register_target(&multipath_target); | ||
1622 | + if (r < 0) { | ||
1623 | + DMERR("request-based register failed %d", r); | ||
1624 | + r = -EINVAL; | ||
1625 | + goto bad_register_target; | ||
1626 | + } | ||
1627 | + | ||
1628 | return 0; | ||
1629 | |||
1630 | +bad_register_target: | ||
1631 | + destroy_workqueue(kmpath_handlerd); | ||
1632 | bad_alloc_kmpath_handlerd: | ||
1633 | destroy_workqueue(kmultipathd); | ||
1634 | bad_alloc_kmultipathd: | ||
1635 | - dm_unregister_target(&multipath_target); | ||
1636 | -bad_register_target: | ||
1637 | return r; | ||
1638 | } | ||
1639 | |||
1640 | diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c | ||
1641 | index 1113b42e1eda..a0613bd8ed00 100644 | ||
1642 | --- a/drivers/md/dm-snap.c | ||
1643 | +++ b/drivers/md/dm-snap.c | ||
1644 | @@ -2411,24 +2411,6 @@ static int __init dm_snapshot_init(void) | ||
1645 | return r; | ||
1646 | } | ||
1647 | |||
1648 | - r = dm_register_target(&snapshot_target); | ||
1649 | - if (r < 0) { | ||
1650 | - DMERR("snapshot target register failed %d", r); | ||
1651 | - goto bad_register_snapshot_target; | ||
1652 | - } | ||
1653 | - | ||
1654 | - r = dm_register_target(&origin_target); | ||
1655 | - if (r < 0) { | ||
1656 | - DMERR("Origin target register failed %d", r); | ||
1657 | - goto bad_register_origin_target; | ||
1658 | - } | ||
1659 | - | ||
1660 | - r = dm_register_target(&merge_target); | ||
1661 | - if (r < 0) { | ||
1662 | - DMERR("Merge target register failed %d", r); | ||
1663 | - goto bad_register_merge_target; | ||
1664 | - } | ||
1665 | - | ||
1666 | r = init_origin_hash(); | ||
1667 | if (r) { | ||
1668 | DMERR("init_origin_hash failed."); | ||
1669 | @@ -2449,19 +2431,37 @@ static int __init dm_snapshot_init(void) | ||
1670 | goto bad_pending_cache; | ||
1671 | } | ||
1672 | |||
1673 | + r = dm_register_target(&snapshot_target); | ||
1674 | + if (r < 0) { | ||
1675 | + DMERR("snapshot target register failed %d", r); | ||
1676 | + goto bad_register_snapshot_target; | ||
1677 | + } | ||
1678 | + | ||
1679 | + r = dm_register_target(&origin_target); | ||
1680 | + if (r < 0) { | ||
1681 | + DMERR("Origin target register failed %d", r); | ||
1682 | + goto bad_register_origin_target; | ||
1683 | + } | ||
1684 | + | ||
1685 | + r = dm_register_target(&merge_target); | ||
1686 | + if (r < 0) { | ||
1687 | + DMERR("Merge target register failed %d", r); | ||
1688 | + goto bad_register_merge_target; | ||
1689 | + } | ||
1690 | + | ||
1691 | return 0; | ||
1692 | |||
1693 | -bad_pending_cache: | ||
1694 | - kmem_cache_destroy(exception_cache); | ||
1695 | -bad_exception_cache: | ||
1696 | - exit_origin_hash(); | ||
1697 | -bad_origin_hash: | ||
1698 | - dm_unregister_target(&merge_target); | ||
1699 | bad_register_merge_target: | ||
1700 | dm_unregister_target(&origin_target); | ||
1701 | bad_register_origin_target: | ||
1702 | dm_unregister_target(&snapshot_target); | ||
1703 | bad_register_snapshot_target: | ||
1704 | + kmem_cache_destroy(pending_cache); | ||
1705 | +bad_pending_cache: | ||
1706 | + kmem_cache_destroy(exception_cache); | ||
1707 | +bad_exception_cache: | ||
1708 | + exit_origin_hash(); | ||
1709 | +bad_origin_hash: | ||
1710 | dm_exception_store_exit(); | ||
1711 | |||
1712 | return r; | ||
1713 | diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c | ||
1714 | index 1e25705209c2..02e42ba2ecbc 100644 | ||
1715 | --- a/drivers/md/dm-thin.c | ||
1716 | +++ b/drivers/md/dm-thin.c | ||
1717 | @@ -4355,30 +4355,28 @@ static struct target_type thin_target = { | ||
1718 | |||
1719 | static int __init dm_thin_init(void) | ||
1720 | { | ||
1721 | - int r; | ||
1722 | + int r = -ENOMEM; | ||
1723 | |||
1724 | pool_table_init(); | ||
1725 | |||
1726 | + _new_mapping_cache = KMEM_CACHE(dm_thin_new_mapping, 0); | ||
1727 | + if (!_new_mapping_cache) | ||
1728 | + return r; | ||
1729 | + | ||
1730 | r = dm_register_target(&thin_target); | ||
1731 | if (r) | ||
1732 | - return r; | ||
1733 | + goto bad_new_mapping_cache; | ||
1734 | |||
1735 | r = dm_register_target(&pool_target); | ||
1736 | if (r) | ||
1737 | - goto bad_pool_target; | ||
1738 | - | ||
1739 | - r = -ENOMEM; | ||
1740 | - | ||
1741 | - _new_mapping_cache = KMEM_CACHE(dm_thin_new_mapping, 0); | ||
1742 | - if (!_new_mapping_cache) | ||
1743 | - goto bad_new_mapping_cache; | ||
1744 | + goto bad_thin_target; | ||
1745 | |||
1746 | return 0; | ||
1747 | |||
1748 | -bad_new_mapping_cache: | ||
1749 | - dm_unregister_target(&pool_target); | ||
1750 | -bad_pool_target: | ||
1751 | +bad_thin_target: | ||
1752 | dm_unregister_target(&thin_target); | ||
1753 | +bad_new_mapping_cache: | ||
1754 | + kmem_cache_destroy(_new_mapping_cache); | ||
1755 | |||
1756 | return r; | ||
1757 | } | ||
1758 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c | ||
1759 | index e4e8f9e565b7..5a8216b50e38 100644 | ||
1760 | --- a/drivers/md/raid1.c | ||
1761 | +++ b/drivers/md/raid1.c | ||
1762 | @@ -1309,12 +1309,12 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | ||
1763 | sigset_t full, old; | ||
1764 | prepare_to_wait(&conf->wait_barrier, | ||
1765 | &w, TASK_INTERRUPTIBLE); | ||
1766 | - if (bio_end_sector(bio) <= mddev->suspend_lo || | ||
1767 | - bio->bi_iter.bi_sector >= mddev->suspend_hi || | ||
1768 | - (mddev_is_clustered(mddev) && | ||
1769 | + if ((bio_end_sector(bio) <= mddev->suspend_lo || | ||
1770 | + bio->bi_iter.bi_sector >= mddev->suspend_hi) && | ||
1771 | + (!mddev_is_clustered(mddev) || | ||
1772 | !md_cluster_ops->area_resyncing(mddev, WRITE, | ||
1773 | - bio->bi_iter.bi_sector, | ||
1774 | - bio_end_sector(bio)))) | ||
1775 | + bio->bi_iter.bi_sector, | ||
1776 | + bio_end_sector(bio)))) | ||
1777 | break; | ||
1778 | sigfillset(&full); | ||
1779 | sigprocmask(SIG_BLOCK, &full, &old); | ||
1780 | diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c | ||
1781 | index cd026c88f7ef..702b76008886 100644 | ||
1782 | --- a/drivers/md/raid5-ppl.c | ||
1783 | +++ b/drivers/md/raid5-ppl.c | ||
1784 | @@ -758,7 +758,8 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e, | ||
1785 | (unsigned long long)sector); | ||
1786 | |||
1787 | rdev = conf->disks[dd_idx].rdev; | ||
1788 | - if (!rdev) { | ||
1789 | + if (!rdev || (!test_bit(In_sync, &rdev->flags) && | ||
1790 | + sector >= rdev->recovery_offset)) { | ||
1791 | pr_debug("%s:%*s data member disk %d missing\n", | ||
1792 | __func__, indent, "", dd_idx); | ||
1793 | update_parity = false; | ||
1794 | diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c | ||
1795 | index 7aed69a4f655..c406f16f5295 100644 | ||
1796 | --- a/drivers/md/raid5.c | ||
1797 | +++ b/drivers/md/raid5.c | ||
1798 | @@ -1818,8 +1818,11 @@ static void ops_complete_reconstruct(void *stripe_head_ref) | ||
1799 | struct r5dev *dev = &sh->dev[i]; | ||
1800 | |||
1801 | if (dev->written || i == pd_idx || i == qd_idx) { | ||
1802 | - if (!discard && !test_bit(R5_SkipCopy, &dev->flags)) | ||
1803 | + if (!discard && !test_bit(R5_SkipCopy, &dev->flags)) { | ||
1804 | set_bit(R5_UPTODATE, &dev->flags); | ||
1805 | + if (test_bit(STRIPE_EXPAND_READY, &sh->state)) | ||
1806 | + set_bit(R5_Expanded, &dev->flags); | ||
1807 | + } | ||
1808 | if (fua) | ||
1809 | set_bit(R5_WantFUA, &dev->flags); | ||
1810 | if (sync) | ||
1811 | diff --git a/drivers/media/platform/qcom/camss-8x16/camss-vfe.c b/drivers/media/platform/qcom/camss-8x16/camss-vfe.c | ||
1812 | index b22d2dfcd3c2..55232a912950 100644 | ||
1813 | --- a/drivers/media/platform/qcom/camss-8x16/camss-vfe.c | ||
1814 | +++ b/drivers/media/platform/qcom/camss-8x16/camss-vfe.c | ||
1815 | @@ -622,6 +622,9 @@ static void vfe_set_xbar_cfg(struct vfe_device *vfe, struct vfe_output *output, | ||
1816 | reg = VFE_0_BUS_XBAR_CFG_x_M_PAIR_STREAM_EN; | ||
1817 | if (p == V4L2_PIX_FMT_NV12 || p == V4L2_PIX_FMT_NV16) | ||
1818 | reg |= VFE_0_BUS_XBAR_CFG_x_M_PAIR_STREAM_SWAP_INTER_INTRA; | ||
1819 | + } else { | ||
1820 | + /* On current devices output->wm_num is always <= 2 */ | ||
1821 | + break; | ||
1822 | } | ||
1823 | |||
1824 | if (output->wm_idx[i] % 2 == 1) | ||
1825 | diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c | ||
1826 | index 95b5f4319ec2..3668a04359e8 100644 | ||
1827 | --- a/drivers/media/usb/usbtv/usbtv-video.c | ||
1828 | +++ b/drivers/media/usb/usbtv/usbtv-video.c | ||
1829 | @@ -718,8 +718,8 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl) | ||
1830 | */ | ||
1831 | if (ctrl->id == V4L2_CID_BRIGHTNESS || ctrl->id == V4L2_CID_CONTRAST) { | ||
1832 | ret = usb_control_msg(usbtv->udev, | ||
1833 | - usb_sndctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG, | ||
1834 | - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
1835 | + usb_rcvctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG, | ||
1836 | + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
1837 | 0, USBTV_BASE + 0x0244, (void *)data, 3, 0); | ||
1838 | if (ret < 0) | ||
1839 | goto error; | ||
1840 | diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c | ||
1841 | index b3767c3141e5..461b0990b56f 100644 | ||
1842 | --- a/drivers/mfd/fsl-imx25-tsadc.c | ||
1843 | +++ b/drivers/mfd/fsl-imx25-tsadc.c | ||
1844 | @@ -180,6 +180,19 @@ static int mx25_tsadc_probe(struct platform_device *pdev) | ||
1845 | return devm_of_platform_populate(dev); | ||
1846 | } | ||
1847 | |||
1848 | +static int mx25_tsadc_remove(struct platform_device *pdev) | ||
1849 | +{ | ||
1850 | + struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); | ||
1851 | + int irq = platform_get_irq(pdev, 0); | ||
1852 | + | ||
1853 | + if (irq) { | ||
1854 | + irq_set_chained_handler_and_data(irq, NULL, NULL); | ||
1855 | + irq_domain_remove(tsadc->domain); | ||
1856 | + } | ||
1857 | + | ||
1858 | + return 0; | ||
1859 | +} | ||
1860 | + | ||
1861 | static const struct of_device_id mx25_tsadc_ids[] = { | ||
1862 | { .compatible = "fsl,imx25-tsadc" }, | ||
1863 | { /* Sentinel */ } | ||
1864 | @@ -192,6 +205,7 @@ static struct platform_driver mx25_tsadc_driver = { | ||
1865 | .of_match_table = of_match_ptr(mx25_tsadc_ids), | ||
1866 | }, | ||
1867 | .probe = mx25_tsadc_probe, | ||
1868 | + .remove = mx25_tsadc_remove, | ||
1869 | }; | ||
1870 | module_platform_driver(mx25_tsadc_driver); | ||
1871 | |||
1872 | diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c | ||
1873 | index 630bd19b2c0a..98e732a7ae96 100644 | ||
1874 | --- a/drivers/mfd/mxs-lradc.c | ||
1875 | +++ b/drivers/mfd/mxs-lradc.c | ||
1876 | @@ -196,8 +196,10 @@ static int mxs_lradc_probe(struct platform_device *pdev) | ||
1877 | platform_set_drvdata(pdev, lradc); | ||
1878 | |||
1879 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1880 | - if (!res) | ||
1881 | - return -ENOMEM; | ||
1882 | + if (!res) { | ||
1883 | + ret = -ENOMEM; | ||
1884 | + goto err_clk; | ||
1885 | + } | ||
1886 | |||
1887 | switch (lradc->soc) { | ||
1888 | case IMX23_LRADC: | ||
1889 | diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c | ||
1890 | index 372b2060fbba..4cc0b42f2acc 100644 | ||
1891 | --- a/drivers/misc/eeprom/at24.c | ||
1892 | +++ b/drivers/misc/eeprom/at24.c | ||
1893 | @@ -776,7 +776,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
1894 | at24->nvmem_config.reg_read = at24_read; | ||
1895 | at24->nvmem_config.reg_write = at24_write; | ||
1896 | at24->nvmem_config.priv = at24; | ||
1897 | - at24->nvmem_config.stride = 4; | ||
1898 | + at24->nvmem_config.stride = 1; | ||
1899 | at24->nvmem_config.word_size = 1; | ||
1900 | at24->nvmem_config.size = chip.byte_len; | ||
1901 | |||
1902 | diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c | ||
1903 | index deb203026496..e089bb6dde3a 100644 | ||
1904 | --- a/drivers/misc/pci_endpoint_test.c | ||
1905 | +++ b/drivers/misc/pci_endpoint_test.c | ||
1906 | @@ -533,6 +533,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, | ||
1907 | |||
1908 | test->base = test->bar[test_reg_bar]; | ||
1909 | if (!test->base) { | ||
1910 | + err = -ENOMEM; | ||
1911 | dev_err(dev, "Cannot perform PCI test without BAR%d\n", | ||
1912 | test_reg_bar); | ||
1913 | goto err_iounmap; | ||
1914 | @@ -542,6 +543,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, | ||
1915 | |||
1916 | id = ida_simple_get(&pci_endpoint_test_ida, 0, 0, GFP_KERNEL); | ||
1917 | if (id < 0) { | ||
1918 | + err = id; | ||
1919 | dev_err(dev, "unable to get id\n"); | ||
1920 | goto err_iounmap; | ||
1921 | } | ||
1922 | @@ -588,6 +590,8 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev) | ||
1923 | |||
1924 | if (sscanf(misc_device->name, DRV_MODULE_NAME ".%d", &id) != 1) | ||
1925 | return; | ||
1926 | + if (id < 0) | ||
1927 | + return; | ||
1928 | |||
1929 | misc_deregister(&test->miscdev); | ||
1930 | ida_simple_remove(&pci_endpoint_test_ida, id); | ||
1931 | diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h | ||
1932 | index f06cd91964ce..79a5b985ccf5 100644 | ||
1933 | --- a/drivers/mmc/core/card.h | ||
1934 | +++ b/drivers/mmc/core/card.h | ||
1935 | @@ -75,9 +75,11 @@ struct mmc_fixup { | ||
1936 | #define EXT_CSD_REV_ANY (-1u) | ||
1937 | |||
1938 | #define CID_MANFID_SANDISK 0x2 | ||
1939 | +#define CID_MANFID_ATP 0x9 | ||
1940 | #define CID_MANFID_TOSHIBA 0x11 | ||
1941 | #define CID_MANFID_MICRON 0x13 | ||
1942 | #define CID_MANFID_SAMSUNG 0x15 | ||
1943 | +#define CID_MANFID_APACER 0x27 | ||
1944 | #define CID_MANFID_KINGSTON 0x70 | ||
1945 | #define CID_MANFID_HYNIX 0x90 | ||
1946 | |||
1947 | diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h | ||
1948 | index f664e9cbc9f8..75d317623852 100644 | ||
1949 | --- a/drivers/mmc/core/quirks.h | ||
1950 | +++ b/drivers/mmc/core/quirks.h | ||
1951 | @@ -52,6 +52,14 @@ static const struct mmc_fixup mmc_blk_fixups[] = { | ||
1952 | MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, | ||
1953 | MMC_QUIRK_BLK_NO_CMD23), | ||
1954 | |||
1955 | + /* | ||
1956 | + * Some SD cards lockup while using CMD23 multiblock transfers. | ||
1957 | + */ | ||
1958 | + MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd, | ||
1959 | + MMC_QUIRK_BLK_NO_CMD23), | ||
1960 | + MMC_FIXUP("APUSD", CID_MANFID_APACER, 0x5048, add_quirk_sd, | ||
1961 | + MMC_QUIRK_BLK_NO_CMD23), | ||
1962 | + | ||
1963 | /* | ||
1964 | * Some MMC cards need longer data read timeout than indicated in CSD. | ||
1965 | */ | ||
1966 | diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c b/drivers/mtd/spi-nor/stm32-quadspi.c | ||
1967 | index 86c0931543c5..ad6a3e1844cb 100644 | ||
1968 | --- a/drivers/mtd/spi-nor/stm32-quadspi.c | ||
1969 | +++ b/drivers/mtd/spi-nor/stm32-quadspi.c | ||
1970 | @@ -240,12 +240,12 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi, | ||
1971 | STM32_QSPI_FIFO_TIMEOUT_US); | ||
1972 | if (ret) { | ||
1973 | dev_err(qspi->dev, "fifo timeout (stat:%#x)\n", sr); | ||
1974 | - break; | ||
1975 | + return ret; | ||
1976 | } | ||
1977 | tx_fifo(buf++, qspi->io_base + QUADSPI_DR); | ||
1978 | } | ||
1979 | |||
1980 | - return ret; | ||
1981 | + return 0; | ||
1982 | } | ||
1983 | |||
1984 | static int stm32_qspi_tx_mm(struct stm32_qspi *qspi, | ||
1985 | diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c | ||
1986 | index b471413d3df9..1e5a69b9d90a 100644 | ||
1987 | --- a/drivers/net/dsa/lan9303-core.c | ||
1988 | +++ b/drivers/net/dsa/lan9303-core.c | ||
1989 | @@ -569,7 +569,7 @@ static int lan9303_disable_processing(struct lan9303 *chip) | ||
1990 | { | ||
1991 | int p; | ||
1992 | |||
1993 | - for (p = 0; p < LAN9303_NUM_PORTS; p++) { | ||
1994 | + for (p = 1; p < LAN9303_NUM_PORTS; p++) { | ||
1995 | int ret = lan9303_disable_processing_port(chip, p); | ||
1996 | |||
1997 | if (ret) | ||
1998 | diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | ||
1999 | index 2e993ce43b66..4d2db22e011b 100644 | ||
2000 | --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | ||
2001 | +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | ||
2002 | @@ -1289,6 +1289,9 @@ static int liquidio_stop(struct net_device *netdev) | ||
2003 | struct octeon_device *oct = lio->oct_dev; | ||
2004 | struct napi_struct *napi, *n; | ||
2005 | |||
2006 | + /* tell Octeon to stop forwarding packets to host */ | ||
2007 | + send_rx_ctrl_cmd(lio, 0); | ||
2008 | + | ||
2009 | if (oct->props[lio->ifidx].napi_enabled) { | ||
2010 | list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list) | ||
2011 | napi_disable(napi); | ||
2012 | @@ -1306,9 +1309,6 @@ static int liquidio_stop(struct net_device *netdev) | ||
2013 | netif_carrier_off(netdev); | ||
2014 | lio->link_changes++; | ||
2015 | |||
2016 | - /* tell Octeon to stop forwarding packets to host */ | ||
2017 | - send_rx_ctrl_cmd(lio, 0); | ||
2018 | - | ||
2019 | ifstate_reset(lio, LIO_IFSTATE_RUNNING); | ||
2020 | |||
2021 | txqs_stop(netdev); | ||
2022 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | ||
2023 | index c1cdbfd83bdb..a0ef97e7f3c9 100644 | ||
2024 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | ||
2025 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | ||
2026 | @@ -3981,7 +3981,7 @@ static int hclge_init_client_instance(struct hnae3_client *client, | ||
2027 | vport->roce.client = client; | ||
2028 | } | ||
2029 | |||
2030 | - if (hdev->roce_client) { | ||
2031 | + if (hdev->roce_client && hdev->nic_client) { | ||
2032 | ret = hclge_init_roce_base_info(vport); | ||
2033 | if (ret) | ||
2034 | goto err; | ||
2035 | @@ -4007,13 +4007,19 @@ static void hclge_uninit_client_instance(struct hnae3_client *client, | ||
2036 | |||
2037 | for (i = 0; i < hdev->num_vmdq_vport + 1; i++) { | ||
2038 | vport = &hdev->vport[i]; | ||
2039 | - if (hdev->roce_client) | ||
2040 | + if (hdev->roce_client) { | ||
2041 | hdev->roce_client->ops->uninit_instance(&vport->roce, | ||
2042 | 0); | ||
2043 | + hdev->roce_client = NULL; | ||
2044 | + vport->roce.client = NULL; | ||
2045 | + } | ||
2046 | if (client->type == HNAE3_CLIENT_ROCE) | ||
2047 | return; | ||
2048 | - if (client->ops->uninit_instance) | ||
2049 | + if (client->ops->uninit_instance) { | ||
2050 | client->ops->uninit_instance(&vport->nic, 0); | ||
2051 | + hdev->nic_client = NULL; | ||
2052 | + vport->nic.client = NULL; | ||
2053 | + } | ||
2054 | } | ||
2055 | } | ||
2056 | |||
2057 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | ||
2058 | index 35369e1c8036..186772493711 100644 | ||
2059 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | ||
2060 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | ||
2061 | @@ -721,7 +721,7 @@ static void hns3_set_txbd_baseinfo(u16 *bdtp_fe_sc_vld_ra_ri, int frag_end) | ||
2062 | HNS3_TXD_BDTYPE_M, 0); | ||
2063 | hnae_set_bit(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_FE_B, !!frag_end); | ||
2064 | hnae_set_bit(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_VLD_B, 1); | ||
2065 | - hnae_set_field(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_SC_M, HNS3_TXD_SC_S, 1); | ||
2066 | + hnae_set_field(*bdtp_fe_sc_vld_ra_ri, HNS3_TXD_SC_M, HNS3_TXD_SC_S, 0); | ||
2067 | } | ||
2068 | |||
2069 | static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, | ||
2070 | @@ -1546,7 +1546,7 @@ static int hns3_reserve_buffer_map(struct hns3_enet_ring *ring, | ||
2071 | return 0; | ||
2072 | |||
2073 | out_with_buf: | ||
2074 | - hns3_free_buffers(ring); | ||
2075 | + hns3_free_buffer(ring, cb); | ||
2076 | out: | ||
2077 | return ret; | ||
2078 | } | ||
2079 | @@ -1586,7 +1586,7 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring) | ||
2080 | static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i, | ||
2081 | struct hns3_desc_cb *res_cb) | ||
2082 | { | ||
2083 | - hns3_map_buffer(ring, &ring->desc_cb[i]); | ||
2084 | + hns3_unmap_buffer(ring, &ring->desc_cb[i]); | ||
2085 | ring->desc_cb[i] = *res_cb; | ||
2086 | ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma); | ||
2087 | } | ||
2088 | @@ -2460,9 +2460,8 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv) | ||
2089 | (void)irq_set_affinity_hint( | ||
2090 | priv->tqp_vector[i].vector_irq, | ||
2091 | NULL); | ||
2092 | - devm_free_irq(&pdev->dev, | ||
2093 | - priv->tqp_vector[i].vector_irq, | ||
2094 | - &priv->tqp_vector[i]); | ||
2095 | + free_irq(priv->tqp_vector[i].vector_irq, | ||
2096 | + &priv->tqp_vector[i]); | ||
2097 | } | ||
2098 | |||
2099 | priv->ring_data[i].ring->irq_init_flag = HNS3_VECTOR_NOT_INITED; | ||
2100 | @@ -2489,16 +2488,16 @@ static int hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv, | ||
2101 | |||
2102 | if (ring_type == HNAE3_RING_TYPE_TX) { | ||
2103 | ring_data[q->tqp_index].ring = ring; | ||
2104 | + ring_data[q->tqp_index].queue_index = q->tqp_index; | ||
2105 | ring->io_base = (u8 __iomem *)q->io_base + HNS3_TX_REG_OFFSET; | ||
2106 | } else { | ||
2107 | ring_data[q->tqp_index + queue_num].ring = ring; | ||
2108 | + ring_data[q->tqp_index + queue_num].queue_index = q->tqp_index; | ||
2109 | ring->io_base = q->io_base; | ||
2110 | } | ||
2111 | |||
2112 | hnae_set_bit(ring->flag, HNAE3_RING_TYPE_B, ring_type); | ||
2113 | |||
2114 | - ring_data[q->tqp_index].queue_index = q->tqp_index; | ||
2115 | - | ||
2116 | ring->tqp = q; | ||
2117 | ring->desc = NULL; | ||
2118 | ring->desc_cb = NULL; | ||
2119 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | ||
2120 | index d636399232fb..e590d96e434a 100644 | ||
2121 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | ||
2122 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | ||
2123 | @@ -375,6 +375,9 @@ static int hns3_get_link_ksettings(struct net_device *netdev, | ||
2124 | break; | ||
2125 | } | ||
2126 | |||
2127 | + if (!cmd->base.autoneg) | ||
2128 | + advertised_caps &= ~HNS3_LM_AUTONEG_BIT; | ||
2129 | + | ||
2130 | /* now, map driver link modes to ethtool link modes */ | ||
2131 | hns3_driv_to_eth_caps(supported_caps, cmd, false); | ||
2132 | hns3_driv_to_eth_caps(advertised_caps, cmd, true); | ||
2133 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | ||
2134 | index 696b99e65a5a..db38880f54b4 100644 | ||
2135 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | ||
2136 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | ||
2137 | @@ -2974,6 +2974,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | ||
2138 | if (IS_ERR(mlxsw_sp_port_vlan)) { | ||
2139 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to create VID 1\n", | ||
2140 | mlxsw_sp_port->local_port); | ||
2141 | + err = PTR_ERR(mlxsw_sp_port_vlan); | ||
2142 | goto err_port_vlan_get; | ||
2143 | } | ||
2144 | |||
2145 | diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c | ||
2146 | index 13f72f5b18d2..09352ee43b55 100644 | ||
2147 | --- a/drivers/net/ethernet/sfc/ef10.c | ||
2148 | +++ b/drivers/net/ethernet/sfc/ef10.c | ||
2149 | @@ -5726,7 +5726,7 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx) | ||
2150 | * MCFW do not support VFs. | ||
2151 | */ | ||
2152 | rc = efx_ef10_vport_set_mac_address(efx); | ||
2153 | - } else { | ||
2154 | + } else if (rc) { | ||
2155 | efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC, | ||
2156 | sizeof(inbuf), NULL, 0, rc); | ||
2157 | } | ||
2158 | diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c | ||
2159 | index d2aea961e0f4..fb1c9e095d0c 100644 | ||
2160 | --- a/drivers/net/macvlan.c | ||
2161 | +++ b/drivers/net/macvlan.c | ||
2162 | @@ -480,7 +480,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) | ||
2163 | struct macvlan_dev, list); | ||
2164 | else | ||
2165 | vlan = macvlan_hash_lookup(port, eth->h_dest); | ||
2166 | - if (vlan == NULL) | ||
2167 | + if (!vlan || vlan->mode == MACVLAN_MODE_SOURCE) | ||
2168 | return RX_HANDLER_PASS; | ||
2169 | |||
2170 | dev = vlan->dev; | ||
2171 | diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c | ||
2172 | index e365866600ba..bf14c51f35e1 100644 | ||
2173 | --- a/drivers/net/ppp/ppp_generic.c | ||
2174 | +++ b/drivers/net/ppp/ppp_generic.c | ||
2175 | @@ -959,6 +959,7 @@ static __net_exit void ppp_exit_net(struct net *net) | ||
2176 | unregister_netdevice_many(&list); | ||
2177 | rtnl_unlock(); | ||
2178 | |||
2179 | + mutex_destroy(&pn->all_ppp_mutex); | ||
2180 | idr_destroy(&pn->units_idr); | ||
2181 | } | ||
2182 | |||
2183 | diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c | ||
2184 | index 195dafb98131..d790ea20b95d 100644 | ||
2185 | --- a/drivers/net/wireless/ath/ath10k/pci.c | ||
2186 | +++ b/drivers/net/wireless/ath/ath10k/pci.c | ||
2187 | @@ -2577,9 +2577,13 @@ void ath10k_pci_hif_power_down(struct ath10k *ar) | ||
2188 | */ | ||
2189 | } | ||
2190 | |||
2191 | -#ifdef CONFIG_PM | ||
2192 | - | ||
2193 | static int ath10k_pci_hif_suspend(struct ath10k *ar) | ||
2194 | +{ | ||
2195 | + /* Nothing to do; the important stuff is in the driver suspend. */ | ||
2196 | + return 0; | ||
2197 | +} | ||
2198 | + | ||
2199 | +static int ath10k_pci_suspend(struct ath10k *ar) | ||
2200 | { | ||
2201 | /* The grace timer can still be counting down and ar->ps_awake be true. | ||
2202 | * It is known that the device may be asleep after resuming regardless | ||
2203 | @@ -2592,6 +2596,12 @@ static int ath10k_pci_hif_suspend(struct ath10k *ar) | ||
2204 | } | ||
2205 | |||
2206 | static int ath10k_pci_hif_resume(struct ath10k *ar) | ||
2207 | +{ | ||
2208 | + /* Nothing to do; the important stuff is in the driver resume. */ | ||
2209 | + return 0; | ||
2210 | +} | ||
2211 | + | ||
2212 | +static int ath10k_pci_resume(struct ath10k *ar) | ||
2213 | { | ||
2214 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
2215 | struct pci_dev *pdev = ar_pci->pdev; | ||
2216 | @@ -2615,7 +2625,6 @@ static int ath10k_pci_hif_resume(struct ath10k *ar) | ||
2217 | |||
2218 | return ret; | ||
2219 | } | ||
2220 | -#endif | ||
2221 | |||
2222 | static bool ath10k_pci_validate_cal(void *data, size_t size) | ||
2223 | { | ||
2224 | @@ -2770,10 +2779,8 @@ static const struct ath10k_hif_ops ath10k_pci_hif_ops = { | ||
2225 | .power_down = ath10k_pci_hif_power_down, | ||
2226 | .read32 = ath10k_pci_read32, | ||
2227 | .write32 = ath10k_pci_write32, | ||
2228 | -#ifdef CONFIG_PM | ||
2229 | .suspend = ath10k_pci_hif_suspend, | ||
2230 | .resume = ath10k_pci_hif_resume, | ||
2231 | -#endif | ||
2232 | .fetch_cal_eeprom = ath10k_pci_hif_fetch_cal_eeprom, | ||
2233 | }; | ||
2234 | |||
2235 | @@ -3401,11 +3408,7 @@ static __maybe_unused int ath10k_pci_pm_suspend(struct device *dev) | ||
2236 | struct ath10k *ar = dev_get_drvdata(dev); | ||
2237 | int ret; | ||
2238 | |||
2239 | - if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, | ||
2240 | - ar->running_fw->fw_file.fw_features)) | ||
2241 | - return 0; | ||
2242 | - | ||
2243 | - ret = ath10k_hif_suspend(ar); | ||
2244 | + ret = ath10k_pci_suspend(ar); | ||
2245 | if (ret) | ||
2246 | ath10k_warn(ar, "failed to suspend hif: %d\n", ret); | ||
2247 | |||
2248 | @@ -3417,11 +3420,7 @@ static __maybe_unused int ath10k_pci_pm_resume(struct device *dev) | ||
2249 | struct ath10k *ar = dev_get_drvdata(dev); | ||
2250 | int ret; | ||
2251 | |||
2252 | - if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, | ||
2253 | - ar->running_fw->fw_file.fw_features)) | ||
2254 | - return 0; | ||
2255 | - | ||
2256 | - ret = ath10k_hif_resume(ar); | ||
2257 | + ret = ath10k_pci_resume(ar); | ||
2258 | if (ret) | ||
2259 | ath10k_warn(ar, "failed to resume hif: %d\n", ret); | ||
2260 | |||
2261 | diff --git a/drivers/net/wireless/ath/ath9k/tx99.c b/drivers/net/wireless/ath/ath9k/tx99.c | ||
2262 | index 49ed1afb913c..fe3a8263b224 100644 | ||
2263 | --- a/drivers/net/wireless/ath/ath9k/tx99.c | ||
2264 | +++ b/drivers/net/wireless/ath/ath9k/tx99.c | ||
2265 | @@ -179,6 +179,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, | ||
2266 | ssize_t len; | ||
2267 | int r; | ||
2268 | |||
2269 | + if (count < 1) | ||
2270 | + return -EINVAL; | ||
2271 | + | ||
2272 | if (sc->cur_chan->nvifs > 1) | ||
2273 | return -EOPNOTSUPP; | ||
2274 | |||
2275 | @@ -186,6 +189,8 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, | ||
2276 | if (copy_from_user(buf, user_buf, len)) | ||
2277 | return -EFAULT; | ||
2278 | |||
2279 | + buf[len] = '\0'; | ||
2280 | + | ||
2281 | if (strtobool(buf, &start)) | ||
2282 | return -EINVAL; | ||
2283 | |||
2284 | diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | ||
2285 | index 69131965a298..146e42a132e7 100644 | ||
2286 | --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | ||
2287 | +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | ||
2288 | @@ -643,11 +643,11 @@ static int qtnf_tx_queue_ready(struct qtnf_pcie_bus_priv *priv) | ||
2289 | { | ||
2290 | if (!CIRC_SPACE(priv->tx_bd_w_index, priv->tx_bd_r_index, | ||
2291 | priv->tx_bd_num)) { | ||
2292 | - pr_err_ratelimited("reclaim full Tx queue\n"); | ||
2293 | qtnf_pcie_data_tx_reclaim(priv); | ||
2294 | |||
2295 | if (!CIRC_SPACE(priv->tx_bd_w_index, priv->tx_bd_r_index, | ||
2296 | priv->tx_bd_num)) { | ||
2297 | + pr_warn_ratelimited("reclaim full Tx queue\n"); | ||
2298 | priv->tx_full_count++; | ||
2299 | return 0; | ||
2300 | } | ||
2301 | diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c | ||
2302 | index 37f9039bb9ca..0655f45643d9 100644 | ||
2303 | --- a/drivers/nvme/host/core.c | ||
2304 | +++ b/drivers/nvme/host/core.c | ||
2305 | @@ -2299,7 +2299,8 @@ static struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) | ||
2306 | mutex_lock(&ctrl->namespaces_mutex); | ||
2307 | list_for_each_entry(ns, &ctrl->namespaces, list) { | ||
2308 | if (ns->ns_id == nsid) { | ||
2309 | - kref_get(&ns->kref); | ||
2310 | + if (!kref_get_unless_zero(&ns->kref)) | ||
2311 | + continue; | ||
2312 | ret = ns; | ||
2313 | break; | ||
2314 | } | ||
2315 | diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c | ||
2316 | index fafdb165dd2e..df290aa58dce 100644 | ||
2317 | --- a/drivers/pci/pcie/pme.c | ||
2318 | +++ b/drivers/pci/pcie/pme.c | ||
2319 | @@ -226,6 +226,9 @@ static void pcie_pme_work_fn(struct work_struct *work) | ||
2320 | break; | ||
2321 | |||
2322 | pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); | ||
2323 | + if (rtsta == (u32) ~0) | ||
2324 | + break; | ||
2325 | + | ||
2326 | if (rtsta & PCI_EXP_RTSTA_PME) { | ||
2327 | /* | ||
2328 | * Clear PME status of the port. If there are other | ||
2329 | @@ -273,7 +276,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context) | ||
2330 | spin_lock_irqsave(&data->lock, flags); | ||
2331 | pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); | ||
2332 | |||
2333 | - if (!(rtsta & PCI_EXP_RTSTA_PME)) { | ||
2334 | + if (rtsta == (u32) ~0 || !(rtsta & PCI_EXP_RTSTA_PME)) { | ||
2335 | spin_unlock_irqrestore(&data->lock, flags); | ||
2336 | return IRQ_NONE; | ||
2337 | } | ||
2338 | diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c | ||
2339 | index ff94b69738a8..f285cd74088e 100644 | ||
2340 | --- a/drivers/pci/probe.c | ||
2341 | +++ b/drivers/pci/probe.c | ||
2342 | @@ -1076,7 +1076,8 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | ||
2343 | child = pci_add_new_bus(bus, dev, max+1); | ||
2344 | if (!child) | ||
2345 | goto out; | ||
2346 | - pci_bus_insert_busn_res(child, max+1, 0xff); | ||
2347 | + pci_bus_insert_busn_res(child, max+1, | ||
2348 | + bus->busn_res.end); | ||
2349 | } | ||
2350 | max++; | ||
2351 | buses = (buses & 0xff000000) | ||
2352 | @@ -2433,6 +2434,10 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus) | ||
2353 | if (bus->self && bus->self->is_hotplug_bridge && pci_hotplug_bus_size) { | ||
2354 | if (max - bus->busn_res.start < pci_hotplug_bus_size - 1) | ||
2355 | max = bus->busn_res.start + pci_hotplug_bus_size - 1; | ||
2356 | + | ||
2357 | + /* Do not allocate more buses than we have room left */ | ||
2358 | + if (max > bus->busn_res.end) | ||
2359 | + max = bus->busn_res.end; | ||
2360 | } | ||
2361 | |||
2362 | /* | ||
2363 | diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c | ||
2364 | index 73a03d382590..2fa0dbde36b7 100644 | ||
2365 | --- a/drivers/pci/remove.c | ||
2366 | +++ b/drivers/pci/remove.c | ||
2367 | @@ -19,9 +19,9 @@ static void pci_stop_dev(struct pci_dev *dev) | ||
2368 | pci_pme_active(dev, false); | ||
2369 | |||
2370 | if (dev->is_added) { | ||
2371 | + device_release_driver(&dev->dev); | ||
2372 | pci_proc_detach_device(dev); | ||
2373 | pci_remove_sysfs_dev_files(dev); | ||
2374 | - device_release_driver(&dev->dev); | ||
2375 | dev->is_added = 0; | ||
2376 | } | ||
2377 | |||
2378 | diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig | ||
2379 | index 82cd8b08d71f..a73c794bed03 100644 | ||
2380 | --- a/drivers/pinctrl/Kconfig | ||
2381 | +++ b/drivers/pinctrl/Kconfig | ||
2382 | @@ -33,7 +33,8 @@ config DEBUG_PINCTRL | ||
2383 | |||
2384 | config PINCTRL_ADI2 | ||
2385 | bool "ADI pin controller driver" | ||
2386 | - depends on BLACKFIN | ||
2387 | + depends on (BF54x || BF60x) | ||
2388 | + depends on !GPIO_ADI | ||
2389 | select PINMUX | ||
2390 | select IRQ_DOMAIN | ||
2391 | help | ||
2392 | diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c | ||
2393 | index 493d8910a74e..7b12abe86b94 100644 | ||
2394 | --- a/drivers/platform/x86/hp_accel.c | ||
2395 | +++ b/drivers/platform/x86/hp_accel.c | ||
2396 | @@ -240,6 +240,7 @@ static const struct dmi_system_id lis3lv02d_dmi_ids[] = { | ||
2397 | AXIS_DMI_MATCH("HDX18", "HP HDX 18", x_inverted), | ||
2398 | AXIS_DMI_MATCH("HPB432x", "HP ProBook 432", xy_rotated_left), | ||
2399 | AXIS_DMI_MATCH("HPB440G3", "HP ProBook 440 G3", x_inverted_usd), | ||
2400 | + AXIS_DMI_MATCH("HPB440G4", "HP ProBook 440 G4", x_inverted), | ||
2401 | AXIS_DMI_MATCH("HPB442x", "HP ProBook 442", xy_rotated_left), | ||
2402 | AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted), | ||
2403 | AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap), | ||
2404 | diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c | ||
2405 | index a47a41fc10ad..b5b890127479 100644 | ||
2406 | --- a/drivers/platform/x86/intel_punit_ipc.c | ||
2407 | +++ b/drivers/platform/x86/intel_punit_ipc.c | ||
2408 | @@ -252,28 +252,28 @@ static int intel_punit_get_bars(struct platform_device *pdev) | ||
2409 | * - GTDRIVER_IPC BASE_IFACE | ||
2410 | */ | ||
2411 | res = platform_get_resource(pdev, IORESOURCE_MEM, 2); | ||
2412 | - if (res) { | ||
2413 | + if (res && resource_size(res) > 1) { | ||
2414 | addr = devm_ioremap_resource(&pdev->dev, res); | ||
2415 | if (!IS_ERR(addr)) | ||
2416 | punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; | ||
2417 | } | ||
2418 | |||
2419 | res = platform_get_resource(pdev, IORESOURCE_MEM, 3); | ||
2420 | - if (res) { | ||
2421 | + if (res && resource_size(res) > 1) { | ||
2422 | addr = devm_ioremap_resource(&pdev->dev, res); | ||
2423 | if (!IS_ERR(addr)) | ||
2424 | punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; | ||
2425 | } | ||
2426 | |||
2427 | res = platform_get_resource(pdev, IORESOURCE_MEM, 4); | ||
2428 | - if (res) { | ||
2429 | + if (res && resource_size(res) > 1) { | ||
2430 | addr = devm_ioremap_resource(&pdev->dev, res); | ||
2431 | if (!IS_ERR(addr)) | ||
2432 | punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; | ||
2433 | } | ||
2434 | |||
2435 | res = platform_get_resource(pdev, IORESOURCE_MEM, 5); | ||
2436 | - if (res) { | ||
2437 | + if (res && resource_size(res) > 1) { | ||
2438 | addr = devm_ioremap_resource(&pdev->dev, res); | ||
2439 | if (!IS_ERR(addr)) | ||
2440 | punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; | ||
2441 | diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c | ||
2442 | index e3242a0925a6..e8e12c2b1d0e 100644 | ||
2443 | --- a/drivers/rpmsg/qcom_glink_native.c | ||
2444 | +++ b/drivers/rpmsg/qcom_glink_native.c | ||
2445 | @@ -227,6 +227,7 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink, | ||
2446 | |||
2447 | init_completion(&channel->open_req); | ||
2448 | init_completion(&channel->open_ack); | ||
2449 | + init_completion(&channel->intent_req_comp); | ||
2450 | |||
2451 | INIT_LIST_HEAD(&channel->done_intents); | ||
2452 | INIT_WORK(&channel->intent_work, qcom_glink_rx_done_work); | ||
2453 | diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c | ||
2454 | index cea6ea4df970..8c836c51a508 100644 | ||
2455 | --- a/drivers/rtc/rtc-pcf8563.c | ||
2456 | +++ b/drivers/rtc/rtc-pcf8563.c | ||
2457 | @@ -422,7 +422,7 @@ static unsigned long pcf8563_clkout_recalc_rate(struct clk_hw *hw, | ||
2458 | return 0; | ||
2459 | |||
2460 | buf &= PCF8563_REG_CLKO_F_MASK; | ||
2461 | - return clkout_rates[ret]; | ||
2462 | + return clkout_rates[buf]; | ||
2463 | } | ||
2464 | |||
2465 | static long pcf8563_clkout_round_rate(struct clk_hw *hw, unsigned long rate, | ||
2466 | diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c | ||
2467 | index dfe8e70f8d99..525a652dab48 100644 | ||
2468 | --- a/drivers/scsi/aacraid/commsup.c | ||
2469 | +++ b/drivers/scsi/aacraid/commsup.c | ||
2470 | @@ -2383,19 +2383,19 @@ static int aac_send_wellness_command(struct aac_dev *dev, char *wellness_str, | ||
2471 | goto out; | ||
2472 | } | ||
2473 | |||
2474 | -int aac_send_safw_hostttime(struct aac_dev *dev, struct timeval *now) | ||
2475 | +int aac_send_safw_hostttime(struct aac_dev *dev, struct timespec64 *now) | ||
2476 | { | ||
2477 | struct tm cur_tm; | ||
2478 | char wellness_str[] = "<HW>TD\010\0\0\0\0\0\0\0\0\0DW\0\0ZZ"; | ||
2479 | u32 datasize = sizeof(wellness_str); | ||
2480 | - unsigned long local_time; | ||
2481 | + time64_t local_time; | ||
2482 | int ret = -ENODEV; | ||
2483 | |||
2484 | if (!dev->sa_firmware) | ||
2485 | goto out; | ||
2486 | |||
2487 | - local_time = (u32)(now->tv_sec - (sys_tz.tz_minuteswest * 60)); | ||
2488 | - time_to_tm(local_time, 0, &cur_tm); | ||
2489 | + local_time = (now->tv_sec - (sys_tz.tz_minuteswest * 60)); | ||
2490 | + time64_to_tm(local_time, 0, &cur_tm); | ||
2491 | cur_tm.tm_mon += 1; | ||
2492 | cur_tm.tm_year += 1900; | ||
2493 | wellness_str[8] = bin2bcd(cur_tm.tm_hour); | ||
2494 | @@ -2412,7 +2412,7 @@ int aac_send_safw_hostttime(struct aac_dev *dev, struct timeval *now) | ||
2495 | return ret; | ||
2496 | } | ||
2497 | |||
2498 | -int aac_send_hosttime(struct aac_dev *dev, struct timeval *now) | ||
2499 | +int aac_send_hosttime(struct aac_dev *dev, struct timespec64 *now) | ||
2500 | { | ||
2501 | int ret = -ENOMEM; | ||
2502 | struct fib *fibptr; | ||
2503 | @@ -2424,7 +2424,7 @@ int aac_send_hosttime(struct aac_dev *dev, struct timeval *now) | ||
2504 | |||
2505 | aac_fib_init(fibptr); | ||
2506 | info = (__le32 *)fib_data(fibptr); | ||
2507 | - *info = cpu_to_le32(now->tv_sec); | ||
2508 | + *info = cpu_to_le32(now->tv_sec); /* overflow in y2106 */ | ||
2509 | ret = aac_fib_send(SendHostTime, fibptr, sizeof(*info), FsaNormal, | ||
2510 | 1, 1, NULL, NULL); | ||
2511 | |||
2512 | @@ -2496,7 +2496,7 @@ int aac_command_thread(void *data) | ||
2513 | } | ||
2514 | if (!time_before(next_check_jiffies,next_jiffies) | ||
2515 | && ((difference = next_jiffies - jiffies) <= 0)) { | ||
2516 | - struct timeval now; | ||
2517 | + struct timespec64 now; | ||
2518 | int ret; | ||
2519 | |||
2520 | /* Don't even try to talk to adapter if its sick */ | ||
2521 | @@ -2506,15 +2506,15 @@ int aac_command_thread(void *data) | ||
2522 | next_check_jiffies = jiffies | ||
2523 | + ((long)(unsigned)check_interval) | ||
2524 | * HZ; | ||
2525 | - do_gettimeofday(&now); | ||
2526 | + ktime_get_real_ts64(&now); | ||
2527 | |||
2528 | /* Synchronize our watches */ | ||
2529 | - if (((1000000 - (1000000 / HZ)) > now.tv_usec) | ||
2530 | - && (now.tv_usec > (1000000 / HZ))) | ||
2531 | - difference = (((1000000 - now.tv_usec) * HZ) | ||
2532 | - + 500000) / 1000000; | ||
2533 | + if (((NSEC_PER_SEC - (NSEC_PER_SEC / HZ)) > now.tv_nsec) | ||
2534 | + && (now.tv_nsec > (NSEC_PER_SEC / HZ))) | ||
2535 | + difference = (((NSEC_PER_SEC - now.tv_nsec) * HZ) | ||
2536 | + + NSEC_PER_SEC / 2) / NSEC_PER_SEC; | ||
2537 | else { | ||
2538 | - if (now.tv_usec > 500000) | ||
2539 | + if (now.tv_nsec > NSEC_PER_SEC / 2) | ||
2540 | ++now.tv_sec; | ||
2541 | |||
2542 | if (dev->sa_firmware) | ||
2543 | diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c | ||
2544 | index 8dcd8c70c7ee..05f523971348 100644 | ||
2545 | --- a/drivers/scsi/bfa/bfad_debugfs.c | ||
2546 | +++ b/drivers/scsi/bfa/bfad_debugfs.c | ||
2547 | @@ -255,7 +255,8 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf, | ||
2548 | struct bfad_s *bfad = port->bfad; | ||
2549 | struct bfa_s *bfa = &bfad->bfa; | ||
2550 | struct bfa_ioc_s *ioc = &bfa->ioc; | ||
2551 | - int addr, len, rc, i; | ||
2552 | + int addr, rc, i; | ||
2553 | + u32 len; | ||
2554 | u32 *regbuf; | ||
2555 | void __iomem *rb, *reg_addr; | ||
2556 | unsigned long flags; | ||
2557 | @@ -266,7 +267,7 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf, | ||
2558 | return PTR_ERR(kern_buf); | ||
2559 | |||
2560 | rc = sscanf(kern_buf, "%x:%x", &addr, &len); | ||
2561 | - if (rc < 2) { | ||
2562 | + if (rc < 2 || len > (UINT_MAX >> 2)) { | ||
2563 | printk(KERN_INFO | ||
2564 | "bfad[%d]: %s failed to read user buf\n", | ||
2565 | bfad->inst_no, __func__); | ||
2566 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c | ||
2567 | index 16664f2e15fb..8fa9bb336ad4 100644 | ||
2568 | --- a/drivers/scsi/hisi_sas/hisi_sas_main.c | ||
2569 | +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c | ||
2570 | @@ -185,13 +185,16 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, | ||
2571 | struct domain_device *device = task->dev; | ||
2572 | struct hisi_sas_device *sas_dev = device->lldd_dev; | ||
2573 | |||
2574 | + if (!task->lldd_task) | ||
2575 | + return; | ||
2576 | + | ||
2577 | + task->lldd_task = NULL; | ||
2578 | + | ||
2579 | if (!sas_protocol_ata(task->task_proto)) | ||
2580 | if (slot->n_elem) | ||
2581 | dma_unmap_sg(dev, task->scatter, slot->n_elem, | ||
2582 | task->data_dir); | ||
2583 | |||
2584 | - task->lldd_task = NULL; | ||
2585 | - | ||
2586 | if (sas_dev) | ||
2587 | atomic64_dec(&sas_dev->running_req); | ||
2588 | } | ||
2589 | @@ -199,8 +202,8 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, | ||
2590 | if (slot->buf) | ||
2591 | dma_pool_free(hisi_hba->buffer_pool, slot->buf, slot->buf_dma); | ||
2592 | |||
2593 | - | ||
2594 | list_del_init(&slot->entry); | ||
2595 | + slot->buf = NULL; | ||
2596 | slot->task = NULL; | ||
2597 | slot->port = NULL; | ||
2598 | hisi_sas_slot_index_free(hisi_hba, slot->idx); | ||
2599 | diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c | ||
2600 | index 4ed3d26ffdde..5fbaf13781b6 100644 | ||
2601 | --- a/drivers/scsi/hpsa.c | ||
2602 | +++ b/drivers/scsi/hpsa.c | ||
2603 | @@ -8684,6 +8684,8 @@ static void hpsa_remove_one(struct pci_dev *pdev) | ||
2604 | destroy_workqueue(h->rescan_ctlr_wq); | ||
2605 | destroy_workqueue(h->resubmit_wq); | ||
2606 | |||
2607 | + hpsa_delete_sas_host(h); | ||
2608 | + | ||
2609 | /* | ||
2610 | * Call before disabling interrupts. | ||
2611 | * scsi_remove_host can trigger I/O operations especially | ||
2612 | @@ -8718,8 +8720,6 @@ static void hpsa_remove_one(struct pci_dev *pdev) | ||
2613 | h->lockup_detected = NULL; /* init_one 2 */ | ||
2614 | /* (void) pci_disable_pcie_error_reporting(pdev); */ /* init_one 1 */ | ||
2615 | |||
2616 | - hpsa_delete_sas_host(h); | ||
2617 | - | ||
2618 | kfree(h); /* init_one 1 */ | ||
2619 | } | ||
2620 | |||
2621 | @@ -9207,9 +9207,9 @@ static void hpsa_free_sas_phy(struct hpsa_sas_phy *hpsa_sas_phy) | ||
2622 | struct sas_phy *phy = hpsa_sas_phy->phy; | ||
2623 | |||
2624 | sas_port_delete_phy(hpsa_sas_phy->parent_port->port, phy); | ||
2625 | - sas_phy_free(phy); | ||
2626 | if (hpsa_sas_phy->added_to_port) | ||
2627 | list_del(&hpsa_sas_phy->phy_list_entry); | ||
2628 | + sas_phy_delete(phy); | ||
2629 | kfree(hpsa_sas_phy); | ||
2630 | } | ||
2631 | |||
2632 | diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c | ||
2633 | index 6b4fd2375178..324d8d8c62de 100644 | ||
2634 | --- a/drivers/scsi/libsas/sas_expander.c | ||
2635 | +++ b/drivers/scsi/libsas/sas_expander.c | ||
2636 | @@ -2145,7 +2145,7 @@ void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, | ||
2637 | struct sas_rphy *rphy) | ||
2638 | { | ||
2639 | struct domain_device *dev; | ||
2640 | - unsigned int reslen = 0; | ||
2641 | + unsigned int rcvlen = 0; | ||
2642 | int ret = -EINVAL; | ||
2643 | |||
2644 | /* no rphy means no smp target support (ie aic94xx host) */ | ||
2645 | @@ -2179,12 +2179,12 @@ void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, | ||
2646 | |||
2647 | ret = smp_execute_task_sg(dev, job->request_payload.sg_list, | ||
2648 | job->reply_payload.sg_list); | ||
2649 | - if (ret > 0) { | ||
2650 | - /* positive number is the untransferred residual */ | ||
2651 | - reslen = ret; | ||
2652 | + if (ret >= 0) { | ||
2653 | + /* bsg_job_done() requires the length received */ | ||
2654 | + rcvlen = job->reply_payload.payload_len - ret; | ||
2655 | ret = 0; | ||
2656 | } | ||
2657 | |||
2658 | out: | ||
2659 | - bsg_job_done(job, ret, reslen); | ||
2660 | + bsg_job_done(job, ret, rcvlen); | ||
2661 | } | ||
2662 | diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c | ||
2663 | index 09ba494f8896..92bc5b2d24ae 100644 | ||
2664 | --- a/drivers/scsi/scsi_debug.c | ||
2665 | +++ b/drivers/scsi/scsi_debug.c | ||
2666 | @@ -3001,11 +3001,11 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, | ||
2667 | if (-1 == ret) { | ||
2668 | write_unlock_irqrestore(&atomic_rw, iflags); | ||
2669 | return DID_ERROR << 16; | ||
2670 | - } else if (sdebug_verbose && (ret < (num * sdebug_sector_size))) | ||
2671 | + } else if (sdebug_verbose && !ndob && (ret < sdebug_sector_size)) | ||
2672 | sdev_printk(KERN_INFO, scp->device, | ||
2673 | - "%s: %s: cdb indicated=%u, IO sent=%d bytes\n", | ||
2674 | + "%s: %s: lb size=%u, IO sent=%d bytes\n", | ||
2675 | my_name, "write same", | ||
2676 | - num * sdebug_sector_size, ret); | ||
2677 | + sdebug_sector_size, ret); | ||
2678 | |||
2679 | /* Copy first sector to remaining blocks */ | ||
2680 | for (i = 1 ; i < num ; i++) | ||
2681 | diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c | ||
2682 | index 01f08c03f2c1..c3765d29fd3f 100644 | ||
2683 | --- a/drivers/scsi/scsi_debugfs.c | ||
2684 | +++ b/drivers/scsi/scsi_debugfs.c | ||
2685 | @@ -8,9 +8,11 @@ void scsi_show_rq(struct seq_file *m, struct request *rq) | ||
2686 | { | ||
2687 | struct scsi_cmnd *cmd = container_of(scsi_req(rq), typeof(*cmd), req); | ||
2688 | int msecs = jiffies_to_msecs(jiffies - cmd->jiffies_at_alloc); | ||
2689 | - char buf[80]; | ||
2690 | + const u8 *const cdb = READ_ONCE(cmd->cmnd); | ||
2691 | + char buf[80] = "(?)"; | ||
2692 | |||
2693 | - __scsi_format_command(buf, sizeof(buf), cmd->cmnd, cmd->cmd_len); | ||
2694 | + if (cdb) | ||
2695 | + __scsi_format_command(buf, sizeof(buf), cdb, cmd->cmd_len); | ||
2696 | seq_printf(m, ", .cmd=%s, .retries=%d, allocated %d.%03d s ago", buf, | ||
2697 | cmd->retries, msecs / 1000, msecs % 1000); | ||
2698 | } | ||
2699 | diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c | ||
2700 | index 6bf43d94cdc0..b19b00adacb2 100644 | ||
2701 | --- a/drivers/scsi/scsi_devinfo.c | ||
2702 | +++ b/drivers/scsi/scsi_devinfo.c | ||
2703 | @@ -161,7 +161,7 @@ static struct { | ||
2704 | {"DGC", "RAID", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, storage on LUN 0 */ | ||
2705 | {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, no storage on LUN 0 */ | ||
2706 | {"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, | ||
2707 | - {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_FORCELUN}, | ||
2708 | + {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_REPORTLUN2}, | ||
2709 | {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN}, | ||
2710 | {"easyRAID", "16P", NULL, BLIST_NOREPORTLUN}, | ||
2711 | {"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN}, | ||
2712 | diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c | ||
2713 | index d175c5c5ccf8..72db0f7d221a 100644 | ||
2714 | --- a/drivers/scsi/sd.c | ||
2715 | +++ b/drivers/scsi/sd.c | ||
2716 | @@ -231,11 +231,15 @@ manage_start_stop_store(struct device *dev, struct device_attribute *attr, | ||
2717 | { | ||
2718 | struct scsi_disk *sdkp = to_scsi_disk(dev); | ||
2719 | struct scsi_device *sdp = sdkp->device; | ||
2720 | + bool v; | ||
2721 | |||
2722 | if (!capable(CAP_SYS_ADMIN)) | ||
2723 | return -EACCES; | ||
2724 | |||
2725 | - sdp->manage_start_stop = simple_strtoul(buf, NULL, 10); | ||
2726 | + if (kstrtobool(buf, &v)) | ||
2727 | + return -EINVAL; | ||
2728 | + | ||
2729 | + sdp->manage_start_stop = v; | ||
2730 | |||
2731 | return count; | ||
2732 | } | ||
2733 | @@ -253,6 +257,7 @@ static ssize_t | ||
2734 | allow_restart_store(struct device *dev, struct device_attribute *attr, | ||
2735 | const char *buf, size_t count) | ||
2736 | { | ||
2737 | + bool v; | ||
2738 | struct scsi_disk *sdkp = to_scsi_disk(dev); | ||
2739 | struct scsi_device *sdp = sdkp->device; | ||
2740 | |||
2741 | @@ -262,7 +267,10 @@ allow_restart_store(struct device *dev, struct device_attribute *attr, | ||
2742 | if (sdp->type != TYPE_DISK && sdp->type != TYPE_ZBC) | ||
2743 | return -EINVAL; | ||
2744 | |||
2745 | - sdp->allow_restart = simple_strtoul(buf, NULL, 10); | ||
2746 | + if (kstrtobool(buf, &v)) | ||
2747 | + return -EINVAL; | ||
2748 | + | ||
2749 | + sdp->allow_restart = v; | ||
2750 | |||
2751 | return count; | ||
2752 | } | ||
2753 | @@ -1284,6 +1292,7 @@ static int sd_init_command(struct scsi_cmnd *cmd) | ||
2754 | static void sd_uninit_command(struct scsi_cmnd *SCpnt) | ||
2755 | { | ||
2756 | struct request *rq = SCpnt->request; | ||
2757 | + u8 *cmnd; | ||
2758 | |||
2759 | if (SCpnt->flags & SCMD_ZONE_WRITE_LOCK) | ||
2760 | sd_zbc_write_unlock_zone(SCpnt); | ||
2761 | @@ -1292,9 +1301,10 @@ static void sd_uninit_command(struct scsi_cmnd *SCpnt) | ||
2762 | __free_page(rq->special_vec.bv_page); | ||
2763 | |||
2764 | if (SCpnt->cmnd != scsi_req(rq)->cmd) { | ||
2765 | - mempool_free(SCpnt->cmnd, sd_cdb_pool); | ||
2766 | + cmnd = SCpnt->cmnd; | ||
2767 | SCpnt->cmnd = NULL; | ||
2768 | SCpnt->cmd_len = 0; | ||
2769 | + mempool_free(cmnd, sd_cdb_pool); | ||
2770 | } | ||
2771 | } | ||
2772 | |||
2773 | diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c | ||
2774 | index c2048382830f..e3df1e96b141 100644 | ||
2775 | --- a/drivers/soc/mediatek/mtk-pmic-wrap.c | ||
2776 | +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c | ||
2777 | @@ -522,7 +522,7 @@ struct pmic_wrapper_type { | ||
2778 | u32 int_en_all; | ||
2779 | u32 spi_w; | ||
2780 | u32 wdt_src; | ||
2781 | - int has_bridge:1; | ||
2782 | + unsigned int has_bridge:1; | ||
2783 | int (*init_reg_clock)(struct pmic_wrapper *wrp); | ||
2784 | int (*init_soc_specific)(struct pmic_wrapper *wrp); | ||
2785 | }; | ||
2786 | diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c | ||
2787 | index 32a483769975..fa611455109a 100644 | ||
2788 | --- a/drivers/staging/rtl8188eu/core/rtw_ap.c | ||
2789 | +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c | ||
2790 | @@ -754,7 +754,7 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) | ||
2791 | } | ||
2792 | |||
2793 | /* setting only at first time */ | ||
2794 | - if (!(pmlmepriv->cur_network.join_res)) { | ||
2795 | + if (pmlmepriv->cur_network.join_res != true) { | ||
2796 | /* WEP Key will be set before this function, do not | ||
2797 | * clear CAM. | ||
2798 | */ | ||
2799 | diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c | ||
2800 | index 9461bce883ea..be8542676adf 100644 | ||
2801 | --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c | ||
2802 | +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c | ||
2803 | @@ -333,7 +333,7 @@ u8 rtw_createbss_cmd(struct adapter *padapter) | ||
2804 | else | ||
2805 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); | ||
2806 | |||
2807 | - pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | ||
2808 | + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); | ||
2809 | if (!pcmd) { | ||
2810 | res = _FAIL; | ||
2811 | goto exit; | ||
2812 | @@ -508,7 +508,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu | ||
2813 | |||
2814 | if (enqueue) { | ||
2815 | /* need enqueue, prepare cmd_obj and enqueue */ | ||
2816 | - cmdobj = kzalloc(sizeof(*cmdobj), GFP_KERNEL); | ||
2817 | + cmdobj = kzalloc(sizeof(*cmdobj), GFP_ATOMIC); | ||
2818 | if (!cmdobj) { | ||
2819 | res = _FAIL; | ||
2820 | kfree(param); | ||
2821 | diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c | ||
2822 | index 9fcf2e223f71..1123b4f1e1d6 100644 | ||
2823 | --- a/drivers/staging/vt6655/device_main.c | ||
2824 | +++ b/drivers/staging/vt6655/device_main.c | ||
2825 | @@ -1693,10 +1693,11 @@ static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state) | ||
2826 | MACbShutdown(priv); | ||
2827 | |||
2828 | pci_disable_device(pcid); | ||
2829 | - pci_set_power_state(pcid, pci_choose_state(pcid, state)); | ||
2830 | |||
2831 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2832 | |||
2833 | + pci_set_power_state(pcid, pci_choose_state(pcid, state)); | ||
2834 | + | ||
2835 | return 0; | ||
2836 | } | ||
2837 | |||
2838 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c | ||
2839 | index d9ba4ee2c62b..52fa52c20be0 100644 | ||
2840 | --- a/drivers/target/iscsi/iscsi_target.c | ||
2841 | +++ b/drivers/target/iscsi/iscsi_target.c | ||
2842 | @@ -834,6 +834,7 @@ static int iscsit_add_reject_from_cmd( | ||
2843 | unsigned char *buf) | ||
2844 | { | ||
2845 | struct iscsi_conn *conn; | ||
2846 | + const bool do_put = cmd->se_cmd.se_tfo != NULL; | ||
2847 | |||
2848 | if (!cmd->conn) { | ||
2849 | pr_err("cmd->conn is NULL for ITT: 0x%08x\n", | ||
2850 | @@ -864,7 +865,7 @@ static int iscsit_add_reject_from_cmd( | ||
2851 | * Perform the kref_put now if se_cmd has already been setup by | ||
2852 | * scsit_setup_scsi_cmd() | ||
2853 | */ | ||
2854 | - if (cmd->se_cmd.se_tfo != NULL) { | ||
2855 | + if (do_put) { | ||
2856 | pr_debug("iscsi reject: calling target_put_sess_cmd >>>>>>\n"); | ||
2857 | target_put_sess_cmd(&cmd->se_cmd); | ||
2858 | } | ||
2859 | diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c | ||
2860 | index 0dd4c45f7575..0ebc4818e132 100644 | ||
2861 | --- a/drivers/target/iscsi/iscsi_target_configfs.c | ||
2862 | +++ b/drivers/target/iscsi/iscsi_target_configfs.c | ||
2863 | @@ -1123,7 +1123,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg( | ||
2864 | |||
2865 | ret = core_tpg_register(wwn, &tpg->tpg_se_tpg, SCSI_PROTOCOL_ISCSI); | ||
2866 | if (ret < 0) | ||
2867 | - return NULL; | ||
2868 | + goto free_out; | ||
2869 | |||
2870 | ret = iscsit_tpg_add_portal_group(tiqn, tpg); | ||
2871 | if (ret != 0) | ||
2872 | @@ -1135,6 +1135,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg( | ||
2873 | return &tpg->tpg_se_tpg; | ||
2874 | out: | ||
2875 | core_tpg_deregister(&tpg->tpg_se_tpg); | ||
2876 | +free_out: | ||
2877 | kfree(tpg); | ||
2878 | return NULL; | ||
2879 | } | ||
2880 | diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c | ||
2881 | index 1e36f83b5961..70c6b9bfc04e 100644 | ||
2882 | --- a/drivers/target/iscsi/iscsi_target_util.c | ||
2883 | +++ b/drivers/target/iscsi/iscsi_target_util.c | ||
2884 | @@ -694,6 +694,8 @@ void iscsit_release_cmd(struct iscsi_cmd *cmd) | ||
2885 | struct iscsi_session *sess; | ||
2886 | struct se_cmd *se_cmd = &cmd->se_cmd; | ||
2887 | |||
2888 | + WARN_ON(!list_empty(&cmd->i_conn_node)); | ||
2889 | + | ||
2890 | if (cmd->conn) | ||
2891 | sess = cmd->conn->sess; | ||
2892 | else | ||
2893 | @@ -716,6 +718,8 @@ void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool check_queues) | ||
2894 | { | ||
2895 | struct iscsi_conn *conn = cmd->conn; | ||
2896 | |||
2897 | + WARN_ON(!list_empty(&cmd->i_conn_node)); | ||
2898 | + | ||
2899 | if (cmd->data_direction == DMA_TO_DEVICE) { | ||
2900 | iscsit_stop_dataout_timer(cmd); | ||
2901 | iscsit_free_r2ts_from_list(cmd); | ||
2902 | diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c | ||
2903 | index c629817a8854..9b2c0c773022 100644 | ||
2904 | --- a/drivers/target/target_core_file.c | ||
2905 | +++ b/drivers/target/target_core_file.c | ||
2906 | @@ -482,6 +482,10 @@ fd_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) | ||
2907 | struct inode *inode = file->f_mapping->host; | ||
2908 | int ret; | ||
2909 | |||
2910 | + if (!nolb) { | ||
2911 | + return 0; | ||
2912 | + } | ||
2913 | + | ||
2914 | if (cmd->se_dev->dev_attrib.pi_prot_type) { | ||
2915 | ret = fd_do_prot_unmap(cmd, lba, nolb); | ||
2916 | if (ret) | ||
2917 | diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c | ||
2918 | index 9f25c9c6f67d..4ba5004a069e 100644 | ||
2919 | --- a/drivers/target/target_core_pr.c | ||
2920 | +++ b/drivers/target/target_core_pr.c | ||
2921 | @@ -58,8 +58,10 @@ void core_pr_dump_initiator_port( | ||
2922 | char *buf, | ||
2923 | u32 size) | ||
2924 | { | ||
2925 | - if (!pr_reg->isid_present_at_reg) | ||
2926 | + if (!pr_reg->isid_present_at_reg) { | ||
2927 | buf[0] = '\0'; | ||
2928 | + return; | ||
2929 | + } | ||
2930 | |||
2931 | snprintf(buf, size, ",i,0x%s", pr_reg->pr_reg_isid); | ||
2932 | } | ||
2933 | diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c | ||
2934 | index be95826631b7..ee047ca43084 100644 | ||
2935 | --- a/drivers/thermal/step_wise.c | ||
2936 | +++ b/drivers/thermal/step_wise.c | ||
2937 | @@ -31,8 +31,7 @@ | ||
2938 | * If the temperature is higher than a trip point, | ||
2939 | * a. if the trend is THERMAL_TREND_RAISING, use higher cooling | ||
2940 | * state for this trip point | ||
2941 | - * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling | ||
2942 | - * state for this trip point | ||
2943 | + * b. if the trend is THERMAL_TREND_DROPPING, do nothing | ||
2944 | * c. if the trend is THERMAL_TREND_RAISE_FULL, use upper limit | ||
2945 | * for this trip point | ||
2946 | * d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit | ||
2947 | @@ -94,9 +93,11 @@ static unsigned long get_target_state(struct thermal_instance *instance, | ||
2948 | if (!throttle) | ||
2949 | next_target = THERMAL_NO_TARGET; | ||
2950 | } else { | ||
2951 | - next_target = cur_state - 1; | ||
2952 | - if (next_target > instance->upper) | ||
2953 | - next_target = instance->upper; | ||
2954 | + if (!throttle) { | ||
2955 | + next_target = cur_state - 1; | ||
2956 | + if (next_target > instance->upper) | ||
2957 | + next_target = instance->upper; | ||
2958 | + } | ||
2959 | } | ||
2960 | break; | ||
2961 | case THERMAL_TREND_DROP_FULL: | ||
2962 | diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c | ||
2963 | index d674e06767a5..1424581fd9af 100644 | ||
2964 | --- a/drivers/thunderbolt/tb.c | ||
2965 | +++ b/drivers/thunderbolt/tb.c | ||
2966 | @@ -225,6 +225,7 @@ static void tb_activate_pcie_devices(struct tb *tb) | ||
2967 | tb_port_info(up_port, | ||
2968 | "PCIe tunnel activation failed, aborting\n"); | ||
2969 | tb_pci_free(tunnel); | ||
2970 | + continue; | ||
2971 | } | ||
2972 | |||
2973 | list_add(&tunnel->list, &tcm->tunnel_list); | ||
2974 | diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c | ||
2975 | index 7f785d77ba7f..69fc6d9ab490 100644 | ||
2976 | --- a/drivers/tty/serdev/serdev-ttyport.c | ||
2977 | +++ b/drivers/tty/serdev/serdev-ttyport.c | ||
2978 | @@ -120,10 +120,10 @@ static int ttyport_open(struct serdev_controller *ctrl) | ||
2979 | return PTR_ERR(tty); | ||
2980 | serport->tty = tty; | ||
2981 | |||
2982 | - if (tty->ops->open) | ||
2983 | - tty->ops->open(serport->tty, NULL); | ||
2984 | - else | ||
2985 | - tty_port_open(serport->port, tty, NULL); | ||
2986 | + if (!tty->ops->open) | ||
2987 | + goto err_unlock; | ||
2988 | + | ||
2989 | + tty->ops->open(serport->tty, NULL); | ||
2990 | |||
2991 | /* Bring the UART into a known 8 bits no parity hw fc state */ | ||
2992 | ktermios = tty->termios; | ||
2993 | @@ -140,6 +140,12 @@ static int ttyport_open(struct serdev_controller *ctrl) | ||
2994 | |||
2995 | tty_unlock(serport->tty); | ||
2996 | return 0; | ||
2997 | + | ||
2998 | +err_unlock: | ||
2999 | + tty_unlock(tty); | ||
3000 | + tty_release_struct(tty, serport->tty_idx); | ||
3001 | + | ||
3002 | + return -ENODEV; | ||
3003 | } | ||
3004 | |||
3005 | static void ttyport_close(struct serdev_controller *ctrl) | ||
3006 | diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c | ||
3007 | index c42a3e63eb07..843ef46d2537 100644 | ||
3008 | --- a/drivers/usb/core/config.c | ||
3009 | +++ b/drivers/usb/core/config.c | ||
3010 | @@ -555,6 +555,9 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, | ||
3011 | unsigned iad_num = 0; | ||
3012 | |||
3013 | memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE); | ||
3014 | + nintf = nintf_orig = config->desc.bNumInterfaces; | ||
3015 | + config->desc.bNumInterfaces = 0; // Adjusted later | ||
3016 | + | ||
3017 | if (config->desc.bDescriptorType != USB_DT_CONFIG || | ||
3018 | config->desc.bLength < USB_DT_CONFIG_SIZE || | ||
3019 | config->desc.bLength > size) { | ||
3020 | @@ -568,7 +571,6 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, | ||
3021 | buffer += config->desc.bLength; | ||
3022 | size -= config->desc.bLength; | ||
3023 | |||
3024 | - nintf = nintf_orig = config->desc.bNumInterfaces; | ||
3025 | if (nintf > USB_MAXINTERFACES) { | ||
3026 | dev_warn(ddev, "config %d has too many interfaces: %d, " | ||
3027 | "using maximum allowed: %d\n", | ||
3028 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c | ||
3029 | index 97f30eb7dac0..ccdc971283d0 100644 | ||
3030 | --- a/drivers/usb/host/xhci-mem.c | ||
3031 | +++ b/drivers/usb/host/xhci-mem.c | ||
3032 | @@ -983,10 +983,9 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, | ||
3033 | return 0; | ||
3034 | } | ||
3035 | |||
3036 | - xhci->devs[slot_id] = kzalloc(sizeof(*xhci->devs[slot_id]), flags); | ||
3037 | - if (!xhci->devs[slot_id]) | ||
3038 | + dev = kzalloc(sizeof(*dev), flags); | ||
3039 | + if (!dev) | ||
3040 | return 0; | ||
3041 | - dev = xhci->devs[slot_id]; | ||
3042 | |||
3043 | /* Allocate the (output) device context that will be used in the HC. */ | ||
3044 | dev->out_ctx = xhci_alloc_container_ctx(xhci, XHCI_CTX_TYPE_DEVICE, flags); | ||
3045 | @@ -1027,9 +1026,17 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, | ||
3046 | |||
3047 | trace_xhci_alloc_virt_device(dev); | ||
3048 | |||
3049 | + xhci->devs[slot_id] = dev; | ||
3050 | + | ||
3051 | return 1; | ||
3052 | fail: | ||
3053 | - xhci_free_virt_device(xhci, slot_id); | ||
3054 | + | ||
3055 | + if (dev->in_ctx) | ||
3056 | + xhci_free_container_ctx(xhci, dev->in_ctx); | ||
3057 | + if (dev->out_ctx) | ||
3058 | + xhci_free_container_ctx(xhci, dev->out_ctx); | ||
3059 | + kfree(dev); | ||
3060 | + | ||
3061 | return 0; | ||
3062 | } | ||
3063 | |||
3064 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c | ||
3065 | index 353520005c13..6996235e34a9 100644 | ||
3066 | --- a/drivers/usb/host/xhci-ring.c | ||
3067 | +++ b/drivers/usb/host/xhci-ring.c | ||
3068 | @@ -3121,7 +3121,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred, | ||
3069 | { | ||
3070 | u32 maxp, total_packet_count; | ||
3071 | |||
3072 | - /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */ | ||
3073 | + /* MTK xHCI 0.96 contains some features from 1.0 */ | ||
3074 | if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST)) | ||
3075 | return ((td_total_len - transferred) >> 10); | ||
3076 | |||
3077 | @@ -3130,8 +3130,8 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred, | ||
3078 | trb_buff_len == td_total_len) | ||
3079 | return 0; | ||
3080 | |||
3081 | - /* for MTK xHCI, TD size doesn't include this TRB */ | ||
3082 | - if (xhci->quirks & XHCI_MTK_HOST) | ||
3083 | + /* for MTK xHCI 0.96, TD size include this TRB, but not in 1.x */ | ||
3084 | + if ((xhci->quirks & XHCI_MTK_HOST) && (xhci->hci_version < 0x100)) | ||
3085 | trb_buff_len = 0; | ||
3086 | |||
3087 | maxp = usb_endpoint_maxp(&urb->ep->desc); | ||
3088 | diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c | ||
3089 | index df88123274ca..972bf4210189 100644 | ||
3090 | --- a/drivers/usb/musb/da8xx.c | ||
3091 | +++ b/drivers/usb/musb/da8xx.c | ||
3092 | @@ -305,7 +305,15 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | ||
3093 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; | ||
3094 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | ||
3095 | del_timer(&otg_workaround); | ||
3096 | - } else { | ||
3097 | + } else if (!(musb->int_usb & MUSB_INTR_BABBLE)){ | ||
3098 | + /* | ||
3099 | + * When babble condition happens, drvvbus interrupt | ||
3100 | + * is also generated. Ignore this drvvbus interrupt | ||
3101 | + * and let babble interrupt handler recovers the | ||
3102 | + * controller; otherwise, the host-mode flag is lost | ||
3103 | + * due to the MUSB_DEV_MODE() call below and babble | ||
3104 | + * recovery logic will not called. | ||
3105 | + */ | ||
3106 | musb->is_active = 0; | ||
3107 | MUSB_DEV_MODE(musb); | ||
3108 | otg->default_a = 0; | ||
3109 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h | ||
3110 | index eb06d88b41d6..9af39644561f 100644 | ||
3111 | --- a/drivers/usb/storage/unusual_devs.h | ||
3112 | +++ b/drivers/usb/storage/unusual_devs.h | ||
3113 | @@ -2113,6 +2113,13 @@ UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116, | ||
3114 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
3115 | US_FL_BROKEN_FUA ), | ||
3116 | |||
3117 | +/* Reported by David Kozub <zub@linux.fjfi.cvut.cz> */ | ||
3118 | +UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999, | ||
3119 | + "JMicron", | ||
3120 | + "JMS567", | ||
3121 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
3122 | + US_FL_BROKEN_FUA), | ||
3123 | + | ||
3124 | /* | ||
3125 | * Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> | ||
3126 | * JMicron responds to USN and several other SCSI ioctls with a | ||
3127 | diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h | ||
3128 | index cde115359793..9f356f7cf7d5 100644 | ||
3129 | --- a/drivers/usb/storage/unusual_uas.h | ||
3130 | +++ b/drivers/usb/storage/unusual_uas.h | ||
3131 | @@ -142,6 +142,13 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | ||
3132 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
3133 | US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES), | ||
3134 | |||
3135 | +/* Reported-by: David Kozub <zub@linux.fjfi.cvut.cz> */ | ||
3136 | +UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999, | ||
3137 | + "JMicron", | ||
3138 | + "JMS567", | ||
3139 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
3140 | + US_FL_BROKEN_FUA), | ||
3141 | + | ||
3142 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
3143 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | ||
3144 | "VIA", | ||
3145 | diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c | ||
3146 | index 191b176ffedf..283a9be77a22 100644 | ||
3147 | --- a/drivers/usb/usbip/stub_rx.c | ||
3148 | +++ b/drivers/usb/usbip/stub_rx.c | ||
3149 | @@ -336,23 +336,34 @@ static struct stub_priv *stub_priv_alloc(struct stub_device *sdev, | ||
3150 | return priv; | ||
3151 | } | ||
3152 | |||
3153 | -static int get_pipe(struct stub_device *sdev, int epnum, int dir) | ||
3154 | +static int get_pipe(struct stub_device *sdev, struct usbip_header *pdu) | ||
3155 | { | ||
3156 | struct usb_device *udev = sdev->udev; | ||
3157 | struct usb_host_endpoint *ep; | ||
3158 | struct usb_endpoint_descriptor *epd = NULL; | ||
3159 | + int epnum = pdu->base.ep; | ||
3160 | + int dir = pdu->base.direction; | ||
3161 | + | ||
3162 | + if (epnum < 0 || epnum > 15) | ||
3163 | + goto err_ret; | ||
3164 | |||
3165 | if (dir == USBIP_DIR_IN) | ||
3166 | ep = udev->ep_in[epnum & 0x7f]; | ||
3167 | else | ||
3168 | ep = udev->ep_out[epnum & 0x7f]; | ||
3169 | - if (!ep) { | ||
3170 | - dev_err(&sdev->udev->dev, "no such endpoint?, %d\n", | ||
3171 | - epnum); | ||
3172 | - BUG(); | ||
3173 | - } | ||
3174 | + if (!ep) | ||
3175 | + goto err_ret; | ||
3176 | |||
3177 | epd = &ep->desc; | ||
3178 | + | ||
3179 | + /* validate transfer_buffer_length */ | ||
3180 | + if (pdu->u.cmd_submit.transfer_buffer_length > INT_MAX) { | ||
3181 | + dev_err(&sdev->udev->dev, | ||
3182 | + "CMD_SUBMIT: -EMSGSIZE transfer_buffer_length %d\n", | ||
3183 | + pdu->u.cmd_submit.transfer_buffer_length); | ||
3184 | + return -1; | ||
3185 | + } | ||
3186 | + | ||
3187 | if (usb_endpoint_xfer_control(epd)) { | ||
3188 | if (dir == USBIP_DIR_OUT) | ||
3189 | return usb_sndctrlpipe(udev, epnum); | ||
3190 | @@ -375,15 +386,31 @@ static int get_pipe(struct stub_device *sdev, int epnum, int dir) | ||
3191 | } | ||
3192 | |||
3193 | if (usb_endpoint_xfer_isoc(epd)) { | ||
3194 | + /* validate packet size and number of packets */ | ||
3195 | + unsigned int maxp, packets, bytes; | ||
3196 | + | ||
3197 | + maxp = usb_endpoint_maxp(epd); | ||
3198 | + maxp *= usb_endpoint_maxp_mult(epd); | ||
3199 | + bytes = pdu->u.cmd_submit.transfer_buffer_length; | ||
3200 | + packets = DIV_ROUND_UP(bytes, maxp); | ||
3201 | + | ||
3202 | + if (pdu->u.cmd_submit.number_of_packets < 0 || | ||
3203 | + pdu->u.cmd_submit.number_of_packets > packets) { | ||
3204 | + dev_err(&sdev->udev->dev, | ||
3205 | + "CMD_SUBMIT: isoc invalid num packets %d\n", | ||
3206 | + pdu->u.cmd_submit.number_of_packets); | ||
3207 | + return -1; | ||
3208 | + } | ||
3209 | if (dir == USBIP_DIR_OUT) | ||
3210 | return usb_sndisocpipe(udev, epnum); | ||
3211 | else | ||
3212 | return usb_rcvisocpipe(udev, epnum); | ||
3213 | } | ||
3214 | |||
3215 | +err_ret: | ||
3216 | /* NOT REACHED */ | ||
3217 | - dev_err(&sdev->udev->dev, "get pipe, epnum %d\n", epnum); | ||
3218 | - return 0; | ||
3219 | + dev_err(&sdev->udev->dev, "CMD_SUBMIT: invalid epnum %d\n", epnum); | ||
3220 | + return -1; | ||
3221 | } | ||
3222 | |||
3223 | static void masking_bogus_flags(struct urb *urb) | ||
3224 | @@ -447,7 +474,10 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, | ||
3225 | struct stub_priv *priv; | ||
3226 | struct usbip_device *ud = &sdev->ud; | ||
3227 | struct usb_device *udev = sdev->udev; | ||
3228 | - int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction); | ||
3229 | + int pipe = get_pipe(sdev, pdu); | ||
3230 | + | ||
3231 | + if (pipe == -1) | ||
3232 | + return; | ||
3233 | |||
3234 | priv = stub_priv_alloc(sdev, pdu); | ||
3235 | if (!priv) | ||
3236 | @@ -466,7 +496,8 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, | ||
3237 | } | ||
3238 | |||
3239 | /* allocate urb transfer buffer, if needed */ | ||
3240 | - if (pdu->u.cmd_submit.transfer_buffer_length > 0) { | ||
3241 | + if (pdu->u.cmd_submit.transfer_buffer_length > 0 && | ||
3242 | + pdu->u.cmd_submit.transfer_buffer_length <= INT_MAX) { | ||
3243 | priv->urb->transfer_buffer = | ||
3244 | kzalloc(pdu->u.cmd_submit.transfer_buffer_length, | ||
3245 | GFP_KERNEL); | ||
3246 | diff --git a/drivers/usb/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c | ||
3247 | index be50cef645d8..87ff94be4235 100644 | ||
3248 | --- a/drivers/usb/usbip/stub_tx.c | ||
3249 | +++ b/drivers/usb/usbip/stub_tx.c | ||
3250 | @@ -181,6 +181,13 @@ static int stub_send_ret_submit(struct stub_device *sdev) | ||
3251 | memset(&pdu_header, 0, sizeof(pdu_header)); | ||
3252 | memset(&msg, 0, sizeof(msg)); | ||
3253 | |||
3254 | + if (urb->actual_length > 0 && !urb->transfer_buffer) { | ||
3255 | + dev_err(&sdev->udev->dev, | ||
3256 | + "urb: actual_length %d transfer_buffer null\n", | ||
3257 | + urb->actual_length); | ||
3258 | + return -1; | ||
3259 | + } | ||
3260 | + | ||
3261 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) | ||
3262 | iovnum = 2 + urb->number_of_packets; | ||
3263 | else | ||
3264 | diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h | ||
3265 | index 3050fc99a417..33737b612b1f 100644 | ||
3266 | --- a/drivers/usb/usbip/usbip_common.h | ||
3267 | +++ b/drivers/usb/usbip/usbip_common.h | ||
3268 | @@ -270,6 +270,7 @@ struct usbip_device { | ||
3269 | /* lock for status */ | ||
3270 | spinlock_t lock; | ||
3271 | |||
3272 | + int sockfd; | ||
3273 | struct socket *tcp_socket; | ||
3274 | |||
3275 | struct task_struct *tcp_rx; | ||
3276 | diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c | ||
3277 | index 1b9f60a22e0b..84df63e3130d 100644 | ||
3278 | --- a/drivers/usb/usbip/vhci_sysfs.c | ||
3279 | +++ b/drivers/usb/usbip/vhci_sysfs.c | ||
3280 | @@ -31,15 +31,20 @@ | ||
3281 | |||
3282 | /* | ||
3283 | * output example: | ||
3284 | - * hub port sta spd dev socket local_busid | ||
3285 | - * hs 0000 004 000 00000000 c5a7bb80 1-2.3 | ||
3286 | + * hub port sta spd dev sockfd local_busid | ||
3287 | + * hs 0000 004 000 00000000 3 1-2.3 | ||
3288 | * ................................................ | ||
3289 | - * ss 0008 004 000 00000000 d8cee980 2-3.4 | ||
3290 | + * ss 0008 004 000 00000000 4 2-3.4 | ||
3291 | * ................................................ | ||
3292 | * | ||
3293 | - * IP address can be retrieved from a socket pointer address by looking | ||
3294 | - * up /proc/net/{tcp,tcp6}. Also, a userland program may remember a | ||
3295 | - * port number and its peer IP address. | ||
3296 | + * Output includes socket fd instead of socket pointer address to avoid | ||
3297 | + * leaking kernel memory address in: | ||
3298 | + * /sys/devices/platform/vhci_hcd.0/status and in debug output. | ||
3299 | + * The socket pointer address is not used at the moment and it was made | ||
3300 | + * visible as a convenient way to find IP address from socket pointer | ||
3301 | + * address by looking up /proc/net/{tcp,tcp6}. As this opens a security | ||
3302 | + * hole, the change is made to use sockfd instead. | ||
3303 | + * | ||
3304 | */ | ||
3305 | static void port_show_vhci(char **out, int hub, int port, struct vhci_device *vdev) | ||
3306 | { | ||
3307 | @@ -53,8 +58,8 @@ static void port_show_vhci(char **out, int hub, int port, struct vhci_device *vd | ||
3308 | if (vdev->ud.status == VDEV_ST_USED) { | ||
3309 | *out += sprintf(*out, "%03u %08x ", | ||
3310 | vdev->speed, vdev->devid); | ||
3311 | - *out += sprintf(*out, "%16p %s", | ||
3312 | - vdev->ud.tcp_socket, | ||
3313 | + *out += sprintf(*out, "%u %s", | ||
3314 | + vdev->ud.sockfd, | ||
3315 | dev_name(&vdev->udev->dev)); | ||
3316 | |||
3317 | } else { | ||
3318 | @@ -174,7 +179,8 @@ static ssize_t nports_show(struct device *dev, struct device_attribute *attr, | ||
3319 | char *s = out; | ||
3320 | |||
3321 | /* | ||
3322 | - * Half the ports are for SPEED_HIGH and half for SPEED_SUPER, thus the * 2. | ||
3323 | + * Half the ports are for SPEED_HIGH and half for SPEED_SUPER, | ||
3324 | + * thus the * 2. | ||
3325 | */ | ||
3326 | out += sprintf(out, "%d\n", VHCI_PORTS * vhci_num_controllers); | ||
3327 | return out - s; | ||
3328 | @@ -380,6 +386,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, | ||
3329 | |||
3330 | vdev->devid = devid; | ||
3331 | vdev->speed = speed; | ||
3332 | + vdev->ud.sockfd = sockfd; | ||
3333 | vdev->ud.tcp_socket = socket; | ||
3334 | vdev->ud.status = VDEV_ST_NOTASSIGNED; | ||
3335 | |||
3336 | diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c | ||
3337 | index 5f04b4096c42..6c542d0ca076 100644 | ||
3338 | --- a/drivers/video/fbdev/au1200fb.c | ||
3339 | +++ b/drivers/video/fbdev/au1200fb.c | ||
3340 | @@ -1681,8 +1681,10 @@ static int au1200fb_drv_probe(struct platform_device *dev) | ||
3341 | |||
3342 | fbi = framebuffer_alloc(sizeof(struct au1200fb_device), | ||
3343 | &dev->dev); | ||
3344 | - if (!fbi) | ||
3345 | + if (!fbi) { | ||
3346 | + ret = -ENOMEM; | ||
3347 | goto failed; | ||
3348 | + } | ||
3349 | |||
3350 | _au1200fb_infos[plane] = fbi; | ||
3351 | fbdev = fbi->par; | ||
3352 | @@ -1701,7 +1703,8 @@ static int au1200fb_drv_probe(struct platform_device *dev) | ||
3353 | if (!fbdev->fb_mem) { | ||
3354 | print_err("fail to allocate frambuffer (size: %dK))", | ||
3355 | fbdev->fb_len / 1024); | ||
3356 | - return -ENOMEM; | ||
3357 | + ret = -ENOMEM; | ||
3358 | + goto failed; | ||
3359 | } | ||
3360 | |||
3361 | /* | ||
3362 | diff --git a/drivers/video/fbdev/controlfb.h b/drivers/video/fbdev/controlfb.h | ||
3363 | index 6026c60fc100..261522fabdac 100644 | ||
3364 | --- a/drivers/video/fbdev/controlfb.h | ||
3365 | +++ b/drivers/video/fbdev/controlfb.h | ||
3366 | @@ -141,5 +141,7 @@ static struct max_cmodes control_mac_modes[] = { | ||
3367 | {{ 1, 2}}, /* 1152x870, 75Hz */ | ||
3368 | {{ 0, 1}}, /* 1280x960, 75Hz */ | ||
3369 | {{ 0, 1}}, /* 1280x1024, 75Hz */ | ||
3370 | + {{ 1, 2}}, /* 1152x768, 60Hz */ | ||
3371 | + {{ 0, 1}}, /* 1600x1024, 60Hz */ | ||
3372 | }; | ||
3373 | |||
3374 | diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c | ||
3375 | index ef08a104fb42..d44f14242016 100644 | ||
3376 | --- a/drivers/video/fbdev/udlfb.c | ||
3377 | +++ b/drivers/video/fbdev/udlfb.c | ||
3378 | @@ -769,11 +769,11 @@ static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len) | ||
3379 | |||
3380 | for (i = 0; i < len; i++) { | ||
3381 | ret = usb_control_msg(dev->udev, | ||
3382 | - usb_rcvctrlpipe(dev->udev, 0), (0x02), | ||
3383 | - (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, | ||
3384 | - HZ); | ||
3385 | - if (ret < 1) { | ||
3386 | - pr_err("Read EDID byte %d failed err %x\n", i, ret); | ||
3387 | + usb_rcvctrlpipe(dev->udev, 0), 0x02, | ||
3388 | + (0x80 | (0x02 << 5)), i << 8, 0xA1, | ||
3389 | + rbuf, 2, USB_CTRL_GET_TIMEOUT); | ||
3390 | + if (ret < 2) { | ||
3391 | + pr_err("Read EDID byte %d failed: %d\n", i, ret); | ||
3392 | i--; | ||
3393 | break; | ||
3394 | } | ||
3395 | diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c | ||
3396 | index 8fc41705c7cd..961a12dc6dc8 100644 | ||
3397 | --- a/fs/autofs4/waitq.c | ||
3398 | +++ b/fs/autofs4/waitq.c | ||
3399 | @@ -170,7 +170,6 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | ||
3400 | |||
3401 | mutex_unlock(&sbi->wq_mutex); | ||
3402 | |||
3403 | - if (autofs4_write(sbi, pipe, &pkt, pktsz)) | ||
3404 | switch (ret = autofs4_write(sbi, pipe, &pkt, pktsz)) { | ||
3405 | case 0: | ||
3406 | break; | ||
3407 | diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c | ||
3408 | index 6c7a49faf4e0..1f1338d52303 100644 | ||
3409 | --- a/fs/btrfs/ioctl.c | ||
3410 | +++ b/fs/btrfs/ioctl.c | ||
3411 | @@ -1842,8 +1842,13 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | ||
3412 | |||
3413 | ret = btrfs_update_root(trans, fs_info->tree_root, | ||
3414 | &root->root_key, &root->root_item); | ||
3415 | + if (ret < 0) { | ||
3416 | + btrfs_end_transaction(trans); | ||
3417 | + goto out_reset; | ||
3418 | + } | ||
3419 | + | ||
3420 | + ret = btrfs_commit_transaction(trans); | ||
3421 | |||
3422 | - btrfs_commit_transaction(trans); | ||
3423 | out_reset: | ||
3424 | if (ret) | ||
3425 | btrfs_set_root_flags(&root->root_item, root_flags); | ||
3426 | diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c | ||
3427 | index 161694b66038..e8f5e24325f3 100644 | ||
3428 | --- a/fs/btrfs/super.c | ||
3429 | +++ b/fs/btrfs/super.c | ||
3430 | @@ -202,7 +202,6 @@ static struct ratelimit_state printk_limits[] = { | ||
3431 | |||
3432 | void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...) | ||
3433 | { | ||
3434 | - struct super_block *sb = fs_info->sb; | ||
3435 | char lvl[PRINTK_MAX_SINGLE_HEADER_LEN + 1] = "\0"; | ||
3436 | struct va_format vaf; | ||
3437 | va_list args; | ||
3438 | @@ -228,7 +227,8 @@ void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...) | ||
3439 | vaf.va = &args; | ||
3440 | |||
3441 | if (__ratelimit(ratelimit)) | ||
3442 | - printk("%sBTRFS %s (device %s): %pV\n", lvl, type, sb->s_id, &vaf); | ||
3443 | + printk("%sBTRFS %s (device %s): %pV\n", lvl, type, | ||
3444 | + fs_info ? fs_info->sb->s_id : "<unknown>", &vaf); | ||
3445 | |||
3446 | va_end(args); | ||
3447 | } | ||
3448 | diff --git a/fs/btrfs/tests/free-space-tree-tests.c b/fs/btrfs/tests/free-space-tree-tests.c | ||
3449 | index 1458bb0ea124..8444a018cca2 100644 | ||
3450 | --- a/fs/btrfs/tests/free-space-tree-tests.c | ||
3451 | +++ b/fs/btrfs/tests/free-space-tree-tests.c | ||
3452 | @@ -500,7 +500,8 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize, | ||
3453 | path = btrfs_alloc_path(); | ||
3454 | if (!path) { | ||
3455 | test_msg("Couldn't allocate path\n"); | ||
3456 | - return -ENOMEM; | ||
3457 | + ret = -ENOMEM; | ||
3458 | + goto out; | ||
3459 | } | ||
3460 | |||
3461 | ret = add_block_group_free_space(&trans, root->fs_info, cache); | ||
3462 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c | ||
3463 | index b39737568c22..0c11121a8ace 100644 | ||
3464 | --- a/fs/btrfs/volumes.c | ||
3465 | +++ b/fs/btrfs/volumes.c | ||
3466 | @@ -2501,6 +2501,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path | ||
3467 | return ret; | ||
3468 | |||
3469 | error_trans: | ||
3470 | + if (seeding_dev) | ||
3471 | + sb->s_flags |= MS_RDONLY; | ||
3472 | btrfs_end_transaction(trans); | ||
3473 | rcu_string_free(device->name); | ||
3474 | btrfs_sysfs_rm_device_link(fs_info->fs_devices, device); | ||
3475 | @@ -6144,7 +6146,10 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical) | ||
3476 | |||
3477 | btrfs_io_bio(bio)->mirror_num = bbio->mirror_num; | ||
3478 | bio->bi_iter.bi_sector = logical >> 9; | ||
3479 | - bio->bi_status = BLK_STS_IOERR; | ||
3480 | + if (atomic_read(&bbio->error) > bbio->max_errors) | ||
3481 | + bio->bi_status = BLK_STS_IOERR; | ||
3482 | + else | ||
3483 | + bio->bi_status = BLK_STS_OK; | ||
3484 | btrfs_end_bbio(bbio, bio); | ||
3485 | } | ||
3486 | } | ||
3487 | diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c | ||
3488 | index 0687ab3c3267..bf378ddca4db 100644 | ||
3489 | --- a/fs/ceph/mds_client.c | ||
3490 | +++ b/fs/ceph/mds_client.c | ||
3491 | @@ -1428,6 +1428,29 @@ static int __close_session(struct ceph_mds_client *mdsc, | ||
3492 | return request_close_session(mdsc, session); | ||
3493 | } | ||
3494 | |||
3495 | +static bool drop_negative_children(struct dentry *dentry) | ||
3496 | +{ | ||
3497 | + struct dentry *child; | ||
3498 | + bool all_negative = true; | ||
3499 | + | ||
3500 | + if (!d_is_dir(dentry)) | ||
3501 | + goto out; | ||
3502 | + | ||
3503 | + spin_lock(&dentry->d_lock); | ||
3504 | + list_for_each_entry(child, &dentry->d_subdirs, d_child) { | ||
3505 | + if (d_really_is_positive(child)) { | ||
3506 | + all_negative = false; | ||
3507 | + break; | ||
3508 | + } | ||
3509 | + } | ||
3510 | + spin_unlock(&dentry->d_lock); | ||
3511 | + | ||
3512 | + if (all_negative) | ||
3513 | + shrink_dcache_parent(dentry); | ||
3514 | +out: | ||
3515 | + return all_negative; | ||
3516 | +} | ||
3517 | + | ||
3518 | /* | ||
3519 | * Trim old(er) caps. | ||
3520 | * | ||
3521 | @@ -1473,16 +1496,27 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | ||
3522 | if ((used | wanted) & ~oissued & mine) | ||
3523 | goto out; /* we need these caps */ | ||
3524 | |||
3525 | - session->s_trim_caps--; | ||
3526 | if (oissued) { | ||
3527 | /* we aren't the only cap.. just remove us */ | ||
3528 | __ceph_remove_cap(cap, true); | ||
3529 | + session->s_trim_caps--; | ||
3530 | } else { | ||
3531 | + struct dentry *dentry; | ||
3532 | /* try dropping referring dentries */ | ||
3533 | spin_unlock(&ci->i_ceph_lock); | ||
3534 | - d_prune_aliases(inode); | ||
3535 | - dout("trim_caps_cb %p cap %p pruned, count now %d\n", | ||
3536 | - inode, cap, atomic_read(&inode->i_count)); | ||
3537 | + dentry = d_find_any_alias(inode); | ||
3538 | + if (dentry && drop_negative_children(dentry)) { | ||
3539 | + int count; | ||
3540 | + dput(dentry); | ||
3541 | + d_prune_aliases(inode); | ||
3542 | + count = atomic_read(&inode->i_count); | ||
3543 | + if (count == 1) | ||
3544 | + session->s_trim_caps--; | ||
3545 | + dout("trim_caps_cb %p cap %p pruned, count now %d\n", | ||
3546 | + inode, cap, count); | ||
3547 | + } else { | ||
3548 | + dput(dentry); | ||
3549 | + } | ||
3550 | return 0; | ||
3551 | } | ||
3552 | |||
3553 | diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c | ||
3554 | index 5331631386a2..01346b8b6edb 100644 | ||
3555 | --- a/fs/cifs/smb2pdu.c | ||
3556 | +++ b/fs/cifs/smb2pdu.c | ||
3557 | @@ -2678,27 +2678,27 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, | ||
3558 | cifs_small_buf_release(req); | ||
3559 | |||
3560 | rsp = (struct smb2_read_rsp *)rsp_iov.iov_base; | ||
3561 | - shdr = get_sync_hdr(rsp); | ||
3562 | |||
3563 | - if (shdr->Status == STATUS_END_OF_FILE) { | ||
3564 | + if (rc) { | ||
3565 | + if (rc != -ENODATA) { | ||
3566 | + cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE); | ||
3567 | + cifs_dbg(VFS, "Send error in read = %d\n", rc); | ||
3568 | + } | ||
3569 | free_rsp_buf(resp_buftype, rsp_iov.iov_base); | ||
3570 | - return 0; | ||
3571 | + return rc == -ENODATA ? 0 : rc; | ||
3572 | } | ||
3573 | |||
3574 | - if (rc) { | ||
3575 | - cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE); | ||
3576 | - cifs_dbg(VFS, "Send error in read = %d\n", rc); | ||
3577 | - } else { | ||
3578 | - *nbytes = le32_to_cpu(rsp->DataLength); | ||
3579 | - if ((*nbytes > CIFS_MAX_MSGSIZE) || | ||
3580 | - (*nbytes > io_parms->length)) { | ||
3581 | - cifs_dbg(FYI, "bad length %d for count %d\n", | ||
3582 | - *nbytes, io_parms->length); | ||
3583 | - rc = -EIO; | ||
3584 | - *nbytes = 0; | ||
3585 | - } | ||
3586 | + *nbytes = le32_to_cpu(rsp->DataLength); | ||
3587 | + if ((*nbytes > CIFS_MAX_MSGSIZE) || | ||
3588 | + (*nbytes > io_parms->length)) { | ||
3589 | + cifs_dbg(FYI, "bad length %d for count %d\n", | ||
3590 | + *nbytes, io_parms->length); | ||
3591 | + rc = -EIO; | ||
3592 | + *nbytes = 0; | ||
3593 | } | ||
3594 | |||
3595 | + shdr = get_sync_hdr(rsp); | ||
3596 | + | ||
3597 | if (*buf) { | ||
3598 | memcpy(*buf, (char *)shdr + rsp->DataOffset, *nbytes); | ||
3599 | free_rsp_buf(resp_buftype, rsp_iov.iov_base); | ||
3600 | diff --git a/fs/exec.c b/fs/exec.c | ||
3601 | index 4726c777dd38..3e14ba25f678 100644 | ||
3602 | --- a/fs/exec.c | ||
3603 | +++ b/fs/exec.c | ||
3604 | @@ -1340,15 +1340,10 @@ void setup_new_exec(struct linux_binprm * bprm) | ||
3605 | * avoid bad behavior from the prior rlimits. This has to | ||
3606 | * happen before arch_pick_mmap_layout(), which examines | ||
3607 | * RLIMIT_STACK, but after the point of no return to avoid | ||
3608 | - * races from other threads changing the limits. This also | ||
3609 | - * must be protected from races with prlimit() calls. | ||
3610 | + * needing to clean up the change on failure. | ||
3611 | */ | ||
3612 | - task_lock(current->group_leader); | ||
3613 | if (current->signal->rlim[RLIMIT_STACK].rlim_cur > _STK_LIM) | ||
3614 | current->signal->rlim[RLIMIT_STACK].rlim_cur = _STK_LIM; | ||
3615 | - if (current->signal->rlim[RLIMIT_STACK].rlim_max > _STK_LIM) | ||
3616 | - current->signal->rlim[RLIMIT_STACK].rlim_max = _STK_LIM; | ||
3617 | - task_unlock(current->group_leader); | ||
3618 | } | ||
3619 | |||
3620 | arch_pick_mmap_layout(current->mm); | ||
3621 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c | ||
3622 | index 07bca11749d4..c941251ac0c0 100644 | ||
3623 | --- a/fs/ext4/extents.c | ||
3624 | +++ b/fs/ext4/extents.c | ||
3625 | @@ -4722,6 +4722,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, | ||
3626 | EXT4_INODE_EOFBLOCKS); | ||
3627 | } | ||
3628 | ext4_mark_inode_dirty(handle, inode); | ||
3629 | + ext4_update_inode_fsync_trans(handle, inode, 1); | ||
3630 | ret2 = ext4_journal_stop(handle); | ||
3631 | if (ret2) | ||
3632 | break; | ||
3633 | diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c | ||
3634 | index c5f697a3fad4..207588dc803e 100644 | ||
3635 | --- a/fs/ext4/ialloc.c | ||
3636 | +++ b/fs/ext4/ialloc.c | ||
3637 | @@ -816,6 +816,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, | ||
3638 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | ||
3639 | struct posix_acl *p = get_acl(dir, ACL_TYPE_DEFAULT); | ||
3640 | |||
3641 | + if (IS_ERR(p)) | ||
3642 | + return ERR_CAST(p); | ||
3643 | if (p) { | ||
3644 | int acl_size = p->a_count * sizeof(ext4_acl_entry); | ||
3645 | |||
3646 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c | ||
3647 | index 38eb621edd80..ea2ccc524bd9 100644 | ||
3648 | --- a/fs/ext4/inode.c | ||
3649 | +++ b/fs/ext4/inode.c | ||
3650 | @@ -149,6 +149,15 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks, | ||
3651 | */ | ||
3652 | int ext4_inode_is_fast_symlink(struct inode *inode) | ||
3653 | { | ||
3654 | + if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) { | ||
3655 | + int ea_blocks = EXT4_I(inode)->i_file_acl ? | ||
3656 | + EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0; | ||
3657 | + | ||
3658 | + if (ext4_has_inline_data(inode)) | ||
3659 | + return 0; | ||
3660 | + | ||
3661 | + return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0); | ||
3662 | + } | ||
3663 | return S_ISLNK(inode->i_mode) && inode->i_size && | ||
3664 | (inode->i_size < EXT4_N_BLOCKS * 4); | ||
3665 | } | ||
3666 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c | ||
3667 | index bd48a8d83961..fccf295fcb03 100644 | ||
3668 | --- a/fs/ext4/namei.c | ||
3669 | +++ b/fs/ext4/namei.c | ||
3670 | @@ -1399,6 +1399,10 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, | ||
3671 | "falling back\n")); | ||
3672 | } | ||
3673 | nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb); | ||
3674 | + if (!nblocks) { | ||
3675 | + ret = NULL; | ||
3676 | + goto cleanup_and_exit; | ||
3677 | + } | ||
3678 | start = EXT4_I(dir)->i_dir_start_lookup; | ||
3679 | if (start >= nblocks) | ||
3680 | start = 0; | ||
3681 | diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c | ||
3682 | index 33a0cb5701a3..2a29cf3371f6 100644 | ||
3683 | --- a/fs/gfs2/file.c | ||
3684 | +++ b/fs/gfs2/file.c | ||
3685 | @@ -256,7 +256,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | ||
3686 | goto out; | ||
3687 | } | ||
3688 | if ((flags ^ new_flags) & GFS2_DIF_JDATA) { | ||
3689 | - if (flags & GFS2_DIF_JDATA) | ||
3690 | + if (new_flags & GFS2_DIF_JDATA) | ||
3691 | gfs2_log_flush(sdp, ip->i_gl, NORMAL_FLUSH); | ||
3692 | error = filemap_fdatawrite(inode->i_mapping); | ||
3693 | if (error) | ||
3694 | @@ -264,6 +264,8 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | ||
3695 | error = filemap_fdatawait(inode->i_mapping); | ||
3696 | if (error) | ||
3697 | goto out; | ||
3698 | + if (new_flags & GFS2_DIF_JDATA) | ||
3699 | + gfs2_ordered_del_inode(ip); | ||
3700 | } | ||
3701 | error = gfs2_trans_begin(sdp, RES_DINODE, 0); | ||
3702 | if (error) | ||
3703 | diff --git a/fs/nfs/write.c b/fs/nfs/write.c | ||
3704 | index babebbccae2a..de325804941d 100644 | ||
3705 | --- a/fs/nfs/write.c | ||
3706 | +++ b/fs/nfs/write.c | ||
3707 | @@ -1889,6 +1889,8 @@ int nfs_commit_inode(struct inode *inode, int how) | ||
3708 | if (res) | ||
3709 | error = nfs_generic_commit_list(inode, &head, how, &cinfo); | ||
3710 | nfs_commit_end(cinfo.mds); | ||
3711 | + if (res == 0) | ||
3712 | + return res; | ||
3713 | if (error < 0) | ||
3714 | goto out_error; | ||
3715 | if (!may_wait) | ||
3716 | diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c | ||
3717 | index 697f8ae7792d..f650e475d8f0 100644 | ||
3718 | --- a/fs/nfsd/auth.c | ||
3719 | +++ b/fs/nfsd/auth.c | ||
3720 | @@ -60,6 +60,9 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) | ||
3721 | gi->gid[i] = exp->ex_anon_gid; | ||
3722 | else | ||
3723 | gi->gid[i] = rqgi->gid[i]; | ||
3724 | + | ||
3725 | + /* Each thread allocates its own gi, no race */ | ||
3726 | + groups_sort(gi); | ||
3727 | } | ||
3728 | } else { | ||
3729 | gi = get_group_info(rqgi); | ||
3730 | diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c | ||
3731 | index bc6d5c5a3443..4bb7e4f53ea6 100644 | ||
3732 | --- a/fs/overlayfs/namei.c | ||
3733 | +++ b/fs/overlayfs/namei.c | ||
3734 | @@ -437,7 +437,7 @@ int ovl_verify_index(struct dentry *index, struct path *lowerstack, | ||
3735 | |||
3736 | /* Check if index is orphan and don't warn before cleaning it */ | ||
3737 | if (d_inode(index)->i_nlink == 1 && | ||
3738 | - ovl_get_nlink(index, origin.dentry, 0) == 0) | ||
3739 | + ovl_get_nlink(origin.dentry, index, 0) == 0) | ||
3740 | err = -ENOENT; | ||
3741 | |||
3742 | dput(origin.dentry); | ||
3743 | diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c | ||
3744 | index 698b74dd750e..b2c7f33e08fc 100644 | ||
3745 | --- a/fs/overlayfs/readdir.c | ||
3746 | +++ b/fs/overlayfs/readdir.c | ||
3747 | @@ -645,7 +645,10 @@ static int ovl_iterate_real(struct file *file, struct dir_context *ctx) | ||
3748 | return PTR_ERR(rdt.cache); | ||
3749 | } | ||
3750 | |||
3751 | - return iterate_dir(od->realfile, &rdt.ctx); | ||
3752 | + err = iterate_dir(od->realfile, &rdt.ctx); | ||
3753 | + ctx->pos = rdt.ctx.pos; | ||
3754 | + | ||
3755 | + return err; | ||
3756 | } | ||
3757 | |||
3758 | |||
3759 | diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c | ||
3760 | index 2da657848cfc..d0cf1c50bb6c 100644 | ||
3761 | --- a/fs/proc/proc_tty.c | ||
3762 | +++ b/fs/proc/proc_tty.c | ||
3763 | @@ -15,6 +15,7 @@ | ||
3764 | #include <linux/tty.h> | ||
3765 | #include <linux/seq_file.h> | ||
3766 | #include <linux/bitops.h> | ||
3767 | +#include "internal.h" | ||
3768 | |||
3769 | /* | ||
3770 | * The /proc/tty directory inodes... | ||
3771 | @@ -165,7 +166,7 @@ void proc_tty_unregister_driver(struct tty_driver *driver) | ||
3772 | if (!ent) | ||
3773 | return; | ||
3774 | |||
3775 | - remove_proc_entry(driver->driver_name, proc_tty_driver); | ||
3776 | + remove_proc_entry(ent->name, proc_tty_driver); | ||
3777 | |||
3778 | driver->proc_entry = NULL; | ||
3779 | } | ||
3780 | diff --git a/fs/udf/super.c b/fs/udf/super.c | ||
3781 | index 99cb81d0077f..08bf097507f6 100644 | ||
3782 | --- a/fs/udf/super.c | ||
3783 | +++ b/fs/udf/super.c | ||
3784 | @@ -703,7 +703,7 @@ static loff_t udf_check_vsd(struct super_block *sb) | ||
3785 | else | ||
3786 | sectorsize = sb->s_blocksize; | ||
3787 | |||
3788 | - sector += (sbi->s_session << sb->s_blocksize_bits); | ||
3789 | + sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits); | ||
3790 | |||
3791 | udf_debug("Starting at sector %u (%ld byte sectors)\n", | ||
3792 | (unsigned int)(sector >> sb->s_blocksize_bits), | ||
3793 | diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c | ||
3794 | index 89263797cf32..a3cc8afed367 100644 | ||
3795 | --- a/fs/xfs/libxfs/xfs_bmap.c | ||
3796 | +++ b/fs/xfs/libxfs/xfs_bmap.c | ||
3797 | @@ -2560,7 +2560,7 @@ xfs_bmap_add_extent_unwritten_real( | ||
3798 | &i))) | ||
3799 | goto done; | ||
3800 | XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done); | ||
3801 | - cur->bc_rec.b.br_state = XFS_EXT_NORM; | ||
3802 | + cur->bc_rec.b.br_state = new->br_state; | ||
3803 | if ((error = xfs_btree_insert(cur, &i))) | ||
3804 | goto done; | ||
3805 | XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done); | ||
3806 | diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c | ||
3807 | index 34227115a5d6..43005fbe8b1e 100644 | ||
3808 | --- a/fs/xfs/xfs_icache.c | ||
3809 | +++ b/fs/xfs/xfs_icache.c | ||
3810 | @@ -610,7 +610,7 @@ xfs_iget( | ||
3811 | } else { | ||
3812 | rcu_read_unlock(); | ||
3813 | if (flags & XFS_IGET_INCORE) { | ||
3814 | - error = -ENOENT; | ||
3815 | + error = -ENODATA; | ||
3816 | goto out_error_or_again; | ||
3817 | } | ||
3818 | XFS_STATS_INC(mp, xs_ig_missed); | ||
3819 | diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c | ||
3820 | index 17081c77ef86..f24e5b6cfc86 100644 | ||
3821 | --- a/fs/xfs/xfs_iops.c | ||
3822 | +++ b/fs/xfs/xfs_iops.c | ||
3823 | @@ -885,22 +885,6 @@ xfs_setattr_size( | ||
3824 | if (error) | ||
3825 | return error; | ||
3826 | |||
3827 | - /* | ||
3828 | - * We are going to log the inode size change in this transaction so | ||
3829 | - * any previous writes that are beyond the on disk EOF and the new | ||
3830 | - * EOF that have not been written out need to be written here. If we | ||
3831 | - * do not write the data out, we expose ourselves to the null files | ||
3832 | - * problem. Note that this includes any block zeroing we did above; | ||
3833 | - * otherwise those blocks may not be zeroed after a crash. | ||
3834 | - */ | ||
3835 | - if (did_zeroing || | ||
3836 | - (newsize > ip->i_d.di_size && oldsize != ip->i_d.di_size)) { | ||
3837 | - error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | ||
3838 | - ip->i_d.di_size, newsize); | ||
3839 | - if (error) | ||
3840 | - return error; | ||
3841 | - } | ||
3842 | - | ||
3843 | /* | ||
3844 | * We've already locked out new page faults, so now we can safely remove | ||
3845 | * pages from the page cache knowing they won't get refaulted until we | ||
3846 | @@ -917,9 +901,29 @@ xfs_setattr_size( | ||
3847 | * user visible changes). There's not much we can do about this, except | ||
3848 | * to hope that the caller sees ENOMEM and retries the truncate | ||
3849 | * operation. | ||
3850 | + * | ||
3851 | + * And we update in-core i_size and truncate page cache beyond newsize | ||
3852 | + * before writeback the [di_size, newsize] range, so we're guaranteed | ||
3853 | + * not to write stale data past the new EOF on truncate down. | ||
3854 | */ | ||
3855 | truncate_setsize(inode, newsize); | ||
3856 | |||
3857 | + /* | ||
3858 | + * We are going to log the inode size change in this transaction so | ||
3859 | + * any previous writes that are beyond the on disk EOF and the new | ||
3860 | + * EOF that have not been written out need to be written here. If we | ||
3861 | + * do not write the data out, we expose ourselves to the null files | ||
3862 | + * problem. Note that this includes any block zeroing we did above; | ||
3863 | + * otherwise those blocks may not be zeroed after a crash. | ||
3864 | + */ | ||
3865 | + if (did_zeroing || | ||
3866 | + (newsize > ip->i_d.di_size && oldsize != ip->i_d.di_size)) { | ||
3867 | + error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | ||
3868 | + ip->i_d.di_size, newsize - 1); | ||
3869 | + if (error) | ||
3870 | + return error; | ||
3871 | + } | ||
3872 | + | ||
3873 | error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); | ||
3874 | if (error) | ||
3875 | return error; | ||
3876 | diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c | ||
3877 | index ee34899396b2..d6e049fdd977 100644 | ||
3878 | --- a/fs/xfs/xfs_log_recover.c | ||
3879 | +++ b/fs/xfs/xfs_log_recover.c | ||
3880 | @@ -753,7 +753,7 @@ xlog_find_head( | ||
3881 | * in the in-core log. The following number can be made tighter if | ||
3882 | * we actually look at the block size of the filesystem. | ||
3883 | */ | ||
3884 | - num_scan_bblks = XLOG_TOTAL_REC_SHIFT(log); | ||
3885 | + num_scan_bblks = min_t(int, log_bbnum, XLOG_TOTAL_REC_SHIFT(log)); | ||
3886 | if (head_blk >= num_scan_bblks) { | ||
3887 | /* | ||
3888 | * We are guaranteed that the entire check can be performed | ||
3889 | diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h | ||
3890 | index f0b44c16e88f..c2bae8da642c 100644 | ||
3891 | --- a/include/crypto/internal/hash.h | ||
3892 | +++ b/include/crypto/internal/hash.h | ||
3893 | @@ -82,6 +82,14 @@ int ahash_register_instance(struct crypto_template *tmpl, | ||
3894 | struct ahash_instance *inst); | ||
3895 | void ahash_free_instance(struct crypto_instance *inst); | ||
3896 | |||
3897 | +int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, | ||
3898 | + unsigned int keylen); | ||
3899 | + | ||
3900 | +static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg) | ||
3901 | +{ | ||
3902 | + return alg->setkey != shash_no_setkey; | ||
3903 | +} | ||
3904 | + | ||
3905 | int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn, | ||
3906 | struct hash_alg_common *alg, | ||
3907 | struct crypto_instance *inst); | ||
3908 | diff --git a/include/linux/cred.h b/include/linux/cred.h | ||
3909 | index 099058e1178b..631286535d0f 100644 | ||
3910 | --- a/include/linux/cred.h | ||
3911 | +++ b/include/linux/cred.h | ||
3912 | @@ -83,6 +83,7 @@ extern int set_current_groups(struct group_info *); | ||
3913 | extern void set_groups(struct cred *, struct group_info *); | ||
3914 | extern int groups_search(const struct group_info *, kgid_t); | ||
3915 | extern bool may_setgroups(void); | ||
3916 | +extern void groups_sort(struct group_info *); | ||
3917 | |||
3918 | /* | ||
3919 | * The security context of a task | ||
3920 | diff --git a/include/linux/mman.h b/include/linux/mman.h | ||
3921 | index 7c87b6652244..835a6f2fd8d4 100644 | ||
3922 | --- a/include/linux/mman.h | ||
3923 | +++ b/include/linux/mman.h | ||
3924 | @@ -64,8 +64,9 @@ static inline bool arch_validate_prot(unsigned long prot) | ||
3925 | * ("bit1" and "bit2" must be single bits) | ||
3926 | */ | ||
3927 | #define _calc_vm_trans(x, bit1, bit2) \ | ||
3928 | + ((!(bit1) || !(bit2)) ? 0 : \ | ||
3929 | ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \ | ||
3930 | - : ((x) & (bit1)) / ((bit1) / (bit2))) | ||
3931 | + : ((x) & (bit1)) / ((bit1) / (bit2)))) | ||
3932 | |||
3933 | /* | ||
3934 | * Combine the mmap "prot" argument into "vm_flags" used internally. | ||
3935 | diff --git a/include/linux/oom.h b/include/linux/oom.h | ||
3936 | index 01c91d874a57..5bad038ac012 100644 | ||
3937 | --- a/include/linux/oom.h | ||
3938 | +++ b/include/linux/oom.h | ||
3939 | @@ -66,6 +66,15 @@ static inline bool tsk_is_oom_victim(struct task_struct * tsk) | ||
3940 | return tsk->signal->oom_mm; | ||
3941 | } | ||
3942 | |||
3943 | +/* | ||
3944 | + * Use this helper if tsk->mm != mm and the victim mm needs a special | ||
3945 | + * handling. This is guaranteed to stay true after once set. | ||
3946 | + */ | ||
3947 | +static inline bool mm_is_oom_victim(struct mm_struct *mm) | ||
3948 | +{ | ||
3949 | + return test_bit(MMF_OOM_VICTIM, &mm->flags); | ||
3950 | +} | ||
3951 | + | ||
3952 | /* | ||
3953 | * Checks whether a page fault on the given mm is still reliable. | ||
3954 | * This is no longer true if the oom reaper started to reap the | ||
3955 | diff --git a/include/linux/sched/coredump.h b/include/linux/sched/coredump.h | ||
3956 | index 9c8847395b5e..ec912d01126f 100644 | ||
3957 | --- a/include/linux/sched/coredump.h | ||
3958 | +++ b/include/linux/sched/coredump.h | ||
3959 | @@ -70,6 +70,7 @@ static inline int get_dumpable(struct mm_struct *mm) | ||
3960 | #define MMF_UNSTABLE 22 /* mm is unstable for copy_from_user */ | ||
3961 | #define MMF_HUGE_ZERO_PAGE 23 /* mm has ever used the global huge zero page */ | ||
3962 | #define MMF_DISABLE_THP 24 /* disable THP for all VMAs */ | ||
3963 | +#define MMF_OOM_VICTIM 25 /* mm is the oom victim */ | ||
3964 | #define MMF_DISABLE_THP_MASK (1 << MMF_DISABLE_THP) | ||
3965 | |||
3966 | #define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\ | ||
3967 | diff --git a/include/linux/string.h b/include/linux/string.h | ||
3968 | index 410ecf17de3c..cfd83eb2f926 100644 | ||
3969 | --- a/include/linux/string.h | ||
3970 | +++ b/include/linux/string.h | ||
3971 | @@ -259,7 +259,10 @@ __FORTIFY_INLINE __kernel_size_t strlen(const char *p) | ||
3972 | { | ||
3973 | __kernel_size_t ret; | ||
3974 | size_t p_size = __builtin_object_size(p, 0); | ||
3975 | - if (p_size == (size_t)-1) | ||
3976 | + | ||
3977 | + /* Work around gcc excess stack consumption issue */ | ||
3978 | + if (p_size == (size_t)-1 || | ||
3979 | + (__builtin_constant_p(p[p_size - 1]) && p[p_size - 1] == '\0')) | ||
3980 | return __builtin_strlen(p); | ||
3981 | ret = strnlen(p, p_size); | ||
3982 | if (p_size <= ret) | ||
3983 | diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h | ||
3984 | index ec5008cf5d51..b2a10c762304 100644 | ||
3985 | --- a/include/rdma/ib_addr.h | ||
3986 | +++ b/include/rdma/ib_addr.h | ||
3987 | @@ -245,10 +245,11 @@ static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_g | ||
3988 | static inline enum ib_mtu iboe_get_mtu(int mtu) | ||
3989 | { | ||
3990 | /* | ||
3991 | - * reduce IB headers from effective IBoE MTU. 28 stands for | ||
3992 | - * atomic header which is the biggest possible header after BTH | ||
3993 | + * Reduce IB headers from effective IBoE MTU. | ||
3994 | */ | ||
3995 | - mtu = mtu - IB_GRH_BYTES - IB_BTH_BYTES - 28; | ||
3996 | + mtu = mtu - (IB_GRH_BYTES + IB_UDP_BYTES + IB_BTH_BYTES + | ||
3997 | + IB_EXT_XRC_BYTES + IB_EXT_ATOMICETH_BYTES + | ||
3998 | + IB_ICRC_BYTES); | ||
3999 | |||
4000 | if (mtu >= ib_mtu_enum_to_int(IB_MTU_4096)) | ||
4001 | return IB_MTU_4096; | ||
4002 | @@ -305,12 +306,12 @@ static inline void rdma_get_ll_mac(struct in6_addr *addr, u8 *mac) | ||
4003 | |||
4004 | static inline int rdma_is_multicast_addr(struct in6_addr *addr) | ||
4005 | { | ||
4006 | - u32 ipv4_addr; | ||
4007 | + __be32 ipv4_addr; | ||
4008 | |||
4009 | if (addr->s6_addr[0] == 0xff) | ||
4010 | return 1; | ||
4011 | |||
4012 | - memcpy(&ipv4_addr, addr->s6_addr + 12, 4); | ||
4013 | + ipv4_addr = addr->s6_addr32[3]; | ||
4014 | return (ipv6_addr_v4mapped(addr) && ipv4_is_multicast(ipv4_addr)); | ||
4015 | } | ||
4016 | |||
4017 | diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h | ||
4018 | index 36655899ee02..7ea1382ad0e5 100644 | ||
4019 | --- a/include/rdma/ib_pack.h | ||
4020 | +++ b/include/rdma/ib_pack.h | ||
4021 | @@ -37,14 +37,17 @@ | ||
4022 | #include <uapi/linux/if_ether.h> | ||
4023 | |||
4024 | enum { | ||
4025 | - IB_LRH_BYTES = 8, | ||
4026 | - IB_ETH_BYTES = 14, | ||
4027 | - IB_VLAN_BYTES = 4, | ||
4028 | - IB_GRH_BYTES = 40, | ||
4029 | - IB_IP4_BYTES = 20, | ||
4030 | - IB_UDP_BYTES = 8, | ||
4031 | - IB_BTH_BYTES = 12, | ||
4032 | - IB_DETH_BYTES = 8 | ||
4033 | + IB_LRH_BYTES = 8, | ||
4034 | + IB_ETH_BYTES = 14, | ||
4035 | + IB_VLAN_BYTES = 4, | ||
4036 | + IB_GRH_BYTES = 40, | ||
4037 | + IB_IP4_BYTES = 20, | ||
4038 | + IB_UDP_BYTES = 8, | ||
4039 | + IB_BTH_BYTES = 12, | ||
4040 | + IB_DETH_BYTES = 8, | ||
4041 | + IB_EXT_ATOMICETH_BYTES = 28, | ||
4042 | + IB_EXT_XRC_BYTES = 4, | ||
4043 | + IB_ICRC_BYTES = 4 | ||
4044 | }; | ||
4045 | |||
4046 | struct ib_field { | ||
4047 | diff --git a/kernel/groups.c b/kernel/groups.c | ||
4048 | index e357bc800111..daae2f2dc6d4 100644 | ||
4049 | --- a/kernel/groups.c | ||
4050 | +++ b/kernel/groups.c | ||
4051 | @@ -86,11 +86,12 @@ static int gid_cmp(const void *_a, const void *_b) | ||
4052 | return gid_gt(a, b) - gid_lt(a, b); | ||
4053 | } | ||
4054 | |||
4055 | -static void groups_sort(struct group_info *group_info) | ||
4056 | +void groups_sort(struct group_info *group_info) | ||
4057 | { | ||
4058 | sort(group_info->gid, group_info->ngroups, sizeof(*group_info->gid), | ||
4059 | gid_cmp, NULL); | ||
4060 | } | ||
4061 | +EXPORT_SYMBOL(groups_sort); | ||
4062 | |||
4063 | /* a simple bsearch */ | ||
4064 | int groups_search(const struct group_info *group_info, kgid_t grp) | ||
4065 | @@ -122,7 +123,6 @@ int groups_search(const struct group_info *group_info, kgid_t grp) | ||
4066 | void set_groups(struct cred *new, struct group_info *group_info) | ||
4067 | { | ||
4068 | put_group_info(new->group_info); | ||
4069 | - groups_sort(group_info); | ||
4070 | get_group_info(group_info); | ||
4071 | new->group_info = group_info; | ||
4072 | } | ||
4073 | @@ -206,6 +206,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist) | ||
4074 | return retval; | ||
4075 | } | ||
4076 | |||
4077 | + groups_sort(group_info); | ||
4078 | retval = set_current_groups(group_info); | ||
4079 | put_group_info(group_info); | ||
4080 | |||
4081 | diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c | ||
4082 | index ccd2d20e6b06..0685c4499431 100644 | ||
4083 | --- a/kernel/power/suspend.c | ||
4084 | +++ b/kernel/power/suspend.c | ||
4085 | @@ -437,7 +437,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) | ||
4086 | error = suspend_ops->enter(state); | ||
4087 | trace_suspend_resume(TPS("machine_suspend"), | ||
4088 | state, false); | ||
4089 | - events_check_enabled = false; | ||
4090 | } else if (*wakeup) { | ||
4091 | error = -EBUSY; | ||
4092 | } | ||
4093 | @@ -582,6 +581,7 @@ static int enter_state(suspend_state_t state) | ||
4094 | pm_restore_gfp_mask(); | ||
4095 | |||
4096 | Finish: | ||
4097 | + events_check_enabled = false; | ||
4098 | pm_pr_dbg("Finishing wakeup.\n"); | ||
4099 | suspend_finish(); | ||
4100 | Unlock: | ||
4101 | diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c | ||
4102 | index d8c43d73e078..7464c5c4de46 100644 | ||
4103 | --- a/kernel/sched/rt.c | ||
4104 | +++ b/kernel/sched/rt.c | ||
4105 | @@ -2034,8 +2034,9 @@ static void pull_rt_task(struct rq *this_rq) | ||
4106 | bool resched = false; | ||
4107 | struct task_struct *p; | ||
4108 | struct rq *src_rq; | ||
4109 | + int rt_overload_count = rt_overloaded(this_rq); | ||
4110 | |||
4111 | - if (likely(!rt_overloaded(this_rq))) | ||
4112 | + if (likely(!rt_overload_count)) | ||
4113 | return; | ||
4114 | |||
4115 | /* | ||
4116 | @@ -2044,6 +2045,11 @@ static void pull_rt_task(struct rq *this_rq) | ||
4117 | */ | ||
4118 | smp_rmb(); | ||
4119 | |||
4120 | + /* If we are the only overloaded CPU do nothing */ | ||
4121 | + if (rt_overload_count == 1 && | ||
4122 | + cpumask_test_cpu(this_rq->cpu, this_rq->rd->rto_mask)) | ||
4123 | + return; | ||
4124 | + | ||
4125 | #ifdef HAVE_RT_PUSH_IPI | ||
4126 | if (sched_feat(RT_PUSH_IPI)) { | ||
4127 | tell_cpu_to_push(this_rq); | ||
4128 | diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c | ||
4129 | index 13d6881f908b..ec999f32c840 100644 | ||
4130 | --- a/kernel/time/posix-timers.c | ||
4131 | +++ b/kernel/time/posix-timers.c | ||
4132 | @@ -434,17 +434,22 @@ static struct pid *good_sigevent(sigevent_t * event) | ||
4133 | { | ||
4134 | struct task_struct *rtn = current->group_leader; | ||
4135 | |||
4136 | - if ((event->sigev_notify & SIGEV_THREAD_ID ) && | ||
4137 | - (!(rtn = find_task_by_vpid(event->sigev_notify_thread_id)) || | ||
4138 | - !same_thread_group(rtn, current) || | ||
4139 | - (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)) | ||
4140 | + switch (event->sigev_notify) { | ||
4141 | + case SIGEV_SIGNAL | SIGEV_THREAD_ID: | ||
4142 | + rtn = find_task_by_vpid(event->sigev_notify_thread_id); | ||
4143 | + if (!rtn || !same_thread_group(rtn, current)) | ||
4144 | + return NULL; | ||
4145 | + /* FALLTHRU */ | ||
4146 | + case SIGEV_SIGNAL: | ||
4147 | + case SIGEV_THREAD: | ||
4148 | + if (event->sigev_signo <= 0 || event->sigev_signo > SIGRTMAX) | ||
4149 | + return NULL; | ||
4150 | + /* FALLTHRU */ | ||
4151 | + case SIGEV_NONE: | ||
4152 | + return task_pid(rtn); | ||
4153 | + default: | ||
4154 | return NULL; | ||
4155 | - | ||
4156 | - if (((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) && | ||
4157 | - ((event->sigev_signo <= 0) || (event->sigev_signo > SIGRTMAX))) | ||
4158 | - return NULL; | ||
4159 | - | ||
4160 | - return task_pid(rtn); | ||
4161 | + } | ||
4162 | } | ||
4163 | |||
4164 | static struct k_itimer * alloc_posix_timer(void) | ||
4165 | @@ -669,7 +674,7 @@ void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting) | ||
4166 | struct timespec64 ts64; | ||
4167 | bool sig_none; | ||
4168 | |||
4169 | - sig_none = (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE; | ||
4170 | + sig_none = timr->it_sigev_notify == SIGEV_NONE; | ||
4171 | iv = timr->it_interval; | ||
4172 | |||
4173 | /* interval timer ? */ | ||
4174 | @@ -856,7 +861,7 @@ int common_timer_set(struct k_itimer *timr, int flags, | ||
4175 | |||
4176 | timr->it_interval = timespec64_to_ktime(new_setting->it_interval); | ||
4177 | expires = timespec64_to_ktime(new_setting->it_value); | ||
4178 | - sigev_none = (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE; | ||
4179 | + sigev_none = timr->it_sigev_notify == SIGEV_NONE; | ||
4180 | |||
4181 | kc->timer_arm(timr, expires, flags & TIMER_ABSTIME, sigev_none); | ||
4182 | timr->it_active = !sigev_none; | ||
4183 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c | ||
4184 | index 752e5daf0896..80de14973b42 100644 | ||
4185 | --- a/kernel/trace/trace.c | ||
4186 | +++ b/kernel/trace/trace.c | ||
4187 | @@ -4178,37 +4178,30 @@ static const struct file_operations show_traces_fops = { | ||
4188 | .llseek = seq_lseek, | ||
4189 | }; | ||
4190 | |||
4191 | -/* | ||
4192 | - * The tracer itself will not take this lock, but still we want | ||
4193 | - * to provide a consistent cpumask to user-space: | ||
4194 | - */ | ||
4195 | -static DEFINE_MUTEX(tracing_cpumask_update_lock); | ||
4196 | - | ||
4197 | -/* | ||
4198 | - * Temporary storage for the character representation of the | ||
4199 | - * CPU bitmask (and one more byte for the newline): | ||
4200 | - */ | ||
4201 | -static char mask_str[NR_CPUS + 1]; | ||
4202 | - | ||
4203 | static ssize_t | ||
4204 | tracing_cpumask_read(struct file *filp, char __user *ubuf, | ||
4205 | size_t count, loff_t *ppos) | ||
4206 | { | ||
4207 | struct trace_array *tr = file_inode(filp)->i_private; | ||
4208 | + char *mask_str; | ||
4209 | int len; | ||
4210 | |||
4211 | - mutex_lock(&tracing_cpumask_update_lock); | ||
4212 | + len = snprintf(NULL, 0, "%*pb\n", | ||
4213 | + cpumask_pr_args(tr->tracing_cpumask)) + 1; | ||
4214 | + mask_str = kmalloc(len, GFP_KERNEL); | ||
4215 | + if (!mask_str) | ||
4216 | + return -ENOMEM; | ||
4217 | |||
4218 | - len = snprintf(mask_str, count, "%*pb\n", | ||
4219 | + len = snprintf(mask_str, len, "%*pb\n", | ||
4220 | cpumask_pr_args(tr->tracing_cpumask)); | ||
4221 | if (len >= count) { | ||
4222 | count = -EINVAL; | ||
4223 | goto out_err; | ||
4224 | } | ||
4225 | - count = simple_read_from_buffer(ubuf, count, ppos, mask_str, NR_CPUS+1); | ||
4226 | + count = simple_read_from_buffer(ubuf, count, ppos, mask_str, len); | ||
4227 | |||
4228 | out_err: | ||
4229 | - mutex_unlock(&tracing_cpumask_update_lock); | ||
4230 | + kfree(mask_str); | ||
4231 | |||
4232 | return count; | ||
4233 | } | ||
4234 | @@ -4228,8 +4221,6 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf, | ||
4235 | if (err) | ||
4236 | goto err_unlock; | ||
4237 | |||
4238 | - mutex_lock(&tracing_cpumask_update_lock); | ||
4239 | - | ||
4240 | local_irq_disable(); | ||
4241 | arch_spin_lock(&tr->max_lock); | ||
4242 | for_each_tracing_cpu(cpu) { | ||
4243 | @@ -4252,8 +4243,6 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf, | ||
4244 | local_irq_enable(); | ||
4245 | |||
4246 | cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new); | ||
4247 | - | ||
4248 | - mutex_unlock(&tracing_cpumask_update_lock); | ||
4249 | free_cpumask_var(tracing_cpumask_new); | ||
4250 | |||
4251 | return count; | ||
4252 | diff --git a/kernel/uid16.c b/kernel/uid16.c | ||
4253 | index ce74a4901d2b..ef1da2a5f9bd 100644 | ||
4254 | --- a/kernel/uid16.c | ||
4255 | +++ b/kernel/uid16.c | ||
4256 | @@ -192,6 +192,7 @@ SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist) | ||
4257 | return retval; | ||
4258 | } | ||
4259 | |||
4260 | + groups_sort(group_info); | ||
4261 | retval = set_current_groups(group_info); | ||
4262 | put_group_info(group_info); | ||
4263 | |||
4264 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
4265 | index 476e810cf100..0de87a376aaa 100644 | ||
4266 | --- a/mm/mmap.c | ||
4267 | +++ b/mm/mmap.c | ||
4268 | @@ -3004,20 +3004,20 @@ void exit_mmap(struct mm_struct *mm) | ||
4269 | /* Use -1 here to ensure all VMAs in the mm are unmapped */ | ||
4270 | unmap_vmas(&tlb, vma, 0, -1); | ||
4271 | |||
4272 | - set_bit(MMF_OOM_SKIP, &mm->flags); | ||
4273 | - if (unlikely(tsk_is_oom_victim(current))) { | ||
4274 | + if (unlikely(mm_is_oom_victim(mm))) { | ||
4275 | /* | ||
4276 | * Wait for oom_reap_task() to stop working on this | ||
4277 | * mm. Because MMF_OOM_SKIP is already set before | ||
4278 | * calling down_read(), oom_reap_task() will not run | ||
4279 | * on this "mm" post up_write(). | ||
4280 | * | ||
4281 | - * tsk_is_oom_victim() cannot be set from under us | ||
4282 | - * either because current->mm is already set to NULL | ||
4283 | + * mm_is_oom_victim() cannot be set from under us | ||
4284 | + * either because victim->mm is already set to NULL | ||
4285 | * under task_lock before calling mmput and oom_mm is | ||
4286 | - * set not NULL by the OOM killer only if current->mm | ||
4287 | + * set not NULL by the OOM killer only if victim->mm | ||
4288 | * is found not NULL while holding the task_lock. | ||
4289 | */ | ||
4290 | + set_bit(MMF_OOM_SKIP, &mm->flags); | ||
4291 | down_write(&mm->mmap_sem); | ||
4292 | up_write(&mm->mmap_sem); | ||
4293 | } | ||
4294 | diff --git a/mm/oom_kill.c b/mm/oom_kill.c | ||
4295 | index 18c5b356b505..10aed8d8c080 100644 | ||
4296 | --- a/mm/oom_kill.c | ||
4297 | +++ b/mm/oom_kill.c | ||
4298 | @@ -673,8 +673,10 @@ static void mark_oom_victim(struct task_struct *tsk) | ||
4299 | return; | ||
4300 | |||
4301 | /* oom_mm is bound to the signal struct life time. */ | ||
4302 | - if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) | ||
4303 | + if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) { | ||
4304 | mmgrab(tsk->signal->oom_mm); | ||
4305 | + set_bit(MMF_OOM_VICTIM, &mm->flags); | ||
4306 | + } | ||
4307 | |||
4308 | /* | ||
4309 | * Make sure that the task is woken up from uninterruptible sleep | ||
4310 | diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c | ||
4311 | index 681e33998e03..3c1570d3e22f 100644 | ||
4312 | --- a/net/ipv4/icmp.c | ||
4313 | +++ b/net/ipv4/icmp.c | ||
4314 | @@ -782,7 +782,7 @@ static bool icmp_tag_validation(int proto) | ||
4315 | } | ||
4316 | |||
4317 | /* | ||
4318 | - * Handle ICMP_DEST_UNREACH, ICMP_TIME_EXCEED, ICMP_QUENCH, and | ||
4319 | + * Handle ICMP_DEST_UNREACH, ICMP_TIME_EXCEEDED, ICMP_QUENCH, and | ||
4320 | * ICMP_PARAMETERPROB. | ||
4321 | */ | ||
4322 | |||
4323 | @@ -810,7 +810,8 @@ static bool icmp_unreach(struct sk_buff *skb) | ||
4324 | if (iph->ihl < 5) /* Mangled header, drop. */ | ||
4325 | goto out_err; | ||
4326 | |||
4327 | - if (icmph->type == ICMP_DEST_UNREACH) { | ||
4328 | + switch (icmph->type) { | ||
4329 | + case ICMP_DEST_UNREACH: | ||
4330 | switch (icmph->code & 15) { | ||
4331 | case ICMP_NET_UNREACH: | ||
4332 | case ICMP_HOST_UNREACH: | ||
4333 | @@ -846,8 +847,16 @@ static bool icmp_unreach(struct sk_buff *skb) | ||
4334 | } | ||
4335 | if (icmph->code > NR_ICMP_UNREACH) | ||
4336 | goto out; | ||
4337 | - } else if (icmph->type == ICMP_PARAMETERPROB) | ||
4338 | + break; | ||
4339 | + case ICMP_PARAMETERPROB: | ||
4340 | info = ntohl(icmph->un.gateway) >> 24; | ||
4341 | + break; | ||
4342 | + case ICMP_TIME_EXCEEDED: | ||
4343 | + __ICMP_INC_STATS(net, ICMP_MIB_INTIMEEXCDS); | ||
4344 | + if (icmph->code == ICMP_EXC_FRAGTIME) | ||
4345 | + goto out; | ||
4346 | + break; | ||
4347 | + } | ||
4348 | |||
4349 | /* | ||
4350 | * Throw it at our lower layers | ||
4351 | diff --git a/net/ipv4/route.c b/net/ipv4/route.c | ||
4352 | index 647cfc972bde..804bead564db 100644 | ||
4353 | --- a/net/ipv4/route.c | ||
4354 | +++ b/net/ipv4/route.c | ||
4355 | @@ -1254,7 +1254,7 @@ static void set_class_tag(struct rtable *rt, u32 tag) | ||
4356 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst) | ||
4357 | { | ||
4358 | unsigned int header_size = sizeof(struct tcphdr) + sizeof(struct iphdr); | ||
4359 | - unsigned int advmss = max_t(unsigned int, dst->dev->mtu - header_size, | ||
4360 | + unsigned int advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, | ||
4361 | ip_rt_min_advmss); | ||
4362 | |||
4363 | return min(advmss, IPV4_MAX_PMTU - header_size); | ||
4364 | diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c | ||
4365 | index 02d61101b108..af22aa8ae35b 100644 | ||
4366 | --- a/net/l2tp/l2tp_core.c | ||
4367 | +++ b/net/l2tp/l2tp_core.c | ||
4368 | @@ -1891,7 +1891,7 @@ static __net_exit void l2tp_exit_net(struct net *net) | ||
4369 | |||
4370 | rcu_read_lock_bh(); | ||
4371 | list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { | ||
4372 | - (void)l2tp_tunnel_delete(tunnel); | ||
4373 | + l2tp_tunnel_delete(tunnel); | ||
4374 | } | ||
4375 | rcu_read_unlock_bh(); | ||
4376 | |||
4377 | diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c | ||
4378 | index 7135f4645d3a..c28223d8092b 100644 | ||
4379 | --- a/net/l2tp/l2tp_netlink.c | ||
4380 | +++ b/net/l2tp/l2tp_netlink.c | ||
4381 | @@ -282,7 +282,7 @@ static int l2tp_nl_cmd_tunnel_delete(struct sk_buff *skb, struct genl_info *info | ||
4382 | l2tp_tunnel_notify(&l2tp_nl_family, info, | ||
4383 | tunnel, L2TP_CMD_TUNNEL_DELETE); | ||
4384 | |||
4385 | - (void) l2tp_tunnel_delete(tunnel); | ||
4386 | + l2tp_tunnel_delete(tunnel); | ||
4387 | |||
4388 | l2tp_tunnel_dec_refcount(tunnel); | ||
4389 | |||
4390 | diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c | ||
4391 | index 4f940d7eb2f7..b3245f9a37d1 100644 | ||
4392 | --- a/net/netfilter/ipvs/ip_vs_ctl.c | ||
4393 | +++ b/net/netfilter/ipvs/ip_vs_ctl.c | ||
4394 | @@ -2034,12 +2034,16 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v) | ||
4395 | seq_puts(seq, | ||
4396 | " -> RemoteAddress:Port Forward Weight ActiveConn InActConn\n"); | ||
4397 | } else { | ||
4398 | + struct net *net = seq_file_net(seq); | ||
4399 | + struct netns_ipvs *ipvs = net_ipvs(net); | ||
4400 | const struct ip_vs_service *svc = v; | ||
4401 | const struct ip_vs_iter *iter = seq->private; | ||
4402 | const struct ip_vs_dest *dest; | ||
4403 | struct ip_vs_scheduler *sched = rcu_dereference(svc->scheduler); | ||
4404 | char *sched_name = sched ? sched->name : "none"; | ||
4405 | |||
4406 | + if (svc->ipvs != ipvs) | ||
4407 | + return 0; | ||
4408 | if (iter->table == ip_vs_svc_table) { | ||
4409 | #ifdef CONFIG_IP_VS_IPV6 | ||
4410 | if (svc->af == AF_INET6) | ||
4411 | diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c | ||
4412 | index c4778cae58ef..444380f968f1 100644 | ||
4413 | --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c | ||
4414 | +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c | ||
4415 | @@ -231,6 +231,7 @@ static int gssx_dec_linux_creds(struct xdr_stream *xdr, | ||
4416 | goto out_free_groups; | ||
4417 | creds->cr_group_info->gid[i] = kgid; | ||
4418 | } | ||
4419 | + groups_sort(creds->cr_group_info); | ||
4420 | |||
4421 | return 0; | ||
4422 | out_free_groups: | ||
4423 | diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c | ||
4424 | index 7b1ee5a0b03c..f41ffb22652c 100644 | ||
4425 | --- a/net/sunrpc/auth_gss/svcauth_gss.c | ||
4426 | +++ b/net/sunrpc/auth_gss/svcauth_gss.c | ||
4427 | @@ -481,6 +481,7 @@ static int rsc_parse(struct cache_detail *cd, | ||
4428 | goto out; | ||
4429 | rsci.cred.cr_group_info->gid[i] = kgid; | ||
4430 | } | ||
4431 | + groups_sort(rsci.cred.cr_group_info); | ||
4432 | |||
4433 | /* mech name */ | ||
4434 | len = qword_get(&mesg, buf, mlen); | ||
4435 | diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c | ||
4436 | index f81eaa8e0888..acb70d235e47 100644 | ||
4437 | --- a/net/sunrpc/svcauth_unix.c | ||
4438 | +++ b/net/sunrpc/svcauth_unix.c | ||
4439 | @@ -520,6 +520,7 @@ static int unix_gid_parse(struct cache_detail *cd, | ||
4440 | ug.gi->gid[i] = kgid; | ||
4441 | } | ||
4442 | |||
4443 | + groups_sort(ug.gi); | ||
4444 | ugp = unix_gid_lookup(cd, uid); | ||
4445 | if (ugp) { | ||
4446 | struct cache_head *ch; | ||
4447 | @@ -819,6 +820,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp) | ||
4448 | kgid_t kgid = make_kgid(&init_user_ns, svc_getnl(argv)); | ||
4449 | cred->cr_group_info->gid[i] = kgid; | ||
4450 | } | ||
4451 | + groups_sort(cred->cr_group_info); | ||
4452 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { | ||
4453 | *authp = rpc_autherr_badverf; | ||
4454 | return SVC_DENIED; | ||
4455 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c | ||
4456 | index 898485e3ece4..8eb0c4f3b3e9 100644 | ||
4457 | --- a/net/sunrpc/xprt.c | ||
4458 | +++ b/net/sunrpc/xprt.c | ||
4459 | @@ -1001,6 +1001,7 @@ void xprt_transmit(struct rpc_task *task) | ||
4460 | { | ||
4461 | struct rpc_rqst *req = task->tk_rqstp; | ||
4462 | struct rpc_xprt *xprt = req->rq_xprt; | ||
4463 | + unsigned int connect_cookie; | ||
4464 | int status, numreqs; | ||
4465 | |||
4466 | dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen); | ||
4467 | @@ -1024,6 +1025,7 @@ void xprt_transmit(struct rpc_task *task) | ||
4468 | } else if (!req->rq_bytes_sent) | ||
4469 | return; | ||
4470 | |||
4471 | + connect_cookie = xprt->connect_cookie; | ||
4472 | req->rq_xtime = ktime_get(); | ||
4473 | status = xprt->ops->send_request(task); | ||
4474 | trace_xprt_transmit(xprt, req->rq_xid, status); | ||
4475 | @@ -1047,20 +1049,28 @@ void xprt_transmit(struct rpc_task *task) | ||
4476 | xprt->stat.bklog_u += xprt->backlog.qlen; | ||
4477 | xprt->stat.sending_u += xprt->sending.qlen; | ||
4478 | xprt->stat.pending_u += xprt->pending.qlen; | ||
4479 | + spin_unlock_bh(&xprt->transport_lock); | ||
4480 | |||
4481 | - /* Don't race with disconnect */ | ||
4482 | - if (!xprt_connected(xprt)) | ||
4483 | - task->tk_status = -ENOTCONN; | ||
4484 | - else { | ||
4485 | + req->rq_connect_cookie = connect_cookie; | ||
4486 | + if (rpc_reply_expected(task) && !READ_ONCE(req->rq_reply_bytes_recvd)) { | ||
4487 | /* | ||
4488 | - * Sleep on the pending queue since | ||
4489 | - * we're expecting a reply. | ||
4490 | + * Sleep on the pending queue if we're expecting a reply. | ||
4491 | + * The spinlock ensures atomicity between the test of | ||
4492 | + * req->rq_reply_bytes_recvd, and the call to rpc_sleep_on(). | ||
4493 | */ | ||
4494 | - if (!req->rq_reply_bytes_recvd && rpc_reply_expected(task)) | ||
4495 | + spin_lock(&xprt->recv_lock); | ||
4496 | + if (!req->rq_reply_bytes_recvd) { | ||
4497 | rpc_sleep_on(&xprt->pending, task, xprt_timer); | ||
4498 | - req->rq_connect_cookie = xprt->connect_cookie; | ||
4499 | + /* | ||
4500 | + * Send an extra queue wakeup call if the | ||
4501 | + * connection was dropped in case the call to | ||
4502 | + * rpc_sleep_on() raced. | ||
4503 | + */ | ||
4504 | + if (!xprt_connected(xprt)) | ||
4505 | + xprt_wake_pending_tasks(xprt, -ENOTCONN); | ||
4506 | + } | ||
4507 | + spin_unlock(&xprt->recv_lock); | ||
4508 | } | ||
4509 | - spin_unlock_bh(&xprt->transport_lock); | ||
4510 | } | ||
4511 | |||
4512 | static void xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task) | ||
4513 | diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c | ||
4514 | index c84e2b644e13..8cf5ccfe180d 100644 | ||
4515 | --- a/net/sunrpc/xprtrdma/transport.c | ||
4516 | +++ b/net/sunrpc/xprtrdma/transport.c | ||
4517 | @@ -686,7 +686,7 @@ xprt_rdma_free(struct rpc_task *task) | ||
4518 | dprintk("RPC: %s: called on 0x%p\n", __func__, req->rl_reply); | ||
4519 | |||
4520 | if (!list_empty(&req->rl_registered)) | ||
4521 | - ia->ri_ops->ro_unmap_safe(r_xprt, req, !RPC_IS_ASYNC(task)); | ||
4522 | + ia->ri_ops->ro_unmap_sync(r_xprt, &req->rl_registered); | ||
4523 | rpcrdma_unmap_sges(ia, req); | ||
4524 | rpcrdma_buffer_put(req); | ||
4525 | } | ||
4526 | diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c | ||
4527 | index 2431c0321b71..fdaefe91801d 100644 | ||
4528 | --- a/samples/bpf/xdp1_user.c | ||
4529 | +++ b/samples/bpf/xdp1_user.c | ||
4530 | @@ -14,6 +14,7 @@ | ||
4531 | #include <string.h> | ||
4532 | #include <unistd.h> | ||
4533 | #include <libgen.h> | ||
4534 | +#include <sys/resource.h> | ||
4535 | |||
4536 | #include "bpf_load.h" | ||
4537 | #include "bpf_util.h" | ||
4538 | @@ -69,6 +70,7 @@ static void usage(const char *prog) | ||
4539 | |||
4540 | int main(int argc, char **argv) | ||
4541 | { | ||
4542 | + struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; | ||
4543 | const char *optstr = "SN"; | ||
4544 | char filename[256]; | ||
4545 | int opt; | ||
4546 | @@ -91,6 +93,12 @@ int main(int argc, char **argv) | ||
4547 | usage(basename(argv[0])); | ||
4548 | return 1; | ||
4549 | } | ||
4550 | + | ||
4551 | + if (setrlimit(RLIMIT_MEMLOCK, &r)) { | ||
4552 | + perror("setrlimit(RLIMIT_MEMLOCK)"); | ||
4553 | + return 1; | ||
4554 | + } | ||
4555 | + | ||
4556 | ifindex = strtoul(argv[optind], NULL, 0); | ||
4557 | |||
4558 | snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); | ||
4559 | diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c | ||
4560 | index 369ef7ce981c..8ff89280d9fd 100644 | ||
4561 | --- a/sound/soc/intel/skylake/skl-sst-utils.c | ||
4562 | +++ b/sound/soc/intel/skylake/skl-sst-utils.c | ||
4563 | @@ -251,6 +251,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw, | ||
4564 | struct uuid_module *module; | ||
4565 | struct firmware stripped_fw; | ||
4566 | unsigned int safe_file; | ||
4567 | + int ret = 0; | ||
4568 | |||
4569 | /* Get the FW pointer to derive ADSP header */ | ||
4570 | stripped_fw.data = fw->data; | ||
4571 | @@ -299,8 +300,10 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw, | ||
4572 | |||
4573 | for (i = 0; i < num_entry; i++, mod_entry++) { | ||
4574 | module = kzalloc(sizeof(*module), GFP_KERNEL); | ||
4575 | - if (!module) | ||
4576 | - return -ENOMEM; | ||
4577 | + if (!module) { | ||
4578 | + ret = -ENOMEM; | ||
4579 | + goto free_uuid_list; | ||
4580 | + } | ||
4581 | |||
4582 | uuid_bin = (uuid_le *)mod_entry->uuid.id; | ||
4583 | memcpy(&module->uuid, uuid_bin, sizeof(module->uuid)); | ||
4584 | @@ -311,8 +314,8 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw, | ||
4585 | size = sizeof(int) * mod_entry->instance_max_count; | ||
4586 | module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL); | ||
4587 | if (!module->instance_id) { | ||
4588 | - kfree(module); | ||
4589 | - return -ENOMEM; | ||
4590 | + ret = -ENOMEM; | ||
4591 | + goto free_uuid_list; | ||
4592 | } | ||
4593 | |||
4594 | list_add_tail(&module->list, &skl->uuid_list); | ||
4595 | @@ -323,6 +326,10 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw, | ||
4596 | } | ||
4597 | |||
4598 | return 0; | ||
4599 | + | ||
4600 | +free_uuid_list: | ||
4601 | + skl_freeup_uuid_list(skl); | ||
4602 | + return ret; | ||
4603 | } | ||
4604 | |||
4605 | void skl_freeup_uuid_list(struct skl_sst *ctx) | ||
4606 | diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c | ||
4607 | index fffc07e72627..2aef7c00cca1 100644 | ||
4608 | --- a/sound/soc/sh/rcar/ssi.c | ||
4609 | +++ b/sound/soc/sh/rcar/ssi.c | ||
4610 | @@ -198,10 +198,15 @@ static u32 rsnd_ssi_run_mods(struct rsnd_dai_stream *io) | ||
4611 | { | ||
4612 | struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io); | ||
4613 | struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); | ||
4614 | + u32 mods; | ||
4615 | |||
4616 | - return rsnd_ssi_multi_slaves_runtime(io) | | ||
4617 | - 1 << rsnd_mod_id(ssi_mod) | | ||
4618 | - 1 << rsnd_mod_id(ssi_parent_mod); | ||
4619 | + mods = rsnd_ssi_multi_slaves_runtime(io) | | ||
4620 | + 1 << rsnd_mod_id(ssi_mod); | ||
4621 | + | ||
4622 | + if (ssi_parent_mod) | ||
4623 | + mods |= 1 << rsnd_mod_id(ssi_parent_mod); | ||
4624 | + | ||
4625 | + return mods; | ||
4626 | } | ||
4627 | |||
4628 | u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io) | ||
4629 | diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c | ||
4630 | index 8a1cd1616de4..d1fc0f9f00fb 100644 | ||
4631 | --- a/tools/usb/usbip/libsrc/vhci_driver.c | ||
4632 | +++ b/tools/usb/usbip/libsrc/vhci_driver.c | ||
4633 | @@ -50,14 +50,14 @@ static int parse_status(const char *value) | ||
4634 | |||
4635 | while (*c != '\0') { | ||
4636 | int port, status, speed, devid; | ||
4637 | - unsigned long socket; | ||
4638 | + int sockfd; | ||
4639 | char lbusid[SYSFS_BUS_ID_SIZE]; | ||
4640 | struct usbip_imported_device *idev; | ||
4641 | char hub[3]; | ||
4642 | |||
4643 | - ret = sscanf(c, "%2s %d %d %d %x %lx %31s\n", | ||
4644 | + ret = sscanf(c, "%2s %d %d %d %x %u %31s\n", | ||
4645 | hub, &port, &status, &speed, | ||
4646 | - &devid, &socket, lbusid); | ||
4647 | + &devid, &sockfd, lbusid); | ||
4648 | |||
4649 | if (ret < 5) { | ||
4650 | dbg("sscanf failed: %d", ret); | ||
4651 | @@ -66,7 +66,7 @@ static int parse_status(const char *value) | ||
4652 | |||
4653 | dbg("hub %s port %d status %d speed %d devid %x", | ||
4654 | hub, port, status, speed, devid); | ||
4655 | - dbg("socket %lx lbusid %s", socket, lbusid); | ||
4656 | + dbg("sockfd %u lbusid %s", sockfd, lbusid); | ||
4657 | |||
4658 | /* if a device is connected, look at it */ | ||
4659 | idev = &vhci_driver->idev[port]; |