Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 21 Nov 2018 15:02:38
Message-Id: 1542812486.89c8e5c0c83c95951d8ca64cde888e9773ccd854.mpagano@gentoo
1 commit: 89c8e5c0c83c95951d8ca64cde888e9773ccd854
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 5 15:21:02 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 21 15:01:26 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=89c8e5c0
7
8 Linux patch 4.4.154
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1153_linux-4.4.154.patch | 2064 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2068 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index e62afd1..5a367b5 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -655,6 +655,10 @@ Patch: 1152_linux-4.4.153.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.153
23
24 +Patch: 1153_linux-4.4.154.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.154
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1153_linux-4.4.154.patch b/1153_linux-4.4.154.patch
33 new file mode 100644
34 index 0000000..88b66fb
35 --- /dev/null
36 +++ b/1153_linux-4.4.154.patch
37 @@ -0,0 +1,2064 @@
38 +diff --git a/Makefile b/Makefile
39 +index 208a813be615..b184286cf7e6 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 153
46 ++SUBLEVEL = 154
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h
51 +index d5da2115d78a..03d6bb0f4e13 100644
52 +--- a/arch/arc/include/asm/delay.h
53 ++++ b/arch/arc/include/asm/delay.h
54 +@@ -17,8 +17,11 @@
55 + #ifndef __ASM_ARC_UDELAY_H
56 + #define __ASM_ARC_UDELAY_H
57 +
58 ++#include <asm-generic/types.h>
59 + #include <asm/param.h> /* HZ */
60 +
61 ++extern unsigned long loops_per_jiffy;
62 ++
63 + static inline void __delay(unsigned long loops)
64 + {
65 + __asm__ __volatile__(
66 +diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
67 +index 9a84cbdd44b0..017fb440bba4 100644
68 +--- a/arch/arc/mm/cache.c
69 ++++ b/arch/arc/mm/cache.c
70 +@@ -821,7 +821,7 @@ void flush_cache_mm(struct mm_struct *mm)
71 + void flush_cache_page(struct vm_area_struct *vma, unsigned long u_vaddr,
72 + unsigned long pfn)
73 + {
74 +- unsigned int paddr = pfn << PAGE_SHIFT;
75 ++ phys_addr_t paddr = pfn << PAGE_SHIFT;
76 +
77 + u_vaddr &= PAGE_MASK;
78 +
79 +@@ -841,8 +841,9 @@ void flush_anon_page(struct vm_area_struct *vma, struct page *page,
80 + unsigned long u_vaddr)
81 + {
82 + /* TBD: do we really need to clear the kernel mapping */
83 +- __flush_dcache_page(page_address(page), u_vaddr);
84 +- __flush_dcache_page(page_address(page), page_address(page));
85 ++ __flush_dcache_page((phys_addr_t)page_address(page), u_vaddr);
86 ++ __flush_dcache_page((phys_addr_t)page_address(page),
87 ++ (phys_addr_t)page_address(page));
88 +
89 + }
90 +
91 +diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
92 +index e8835d4e173c..e0267532bd4e 100644
93 +--- a/arch/arm/kvm/mmu.c
94 ++++ b/arch/arm/kvm/mmu.c
95 +@@ -892,19 +892,35 @@ static int stage2_set_pmd_huge(struct kvm *kvm, struct kvm_mmu_memory_cache
96 + pmd = stage2_get_pmd(kvm, cache, addr);
97 + VM_BUG_ON(!pmd);
98 +
99 +- /*
100 +- * Mapping in huge pages should only happen through a fault. If a
101 +- * page is merged into a transparent huge page, the individual
102 +- * subpages of that huge page should be unmapped through MMU
103 +- * notifiers before we get here.
104 +- *
105 +- * Merging of CompoundPages is not supported; they should become
106 +- * splitting first, unmapped, merged, and mapped back in on-demand.
107 +- */
108 +- VM_BUG_ON(pmd_present(*pmd) && pmd_pfn(*pmd) != pmd_pfn(*new_pmd));
109 +-
110 + old_pmd = *pmd;
111 + if (pmd_present(old_pmd)) {
112 ++ /*
113 ++ * Multiple vcpus faulting on the same PMD entry, can
114 ++ * lead to them sequentially updating the PMD with the
115 ++ * same value. Following the break-before-make
116 ++ * (pmd_clear() followed by tlb_flush()) process can
117 ++ * hinder forward progress due to refaults generated
118 ++ * on missing translations.
119 ++ *
120 ++ * Skip updating the page table if the entry is
121 ++ * unchanged.
122 ++ */
123 ++ if (pmd_val(old_pmd) == pmd_val(*new_pmd))
124 ++ return 0;
125 ++
126 ++ /*
127 ++ * Mapping in huge pages should only happen through a
128 ++ * fault. If a page is merged into a transparent huge
129 ++ * page, the individual subpages of that huge page
130 ++ * should be unmapped through MMU notifiers before we
131 ++ * get here.
132 ++ *
133 ++ * Merging of CompoundPages is not supported; they
134 ++ * should become splitting first, unmapped, merged,
135 ++ * and mapped back in on-demand.
136 ++ */
137 ++ VM_BUG_ON(pmd_pfn(old_pmd) != pmd_pfn(*new_pmd));
138 ++
139 + pmd_clear(pmd);
140 + kvm_tlb_flush_vmid_ipa(kvm, addr);
141 + } else {
142 +@@ -961,6 +977,10 @@ static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
143 + /* Create 2nd stage page table mapping - Level 3 */
144 + old_pte = *pte;
145 + if (pte_present(old_pte)) {
146 ++ /* Skip page table update if there is no change */
147 ++ if (pte_val(old_pte) == pte_val(*new_pte))
148 ++ return 0;
149 ++
150 + kvm_set_pte(pte, __pte(0));
151 + kvm_tlb_flush_vmid_ipa(kvm, addr);
152 + } else {
153 +diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
154 +index efd89ce4533d..adf4122502a9 100644
155 +--- a/arch/arm64/mm/init.c
156 ++++ b/arch/arm64/mm/init.c
157 +@@ -120,7 +120,11 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
158 + #ifdef CONFIG_HAVE_ARCH_PFN_VALID
159 + int pfn_valid(unsigned long pfn)
160 + {
161 +- return memblock_is_memory(pfn << PAGE_SHIFT);
162 ++ phys_addr_t addr = pfn << PAGE_SHIFT;
163 ++
164 ++ if ((addr >> PAGE_SHIFT) != pfn)
165 ++ return 0;
166 ++ return memblock_is_memory(addr);
167 + }
168 + EXPORT_SYMBOL(pfn_valid);
169 + #endif
170 +diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
171 +index 4ca33175ec05..6d38948f0f1e 100644
172 +--- a/arch/mips/bcm47xx/setup.c
173 ++++ b/arch/mips/bcm47xx/setup.c
174 +@@ -249,12 +249,6 @@ static int __init bcm47xx_cpu_fixes(void)
175 + */
176 + if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706)
177 + cpu_wait = NULL;
178 +-
179 +- /*
180 +- * BCM47XX Erratum "R10: PCIe Transactions Periodically Fail"
181 +- * Enable ExternalSync for sync instruction to take effect
182 +- */
183 +- set_c0_config7(MIPS_CONF7_ES);
184 + break;
185 + #endif
186 + }
187 +diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
188 +index 15c183ce9d4f..e43aca183c99 100644
189 +--- a/arch/mips/include/asm/mipsregs.h
190 ++++ b/arch/mips/include/asm/mipsregs.h
191 +@@ -605,8 +605,6 @@
192 + #define MIPS_CONF7_WII (_ULCAST_(1) << 31)
193 +
194 + #define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
195 +-/* ExternalSync */
196 +-#define MIPS_CONF7_ES (_ULCAST_(1) << 8)
197 +
198 + #define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
199 + #define MIPS_CONF7_AR (_ULCAST_(1) << 16)
200 +@@ -2014,7 +2012,6 @@ __BUILD_SET_C0(status)
201 + __BUILD_SET_C0(cause)
202 + __BUILD_SET_C0(config)
203 + __BUILD_SET_C0(config5)
204 +-__BUILD_SET_C0(config7)
205 + __BUILD_SET_C0(intcontrol)
206 + __BUILD_SET_C0(intctl)
207 + __BUILD_SET_C0(srsmap)
208 +diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
209 +index 041153f5cf93..41a8201d572e 100644
210 +--- a/arch/mips/include/asm/processor.h
211 ++++ b/arch/mips/include/asm/processor.h
212 +@@ -131,7 +131,7 @@ struct mips_fpu_struct {
213 +
214 + #define NUM_DSP_REGS 6
215 +
216 +-typedef __u32 dspreg_t;
217 ++typedef unsigned long dspreg_t;
218 +
219 + struct mips_dsp_state {
220 + dspreg_t dspr[NUM_DSP_REGS];
221 +diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
222 +index 32fa3ae1a0a6..5a869515b393 100644
223 +--- a/arch/mips/kernel/ptrace.c
224 ++++ b/arch/mips/kernel/ptrace.c
225 +@@ -879,7 +879,7 @@ long arch_ptrace(struct task_struct *child, long request,
226 + goto out;
227 + }
228 + dregs = __get_dsp_regs(child);
229 +- tmp = (unsigned long) (dregs[addr - DSP_BASE]);
230 ++ tmp = dregs[addr - DSP_BASE];
231 + break;
232 + }
233 + case DSP_CONTROL:
234 +diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
235 +index d95117e71f69..286ec2d24d47 100644
236 +--- a/arch/mips/kernel/ptrace32.c
237 ++++ b/arch/mips/kernel/ptrace32.c
238 +@@ -140,7 +140,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
239 + goto out;
240 + }
241 + dregs = __get_dsp_regs(child);
242 +- tmp = (unsigned long) (dregs[addr - DSP_BASE]);
243 ++ tmp = dregs[addr - DSP_BASE];
244 + break;
245 + }
246 + case DSP_CONTROL:
247 +diff --git a/arch/mips/lib/multi3.c b/arch/mips/lib/multi3.c
248 +index 111ad475aa0c..4c2483f410c2 100644
249 +--- a/arch/mips/lib/multi3.c
250 ++++ b/arch/mips/lib/multi3.c
251 +@@ -4,12 +4,12 @@
252 + #include "libgcc.h"
253 +
254 + /*
255 +- * GCC 7 suboptimally generates __multi3 calls for mips64r6, so for that
256 +- * specific case only we'll implement it here.
257 ++ * GCC 7 & older can suboptimally generate __multi3 calls for mips64r6, so for
258 ++ * that specific case only we implement that intrinsic here.
259 + *
260 + * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981
261 + */
262 +-#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ == 7)
263 ++#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 8)
264 +
265 + /* multiply 64-bit values, low 64-bits returned */
266 + static inline long long notrace dmulu(long long a, long long b)
267 +diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
268 +index 998b61cd0e56..4b39ba700d32 100644
269 +--- a/arch/s390/include/asm/qdio.h
270 ++++ b/arch/s390/include/asm/qdio.h
271 +@@ -261,7 +261,6 @@ struct qdio_outbuf_state {
272 + void *user;
273 + };
274 +
275 +-#define QDIO_OUTBUF_STATE_FLAG_NONE 0x00
276 + #define QDIO_OUTBUF_STATE_FLAG_PENDING 0x01
277 +
278 + #define CHSC_AC1_INITIATE_INPUTQ 0x80
279 +diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
280 +index ec1a30d0d11a..7218689bd6ee 100644
281 +--- a/arch/s390/mm/fault.c
282 ++++ b/arch/s390/mm/fault.c
283 +@@ -459,6 +459,8 @@ retry:
284 + /* No reason to continue if interrupted by SIGKILL. */
285 + if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
286 + fault = VM_FAULT_SIGNAL;
287 ++ if (flags & FAULT_FLAG_RETRY_NOWAIT)
288 ++ goto out_up;
289 + goto out;
290 + }
291 + if (unlikely(fault & VM_FAULT_ERROR))
292 +diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
293 +index a26528afceb2..727693e283da 100644
294 +--- a/arch/s390/net/bpf_jit_comp.c
295 ++++ b/arch/s390/net/bpf_jit_comp.c
296 +@@ -522,8 +522,6 @@ static void bpf_jit_epilogue(struct bpf_jit *jit)
297 + /* br %r1 */
298 + _EMIT2(0x07f1);
299 + } else {
300 +- /* larl %r1,.+14 */
301 +- EMIT6_PCREL_RILB(0xc0000000, REG_1, jit->prg + 14);
302 + /* ex 0,S390_lowcore.br_r1_tampoline */
303 + EMIT4_DISP(0x44000000, REG_0, REG_0,
304 + offsetof(struct _lowcore, br_r1_trampoline));
305 +diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
306 +index ef0499b76c50..9a5754d4ee87 100644
307 +--- a/arch/s390/pci/pci.c
308 ++++ b/arch/s390/pci/pci.c
309 +@@ -412,6 +412,8 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
310 + hwirq = 0;
311 + for_each_pci_msi_entry(msi, pdev) {
312 + rc = -EIO;
313 ++ if (hwirq >= msi_vecs)
314 ++ break;
315 + irq = irq_alloc_desc(0); /* Alloc irq on node 0 */
316 + if (irq < 0)
317 + goto out_msi;
318 +diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
319 +index cb7f04981c6b..8afbdcd3032b 100644
320 +--- a/arch/x86/include/asm/irqflags.h
321 ++++ b/arch/x86/include/asm/irqflags.h
322 +@@ -28,7 +28,8 @@ extern inline unsigned long native_save_fl(void)
323 + return flags;
324 + }
325 +
326 +-static inline void native_restore_fl(unsigned long flags)
327 ++extern inline void native_restore_fl(unsigned long flags);
328 ++extern inline void native_restore_fl(unsigned long flags)
329 + {
330 + asm volatile("push %0 ; popf"
331 + : /* no output */
332 +diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
333 +index a3a53955f01c..337c52192278 100644
334 +--- a/arch/x86/include/asm/processor.h
335 ++++ b/arch/x86/include/asm/processor.h
336 +@@ -172,9 +172,9 @@ extern const struct seq_operations cpuinfo_op;
337 +
338 + extern void cpu_detect(struct cpuinfo_x86 *c);
339 +
340 +-static inline unsigned long l1tf_pfn_limit(void)
341 ++static inline unsigned long long l1tf_pfn_limit(void)
342 + {
343 +- return BIT(boot_cpu_data.x86_phys_bits - 1 - PAGE_SHIFT) - 1;
344 ++ return BIT_ULL(boot_cpu_data.x86_phys_bits - 1 - PAGE_SHIFT);
345 + }
346 +
347 + extern void early_cpu_init(void);
348 +diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
349 +index 34e4aaaf03d2..b9e6b60df148 100644
350 +--- a/arch/x86/kernel/cpu/bugs.c
351 ++++ b/arch/x86/kernel/cpu/bugs.c
352 +@@ -654,6 +654,10 @@ static void __init l1tf_select_mitigation(void)
353 + half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT;
354 + if (e820_any_mapped(half_pa, ULLONG_MAX - half_pa, E820_RAM)) {
355 + pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n");
356 ++ pr_info("You may make it effective by booting the kernel with mem=%llu parameter.\n",
357 ++ half_pa);
358 ++ pr_info("However, doing so will make a part of your RAM unusable.\n");
359 ++ pr_info("Reading https://www.kernel.org/doc/html/latest/admin-guide/l1tf.html might help you decide.\n");
360 + return;
361 + }
362 +
363 +diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
364 +index 4dce22d3cb06..b18fe3d245fe 100644
365 +--- a/arch/x86/kernel/cpu/intel.c
366 ++++ b/arch/x86/kernel/cpu/intel.c
367 +@@ -74,6 +74,9 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
368 + if (cpu_has(c, X86_FEATURE_HYPERVISOR))
369 + return false;
370 +
371 ++ if (c->x86 != 6)
372 ++ return false;
373 ++
374 + for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) {
375 + if (c->x86_model == spectre_bad_microcodes[i].model &&
376 + c->x86_mask == spectre_bad_microcodes[i].stepping)
377 +diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
378 +index 4cbb60fbff3e..c7cc81e9bb84 100644
379 +--- a/arch/x86/kernel/process_64.c
380 ++++ b/arch/x86/kernel/process_64.c
381 +@@ -250,6 +250,7 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
382 + start_thread_common(regs, new_ip, new_sp,
383 + __USER_CS, __USER_DS, 0);
384 + }
385 ++EXPORT_SYMBOL_GPL(start_thread);
386 +
387 + #ifdef CONFIG_COMPAT
388 + void compat_start_thread(struct pt_regs *regs, u32 new_ip, u32 new_sp)
389 +diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
390 +index 4954a6cef50a..f00eb52c16a6 100644
391 +--- a/arch/x86/mm/init.c
392 ++++ b/arch/x86/mm/init.c
393 +@@ -779,7 +779,7 @@ unsigned long max_swapfile_size(void)
394 +
395 + if (boot_cpu_has_bug(X86_BUG_L1TF)) {
396 + /* Limit the swap file size to MAX_PA/2 for L1TF workaround */
397 +- unsigned long l1tf_limit = l1tf_pfn_limit() + 1;
398 ++ unsigned long long l1tf_limit = l1tf_pfn_limit();
399 + /*
400 + * We encode swap offsets also with 3 bits below those for pfn
401 + * which makes the usable limit higher.
402 +@@ -787,7 +787,7 @@ unsigned long max_swapfile_size(void)
403 + #if CONFIG_PGTABLE_LEVELS > 2
404 + l1tf_limit <<= PAGE_SHIFT - SWP_OFFSET_FIRST_BIT;
405 + #endif
406 +- pages = min_t(unsigned long, l1tf_limit, pages);
407 ++ pages = min_t(unsigned long long, l1tf_limit, pages);
408 + }
409 + return pages;
410 + }
411 +diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
412 +index 9a055ea279eb..528d71b50c3b 100644
413 +--- a/arch/x86/mm/mmap.c
414 ++++ b/arch/x86/mm/mmap.c
415 +@@ -138,7 +138,7 @@ bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot)
416 + /* If it's real memory always allow */
417 + if (pfn_valid(pfn))
418 + return true;
419 +- if (pfn > l1tf_pfn_limit() && !capable(CAP_SYS_ADMIN))
420 ++ if (pfn >= l1tf_pfn_limit() && !capable(CAP_SYS_ADMIN))
421 + return false;
422 + return true;
423 + }
424 +diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
425 +index 0151039bff05..1012b2cb6a16 100644
426 +--- a/drivers/cdrom/cdrom.c
427 ++++ b/drivers/cdrom/cdrom.c
428 +@@ -2526,7 +2526,7 @@ static int cdrom_ioctl_drive_status(struct cdrom_device_info *cdi,
429 + if (!CDROM_CAN(CDC_SELECT_DISC) ||
430 + (arg == CDSL_CURRENT || arg == CDSL_NONE))
431 + return cdi->ops->drive_status(cdi, CDSL_CURRENT);
432 +- if (((int)arg >= cdi->capacity))
433 ++ if (arg >= cdi->capacity)
434 + return -EINVAL;
435 + return cdrom_slot_status(cdi, arg);
436 + }
437 +diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
438 +index dba5c0ea0827..c7c243e9b808 100644
439 +--- a/drivers/gpu/drm/i2c/adv7511.c
440 ++++ b/drivers/gpu/drm/i2c/adv7511.c
441 +@@ -450,6 +450,18 @@ static void adv7511_hpd_work(struct work_struct *work)
442 + else
443 + status = connector_status_disconnected;
444 +
445 ++ /*
446 ++ * The bridge resets its registers on unplug. So when we get a plug
447 ++ * event and we're already supposed to be powered, cycle the bridge to
448 ++ * restore its state.
449 ++ */
450 ++ if (status == connector_status_connected &&
451 ++ adv7511->connector.status == connector_status_disconnected &&
452 ++ adv7511->powered) {
453 ++ regcache_mark_dirty(adv7511->regmap);
454 ++ adv7511_power_on(adv7511);
455 ++ }
456 ++
457 + if (adv7511->connector.status != status) {
458 + adv7511->connector.status = status;
459 + drm_kms_helper_hotplug_event(adv7511->connector.dev);
460 +diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
461 +index abacc8f67469..31ca56e593f5 100644
462 +--- a/drivers/gpu/drm/imx/imx-ldb.c
463 ++++ b/drivers/gpu/drm/imx/imx-ldb.c
464 +@@ -526,6 +526,9 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
465 + return PTR_ERR(imx_ldb->regmap);
466 + }
467 +
468 ++ /* disable LDB by resetting the control register to POR default */
469 ++ regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0);
470 ++
471 + imx_ldb->dev = dev;
472 +
473 + if (of_id)
474 +@@ -566,14 +569,14 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
475 + if (ret || i < 0 || i > 1)
476 + return -EINVAL;
477 +
478 ++ if (!of_device_is_available(child))
479 ++ continue;
480 ++
481 + if (dual && i > 0) {
482 + dev_warn(dev, "dual-channel mode, ignoring second output\n");
483 + continue;
484 + }
485 +
486 +- if (!of_device_is_available(child))
487 +- continue;
488 +-
489 + channel = &imx_ldb->channel[i];
490 + channel->ldb = imx_ldb;
491 + channel->chno = i;
492 +diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
493 +index 29bd801f5dad..0c648efd9a58 100644
494 +--- a/drivers/gpu/drm/udl/udl_fb.c
495 ++++ b/drivers/gpu/drm/udl/udl_fb.c
496 +@@ -341,7 +341,7 @@ static int udl_fb_open(struct fb_info *info, int user)
497 +
498 + struct fb_deferred_io *fbdefio;
499 +
500 +- fbdefio = kmalloc(sizeof(struct fb_deferred_io), GFP_KERNEL);
501 ++ fbdefio = kzalloc(sizeof(struct fb_deferred_io), GFP_KERNEL);
502 +
503 + if (fbdefio) {
504 + fbdefio->delay = DL_DEFIO_WRITE_DELAY;
505 +diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
506 +index 33dbfb2c4748..30bfeb1b2512 100644
507 +--- a/drivers/gpu/drm/udl/udl_main.c
508 ++++ b/drivers/gpu/drm/udl/udl_main.c
509 +@@ -141,18 +141,13 @@ static void udl_free_urb_list(struct drm_device *dev)
510 + struct list_head *node;
511 + struct urb_node *unode;
512 + struct urb *urb;
513 +- int ret;
514 + unsigned long flags;
515 +
516 + DRM_DEBUG("Waiting for completes and freeing all render urbs\n");
517 +
518 + /* keep waiting and freeing, until we've got 'em all */
519 + while (count--) {
520 +-
521 +- /* Getting interrupted means a leak, but ok at shutdown*/
522 +- ret = down_interruptible(&udl->urbs.limit_sem);
523 +- if (ret)
524 +- break;
525 ++ down(&udl->urbs.limit_sem);
526 +
527 + spin_lock_irqsave(&udl->urbs.lock, flags);
528 +
529 +@@ -176,17 +171,22 @@ static void udl_free_urb_list(struct drm_device *dev)
530 + static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size)
531 + {
532 + struct udl_device *udl = dev->dev_private;
533 +- int i = 0;
534 + struct urb *urb;
535 + struct urb_node *unode;
536 + char *buf;
537 ++ size_t wanted_size = count * size;
538 +
539 + spin_lock_init(&udl->urbs.lock);
540 +
541 ++retry:
542 + udl->urbs.size = size;
543 + INIT_LIST_HEAD(&udl->urbs.list);
544 +
545 +- while (i < count) {
546 ++ sema_init(&udl->urbs.limit_sem, 0);
547 ++ udl->urbs.count = 0;
548 ++ udl->urbs.available = 0;
549 ++
550 ++ while (udl->urbs.count * size < wanted_size) {
551 + unode = kzalloc(sizeof(struct urb_node), GFP_KERNEL);
552 + if (!unode)
553 + break;
554 +@@ -202,11 +202,16 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size)
555 + }
556 + unode->urb = urb;
557 +
558 +- buf = usb_alloc_coherent(udl->udev, MAX_TRANSFER, GFP_KERNEL,
559 ++ buf = usb_alloc_coherent(udl->udev, size, GFP_KERNEL,
560 + &urb->transfer_dma);
561 + if (!buf) {
562 + kfree(unode);
563 + usb_free_urb(urb);
564 ++ if (size > PAGE_SIZE) {
565 ++ size /= 2;
566 ++ udl_free_urb_list(dev);
567 ++ goto retry;
568 ++ }
569 + break;
570 + }
571 +
572 +@@ -217,16 +222,14 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size)
573 +
574 + list_add_tail(&unode->entry, &udl->urbs.list);
575 +
576 +- i++;
577 ++ up(&udl->urbs.limit_sem);
578 ++ udl->urbs.count++;
579 ++ udl->urbs.available++;
580 + }
581 +
582 +- sema_init(&udl->urbs.limit_sem, i);
583 +- udl->urbs.count = i;
584 +- udl->urbs.available = i;
585 +-
586 +- DRM_DEBUG("allocated %d %d byte urbs\n", i, (int) size);
587 ++ DRM_DEBUG("allocated %d %d byte urbs\n", udl->urbs.count, (int) size);
588 +
589 +- return i;
590 ++ return udl->urbs.count;
591 + }
592 +
593 + struct urb *udl_get_urb(struct drm_device *dev)
594 +diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
595 +index a8bdcb5292f5..57f6eb1427b4 100644
596 +--- a/drivers/i2c/busses/i2c-davinci.c
597 ++++ b/drivers/i2c/busses/i2c-davinci.c
598 +@@ -234,12 +234,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
599 + /*
600 + * It's not always possible to have 1 to 2 ratio when d=7, so fall back
601 + * to minimal possible clkh in this case.
602 ++ *
603 ++ * Note:
604 ++ * CLKH is not allowed to be 0, in this case I2C clock is not generated
605 ++ * at all
606 + */
607 +- if (clk >= clkl + d) {
608 ++ if (clk > clkl + d) {
609 + clkh = clk - clkl - d;
610 + clkl -= d;
611 + } else {
612 +- clkh = 0;
613 ++ clkh = 1;
614 + clkl = clk - (d << 1);
615 + }
616 +
617 +diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
618 +index c7427bdd3a4b..2949a381a94d 100644
619 +--- a/drivers/net/can/mscan/mpc5xxx_can.c
620 ++++ b/drivers/net/can/mscan/mpc5xxx_can.c
621 +@@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
622 + return 0;
623 + }
624 + cdm = of_iomap(np_cdm, 0);
625 ++ if (!cdm) {
626 ++ of_node_put(np_cdm);
627 ++ dev_err(&ofdev->dev, "can't map clock node!\n");
628 ++ return 0;
629 ++ }
630 +
631 + if (in_8(&cdm->ipb_clk_sel) & 0x1)
632 + freq *= 2;
633 +diff --git a/drivers/net/ethernet/3com/Kconfig b/drivers/net/ethernet/3com/Kconfig
634 +index 5b7658bcf020..5c3ef9fc8207 100644
635 +--- a/drivers/net/ethernet/3com/Kconfig
636 ++++ b/drivers/net/ethernet/3com/Kconfig
637 +@@ -32,7 +32,7 @@ config EL3
638 +
639 + config 3C515
640 + tristate "3c515 ISA \"Fast EtherLink\""
641 +- depends on ISA && ISA_DMA_API
642 ++ depends on ISA && ISA_DMA_API && !PPC32
643 + ---help---
644 + If you have a 3Com ISA EtherLink XL "Corkscrew" 3c515 Fast Ethernet
645 + network card, say Y here.
646 +diff --git a/drivers/net/ethernet/amd/Kconfig b/drivers/net/ethernet/amd/Kconfig
647 +index 0038709fd317..ec59425fdbff 100644
648 +--- a/drivers/net/ethernet/amd/Kconfig
649 ++++ b/drivers/net/ethernet/amd/Kconfig
650 +@@ -44,7 +44,7 @@ config AMD8111_ETH
651 +
652 + config LANCE
653 + tristate "AMD LANCE and PCnet (AT1500 and NE2100) support"
654 +- depends on ISA && ISA_DMA_API && !ARM
655 ++ depends on ISA && ISA_DMA_API && !ARM && !PPC32
656 + ---help---
657 + If you have a network (Ethernet) card of this type, say Y here.
658 + Some LinkSys cards are of this type.
659 +@@ -138,7 +138,7 @@ config PCMCIA_NMCLAN
660 +
661 + config NI65
662 + tristate "NI6510 support"
663 +- depends on ISA && ISA_DMA_API && !ARM
664 ++ depends on ISA && ISA_DMA_API && !ARM && !PPC32
665 + ---help---
666 + If you have a network (Ethernet) card of this type, say Y here.
667 +
668 +diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
669 +index 8b5988e210d5..c08d34f618b9 100644
670 +--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
671 ++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
672 +@@ -1683,6 +1683,7 @@ static struct sk_buff *atl1c_alloc_skb(struct atl1c_adapter *adapter)
673 + skb = build_skb(page_address(page) + adapter->rx_page_offset,
674 + adapter->rx_frag_size);
675 + if (likely(skb)) {
676 ++ skb_reserve(skb, NET_SKB_PAD);
677 + adapter->rx_page_offset += adapter->rx_frag_size;
678 + if (adapter->rx_page_offset >= PAGE_SIZE)
679 + adapter->rx_page = NULL;
680 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
681 +index d84efcd34fac..c56b61dce2d1 100644
682 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
683 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
684 +@@ -3360,14 +3360,18 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
685 + DP(BNX2X_MSG_ETHTOOL,
686 + "rss re-configured, UDP 4-tupple %s\n",
687 + udp_rss_requested ? "enabled" : "disabled");
688 +- return bnx2x_rss(bp, &bp->rss_conf_obj, false, true);
689 ++ if (bp->state == BNX2X_STATE_OPEN)
690 ++ return bnx2x_rss(bp, &bp->rss_conf_obj, false,
691 ++ true);
692 + } else if ((info->flow_type == UDP_V6_FLOW) &&
693 + (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) {
694 + bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested;
695 + DP(BNX2X_MSG_ETHTOOL,
696 + "rss re-configured, UDP 4-tupple %s\n",
697 + udp_rss_requested ? "enabled" : "disabled");
698 +- return bnx2x_rss(bp, &bp->rss_conf_obj, false, true);
699 ++ if (bp->state == BNX2X_STATE_OPEN)
700 ++ return bnx2x_rss(bp, &bp->rss_conf_obj, false,
701 ++ true);
702 + }
703 + return 0;
704 +
705 +@@ -3481,7 +3485,10 @@ static int bnx2x_set_rxfh(struct net_device *dev, const u32 *indir,
706 + bp->rss_conf_obj.ind_table[i] = indir[i] + bp->fp->cl_id;
707 + }
708 +
709 +- return bnx2x_config_rss_eth(bp, false);
710 ++ if (bp->state == BNX2X_STATE_OPEN)
711 ++ return bnx2x_config_rss_eth(bp, false);
712 ++
713 ++ return 0;
714 + }
715 +
716 + /**
717 +diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig
718 +index 5ab912937aff..ec0b545197e2 100644
719 +--- a/drivers/net/ethernet/cirrus/Kconfig
720 ++++ b/drivers/net/ethernet/cirrus/Kconfig
721 +@@ -19,6 +19,7 @@ if NET_VENDOR_CIRRUS
722 + config CS89x0
723 + tristate "CS89x0 support"
724 + depends on ISA || EISA || ARM
725 ++ depends on !PPC32
726 + ---help---
727 + Support for CS89x0 chipset based Ethernet cards. If you have a
728 + network (Ethernet) card of this type, say Y and read the file
729 +diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
730 +index 8390597aecb8..b20bce2c7da1 100644
731 +--- a/drivers/net/ethernet/cisco/enic/enic_main.c
732 ++++ b/drivers/net/ethernet/cisco/enic/enic_main.c
733 +@@ -1842,10 +1842,32 @@ static int enic_stop(struct net_device *netdev)
734 + return 0;
735 + }
736 +
737 ++static int _enic_change_mtu(struct net_device *netdev, int new_mtu)
738 ++{
739 ++ bool running = netif_running(netdev);
740 ++ int err = 0;
741 ++
742 ++ ASSERT_RTNL();
743 ++ if (running) {
744 ++ err = enic_stop(netdev);
745 ++ if (err)
746 ++ return err;
747 ++ }
748 ++
749 ++ netdev->mtu = new_mtu;
750 ++
751 ++ if (running) {
752 ++ err = enic_open(netdev);
753 ++ if (err)
754 ++ return err;
755 ++ }
756 ++
757 ++ return 0;
758 ++}
759 ++
760 + static int enic_change_mtu(struct net_device *netdev, int new_mtu)
761 + {
762 + struct enic *enic = netdev_priv(netdev);
763 +- int running = netif_running(netdev);
764 +
765 + if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU)
766 + return -EINVAL;
767 +@@ -1853,20 +1875,12 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)
768 + if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic))
769 + return -EOPNOTSUPP;
770 +
771 +- if (running)
772 +- enic_stop(netdev);
773 +-
774 +- netdev->mtu = new_mtu;
775 +-
776 + if (netdev->mtu > enic->port_mtu)
777 + netdev_warn(netdev,
778 +- "interface MTU (%d) set higher than port MTU (%d)\n",
779 +- netdev->mtu, enic->port_mtu);
780 ++ "interface MTU (%d) set higher than port MTU (%d)\n",
781 ++ netdev->mtu, enic->port_mtu);
782 +
783 +- if (running)
784 +- enic_open(netdev);
785 +-
786 +- return 0;
787 ++ return _enic_change_mtu(netdev, new_mtu);
788 + }
789 +
790 + static void enic_change_mtu_work(struct work_struct *work)
791 +@@ -1874,47 +1888,9 @@ static void enic_change_mtu_work(struct work_struct *work)
792 + struct enic *enic = container_of(work, struct enic, change_mtu_work);
793 + struct net_device *netdev = enic->netdev;
794 + int new_mtu = vnic_dev_mtu(enic->vdev);
795 +- int err;
796 +- unsigned int i;
797 +-
798 +- new_mtu = max_t(int, ENIC_MIN_MTU, min_t(int, ENIC_MAX_MTU, new_mtu));
799 +
800 + rtnl_lock();
801 +-
802 +- /* Stop RQ */
803 +- del_timer_sync(&enic->notify_timer);
804 +-
805 +- for (i = 0; i < enic->rq_count; i++)
806 +- napi_disable(&enic->napi[i]);
807 +-
808 +- vnic_intr_mask(&enic->intr[0]);
809 +- enic_synchronize_irqs(enic);
810 +- err = vnic_rq_disable(&enic->rq[0]);
811 +- if (err) {
812 +- rtnl_unlock();
813 +- netdev_err(netdev, "Unable to disable RQ.\n");
814 +- return;
815 +- }
816 +- vnic_rq_clean(&enic->rq[0], enic_free_rq_buf);
817 +- vnic_cq_clean(&enic->cq[0]);
818 +- vnic_intr_clean(&enic->intr[0]);
819 +-
820 +- /* Fill RQ with new_mtu-sized buffers */
821 +- netdev->mtu = new_mtu;
822 +- vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf);
823 +- /* Need at least one buffer on ring to get going */
824 +- if (vnic_rq_desc_used(&enic->rq[0]) == 0) {
825 +- rtnl_unlock();
826 +- netdev_err(netdev, "Unable to alloc receive buffers.\n");
827 +- return;
828 +- }
829 +-
830 +- /* Start RQ */
831 +- vnic_rq_enable(&enic->rq[0]);
832 +- napi_enable(&enic->napi[0]);
833 +- vnic_intr_unmask(&enic->intr[0]);
834 +- enic_notify_timer_start(enic);
835 +-
836 ++ (void)_enic_change_mtu(netdev, new_mtu);
837 + rtnl_unlock();
838 +
839 + netdev_info(netdev, "interface MTU set as %d\n", netdev->mtu);
840 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
841 +index 20d048cdcb88..c898006abb32 100644
842 +--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
843 ++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
844 +@@ -420,6 +420,7 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
845 + break;
846 + default:
847 + p_link->speed = 0;
848 ++ p_link->link_up = 0;
849 + }
850 +
851 + /* Correct speed according to bandwidth allocation */
852 +diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
853 +index 507bbb0355c2..f6108413adba 100644
854 +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
855 ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
856 +@@ -218,6 +218,7 @@ issue:
857 + ret = of_mdiobus_register(bus, np1);
858 + if (ret) {
859 + mdiobus_free(bus);
860 ++ lp->mii_bus = NULL;
861 + return ret;
862 + }
863 + return 0;
864 +diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
865 +index 317bc79cc8b9..c178e1218347 100644
866 +--- a/drivers/net/wan/lmc/lmc_main.c
867 ++++ b/drivers/net/wan/lmc/lmc_main.c
868 +@@ -1385,7 +1385,7 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/
869 + case 0x001:
870 + printk(KERN_WARNING "%s: Master Abort (naughty)\n", dev->name);
871 + break;
872 +- case 0x010:
873 ++ case 0x002:
874 + printk(KERN_WARNING "%s: Target Abort (not so naughty)\n", dev->name);
875 + break;
876 + default:
877 +diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
878 +index acaf84cadca3..6c9420ee9e03 100644
879 +--- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c
880 ++++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
881 +@@ -434,7 +434,7 @@ static void imx1_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
882 + const char *name;
883 + int i, ret;
884 +
885 +- if (group > info->ngroups)
886 ++ if (group >= info->ngroups)
887 + return;
888 +
889 + seq_puts(s, "\n");
890 +diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
891 +index 742ca57ece8c..d64b401f3d05 100644
892 +--- a/drivers/s390/cio/qdio_main.c
893 ++++ b/drivers/s390/cio/qdio_main.c
894 +@@ -640,21 +640,20 @@ static inline unsigned long qdio_aob_for_buffer(struct qdio_output_q *q,
895 + unsigned long phys_aob = 0;
896 +
897 + if (!q->use_cq)
898 +- goto out;
899 ++ return 0;
900 +
901 + if (!q->aobs[bufnr]) {
902 + struct qaob *aob = qdio_allocate_aob();
903 + q->aobs[bufnr] = aob;
904 + }
905 + if (q->aobs[bufnr]) {
906 +- q->sbal_state[bufnr].flags = QDIO_OUTBUF_STATE_FLAG_NONE;
907 + q->sbal_state[bufnr].aob = q->aobs[bufnr];
908 + q->aobs[bufnr]->user1 = (u64) q->sbal_state[bufnr].user;
909 + phys_aob = virt_to_phys(q->aobs[bufnr]);
910 + WARN_ON_ONCE(phys_aob & 0xFF);
911 + }
912 +
913 +-out:
914 ++ q->sbal_state[bufnr].flags = 0;
915 + return phys_aob;
916 + }
917 +
918 +diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
919 +index 34a1b1f333b4..d5184aa1ace4 100644
920 +--- a/drivers/scsi/fcoe/fcoe_ctlr.c
921 ++++ b/drivers/scsi/fcoe/fcoe_ctlr.c
922 +@@ -752,9 +752,9 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport,
923 + case ELS_LOGO:
924 + if (fip->mode == FIP_MODE_VN2VN) {
925 + if (fip->state != FIP_ST_VNMP_UP)
926 +- return -EINVAL;
927 ++ goto drop;
928 + if (ntoh24(fh->fh_d_id) == FC_FID_FLOGI)
929 +- return -EINVAL;
930 ++ goto drop;
931 + } else {
932 + if (fip->state != FIP_ST_ENABLED)
933 + return 0;
934 +diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
935 +index 9f0b00c38658..a74f8fbefd33 100644
936 +--- a/drivers/scsi/libiscsi.c
937 ++++ b/drivers/scsi/libiscsi.c
938 +@@ -283,11 +283,11 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)
939 + */
940 + if (opcode != ISCSI_OP_SCSI_DATA_OUT) {
941 + iscsi_conn_printk(KERN_INFO, conn,
942 +- "task [op %x/%x itt "
943 ++ "task [op %x itt "
944 + "0x%x/0x%x] "
945 + "rejected.\n",
946 +- task->hdr->opcode, opcode,
947 +- task->itt, task->hdr_itt);
948 ++ opcode, task->itt,
949 ++ task->hdr_itt);
950 + return -EACCES;
951 + }
952 + /*
953 +@@ -296,10 +296,10 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)
954 + */
955 + if (conn->session->fast_abort) {
956 + iscsi_conn_printk(KERN_INFO, conn,
957 +- "task [op %x/%x itt "
958 ++ "task [op %x itt "
959 + "0x%x/0x%x] fast abort.\n",
960 +- task->hdr->opcode, opcode,
961 +- task->itt, task->hdr_itt);
962 ++ opcode, task->itt,
963 ++ task->hdr_itt);
964 + return -EACCES;
965 + }
966 + break;
967 +diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
968 +index 4477e999ec70..8db0c48943d6 100644
969 +--- a/drivers/scsi/scsi_sysfs.c
970 ++++ b/drivers/scsi/scsi_sysfs.c
971 +@@ -678,8 +678,24 @@ static ssize_t
972 + sdev_store_delete(struct device *dev, struct device_attribute *attr,
973 + const char *buf, size_t count)
974 + {
975 +- if (device_remove_file_self(dev, attr))
976 +- scsi_remove_device(to_scsi_device(dev));
977 ++ struct kernfs_node *kn;
978 ++
979 ++ kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
980 ++ WARN_ON_ONCE(!kn);
981 ++ /*
982 ++ * Concurrent writes into the "delete" sysfs attribute may trigger
983 ++ * concurrent calls to device_remove_file() and scsi_remove_device().
984 ++ * device_remove_file() handles concurrent removal calls by
985 ++ * serializing these and by ignoring the second and later removal
986 ++ * attempts. Concurrent calls of scsi_remove_device() are
987 ++ * serialized. The second and later calls of scsi_remove_device() are
988 ++ * ignored because the first call of that function changes the device
989 ++ * state into SDEV_DEL.
990 ++ */
991 ++ device_remove_file(dev, attr);
992 ++ scsi_remove_device(to_scsi_device(dev));
993 ++ if (kn)
994 ++ sysfs_unbreak_active_protection(kn);
995 + return count;
996 + };
997 + static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
998 +diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
999 +index 0f133c1817de..0de2f9069e23 100644
1000 +--- a/drivers/scsi/vmw_pvscsi.c
1001 ++++ b/drivers/scsi/vmw_pvscsi.c
1002 +@@ -545,9 +545,14 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
1003 + (btstat == BTSTAT_SUCCESS ||
1004 + btstat == BTSTAT_LINKED_COMMAND_COMPLETED ||
1005 + btstat == BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG)) {
1006 +- cmd->result = (DID_OK << 16) | sdstat;
1007 +- if (sdstat == SAM_STAT_CHECK_CONDITION && cmd->sense_buffer)
1008 +- cmd->result |= (DRIVER_SENSE << 24);
1009 ++ if (sdstat == SAM_STAT_COMMAND_TERMINATED) {
1010 ++ cmd->result = (DID_RESET << 16);
1011 ++ } else {
1012 ++ cmd->result = (DID_OK << 16) | sdstat;
1013 ++ if (sdstat == SAM_STAT_CHECK_CONDITION &&
1014 ++ cmd->sense_buffer)
1015 ++ cmd->result |= (DRIVER_SENSE << 24);
1016 ++ }
1017 + } else
1018 + switch (btstat) {
1019 + case BTSTAT_SUCCESS:
1020 +diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
1021 +index 2a0158bb4974..5a78ef057635 100644
1022 +--- a/drivers/staging/media/omap4iss/iss_video.c
1023 ++++ b/drivers/staging/media/omap4iss/iss_video.c
1024 +@@ -11,7 +11,6 @@
1025 + * (at your option) any later version.
1026 + */
1027 +
1028 +-#include <asm/cacheflush.h>
1029 + #include <linux/clk.h>
1030 + #include <linux/mm.h>
1031 + #include <linux/pagemap.h>
1032 +@@ -22,6 +21,8 @@
1033 + #include <media/v4l2-dev.h>
1034 + #include <media/v4l2-ioctl.h>
1035 +
1036 ++#include <asm/cacheflush.h>
1037 ++
1038 + #include "iss_video.h"
1039 + #include "iss.h"
1040 +
1041 +diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
1042 +index bc2cbffec27e..63e54beed196 100644
1043 +--- a/drivers/target/iscsi/iscsi_target_login.c
1044 ++++ b/drivers/target/iscsi/iscsi_target_login.c
1045 +@@ -323,8 +323,7 @@ static int iscsi_login_zero_tsih_s1(
1046 + pr_err("idr_alloc() for sess_idr failed\n");
1047 + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
1048 + ISCSI_LOGIN_STATUS_NO_RESOURCES);
1049 +- kfree(sess);
1050 +- return -ENOMEM;
1051 ++ goto free_sess;
1052 + }
1053 +
1054 + sess->creation_time = get_jiffies_64();
1055 +@@ -340,20 +339,28 @@ static int iscsi_login_zero_tsih_s1(
1056 + ISCSI_LOGIN_STATUS_NO_RESOURCES);
1057 + pr_err("Unable to allocate memory for"
1058 + " struct iscsi_sess_ops.\n");
1059 +- kfree(sess);
1060 +- return -ENOMEM;
1061 ++ goto remove_idr;
1062 + }
1063 +
1064 + sess->se_sess = transport_init_session(TARGET_PROT_NORMAL);
1065 + if (IS_ERR(sess->se_sess)) {
1066 + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
1067 + ISCSI_LOGIN_STATUS_NO_RESOURCES);
1068 +- kfree(sess->sess_ops);
1069 +- kfree(sess);
1070 +- return -ENOMEM;
1071 ++ goto free_ops;
1072 + }
1073 +
1074 + return 0;
1075 ++
1076 ++free_ops:
1077 ++ kfree(sess->sess_ops);
1078 ++remove_idr:
1079 ++ spin_lock_bh(&sess_idr_lock);
1080 ++ idr_remove(&sess_idr, sess->session_index);
1081 ++ spin_unlock_bh(&sess_idr_lock);
1082 ++free_sess:
1083 ++ kfree(sess);
1084 ++ conn->sess = NULL;
1085 ++ return -ENOMEM;
1086 + }
1087 +
1088 + static int iscsi_login_zero_tsih_s2(
1089 +@@ -1142,13 +1149,13 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn,
1090 + ISCSI_LOGIN_STATUS_INIT_ERR);
1091 + if (!zero_tsih || !conn->sess)
1092 + goto old_sess_out;
1093 +- if (conn->sess->se_sess)
1094 +- transport_free_session(conn->sess->se_sess);
1095 +- if (conn->sess->session_index != 0) {
1096 +- spin_lock_bh(&sess_idr_lock);
1097 +- idr_remove(&sess_idr, conn->sess->session_index);
1098 +- spin_unlock_bh(&sess_idr_lock);
1099 +- }
1100 ++
1101 ++ transport_free_session(conn->sess->se_sess);
1102 ++
1103 ++ spin_lock_bh(&sess_idr_lock);
1104 ++ idr_remove(&sess_idr, conn->sess->session_index);
1105 ++ spin_unlock_bh(&sess_idr_lock);
1106 ++
1107 + kfree(conn->sess->sess_ops);
1108 + kfree(conn->sess);
1109 + conn->sess = NULL;
1110 +diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
1111 +index b5dab103be38..e931c3cb0840 100644
1112 +--- a/drivers/usb/gadget/function/f_uac2.c
1113 ++++ b/drivers/usb/gadget/function/f_uac2.c
1114 +@@ -941,14 +941,14 @@ static struct usb_descriptor_header *hs_audio_desc[] = {
1115 + };
1116 +
1117 + struct cntrl_cur_lay3 {
1118 +- __u32 dCUR;
1119 ++ __le32 dCUR;
1120 + };
1121 +
1122 + struct cntrl_range_lay3 {
1123 +- __u16 wNumSubRanges;
1124 +- __u32 dMIN;
1125 +- __u32 dMAX;
1126 +- __u32 dRES;
1127 ++ __le16 wNumSubRanges;
1128 ++ __le32 dMIN;
1129 ++ __le32 dMAX;
1130 ++ __le32 dRES;
1131 + } __packed;
1132 +
1133 + static inline void
1134 +@@ -1296,9 +1296,9 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr)
1135 + memset(&c, 0, sizeof(struct cntrl_cur_lay3));
1136 +
1137 + if (entity_id == USB_IN_CLK_ID)
1138 +- c.dCUR = p_srate;
1139 ++ c.dCUR = cpu_to_le32(p_srate);
1140 + else if (entity_id == USB_OUT_CLK_ID)
1141 +- c.dCUR = c_srate;
1142 ++ c.dCUR = cpu_to_le32(c_srate);
1143 +
1144 + value = min_t(unsigned, w_length, sizeof c);
1145 + memcpy(req->buf, &c, value);
1146 +@@ -1336,15 +1336,15 @@ in_rq_range(struct usb_function *fn, const struct usb_ctrlrequest *cr)
1147 +
1148 + if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) {
1149 + if (entity_id == USB_IN_CLK_ID)
1150 +- r.dMIN = p_srate;
1151 ++ r.dMIN = cpu_to_le32(p_srate);
1152 + else if (entity_id == USB_OUT_CLK_ID)
1153 +- r.dMIN = c_srate;
1154 ++ r.dMIN = cpu_to_le32(c_srate);
1155 + else
1156 + return -EOPNOTSUPP;
1157 +
1158 + r.dMAX = r.dMIN;
1159 + r.dRES = 0;
1160 +- r.wNumSubRanges = 1;
1161 ++ r.wNumSubRanges = cpu_to_le16(1);
1162 +
1163 + value = min_t(unsigned, w_length, sizeof r);
1164 + memcpy(req->buf, &r, value);
1165 +diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
1166 +index baa0609a429d..e34094647603 100644
1167 +--- a/drivers/usb/gadget/udc/r8a66597-udc.c
1168 ++++ b/drivers/usb/gadget/udc/r8a66597-udc.c
1169 +@@ -835,11 +835,11 @@ static void init_controller(struct r8a66597 *r8a66597)
1170 +
1171 + r8a66597_bset(r8a66597, XCKE, SYSCFG0);
1172 +
1173 +- msleep(3);
1174 ++ mdelay(3);
1175 +
1176 + r8a66597_bset(r8a66597, PLLC, SYSCFG0);
1177 +
1178 +- msleep(1);
1179 ++ mdelay(1);
1180 +
1181 + r8a66597_bset(r8a66597, SCKE, SYSCFG0);
1182 +
1183 +@@ -1193,7 +1193,7 @@ __acquires(r8a66597->lock)
1184 + r8a66597->ep0_req->length = 2;
1185 + /* AV: what happens if we get called again before that gets through? */
1186 + spin_unlock(&r8a66597->lock);
1187 +- r8a66597_queue(r8a66597->gadget.ep0, r8a66597->ep0_req, GFP_KERNEL);
1188 ++ r8a66597_queue(r8a66597->gadget.ep0, r8a66597->ep0_req, GFP_ATOMIC);
1189 + spin_lock(&r8a66597->lock);
1190 + }
1191 +
1192 +diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
1193 +index 94eb2923afed..85d031ce85c1 100644
1194 +--- a/drivers/usb/phy/phy-fsl-usb.c
1195 ++++ b/drivers/usb/phy/phy-fsl-usb.c
1196 +@@ -879,6 +879,7 @@ int usb_otg_start(struct platform_device *pdev)
1197 + if (pdata->init && pdata->init(pdev) != 0)
1198 + return -EINVAL;
1199 +
1200 ++#ifdef CONFIG_PPC32
1201 + if (pdata->big_endian_mmio) {
1202 + _fsl_readl = _fsl_readl_be;
1203 + _fsl_writel = _fsl_writel_be;
1204 +@@ -886,6 +887,7 @@ int usb_otg_start(struct platform_device *pdev)
1205 + _fsl_readl = _fsl_readl_le;
1206 + _fsl_writel = _fsl_writel_le;
1207 + }
1208 ++#endif
1209 +
1210 + /* request irq */
1211 + p_otg->irq = platform_get_irq(pdev, 0);
1212 +@@ -976,7 +978,7 @@ int usb_otg_start(struct platform_device *pdev)
1213 + /*
1214 + * state file in sysfs
1215 + */
1216 +-static int show_fsl_usb2_otg_state(struct device *dev,
1217 ++static ssize_t show_fsl_usb2_otg_state(struct device *dev,
1218 + struct device_attribute *attr, char *buf)
1219 + {
1220 + struct otg_fsm *fsm = &fsl_otg_dev->fsm;
1221 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1222 +index 982a9d509817..493c7354ec0b 100644
1223 +--- a/fs/btrfs/extent-tree.c
1224 ++++ b/fs/btrfs/extent-tree.c
1225 +@@ -4128,7 +4128,7 @@ commit_trans:
1226 + data_sinfo->flags, bytes, 1);
1227 + spin_unlock(&data_sinfo->lock);
1228 +
1229 +- return ret;
1230 ++ return 0;
1231 + }
1232 +
1233 + /*
1234 +diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
1235 +index c4b893453e0e..c43b4b08546b 100644
1236 +--- a/fs/cachefiles/namei.c
1237 ++++ b/fs/cachefiles/namei.c
1238 +@@ -194,7 +194,6 @@ wait_for_old_object:
1239 + pr_err("\n");
1240 + pr_err("Error: Unexpected object collision\n");
1241 + cachefiles_printk_object(object, xobject);
1242 +- BUG();
1243 + }
1244 + atomic_inc(&xobject->usage);
1245 + write_unlock(&cache->active_lock);
1246 +diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
1247 +index c0f3da3926a0..5b68cf526887 100644
1248 +--- a/fs/cachefiles/rdwr.c
1249 ++++ b/fs/cachefiles/rdwr.c
1250 +@@ -27,6 +27,7 @@ static int cachefiles_read_waiter(wait_queue_t *wait, unsigned mode,
1251 + struct cachefiles_one_read *monitor =
1252 + container_of(wait, struct cachefiles_one_read, monitor);
1253 + struct cachefiles_object *object;
1254 ++ struct fscache_retrieval *op = monitor->op;
1255 + struct wait_bit_key *key = _key;
1256 + struct page *page = wait->private;
1257 +
1258 +@@ -51,16 +52,22 @@ static int cachefiles_read_waiter(wait_queue_t *wait, unsigned mode,
1259 + list_del(&wait->task_list);
1260 +
1261 + /* move onto the action list and queue for FS-Cache thread pool */
1262 +- ASSERT(monitor->op);
1263 ++ ASSERT(op);
1264 +
1265 +- object = container_of(monitor->op->op.object,
1266 +- struct cachefiles_object, fscache);
1267 ++ /* We need to temporarily bump the usage count as we don't own a ref
1268 ++ * here otherwise cachefiles_read_copier() may free the op between the
1269 ++ * monitor being enqueued on the op->to_do list and the op getting
1270 ++ * enqueued on the work queue.
1271 ++ */
1272 ++ fscache_get_retrieval(op);
1273 +
1274 ++ object = container_of(op->op.object, struct cachefiles_object, fscache);
1275 + spin_lock(&object->work_lock);
1276 +- list_add_tail(&monitor->op_link, &monitor->op->to_do);
1277 ++ list_add_tail(&monitor->op_link, &op->to_do);
1278 + spin_unlock(&object->work_lock);
1279 +
1280 +- fscache_enqueue_retrieval(monitor->op);
1281 ++ fscache_enqueue_retrieval(op);
1282 ++ fscache_put_retrieval(op);
1283 + return 0;
1284 + }
1285 +
1286 +diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
1287 +index 0a3544fb50f9..bcbe42fb7e92 100644
1288 +--- a/fs/cifs/cifs_debug.c
1289 ++++ b/fs/cifs/cifs_debug.c
1290 +@@ -123,25 +123,41 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
1291 + seq_printf(m, "CIFS Version %s\n", CIFS_VERSION);
1292 + seq_printf(m, "Features:");
1293 + #ifdef CONFIG_CIFS_DFS_UPCALL
1294 +- seq_printf(m, " dfs");
1295 ++ seq_printf(m, " DFS");
1296 + #endif
1297 + #ifdef CONFIG_CIFS_FSCACHE
1298 +- seq_printf(m, " fscache");
1299 ++ seq_printf(m, ",FSCACHE");
1300 ++#endif
1301 ++#ifdef CONFIG_CIFS_SMB_DIRECT
1302 ++ seq_printf(m, ",SMB_DIRECT");
1303 ++#endif
1304 ++#ifdef CONFIG_CIFS_STATS2
1305 ++ seq_printf(m, ",STATS2");
1306 ++#elif defined(CONFIG_CIFS_STATS)
1307 ++ seq_printf(m, ",STATS");
1308 ++#endif
1309 ++#ifdef CONFIG_CIFS_DEBUG2
1310 ++ seq_printf(m, ",DEBUG2");
1311 ++#elif defined(CONFIG_CIFS_DEBUG)
1312 ++ seq_printf(m, ",DEBUG");
1313 ++#endif
1314 ++#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
1315 ++ seq_printf(m, ",ALLOW_INSECURE_LEGACY");
1316 + #endif
1317 + #ifdef CONFIG_CIFS_WEAK_PW_HASH
1318 +- seq_printf(m, " lanman");
1319 ++ seq_printf(m, ",WEAK_PW_HASH");
1320 + #endif
1321 + #ifdef CONFIG_CIFS_POSIX
1322 +- seq_printf(m, " posix");
1323 ++ seq_printf(m, ",CIFS_POSIX");
1324 + #endif
1325 + #ifdef CONFIG_CIFS_UPCALL
1326 +- seq_printf(m, " spnego");
1327 ++ seq_printf(m, ",UPCALL(SPNEGO)");
1328 + #endif
1329 + #ifdef CONFIG_CIFS_XATTR
1330 +- seq_printf(m, " xattr");
1331 ++ seq_printf(m, ",XATTR");
1332 + #endif
1333 + #ifdef CONFIG_CIFS_ACL
1334 +- seq_printf(m, " acl");
1335 ++ seq_printf(m, ",ACL");
1336 + #endif
1337 + seq_putc(m, '\n');
1338 + seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
1339 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
1340 +index 9cdeb0293267..36c8594bb147 100644
1341 +--- a/fs/cifs/inode.c
1342 ++++ b/fs/cifs/inode.c
1343 +@@ -1063,6 +1063,8 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
1344 + if (!server->ops->set_file_info)
1345 + return -ENOSYS;
1346 +
1347 ++ info_buf.Pad = 0;
1348 ++
1349 + if (attrs->ia_valid & ATTR_ATIME) {
1350 + set_time = true;
1351 + info_buf.LastAccessTime =
1352 +diff --git a/fs/cifs/link.c b/fs/cifs/link.c
1353 +index e3548f73bdea..728289c32b32 100644
1354 +--- a/fs/cifs/link.c
1355 ++++ b/fs/cifs/link.c
1356 +@@ -419,7 +419,7 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
1357 + struct cifs_io_parms io_parms;
1358 + int buf_type = CIFS_NO_BUFFER;
1359 + __le16 *utf16_path;
1360 +- __u8 oplock = SMB2_OPLOCK_LEVEL_II;
1361 ++ __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
1362 + struct smb2_file_all_info *pfile_info = NULL;
1363 +
1364 + oparms.tcon = tcon;
1365 +@@ -481,7 +481,7 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
1366 + struct cifs_io_parms io_parms;
1367 + int create_options = CREATE_NOT_DIR;
1368 + __le16 *utf16_path;
1369 +- __u8 oplock = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
1370 ++ __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
1371 + struct kvec iov[2];
1372 +
1373 + if (backup_cred(cifs_sb))
1374 +diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
1375 +index a035d1a95882..9bc7a29f88d6 100644
1376 +--- a/fs/cifs/sess.c
1377 ++++ b/fs/cifs/sess.c
1378 +@@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
1379 + goto setup_ntlmv2_ret;
1380 + }
1381 + *pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
1382 ++ if (!*pbuffer) {
1383 ++ rc = -ENOMEM;
1384 ++ cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc);
1385 ++ *buflen = 0;
1386 ++ goto setup_ntlmv2_ret;
1387 ++ }
1388 + sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;
1389 +
1390 + memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);
1391 +diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
1392 +index 1238cd3552f9..0267d8cbc996 100644
1393 +--- a/fs/cifs/smb2inode.c
1394 ++++ b/fs/cifs/smb2inode.c
1395 +@@ -267,7 +267,7 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
1396 + int rc;
1397 +
1398 + if ((buf->CreationTime == 0) && (buf->LastAccessTime == 0) &&
1399 +- (buf->LastWriteTime == 0) && (buf->ChangeTime) &&
1400 ++ (buf->LastWriteTime == 0) && (buf->ChangeTime == 0) &&
1401 + (buf->Attributes == 0))
1402 + return 0; /* would be a no op, no sense sending this */
1403 +
1404 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
1405 +index 97472088d65a..a1f1e53d0e25 100644
1406 +--- a/fs/ext4/namei.c
1407 ++++ b/fs/ext4/namei.c
1408 +@@ -1401,6 +1401,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
1409 + goto cleanup_and_exit;
1410 + dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, "
1411 + "falling back\n"));
1412 ++ ret = NULL;
1413 + }
1414 + nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
1415 + if (!nblocks) {
1416 +diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
1417 +index c2ee23acf359..ae9929d678d6 100644
1418 +--- a/fs/ext4/sysfs.c
1419 ++++ b/fs/ext4/sysfs.c
1420 +@@ -277,8 +277,12 @@ static ssize_t ext4_attr_show(struct kobject *kobj,
1421 + case attr_pointer_ui:
1422 + if (!ptr)
1423 + return 0;
1424 +- return snprintf(buf, PAGE_SIZE, "%u\n",
1425 +- *((unsigned int *) ptr));
1426 ++ if (a->attr_ptr == ptr_ext4_super_block_offset)
1427 ++ return snprintf(buf, PAGE_SIZE, "%u\n",
1428 ++ le32_to_cpup(ptr));
1429 ++ else
1430 ++ return snprintf(buf, PAGE_SIZE, "%u\n",
1431 ++ *((unsigned int *) ptr));
1432 + case attr_pointer_atomic:
1433 + if (!ptr)
1434 + return 0;
1435 +@@ -311,7 +315,10 @@ static ssize_t ext4_attr_store(struct kobject *kobj,
1436 + ret = kstrtoul(skip_spaces(buf), 0, &t);
1437 + if (ret)
1438 + return ret;
1439 +- *((unsigned int *) ptr) = t;
1440 ++ if (a->attr_ptr == ptr_ext4_super_block_offset)
1441 ++ *((__le32 *) ptr) = cpu_to_le32(t);
1442 ++ else
1443 ++ *((unsigned int *) ptr) = t;
1444 + return len;
1445 + case attr_inode_readahead:
1446 + return inode_readahead_blks_store(a, sbi, buf, len);
1447 +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
1448 +index c7cad05aed27..9fb2a751fce4 100644
1449 +--- a/fs/ext4/xattr.c
1450 ++++ b/fs/ext4/xattr.c
1451 +@@ -197,6 +197,8 @@ ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end,
1452 + struct ext4_xattr_entry *next = EXT4_XATTR_NEXT(e);
1453 + if ((void *)next >= end)
1454 + return -EFSCORRUPTED;
1455 ++ if (strnlen(e->e_name, e->e_name_len) != e->e_name_len)
1456 ++ return -EFSCORRUPTED;
1457 + e = next;
1458 + }
1459 +
1460 +diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c
1461 +index de67745e1cd7..77946d6f617d 100644
1462 +--- a/fs/fscache/operation.c
1463 ++++ b/fs/fscache/operation.c
1464 +@@ -66,7 +66,8 @@ void fscache_enqueue_operation(struct fscache_operation *op)
1465 + ASSERT(op->processor != NULL);
1466 + ASSERT(fscache_object_is_available(op->object));
1467 + ASSERTCMP(atomic_read(&op->usage), >, 0);
1468 +- ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS);
1469 ++ ASSERTIFCMP(op->state != FSCACHE_OP_ST_IN_PROGRESS,
1470 ++ op->state, ==, FSCACHE_OP_ST_CANCELLED);
1471 +
1472 + fscache_stat(&fscache_n_op_enqueue);
1473 + switch (op->flags & FSCACHE_OP_TYPE) {
1474 +@@ -481,7 +482,8 @@ void fscache_put_operation(struct fscache_operation *op)
1475 + struct fscache_cache *cache;
1476 +
1477 + _enter("{OBJ%x OP%x,%d}",
1478 +- op->object->debug_id, op->debug_id, atomic_read(&op->usage));
1479 ++ op->object ? op->object->debug_id : 0,
1480 ++ op->debug_id, atomic_read(&op->usage));
1481 +
1482 + ASSERTCMP(atomic_read(&op->usage), >, 0);
1483 +
1484 +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
1485 +index d0cf1f010fbe..2671e922c720 100644
1486 +--- a/fs/fuse/dev.c
1487 ++++ b/fs/fuse/dev.c
1488 +@@ -143,6 +143,16 @@ static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background)
1489 + return !fc->initialized || (for_background && fc->blocked);
1490 + }
1491 +
1492 ++static void fuse_drop_waiting(struct fuse_conn *fc)
1493 ++{
1494 ++ if (fc->connected) {
1495 ++ atomic_dec(&fc->num_waiting);
1496 ++ } else if (atomic_dec_and_test(&fc->num_waiting)) {
1497 ++ /* wake up aborters */
1498 ++ wake_up_all(&fc->blocked_waitq);
1499 ++ }
1500 ++}
1501 ++
1502 + static struct fuse_req *__fuse_get_req(struct fuse_conn *fc, unsigned npages,
1503 + bool for_background)
1504 + {
1505 +@@ -189,7 +199,7 @@ static struct fuse_req *__fuse_get_req(struct fuse_conn *fc, unsigned npages,
1506 + return req;
1507 +
1508 + out:
1509 +- atomic_dec(&fc->num_waiting);
1510 ++ fuse_drop_waiting(fc);
1511 + return ERR_PTR(err);
1512 + }
1513 +
1514 +@@ -296,7 +306,7 @@ void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
1515 +
1516 + if (test_bit(FR_WAITING, &req->flags)) {
1517 + __clear_bit(FR_WAITING, &req->flags);
1518 +- atomic_dec(&fc->num_waiting);
1519 ++ fuse_drop_waiting(fc);
1520 + }
1521 +
1522 + if (req->stolen_file)
1523 +@@ -382,7 +392,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
1524 + struct fuse_iqueue *fiq = &fc->iq;
1525 +
1526 + if (test_and_set_bit(FR_FINISHED, &req->flags))
1527 +- return;
1528 ++ goto put_request;
1529 +
1530 + spin_lock(&fiq->waitq.lock);
1531 + list_del_init(&req->intr_entry);
1532 +@@ -412,6 +422,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
1533 + wake_up(&req->waitq);
1534 + if (req->end)
1535 + req->end(fc, req);
1536 ++put_request:
1537 + fuse_put_request(fc, req);
1538 + }
1539 +
1540 +@@ -1991,11 +2002,14 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
1541 + if (!fud)
1542 + return -EPERM;
1543 +
1544 ++ pipe_lock(pipe);
1545 ++
1546 + bufs = kmalloc(pipe->buffers * sizeof(struct pipe_buffer), GFP_KERNEL);
1547 +- if (!bufs)
1548 ++ if (!bufs) {
1549 ++ pipe_unlock(pipe);
1550 + return -ENOMEM;
1551 ++ }
1552 +
1553 +- pipe_lock(pipe);
1554 + nbuf = 0;
1555 + rem = 0;
1556 + for (idx = 0; idx < pipe->nrbufs && rem < len; idx++)
1557 +@@ -2151,6 +2165,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
1558 + set_bit(FR_ABORTED, &req->flags);
1559 + if (!test_bit(FR_LOCKED, &req->flags)) {
1560 + set_bit(FR_PRIVATE, &req->flags);
1561 ++ __fuse_get_request(req);
1562 + list_move(&req->list, &to_end1);
1563 + }
1564 + spin_unlock(&req->waitq.lock);
1565 +@@ -2177,7 +2192,6 @@ void fuse_abort_conn(struct fuse_conn *fc)
1566 +
1567 + while (!list_empty(&to_end1)) {
1568 + req = list_first_entry(&to_end1, struct fuse_req, list);
1569 +- __fuse_get_request(req);
1570 + list_del_init(&req->list);
1571 + request_end(fc, req);
1572 + }
1573 +@@ -2188,6 +2202,11 @@ void fuse_abort_conn(struct fuse_conn *fc)
1574 + }
1575 + EXPORT_SYMBOL_GPL(fuse_abort_conn);
1576 +
1577 ++void fuse_wait_aborted(struct fuse_conn *fc)
1578 ++{
1579 ++ wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0);
1580 ++}
1581 ++
1582 + int fuse_dev_release(struct inode *inode, struct file *file)
1583 + {
1584 + struct fuse_dev *fud = fuse_get_dev(file);
1585 +@@ -2195,9 +2214,15 @@ int fuse_dev_release(struct inode *inode, struct file *file)
1586 + if (fud) {
1587 + struct fuse_conn *fc = fud->fc;
1588 + struct fuse_pqueue *fpq = &fud->pq;
1589 ++ LIST_HEAD(to_end);
1590 +
1591 ++ spin_lock(&fpq->lock);
1592 + WARN_ON(!list_empty(&fpq->io));
1593 +- end_requests(fc, &fpq->processing);
1594 ++ list_splice_init(&fpq->processing, &to_end);
1595 ++ spin_unlock(&fpq->lock);
1596 ++
1597 ++ end_requests(fc, &to_end);
1598 ++
1599 + /* Are we the last open device? */
1600 + if (atomic_dec_and_test(&fc->dev_count)) {
1601 + WARN_ON(fc->iq.fasync != NULL);
1602 +diff --git a/fs/fuse/file.c b/fs/fuse/file.c
1603 +index 1a063cbfe503..8577f3ba6dc6 100644
1604 +--- a/fs/fuse/file.c
1605 ++++ b/fs/fuse/file.c
1606 +@@ -879,6 +879,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
1607 + }
1608 +
1609 + if (WARN_ON(req->num_pages >= req->max_pages)) {
1610 ++ unlock_page(page);
1611 + fuse_put_request(fc, req);
1612 + return -EIO;
1613 + }
1614 +diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
1615 +index 604cd42dafef..7aafe9acc6c0 100644
1616 +--- a/fs/fuse/fuse_i.h
1617 ++++ b/fs/fuse/fuse_i.h
1618 +@@ -842,6 +842,7 @@ void fuse_request_send_background_locked(struct fuse_conn *fc,
1619 +
1620 + /* Abort all requests */
1621 + void fuse_abort_conn(struct fuse_conn *fc);
1622 ++void fuse_wait_aborted(struct fuse_conn *fc);
1623 +
1624 + /**
1625 + * Invalidate inode attributes
1626 +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
1627 +index f0b73e0c6d48..4b2eb65be0d4 100644
1628 +--- a/fs/fuse/inode.c
1629 ++++ b/fs/fuse/inode.c
1630 +@@ -379,9 +379,6 @@ static void fuse_put_super(struct super_block *sb)
1631 + {
1632 + struct fuse_conn *fc = get_fuse_conn_super(sb);
1633 +
1634 +- fuse_send_destroy(fc);
1635 +-
1636 +- fuse_abort_conn(fc);
1637 + mutex_lock(&fuse_mutex);
1638 + list_del(&fc->entry);
1639 + fuse_ctl_remove_conn(fc);
1640 +@@ -1172,16 +1169,25 @@ static struct dentry *fuse_mount(struct file_system_type *fs_type,
1641 + return mount_nodev(fs_type, flags, raw_data, fuse_fill_super);
1642 + }
1643 +
1644 +-static void fuse_kill_sb_anon(struct super_block *sb)
1645 ++static void fuse_sb_destroy(struct super_block *sb)
1646 + {
1647 + struct fuse_conn *fc = get_fuse_conn_super(sb);
1648 +
1649 + if (fc) {
1650 ++ fuse_send_destroy(fc);
1651 ++
1652 ++ fuse_abort_conn(fc);
1653 ++ fuse_wait_aborted(fc);
1654 ++
1655 + down_write(&fc->killsb);
1656 + fc->sb = NULL;
1657 + up_write(&fc->killsb);
1658 + }
1659 ++}
1660 +
1661 ++static void fuse_kill_sb_anon(struct super_block *sb)
1662 ++{
1663 ++ fuse_sb_destroy(sb);
1664 + kill_anon_super(sb);
1665 + }
1666 +
1667 +@@ -1204,14 +1210,7 @@ static struct dentry *fuse_mount_blk(struct file_system_type *fs_type,
1668 +
1669 + static void fuse_kill_sb_blk(struct super_block *sb)
1670 + {
1671 +- struct fuse_conn *fc = get_fuse_conn_super(sb);
1672 +-
1673 +- if (fc) {
1674 +- down_write(&fc->killsb);
1675 +- fc->sb = NULL;
1676 +- up_write(&fc->killsb);
1677 +- }
1678 +-
1679 ++ fuse_sb_destroy(sb);
1680 + kill_block_super(sb);
1681 + }
1682 +
1683 +diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
1684 +index 39c75a86c67f..666986b95c5d 100644
1685 +--- a/fs/sysfs/file.c
1686 ++++ b/fs/sysfs/file.c
1687 +@@ -407,6 +407,50 @@ int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr,
1688 + }
1689 + EXPORT_SYMBOL_GPL(sysfs_chmod_file);
1690 +
1691 ++/**
1692 ++ * sysfs_break_active_protection - break "active" protection
1693 ++ * @kobj: The kernel object @attr is associated with.
1694 ++ * @attr: The attribute to break the "active" protection for.
1695 ++ *
1696 ++ * With sysfs, just like kernfs, deletion of an attribute is postponed until
1697 ++ * all active .show() and .store() callbacks have finished unless this function
1698 ++ * is called. Hence this function is useful in methods that implement self
1699 ++ * deletion.
1700 ++ */
1701 ++struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
1702 ++ const struct attribute *attr)
1703 ++{
1704 ++ struct kernfs_node *kn;
1705 ++
1706 ++ kobject_get(kobj);
1707 ++ kn = kernfs_find_and_get(kobj->sd, attr->name);
1708 ++ if (kn)
1709 ++ kernfs_break_active_protection(kn);
1710 ++ return kn;
1711 ++}
1712 ++EXPORT_SYMBOL_GPL(sysfs_break_active_protection);
1713 ++
1714 ++/**
1715 ++ * sysfs_unbreak_active_protection - restore "active" protection
1716 ++ * @kn: Pointer returned by sysfs_break_active_protection().
1717 ++ *
1718 ++ * Undo the effects of sysfs_break_active_protection(). Since this function
1719 ++ * calls kernfs_put() on the kernfs node that corresponds to the 'attr'
1720 ++ * argument passed to sysfs_break_active_protection() that attribute may have
1721 ++ * been removed between the sysfs_break_active_protection() and
1722 ++ * sysfs_unbreak_active_protection() calls, it is not safe to access @kn after
1723 ++ * this function has returned.
1724 ++ */
1725 ++void sysfs_unbreak_active_protection(struct kernfs_node *kn)
1726 ++{
1727 ++ struct kobject *kobj = kn->parent->priv;
1728 ++
1729 ++ kernfs_unbreak_active_protection(kn);
1730 ++ kernfs_put(kn);
1731 ++ kobject_put(kobj);
1732 ++}
1733 ++EXPORT_SYMBOL_GPL(sysfs_unbreak_active_protection);
1734 ++
1735 + /**
1736 + * sysfs_remove_file_ns - remove an object attribute with a custom ns tag
1737 + * @kobj: object we're acting for
1738 +diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
1739 +index 00a1f330f93a..d3c19f8c4564 100644
1740 +--- a/include/linux/sysfs.h
1741 ++++ b/include/linux/sysfs.h
1742 +@@ -238,6 +238,9 @@ int __must_check sysfs_create_files(struct kobject *kobj,
1743 + const struct attribute **attr);
1744 + int __must_check sysfs_chmod_file(struct kobject *kobj,
1745 + const struct attribute *attr, umode_t mode);
1746 ++struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
1747 ++ const struct attribute *attr);
1748 ++void sysfs_unbreak_active_protection(struct kernfs_node *kn);
1749 + void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
1750 + const void *ns);
1751 + bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
1752 +@@ -351,6 +354,17 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
1753 + return 0;
1754 + }
1755 +
1756 ++static inline struct kernfs_node *
1757 ++sysfs_break_active_protection(struct kobject *kobj,
1758 ++ const struct attribute *attr)
1759 ++{
1760 ++ return NULL;
1761 ++}
1762 ++
1763 ++static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn)
1764 ++{
1765 ++}
1766 ++
1767 + static inline void sysfs_remove_file_ns(struct kobject *kobj,
1768 + const struct attribute *attr,
1769 + const void *ns)
1770 +diff --git a/kernel/kprobes.c b/kernel/kprobes.c
1771 +index bbe9dd0886bd..388bcace62f8 100644
1772 +--- a/kernel/kprobes.c
1773 ++++ b/kernel/kprobes.c
1774 +@@ -2441,7 +2441,7 @@ static int __init debugfs_kprobe_init(void)
1775 + if (!dir)
1776 + return -ENOMEM;
1777 +
1778 +- file = debugfs_create_file("list", 0444, dir, NULL,
1779 ++ file = debugfs_create_file("list", 0400, dir, NULL,
1780 + &debugfs_kprobes_operations);
1781 + if (!file)
1782 + goto error;
1783 +@@ -2451,7 +2451,7 @@ static int __init debugfs_kprobe_init(void)
1784 + if (!file)
1785 + goto error;
1786 +
1787 +- file = debugfs_create_file("blacklist", 0444, dir, NULL,
1788 ++ file = debugfs_create_file("blacklist", 0400, dir, NULL,
1789 + &debugfs_kprobe_blacklist_ops);
1790 + if (!file)
1791 + goto error;
1792 +diff --git a/kernel/sysctl.c b/kernel/sysctl.c
1793 +index 17c59e78661b..66100d1bc3f7 100644
1794 +--- a/kernel/sysctl.c
1795 ++++ b/kernel/sysctl.c
1796 +@@ -342,7 +342,8 @@ static struct ctl_table kern_table[] = {
1797 + .data = &sysctl_sched_time_avg,
1798 + .maxlen = sizeof(unsigned int),
1799 + .mode = 0644,
1800 +- .proc_handler = proc_dointvec,
1801 ++ .proc_handler = proc_dointvec_minmax,
1802 ++ .extra1 = &one,
1803 + },
1804 + {
1805 + .procname = "sched_shares_window_ns",
1806 +diff --git a/mm/memory.c b/mm/memory.c
1807 +index d5bb1465d30c..42db644f5ec4 100644
1808 +--- a/mm/memory.c
1809 ++++ b/mm/memory.c
1810 +@@ -3701,6 +3701,9 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
1811 + return -EINVAL;
1812 +
1813 + maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
1814 ++ if (!maddr)
1815 ++ return -ENOMEM;
1816 ++
1817 + if (write)
1818 + memcpy_toio(maddr + offset, buf, len);
1819 + else
1820 +diff --git a/mm/zswap.c b/mm/zswap.c
1821 +index 568015e2fe7a..87a8491909ee 100644
1822 +--- a/mm/zswap.c
1823 ++++ b/mm/zswap.c
1824 +@@ -1018,6 +1018,15 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
1825 + ret = -ENOMEM;
1826 + goto reject;
1827 + }
1828 ++
1829 ++ /* A second zswap_is_full() check after
1830 ++ * zswap_shrink() to make sure it's now
1831 ++ * under the max_pool_percent
1832 ++ */
1833 ++ if (zswap_is_full()) {
1834 ++ ret = -ENOMEM;
1835 ++ goto reject;
1836 ++ }
1837 + }
1838 +
1839 + /* allocate entry */
1840 +diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
1841 +index d730a0f68f46..a0443d40d677 100644
1842 +--- a/net/caif/caif_dev.c
1843 ++++ b/net/caif/caif_dev.c
1844 +@@ -131,8 +131,10 @@ static void caif_flow_cb(struct sk_buff *skb)
1845 + caifd = caif_get(skb->dev);
1846 +
1847 + WARN_ON(caifd == NULL);
1848 +- if (caifd == NULL)
1849 ++ if (!caifd) {
1850 ++ rcu_read_unlock();
1851 + return;
1852 ++ }
1853 +
1854 + caifd_hold(caifd);
1855 + rcu_read_unlock();
1856 +diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
1857 +index 5f3b81941a6f..5169b9b36b6a 100644
1858 +--- a/net/ipv4/cipso_ipv4.c
1859 ++++ b/net/ipv4/cipso_ipv4.c
1860 +@@ -1593,9 +1593,17 @@ unsigned char *cipso_v4_optptr(const struct sk_buff *skb)
1861 + int taglen;
1862 +
1863 + for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 0; ) {
1864 +- if (optptr[0] == IPOPT_CIPSO)
1865 ++ switch (optptr[0]) {
1866 ++ case IPOPT_CIPSO:
1867 + return optptr;
1868 +- taglen = optptr[1];
1869 ++ case IPOPT_END:
1870 ++ return NULL;
1871 ++ case IPOPT_NOOP:
1872 ++ taglen = 1;
1873 ++ break;
1874 ++ default:
1875 ++ taglen = optptr[1];
1876 ++ }
1877 + optlen -= taglen;
1878 + optptr += taglen;
1879 + }
1880 +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
1881 +index 40bb7a5e6d47..6aca9a6b2303 100644
1882 +--- a/net/ipv6/ip6_vti.c
1883 ++++ b/net/ipv6/ip6_vti.c
1884 +@@ -469,10 +469,6 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
1885 + goto tx_err_dst_release;
1886 + }
1887 +
1888 +- skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev)));
1889 +- skb_dst_set(skb, dst);
1890 +- skb->dev = skb_dst(skb)->dev;
1891 +-
1892 + mtu = dst_mtu(dst);
1893 + if (!skb->ignore_df && skb->len > mtu) {
1894 + skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu);
1895 +@@ -487,9 +483,14 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
1896 + htonl(mtu));
1897 + }
1898 +
1899 +- return -EMSGSIZE;
1900 ++ err = -EMSGSIZE;
1901 ++ goto tx_err_dst_release;
1902 + }
1903 +
1904 ++ skb_scrub_packet(skb, !net_eq(t->net, dev_net(dev)));
1905 ++ skb_dst_set(skb, dst);
1906 ++ skb->dev = skb_dst(skb)->dev;
1907 ++
1908 + err = dst_output(t->net, skb->sk, skb);
1909 + if (net_xmit_eval(err) == 0) {
1910 + struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
1911 +diff --git a/net/mac80211/util.c b/net/mac80211/util.c
1912 +index ec26a84b00e2..2214c77d4172 100644
1913 +--- a/net/mac80211/util.c
1914 ++++ b/net/mac80211/util.c
1915 +@@ -2006,7 +2006,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1916 + if (!sta->uploaded)
1917 + continue;
1918 +
1919 +- if (sta->sdata->vif.type != NL80211_IFTYPE_AP)
1920 ++ if (sta->sdata->vif.type != NL80211_IFTYPE_AP &&
1921 ++ sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
1922 + continue;
1923 +
1924 + for (state = IEEE80211_STA_NOTEXIST;
1925 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
1926 +index b0b58d1565c2..b07fd8b8b50c 100644
1927 +--- a/net/wireless/nl80211.c
1928 ++++ b/net/wireless/nl80211.c
1929 +@@ -3578,6 +3578,7 @@ static int parse_station_flags(struct genl_info *info,
1930 + params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) |
1931 + BIT(NL80211_STA_FLAG_MFP) |
1932 + BIT(NL80211_STA_FLAG_AUTHORIZED);
1933 ++ break;
1934 + default:
1935 + return -EINVAL;
1936 + }
1937 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
1938 +index f9a13b67df5e..e9eecf6f0bff 100644
1939 +--- a/net/xfrm/xfrm_policy.c
1940 ++++ b/net/xfrm/xfrm_policy.c
1941 +@@ -2326,6 +2326,9 @@ struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig,
1942 + if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE)
1943 + return make_blackhole(net, dst_orig->ops->family, dst_orig);
1944 +
1945 ++ if (IS_ERR(dst))
1946 ++ dst_release(dst_orig);
1947 ++
1948 + return dst;
1949 + }
1950 + EXPORT_SYMBOL(xfrm_lookup_route);
1951 +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
1952 +index 78c40bb681b9..a9b4491a3cc4 100644
1953 +--- a/net/xfrm/xfrm_user.c
1954 ++++ b/net/xfrm/xfrm_user.c
1955 +@@ -980,10 +980,12 @@ static inline int xfrm_nlmsg_multicast(struct net *net, struct sk_buff *skb,
1956 + {
1957 + struct sock *nlsk = rcu_dereference(net->xfrm.nlsk);
1958 +
1959 +- if (nlsk)
1960 +- return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC);
1961 +- else
1962 +- return -1;
1963 ++ if (!nlsk) {
1964 ++ kfree_skb(skb);
1965 ++ return -EPIPE;
1966 ++ }
1967 ++
1968 ++ return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC);
1969 + }
1970 +
1971 + static inline size_t xfrm_spdinfo_msgsize(void)
1972 +diff --git a/sound/soc/sirf/sirf-usp.c b/sound/soc/sirf/sirf-usp.c
1973 +index 45fc06c0e0e5..6b504f407079 100644
1974 +--- a/sound/soc/sirf/sirf-usp.c
1975 ++++ b/sound/soc/sirf/sirf-usp.c
1976 +@@ -367,10 +367,9 @@ static int sirf_usp_pcm_probe(struct platform_device *pdev)
1977 + platform_set_drvdata(pdev, usp);
1978 +
1979 + mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1980 +- base = devm_ioremap(&pdev->dev, mem_res->start,
1981 +- resource_size(mem_res));
1982 +- if (base == NULL)
1983 +- return -ENOMEM;
1984 ++ base = devm_ioremap_resource(&pdev->dev, mem_res);
1985 ++ if (IS_ERR(base))
1986 ++ return PTR_ERR(base);
1987 + usp->regmap = devm_regmap_init_mmio(&pdev->dev, base,
1988 + &sirf_usp_regmap_config);
1989 + if (IS_ERR(usp->regmap))
1990 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
1991 +index 43b80db952d1..f99eb8f44282 100644
1992 +--- a/sound/soc/soc-pcm.c
1993 ++++ b/sound/soc/soc-pcm.c
1994 +@@ -1570,6 +1570,14 @@ static u64 dpcm_runtime_base_format(struct snd_pcm_substream *substream)
1995 + int i;
1996 +
1997 + for (i = 0; i < be->num_codecs; i++) {
1998 ++ /*
1999 ++ * Skip CODECs which don't support the current stream
2000 ++ * type. See soc_pcm_init_runtime_hw() for more details
2001 ++ */
2002 ++ if (!snd_soc_dai_stream_valid(be->codec_dais[i],
2003 ++ stream))
2004 ++ continue;
2005 ++
2006 + codec_dai_drv = be->codec_dais[i]->driver;
2007 + if (stream == SNDRV_PCM_STREAM_PLAYBACK)
2008 + codec_stream = &codec_dai_drv->playback;
2009 +diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
2010 +index 0dac7e05a6ac..33c79e415075 100644
2011 +--- a/tools/power/x86/turbostat/turbostat.c
2012 ++++ b/tools/power/x86/turbostat/turbostat.c
2013 +@@ -663,9 +663,7 @@ void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_
2014 + if (!printed || !summary_only)
2015 + print_header();
2016 +
2017 +- if (topo.num_cpus > 1)
2018 +- format_counters(&average.threads, &average.cores,
2019 +- &average.packages);
2020 ++ format_counters(&average.threads, &average.cores, &average.packages);
2021 +
2022 + printed = 1;
2023 +
2024 +@@ -2693,7 +2691,9 @@ void process_cpuid()
2025 + family = (fms >> 8) & 0xf;
2026 + model = (fms >> 4) & 0xf;
2027 + stepping = fms & 0xf;
2028 +- if (family == 6 || family == 0xf)
2029 ++ if (family == 0xf)
2030 ++ family += (fms >> 20) & 0xff;
2031 ++ if (family >= 6)
2032 + model += ((fms >> 16) & 0xf) << 4;
2033 +
2034 + if (debug)
2035 +diff --git a/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc b/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc
2036 +new file mode 100644
2037 +index 000000000000..3b1f45e13a2e
2038 +--- /dev/null
2039 ++++ b/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc
2040 +@@ -0,0 +1,28 @@
2041 ++#!/bin/sh
2042 ++# description: Snapshot and tracing setting
2043 ++# flags: instance
2044 ++
2045 ++[ ! -f snapshot ] && exit_unsupported
2046 ++
2047 ++echo "Set tracing off"
2048 ++echo 0 > tracing_on
2049 ++
2050 ++echo "Allocate and take a snapshot"
2051 ++echo 1 > snapshot
2052 ++
2053 ++# Since trace buffer is empty, snapshot is also empty, but allocated
2054 ++grep -q "Snapshot is allocated" snapshot
2055 ++
2056 ++echo "Ensure keep tracing off"
2057 ++test `cat tracing_on` -eq 0
2058 ++
2059 ++echo "Set tracing on"
2060 ++echo 1 > tracing_on
2061 ++
2062 ++echo "Take a snapshot again"
2063 ++echo 1 > snapshot
2064 ++
2065 ++echo "Ensure keep tracing on"
2066 ++test `cat tracing_on` -eq 1
2067 ++
2068 ++exit 0
2069 +diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
2070 +index 88d5e71be044..47dfa0b0fcd7 100644
2071 +--- a/tools/usb/ffs-test.c
2072 ++++ b/tools/usb/ffs-test.c
2073 +@@ -44,12 +44,25 @@
2074 +
2075 + /******************** Little Endian Handling ********************************/
2076 +
2077 +-#define cpu_to_le16(x) htole16(x)
2078 +-#define cpu_to_le32(x) htole32(x)
2079 ++/*
2080 ++ * cpu_to_le16/32 are used when initializing structures, a context where a
2081 ++ * function call is not allowed. To solve this, we code cpu_to_le16/32 in a way
2082 ++ * that allows them to be used when initializing structures.
2083 ++ */
2084 ++
2085 ++#if __BYTE_ORDER == __LITTLE_ENDIAN
2086 ++#define cpu_to_le16(x) (x)
2087 ++#define cpu_to_le32(x) (x)
2088 ++#else
2089 ++#define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))
2090 ++#define cpu_to_le32(x) \
2091 ++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \
2092 ++ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
2093 ++#endif
2094 ++
2095 + #define le32_to_cpu(x) le32toh(x)
2096 + #define le16_to_cpu(x) le16toh(x)
2097 +
2098 +-
2099 + /******************** Messages and Errors ***********************************/
2100 +
2101 + static const char argv0[] = "ffs-test";