Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.12 commit in: /
Date: Mon, 09 Feb 2015 18:56:07
Message-Id: 1423507472.98aa2c86be0a7dc8147049eecd0d759454704aef.mpagano@gentoo
1 commit: 98aa2c86be0a7dc8147049eecd0d759454704aef
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 9 18:44:32 2015 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 9 18:44:32 2015 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=98aa2c86
7
8 Linux patch 3.12.36 and 3.12.37
9
10 ---
11 0000_README | 8 +
12 1035_linux-3.12.36.patch | 2820 +++++++++++++++
13 1036_linux-3.12.37.patch | 8810 ++++++++++++++++++++++++++++++++++++++++++++++
14 3 files changed, 11638 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 202ddb1..10a0b1b 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -182,6 +182,14 @@ Patch: 1034_linux-3.12.35.patch
21 From: http://www.kernel.org
22 Desc: Linux 3.12.35
23
24 +Patch: 1035_linux-3.12.36.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 3.12.36
27 +
28 +Patch: 1036_linux-3.12.37.patch
29 +From: http://www.kernel.org
30 +Desc: Linux 3.12.37
31 +
32 Patch: 1500_XATTR_USER_PREFIX.patch
33 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
34 Desc: Support for namespace user.pax.* on tmpfs.
35
36 diff --git a/1035_linux-3.12.36.patch b/1035_linux-3.12.36.patch
37 new file mode 100644
38 index 0000000..6995ac6
39 --- /dev/null
40 +++ b/1035_linux-3.12.36.patch
41 @@ -0,0 +1,2820 @@
42 +diff --git a/Makefile b/Makefile
43 +index 8d030709ef0f..dfc8fa6f72d3 100644
44 +--- a/Makefile
45 ++++ b/Makefile
46 +@@ -1,6 +1,6 @@
47 + VERSION = 3
48 + PATCHLEVEL = 12
49 +-SUBLEVEL = 35
50 ++SUBLEVEL = 36
51 + EXTRAVERSION =
52 + NAME = One Giant Leap for Frogkind
53 +
54 +diff --git a/arch/powerpc/kernel/vdso32/getcpu.S b/arch/powerpc/kernel/vdso32/getcpu.S
55 +index 47afd08c90f7..fe7e97a1aad9 100644
56 +--- a/arch/powerpc/kernel/vdso32/getcpu.S
57 ++++ b/arch/powerpc/kernel/vdso32/getcpu.S
58 +@@ -30,8 +30,8 @@
59 + V_FUNCTION_BEGIN(__kernel_getcpu)
60 + .cfi_startproc
61 + mfspr r5,SPRN_USPRG3
62 +- cmpdi cr0,r3,0
63 +- cmpdi cr1,r4,0
64 ++ cmpwi cr0,r3,0
65 ++ cmpwi cr1,r4,0
66 + clrlwi r6,r5,16
67 + rlwinm r7,r5,16,31-15,31-0
68 + beq cr0,1f
69 +diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
70 +index 1f1b8c70ab97..0ebb699aad1e 100644
71 +--- a/arch/s390/kernel/compat_linux.c
72 ++++ b/arch/s390/kernel/compat_linux.c
73 +@@ -249,7 +249,7 @@ asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
74 + struct group_info *group_info;
75 + int retval;
76 +
77 +- if (!capable(CAP_SETGID))
78 ++ if (!may_setgroups())
79 + return -EPERM;
80 + if ((unsigned)gidsetsize > NGROUPS_MAX)
81 + return -EINVAL;
82 +diff --git a/arch/x86/include/uapi/asm/ldt.h b/arch/x86/include/uapi/asm/ldt.h
83 +index 46727eb37bfe..6e1aaf73852a 100644
84 +--- a/arch/x86/include/uapi/asm/ldt.h
85 ++++ b/arch/x86/include/uapi/asm/ldt.h
86 +@@ -28,6 +28,13 @@ struct user_desc {
87 + unsigned int seg_not_present:1;
88 + unsigned int useable:1;
89 + #ifdef __x86_64__
90 ++ /*
91 ++ * Because this bit is not present in 32-bit user code, user
92 ++ * programs can pass uninitialized values here. Therefore, in
93 ++ * any context in which a user_desc comes from a 32-bit program,
94 ++ * the kernel must act as though lm == 0, regardless of the
95 ++ * actual value.
96 ++ */
97 + unsigned int lm:1;
98 + #endif
99 + };
100 +diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
101 +index 5edd3c0b437a..c7106f116fb0 100644
102 +--- a/arch/x86/kernel/cpu/perf_event.c
103 ++++ b/arch/x86/kernel/cpu/perf_event.c
104 +@@ -118,6 +118,9 @@ static int x86_pmu_extra_regs(u64 config, struct perf_event *event)
105 + continue;
106 + if (event->attr.config1 & ~er->valid_mask)
107 + return -EINVAL;
108 ++ /* Check if the extra msrs can be safely accessed*/
109 ++ if (!er->extra_msr_access)
110 ++ return -ENXIO;
111 +
112 + reg->idx = er->idx;
113 + reg->config = event->attr.config1;
114 +diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
115 +index cc16faae0538..53bd2726f4cd 100644
116 +--- a/arch/x86/kernel/cpu/perf_event.h
117 ++++ b/arch/x86/kernel/cpu/perf_event.h
118 +@@ -279,14 +279,16 @@ struct extra_reg {
119 + u64 config_mask;
120 + u64 valid_mask;
121 + int idx; /* per_xxx->regs[] reg index */
122 ++ bool extra_msr_access;
123 + };
124 +
125 + #define EVENT_EXTRA_REG(e, ms, m, vm, i) { \
126 +- .event = (e), \
127 +- .msr = (ms), \
128 +- .config_mask = (m), \
129 +- .valid_mask = (vm), \
130 +- .idx = EXTRA_REG_##i, \
131 ++ .event = (e), \
132 ++ .msr = (ms), \
133 ++ .config_mask = (m), \
134 ++ .valid_mask = (vm), \
135 ++ .idx = EXTRA_REG_##i, \
136 ++ .extra_msr_access = true, \
137 + }
138 +
139 + #define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \
140 +diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
141 +index 959bbf204dae..b400d0be5b03 100644
142 +--- a/arch/x86/kernel/cpu/perf_event_intel.c
143 ++++ b/arch/x86/kernel/cpu/perf_event_intel.c
144 +@@ -2144,6 +2144,41 @@ static void intel_snb_check_microcode(void)
145 + }
146 + }
147 +
148 ++/*
149 ++ * Under certain circumstances, access certain MSR may cause #GP.
150 ++ * The function tests if the input MSR can be safely accessed.
151 ++ */
152 ++static bool check_msr(unsigned long msr, u64 mask)
153 ++{
154 ++ u64 val_old, val_new, val_tmp;
155 ++
156 ++ /*
157 ++ * Read the current value, change it and read it back to see if it
158 ++ * matches, this is needed to detect certain hardware emulators
159 ++ * (qemu/kvm) that don't trap on the MSR access and always return 0s.
160 ++ */
161 ++ if (rdmsrl_safe(msr, &val_old))
162 ++ return false;
163 ++
164 ++ /*
165 ++ * Only change the bits which can be updated by wrmsrl.
166 ++ */
167 ++ val_tmp = val_old ^ mask;
168 ++ if (wrmsrl_safe(msr, val_tmp) ||
169 ++ rdmsrl_safe(msr, &val_new))
170 ++ return false;
171 ++
172 ++ if (val_new != val_tmp)
173 ++ return false;
174 ++
175 ++ /* Here it's sure that the MSR can be safely accessed.
176 ++ * Restore the old value and return.
177 ++ */
178 ++ wrmsrl(msr, val_old);
179 ++
180 ++ return true;
181 ++}
182 ++
183 + static __init void intel_sandybridge_quirk(void)
184 + {
185 + x86_pmu.check_microcode = intel_snb_check_microcode;
186 +@@ -2207,7 +2242,8 @@ __init int intel_pmu_init(void)
187 + union cpuid10_ebx ebx;
188 + struct event_constraint *c;
189 + unsigned int unused;
190 +- int version;
191 ++ struct extra_reg *er;
192 ++ int version, i;
193 +
194 + if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
195 + switch (boot_cpu_data.x86) {
196 +@@ -2252,10 +2288,7 @@ __init int intel_pmu_init(void)
197 + if (version > 1)
198 + x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3);
199 +
200 +- /*
201 +- * v2 and above have a perf capabilities MSR
202 +- */
203 +- if (version > 1) {
204 ++ if (boot_cpu_has(X86_FEATURE_PDCM)) {
205 + u64 capabilities;
206 +
207 + rdmsrl(MSR_IA32_PERF_CAPABILITIES, capabilities);
208 +@@ -2515,6 +2548,34 @@ __init int intel_pmu_init(void)
209 + }
210 + }
211 +
212 ++ /*
213 ++ * Access LBR MSR may cause #GP under certain circumstances.
214 ++ * E.g. KVM doesn't support LBR MSR
215 ++ * Check all LBT MSR here.
216 ++ * Disable LBR access if any LBR MSRs can not be accessed.
217 ++ */
218 ++ if (x86_pmu.lbr_nr && !check_msr(x86_pmu.lbr_tos, 0x3UL))
219 ++ x86_pmu.lbr_nr = 0;
220 ++ for (i = 0; i < x86_pmu.lbr_nr; i++) {
221 ++ if (!(check_msr(x86_pmu.lbr_from + i, 0xffffUL) &&
222 ++ check_msr(x86_pmu.lbr_to + i, 0xffffUL)))
223 ++ x86_pmu.lbr_nr = 0;
224 ++ }
225 ++
226 ++ /*
227 ++ * Access extra MSR may cause #GP under certain circumstances.
228 ++ * E.g. KVM doesn't support offcore event
229 ++ * Check all extra_regs here.
230 ++ */
231 ++ if (x86_pmu.extra_regs) {
232 ++ for (er = x86_pmu.extra_regs; er->msr; er++) {
233 ++ er->extra_msr_access = check_msr(er->msr, 0x1ffUL);
234 ++ /* Disable LBR select mapping */
235 ++ if ((er->idx == EXTRA_REG_LBR) && !er->extra_msr_access)
236 ++ x86_pmu.lbr_sel_map = NULL;
237 ++ }
238 ++ }
239 ++
240 + /* Support full width counters using alternative MSR range */
241 + if (x86_pmu.intel_cap.full_width_write) {
242 + x86_pmu.max_period = x86_pmu.cntval_mask;
243 +diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
244 +index f022c54a79a4..e72593338df6 100644
245 +--- a/arch/x86/kernel/kvm.c
246 ++++ b/arch/x86/kernel/kvm.c
247 +@@ -280,7 +280,14 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
248 + static void __init paravirt_ops_setup(void)
249 + {
250 + pv_info.name = "KVM";
251 +- pv_info.paravirt_enabled = 1;
252 ++
253 ++ /*
254 ++ * KVM isn't paravirt in the sense of paravirt_enabled. A KVM
255 ++ * guest kernel works like a bare metal kernel with additional
256 ++ * features, and paravirt_enabled is about features that are
257 ++ * missing.
258 ++ */
259 ++ pv_info.paravirt_enabled = 0;
260 +
261 + if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY))
262 + pv_cpu_ops.io_delay = kvm_io_delay;
263 +diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
264 +index 1570e0741344..23457e5f0f4f 100644
265 +--- a/arch/x86/kernel/kvmclock.c
266 ++++ b/arch/x86/kernel/kvmclock.c
267 +@@ -262,7 +262,6 @@ void __init kvmclock_init(void)
268 + #endif
269 + kvm_get_preset_lpj();
270 + clocksource_register_hz(&kvm_clock, NSEC_PER_SEC);
271 +- pv_info.paravirt_enabled = 1;
272 + pv_info.name = "KVM";
273 +
274 + if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE_STABLE_BIT))
275 +diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
276 +index f7fec09e3e3a..4e942f31b1a7 100644
277 +--- a/arch/x86/kernel/tls.c
278 ++++ b/arch/x86/kernel/tls.c
279 +@@ -27,6 +27,37 @@ static int get_free_idx(void)
280 + return -ESRCH;
281 + }
282 +
283 ++static bool tls_desc_okay(const struct user_desc *info)
284 ++{
285 ++ if (LDT_empty(info))
286 ++ return true;
287 ++
288 ++ /*
289 ++ * espfix is required for 16-bit data segments, but espfix
290 ++ * only works for LDT segments.
291 ++ */
292 ++ if (!info->seg_32bit)
293 ++ return false;
294 ++
295 ++ /* Only allow data segments in the TLS array. */
296 ++ if (info->contents > 1)
297 ++ return false;
298 ++
299 ++ /*
300 ++ * Non-present segments with DPL 3 present an interesting attack
301 ++ * surface. The kernel should handle such segments correctly,
302 ++ * but TLS is very difficult to protect in a sandbox, so prevent
303 ++ * such segments from being created.
304 ++ *
305 ++ * If userspace needs to remove a TLS entry, it can still delete
306 ++ * it outright.
307 ++ */
308 ++ if (info->seg_not_present)
309 ++ return false;
310 ++
311 ++ return true;
312 ++}
313 ++
314 + static void set_tls_desc(struct task_struct *p, int idx,
315 + const struct user_desc *info, int n)
316 + {
317 +@@ -66,6 +97,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
318 + if (copy_from_user(&info, u_info, sizeof(info)))
319 + return -EFAULT;
320 +
321 ++ if (!tls_desc_okay(&info))
322 ++ return -EINVAL;
323 ++
324 + if (idx == -1)
325 + idx = info.entry_number;
326 +
327 +@@ -192,6 +226,7 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset,
328 + {
329 + struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES];
330 + const struct user_desc *info;
331 ++ int i;
332 +
333 + if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) ||
334 + (pos % sizeof(struct user_desc)) != 0 ||
335 +@@ -205,6 +240,10 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset,
336 + else
337 + info = infobuf;
338 +
339 ++ for (i = 0; i < count / sizeof(struct user_desc); i++)
340 ++ if (!tls_desc_okay(info + i))
341 ++ return -EINVAL;
342 ++
343 + set_tls_desc(target,
344 + GDT_ENTRY_TLS_MIN + (pos / sizeof(struct user_desc)),
345 + info, count / sizeof(struct user_desc));
346 +diff --git a/crypto/af_alg.c b/crypto/af_alg.c
347 +index bf948e134981..6ef6e2ad344e 100644
348 +--- a/crypto/af_alg.c
349 ++++ b/crypto/af_alg.c
350 +@@ -449,6 +449,9 @@ void af_alg_complete(struct crypto_async_request *req, int err)
351 + {
352 + struct af_alg_completion *completion = req->data;
353 +
354 ++ if (err == -EINPROGRESS)
355 ++ return;
356 ++
357 + completion->err = err;
358 + complete(&completion->completion);
359 + }
360 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
361 +index 4432c9dc9c7a..53111fd27ebb 100644
362 +--- a/drivers/ata/ahci.c
363 ++++ b/drivers/ata/ahci.c
364 +@@ -320,6 +320,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
365 + { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */
366 + { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */
367 + { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */
368 ++ { PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */
369 ++ { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */
370 ++ { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */
371 + { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */
372 + { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */
373 + { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */
374 +@@ -491,6 +494,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
375 + * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731
376 + */
377 + { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi },
378 ++ { PCI_VDEVICE(SAMSUNG, 0xa800), board_ahci_nomsi },
379 +
380 + /* Enmotus */
381 + { PCI_DEVICE(0x1c44, 0x8000), board_ahci },
382 +diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
383 +index 851bd3f43ac6..017ed84a0cc4 100644
384 +--- a/drivers/ata/sata_fsl.c
385 ++++ b/drivers/ata/sata_fsl.c
386 +@@ -1501,7 +1501,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
387 + host_priv->csr_base = csr_base;
388 +
389 + irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
390 +- if (irq < 0) {
391 ++ if (!irq) {
392 + dev_err(&ofdev->dev, "invalid irq from platform\n");
393 + goto error_exit_with_cleanup;
394 + }
395 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
396 +index 837cc6cd7472..37a9d3c89feb 100644
397 +--- a/drivers/gpu/drm/i915/intel_display.c
398 ++++ b/drivers/gpu/drm/i915/intel_display.c
399 +@@ -3537,7 +3537,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
400 + ironlake_fdi_disable(crtc);
401 +
402 + ironlake_disable_pch_transcoder(dev_priv, pipe);
403 +- intel_set_pch_fifo_underrun_reporting(dev, pipe, true);
404 +
405 + if (HAS_PCH_CPT(dev)) {
406 + /* disable TRANS_DP_CTL */
407 +@@ -3613,7 +3612,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
408 +
409 + if (intel_crtc->config.has_pch_encoder) {
410 + lpt_disable_pch_transcoder(dev_priv);
411 +- intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, true);
412 + intel_ddi_fdi_disable(crtc);
413 + }
414 +
415 +diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
416 +index 667f2117e1d9..e5473daab676 100644
417 +--- a/drivers/gpu/drm/i915/intel_lvds.c
418 ++++ b/drivers/gpu/drm/i915/intel_lvds.c
419 +@@ -934,6 +934,17 @@ void intel_lvds_init(struct drm_device *dev)
420 + int pipe;
421 + u8 pin;
422 +
423 ++ /*
424 ++ * Unlock registers and just leave them unlocked. Do this before
425 ++ * checking quirk lists to avoid bogus WARNINGs.
426 ++ */
427 ++ if (HAS_PCH_SPLIT(dev)) {
428 ++ I915_WRITE(PCH_PP_CONTROL,
429 ++ I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS);
430 ++ } else {
431 ++ I915_WRITE(PP_CONTROL,
432 ++ I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS);
433 ++ }
434 + if (!intel_lvds_supported(dev))
435 + return;
436 +
437 +@@ -1113,17 +1124,6 @@ out:
438 + DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
439 + lvds_encoder->is_dual_link ? "dual" : "single");
440 +
441 +- /*
442 +- * Unlock registers and just
443 +- * leave them unlocked
444 +- */
445 +- if (HAS_PCH_SPLIT(dev)) {
446 +- I915_WRITE(PCH_PP_CONTROL,
447 +- I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS);
448 +- } else {
449 +- I915_WRITE(PP_CONTROL,
450 +- I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS);
451 +- }
452 + lvds_connector->lid_notifier.notifier_call = intel_lid_notify;
453 + if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) {
454 + DRM_DEBUG_KMS("lid notifier registration failed\n");
455 +diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
456 +index a134e8bf53f5..03ff6726ce9f 100644
457 +--- a/drivers/gpu/drm/radeon/radeon_kms.c
458 ++++ b/drivers/gpu/drm/radeon/radeon_kms.c
459 +@@ -684,6 +684,8 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,
460 +
461 + /* Get associated drm_crtc: */
462 + drmcrtc = &rdev->mode_info.crtcs[crtc]->base;
463 ++ if (!drmcrtc)
464 ++ return -EINVAL;
465 +
466 + /* Helper routine in DRM core does all the work: */
467 + return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error,
468 +diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
469 +index 132369fad4e0..4e73f3ee05d8 100644
470 +--- a/drivers/i2c/busses/i2c-davinci.c
471 ++++ b/drivers/i2c/busses/i2c-davinci.c
472 +@@ -411,11 +411,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
473 + if (dev->cmd_err & DAVINCI_I2C_STR_NACK) {
474 + if (msg->flags & I2C_M_IGNORE_NAK)
475 + return msg->len;
476 +- if (stop) {
477 +- w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
478 +- w |= DAVINCI_I2C_MDR_STP;
479 +- davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
480 +- }
481 ++ w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
482 ++ w |= DAVINCI_I2C_MDR_STP;
483 ++ davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
484 + return -EREMOTEIO;
485 + }
486 + return -EIO;
487 +diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
488 +index 9967a6f9c2ff..8eaaff831d7c 100644
489 +--- a/drivers/i2c/busses/i2c-omap.c
490 ++++ b/drivers/i2c/busses/i2c-omap.c
491 +@@ -926,14 +926,12 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
492 + if (stat & OMAP_I2C_STAT_NACK) {
493 + err |= OMAP_I2C_STAT_NACK;
494 + omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK);
495 +- break;
496 + }
497 +
498 + if (stat & OMAP_I2C_STAT_AL) {
499 + dev_err(dev->dev, "Arbitration lost\n");
500 + err |= OMAP_I2C_STAT_AL;
501 + omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL);
502 +- break;
503 + }
504 +
505 + /*
506 +@@ -958,11 +956,13 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
507 + if (dev->fifo_size)
508 + num_bytes = dev->buf_len;
509 +
510 +- omap_i2c_receive_data(dev, num_bytes, true);
511 +-
512 +- if (dev->errata & I2C_OMAP_ERRATA_I207)
513 ++ if (dev->errata & I2C_OMAP_ERRATA_I207) {
514 + i2c_omap_errata_i207(dev, stat);
515 ++ num_bytes = (omap_i2c_read_reg(dev,
516 ++ OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F;
517 ++ }
518 +
519 ++ omap_i2c_receive_data(dev, num_bytes, true);
520 + omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR);
521 + continue;
522 + }
523 +diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
524 +index 140be2dd3e23..93edd894e94b 100644
525 +--- a/drivers/md/dm-bufio.c
526 ++++ b/drivers/md/dm-bufio.c
527 +@@ -530,6 +530,19 @@ static void use_dmio(struct dm_buffer *b, int rw, sector_t block,
528 + end_io(&b->bio, r);
529 + }
530 +
531 ++static void inline_endio(struct bio *bio, int error)
532 ++{
533 ++ bio_end_io_t *end_fn = bio->bi_private;
534 ++
535 ++ /*
536 ++ * Reset the bio to free any attached resources
537 ++ * (e.g. bio integrity profiles).
538 ++ */
539 ++ bio_reset(bio);
540 ++
541 ++ end_fn(bio, error);
542 ++}
543 ++
544 + static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
545 + bio_end_io_t *end_io)
546 + {
547 +@@ -541,7 +554,12 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
548 + b->bio.bi_max_vecs = DM_BUFIO_INLINE_VECS;
549 + b->bio.bi_sector = block << b->c->sectors_per_block_bits;
550 + b->bio.bi_bdev = b->c->bdev;
551 +- b->bio.bi_end_io = end_io;
552 ++ b->bio.bi_end_io = inline_endio;
553 ++ /*
554 ++ * Use of .bi_private isn't a problem here because
555 ++ * the dm_buffer's inline bio is local to bufio.
556 ++ */
557 ++ b->bio.bi_private = end_io;
558 +
559 + /*
560 + * We assume that if len >= PAGE_SIZE ptr is page-aligned.
561 +diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c
562 +index 579b58200bf2..d9a5aa532017 100644
563 +--- a/drivers/md/persistent-data/dm-space-map-metadata.c
564 ++++ b/drivers/md/persistent-data/dm-space-map-metadata.c
565 +@@ -564,7 +564,9 @@ static int sm_bootstrap_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count
566 + {
567 + struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
568 +
569 +- return smm->ll.nr_blocks;
570 ++ *count = smm->ll.nr_blocks;
571 ++
572 ++ return 0;
573 + }
574 +
575 + static int sm_bootstrap_get_nr_free(struct dm_space_map *sm, dm_block_t *count)
576 +diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
577 +index ae66d91bf713..371ca22843ee 100644
578 +--- a/drivers/media/i2c/smiapp/smiapp-core.c
579 ++++ b/drivers/media/i2c/smiapp/smiapp-core.c
580 +@@ -2139,7 +2139,7 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev,
581 + ret = smiapp_set_compose(subdev, fh, sel);
582 + break;
583 + default:
584 +- BUG();
585 ++ ret = -EINVAL;
586 + }
587 +
588 + mutex_unlock(&sensor->mutex);
589 +diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
590 +index ff2b09ba8797..50a5c8697bf7 100644
591 +--- a/drivers/mfd/stmpe.h
592 ++++ b/drivers/mfd/stmpe.h
593 +@@ -269,7 +269,7 @@ int stmpe_remove(struct stmpe *stmpe);
594 + #define STMPE24XX_REG_CHIP_ID 0x80
595 + #define STMPE24XX_REG_IEGPIOR_LSB 0x18
596 + #define STMPE24XX_REG_ISGPIOR_MSB 0x19
597 +-#define STMPE24XX_REG_GPMR_LSB 0xA5
598 ++#define STMPE24XX_REG_GPMR_LSB 0xA4
599 + #define STMPE24XX_REG_GPSR_LSB 0x85
600 + #define STMPE24XX_REG_GPCR_LSB 0x88
601 + #define STMPE24XX_REG_GPDR_LSB 0x8B
602 +diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
603 +index 11c19e538551..48579e5ef02c 100644
604 +--- a/drivers/mfd/tc6393xb.c
605 ++++ b/drivers/mfd/tc6393xb.c
606 +@@ -263,6 +263,17 @@ static int tc6393xb_ohci_disable(struct platform_device *dev)
607 + return 0;
608 + }
609 +
610 ++static int tc6393xb_ohci_suspend(struct platform_device *dev)
611 ++{
612 ++ struct tc6393xb_platform_data *tcpd = dev_get_platdata(dev->dev.parent);
613 ++
614 ++ /* We can't properly store/restore OHCI state, so fail here */
615 ++ if (tcpd->resume_restore)
616 ++ return -EBUSY;
617 ++
618 ++ return tc6393xb_ohci_disable(dev);
619 ++}
620 ++
621 + static int tc6393xb_fb_enable(struct platform_device *dev)
622 + {
623 + struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent);
624 +@@ -403,7 +414,7 @@ static struct mfd_cell tc6393xb_cells[] = {
625 + .num_resources = ARRAY_SIZE(tc6393xb_ohci_resources),
626 + .resources = tc6393xb_ohci_resources,
627 + .enable = tc6393xb_ohci_enable,
628 +- .suspend = tc6393xb_ohci_disable,
629 ++ .suspend = tc6393xb_ohci_suspend,
630 + .resume = tc6393xb_ohci_enable,
631 + .disable = tc6393xb_ohci_disable,
632 + },
633 +diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c
634 +index af2a6703f34f..7bf6dd9625b9 100644
635 +--- a/drivers/mfd/viperboard.c
636 ++++ b/drivers/mfd/viperboard.c
637 +@@ -93,8 +93,9 @@ static int vprbrd_probe(struct usb_interface *interface,
638 + version >> 8, version & 0xff,
639 + vb->usb_dev->bus->busnum, vb->usb_dev->devnum);
640 +
641 +- ret = mfd_add_devices(&interface->dev, -1, vprbrd_devs,
642 +- ARRAY_SIZE(vprbrd_devs), NULL, 0, NULL);
643 ++ ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO,
644 ++ vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0,
645 ++ NULL);
646 + if (ret != 0) {
647 + dev_err(&interface->dev, "Failed to add mfd devices to core.");
648 + goto error;
649 +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
650 +index 4e8212c714b1..2aea365e096e 100644
651 +--- a/drivers/mmc/card/block.c
652 ++++ b/drivers/mmc/card/block.c
653 +@@ -260,7 +260,7 @@ static ssize_t force_ro_show(struct device *dev, struct device_attribute *attr,
654 + int ret;
655 + struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev));
656 +
657 +- ret = snprintf(buf, PAGE_SIZE, "%d",
658 ++ ret = snprintf(buf, PAGE_SIZE, "%d\n",
659 + get_disk_ro(dev_to_disk(dev)) ^
660 + md->read_only);
661 + mmc_blk_put(md);
662 +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
663 +index 18f0d772e544..8d45dce7cfdb 100644
664 +--- a/drivers/net/ethernet/broadcom/tg3.c
665 ++++ b/drivers/net/ethernet/broadcom/tg3.c
666 +@@ -8523,7 +8523,8 @@ static int tg3_init_rings(struct tg3 *tp)
667 + if (tnapi->rx_rcb)
668 + memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp));
669 +
670 +- if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) {
671 ++ if (tnapi->prodring.rx_std &&
672 ++ tg3_rx_prodring_alloc(tp, &tnapi->prodring)) {
673 + tg3_free_rings(tp);
674 + return -ENOMEM;
675 + }
676 +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
677 +index 2b76ae55f2af..02544ce60b1f 100644
678 +--- a/drivers/net/ethernet/intel/igb/igb_main.c
679 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
680 +@@ -1587,6 +1587,8 @@ void igb_power_up_link(struct igb_adapter *adapter)
681 + igb_power_up_phy_copper(&adapter->hw);
682 + else
683 + igb_power_up_serdes_link_82575(&adapter->hw);
684 ++
685 ++ igb_setup_link(&adapter->hw);
686 + }
687 +
688 + /**
689 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
690 +index fabdda91fd0e..9c66d3168911 100644
691 +--- a/drivers/net/ethernet/marvell/mvneta.c
692 ++++ b/drivers/net/ethernet/marvell/mvneta.c
693 +@@ -172,7 +172,7 @@
694 + /* Various constants */
695 +
696 + /* Coalescing */
697 +-#define MVNETA_TXDONE_COAL_PKTS 16
698 ++#define MVNETA_TXDONE_COAL_PKTS 1
699 + #define MVNETA_RX_COAL_PKTS 32
700 + #define MVNETA_RX_COAL_USEC 100
701 +
702 +@@ -1524,6 +1524,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev)
703 + struct mvneta_tx_queue *txq = &pp->txqs[txq_id];
704 + struct mvneta_tx_desc *tx_desc;
705 + struct netdev_queue *nq;
706 ++ int len = skb->len;
707 + int frags = 0;
708 + u32 tx_cmd;
709 +
710 +@@ -1584,7 +1585,7 @@ out:
711 + if (frags > 0) {
712 + u64_stats_update_begin(&pp->tx_stats.syncp);
713 + pp->tx_stats.packets++;
714 +- pp->tx_stats.bytes += skb->len;
715 ++ pp->tx_stats.bytes += len;
716 + u64_stats_update_end(&pp->tx_stats.syncp);
717 +
718 + } else {
719 +diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
720 +index dd6876321116..cdbe63712d2d 100644
721 +--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
722 ++++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
723 +@@ -1227,7 +1227,7 @@ static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd,
724 +
725 + switch (op) {
726 + case RES_OP_RESERVE:
727 +- count = get_param_l(&in_param);
728 ++ count = get_param_l(&in_param) & 0xffffff;
729 + align = get_param_h(&in_param);
730 + err = __mlx4_qp_reserve_range(dev, count, align, &base);
731 + if (err)
732 +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
733 +index 5407c11a9f14..c8e333306c4c 100644
734 +--- a/drivers/net/vxlan.c
735 ++++ b/drivers/net/vxlan.c
736 +@@ -2002,9 +2002,8 @@ static int vxlan_init(struct net_device *dev)
737 + spin_lock(&vn->sock_lock);
738 + vs = vxlan_find_sock(dev_net(dev), ipv6 ? AF_INET6 : AF_INET,
739 + vxlan->dst_port);
740 +- if (vs) {
741 ++ if (vs && atomic_add_unless(&vs->refcnt, 1, 0)) {
742 + /* If we have a socket with same port already, reuse it */
743 +- atomic_inc(&vs->refcnt);
744 + vxlan_vs_add_dev(vs, vxlan);
745 + } else {
746 + /* otherwise make new socket outside of RTNL */
747 +@@ -2447,12 +2446,9 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
748 +
749 + spin_lock(&vn->sock_lock);
750 + vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port);
751 +- if (vs) {
752 +- if (vs->rcv == rcv)
753 +- atomic_inc(&vs->refcnt);
754 +- else
755 ++ if (vs && ((vs->rcv != rcv) ||
756 ++ !atomic_add_unless(&vs->refcnt, 1, 0)))
757 + vs = ERR_PTR(-EBUSY);
758 +- }
759 + spin_unlock(&vn->sock_lock);
760 +
761 + if (!vs)
762 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
763 +index 7c541dc1647e..fd3c1da14495 100644
764 +--- a/drivers/net/xen-netfront.c
765 ++++ b/drivers/net/xen-netfront.c
766 +@@ -468,9 +468,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
767 + len = skb_frag_size(frag);
768 + offset = frag->page_offset;
769 +
770 +- /* Data must not cross a page boundary. */
771 +- BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
772 +-
773 + /* Skip unused frames from start of page */
774 + page += offset >> PAGE_SHIFT;
775 + offset &= ~PAGE_MASK;
776 +@@ -478,8 +475,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
777 + while (len > 0) {
778 + unsigned long bytes;
779 +
780 +- BUG_ON(offset >= PAGE_SIZE);
781 +-
782 + bytes = PAGE_SIZE - offset;
783 + if (bytes > len)
784 + bytes = len;
785 +diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
786 +index bb86494e2b7b..19915c5b256f 100644
787 +--- a/drivers/s390/char/con3215.c
788 ++++ b/drivers/s390/char/con3215.c
789 +@@ -288,12 +288,16 @@ static void raw3215_timeout(unsigned long __data)
790 + unsigned long flags;
791 +
792 + spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
793 +- if (raw->flags & RAW3215_TIMER_RUNS) {
794 +- del_timer(&raw->timer);
795 +- raw->flags &= ~RAW3215_TIMER_RUNS;
796 +- if (!(raw->port.flags & ASYNC_SUSPENDED)) {
797 +- raw3215_mk_write_req(raw);
798 +- raw3215_start_io(raw);
799 ++ raw->flags &= ~RAW3215_TIMER_RUNS;
800 ++ if (!(raw->port.flags & ASYNC_SUSPENDED)) {
801 ++ raw3215_mk_write_req(raw);
802 ++ raw3215_start_io(raw);
803 ++ if ((raw->queued_read || raw->queued_write) &&
804 ++ !(raw->flags & RAW3215_WORKING) &&
805 ++ !(raw->flags & RAW3215_TIMER_RUNS)) {
806 ++ raw->timer.expires = RAW3215_TIMEOUT + jiffies;
807 ++ add_timer(&raw->timer);
808 ++ raw->flags |= RAW3215_TIMER_RUNS;
809 + }
810 + }
811 + spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
812 +@@ -317,17 +321,15 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
813 + (raw->flags & RAW3215_FLUSHING)) {
814 + /* execute write requests bigger than minimum size */
815 + raw3215_start_io(raw);
816 +- if (raw->flags & RAW3215_TIMER_RUNS) {
817 +- del_timer(&raw->timer);
818 +- raw->flags &= ~RAW3215_TIMER_RUNS;
819 +- }
820 +- } else if (!(raw->flags & RAW3215_TIMER_RUNS)) {
821 +- /* delay small writes */
822 +- raw->timer.expires = RAW3215_TIMEOUT + jiffies;
823 +- add_timer(&raw->timer);
824 +- raw->flags |= RAW3215_TIMER_RUNS;
825 + }
826 + }
827 ++ if ((raw->queued_read || raw->queued_write) &&
828 ++ !(raw->flags & RAW3215_WORKING) &&
829 ++ !(raw->flags & RAW3215_TIMER_RUNS)) {
830 ++ raw->timer.expires = RAW3215_TIMEOUT + jiffies;
831 ++ add_timer(&raw->timer);
832 ++ raw->flags |= RAW3215_TIMER_RUNS;
833 ++ }
834 + }
835 +
836 + /*
837 +@@ -1027,12 +1029,26 @@ static int tty3215_write(struct tty_struct * tty,
838 + const unsigned char *buf, int count)
839 + {
840 + struct raw3215_info *raw;
841 ++ int i, written;
842 +
843 + if (!tty)
844 + return 0;
845 + raw = (struct raw3215_info *) tty->driver_data;
846 +- raw3215_write(raw, buf, count);
847 +- return count;
848 ++ written = count;
849 ++ while (count > 0) {
850 ++ for (i = 0; i < count; i++)
851 ++ if (buf[i] == '\t' || buf[i] == '\n')
852 ++ break;
853 ++ raw3215_write(raw, buf, i);
854 ++ count -= i;
855 ++ buf += i;
856 ++ if (count > 0) {
857 ++ raw3215_putchar(raw, *buf);
858 ++ count--;
859 ++ buf++;
860 ++ }
861 ++ }
862 ++ return written;
863 + }
864 +
865 + /*
866 +@@ -1180,7 +1196,7 @@ static int __init tty3215_init(void)
867 + driver->subtype = SYSTEM_TYPE_TTY;
868 + driver->init_termios = tty_std_termios;
869 + driver->init_termios.c_iflag = IGNBRK | IGNPAR;
870 +- driver->init_termios.c_oflag = ONLCR | XTABS;
871 ++ driver->init_termios.c_oflag = ONLCR;
872 + driver->init_termios.c_lflag = ISIG;
873 + driver->flags = TTY_DRIVER_REAL_RAW;
874 + tty_set_operations(driver, &tty3215_ops);
875 +diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
876 +index 1e9d6ad9302b..7563b3d9cc76 100644
877 +--- a/drivers/scsi/NCR5380.c
878 ++++ b/drivers/scsi/NCR5380.c
879 +@@ -2655,14 +2655,14 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) {
880 + *
881 + * Purpose : abort a command
882 + *
883 +- * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
884 +- * host byte of the result field to, if zero DID_ABORTED is
885 ++ * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
886 ++ * host byte of the result field to, if zero DID_ABORTED is
887 + * used.
888 + *
889 +- * Returns : 0 - success, -1 on failure.
890 ++ * Returns : SUCCESS - success, FAILED on failure.
891 + *
892 +- * XXX - there is no way to abort the command that is currently
893 +- * connected, you have to wait for it to complete. If this is
894 ++ * XXX - there is no way to abort the command that is currently
895 ++ * connected, you have to wait for it to complete. If this is
896 + * a problem, we could implement longjmp() / setjmp(), setjmp()
897 + * called where the loop started in NCR5380_main().
898 + *
899 +@@ -2712,7 +2712,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
900 + * aborted flag and get back into our main loop.
901 + */
902 +
903 +- return 0;
904 ++ return SUCCESS;
905 + }
906 + #endif
907 +
908 +diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
909 +index 5f3101797c93..31ace4bef8fe 100644
910 +--- a/drivers/scsi/aha1740.c
911 ++++ b/drivers/scsi/aha1740.c
912 +@@ -531,7 +531,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy)
913 + * quiet as possible...
914 + */
915 +
916 +- return 0;
917 ++ return SUCCESS;
918 + }
919 +
920 + static struct scsi_host_template aha1740_template = {
921 +diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
922 +index 0f3cdbc80ba6..30073d43d87b 100644
923 +--- a/drivers/scsi/atari_NCR5380.c
924 ++++ b/drivers/scsi/atari_NCR5380.c
925 +@@ -2613,7 +2613,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
926 + * host byte of the result field to, if zero DID_ABORTED is
927 + * used.
928 + *
929 +- * Returns : 0 - success, -1 on failure.
930 ++ * Returns : SUCCESS - success, FAILED on failure.
931 + *
932 + * XXX - there is no way to abort the command that is currently
933 + * connected, you have to wait for it to complete. If this is
934 +diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
935 +index 4abf1272e1eb..5718b1febd57 100644
936 +--- a/drivers/scsi/esas2r/esas2r_main.c
937 ++++ b/drivers/scsi/esas2r/esas2r_main.c
938 +@@ -1057,7 +1057,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)
939 +
940 + cmd->scsi_done(cmd);
941 +
942 +- return 0;
943 ++ return SUCCESS;
944 + }
945 +
946 + spin_lock_irqsave(&a->queue_lock, flags);
947 +diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
948 +index 816db12ef5d5..52587ceac099 100644
949 +--- a/drivers/scsi/megaraid.c
950 ++++ b/drivers/scsi/megaraid.c
951 +@@ -1967,7 +1967,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
952 + cmd->device->id, cmd->device->lun);
953 +
954 + if(list_empty(&adapter->pending_list))
955 +- return FALSE;
956 ++ return FAILED;
957 +
958 + list_for_each_safe(pos, next, &adapter->pending_list) {
959 +
960 +@@ -1990,7 +1990,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
961 + (aor==SCB_ABORT) ? "ABORTING":"RESET",
962 + scb->idx);
963 +
964 +- return FALSE;
965 ++ return FAILED;
966 + }
967 + else {
968 +
969 +@@ -2015,12 +2015,12 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
970 + list_add_tail(SCSI_LIST(cmd),
971 + &adapter->completed_list);
972 +
973 +- return TRUE;
974 ++ return SUCCESS;
975 + }
976 + }
977 + }
978 +
979 +- return FALSE;
980 ++ return FAILED;
981 + }
982 +
983 + static inline int
984 +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
985 +index a59a5526a318..855dc7c4cad7 100644
986 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c
987 ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c
988 +@@ -953,7 +953,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance,
989 + cpu_to_le32(upper_32_bits(cmd_to_abort->frame_phys_addr));
990 +
991 + cmd->sync_cmd = 1;
992 +- cmd->cmd_status = 0xFF;
993 ++ cmd->cmd_status = ENODATA;
994 +
995 + instance->instancet->issue_dcmd(instance, cmd);
996 +
997 +diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
998 +index 636bbe0ea84c..fc57c8aec2b3 100644
999 +--- a/drivers/scsi/sun3_NCR5380.c
1000 ++++ b/drivers/scsi/sun3_NCR5380.c
1001 +@@ -2597,15 +2597,15 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
1002 + * Purpose : abort a command
1003 + *
1004 + * Inputs : cmd - the struct scsi_cmnd to abort, code - code to set the
1005 +- * host byte of the result field to, if zero DID_ABORTED is
1006 ++ * host byte of the result field to, if zero DID_ABORTED is
1007 + * used.
1008 + *
1009 +- * Returns : 0 - success, -1 on failure.
1010 ++ * Returns : SUCCESS - success, FAILED on failure.
1011 + *
1012 +- * XXX - there is no way to abort the command that is currently
1013 +- * connected, you have to wait for it to complete. If this is
1014 ++ * XXX - there is no way to abort the command that is currently
1015 ++ * connected, you have to wait for it to complete. If this is
1016 + * a problem, we could implement longjmp() / setjmp(), setjmp()
1017 +- * called where the loop started in NCR5380_main().
1018 ++ * called where the loop started in NCR5380_main().
1019 + */
1020 +
1021 + static int NCR5380_abort(struct scsi_cmnd *cmd)
1022 +diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
1023 +index 4962a6aaf295..4f35f1ca3ce3 100644
1024 +--- a/drivers/thermal/thermal_core.c
1025 ++++ b/drivers/thermal/thermal_core.c
1026 +@@ -1747,10 +1747,10 @@ static int __init thermal_init(void)
1027 +
1028 + return 0;
1029 +
1030 +-unregister_governors:
1031 +- thermal_unregister_governors();
1032 + unregister_class:
1033 + class_unregister(&thermal_class);
1034 ++unregister_governors:
1035 ++ thermal_unregister_governors();
1036 + error:
1037 + idr_destroy(&thermal_tz_idr);
1038 + idr_destroy(&thermal_cdev_idr);
1039 +diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
1040 +index eac1b0d5b463..1197767b3019 100644
1041 +--- a/drivers/tty/n_tty.c
1042 ++++ b/drivers/tty/n_tty.c
1043 +@@ -2410,12 +2410,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
1044 +
1045 + poll_wait(file, &tty->read_wait, wait);
1046 + poll_wait(file, &tty->write_wait, wait);
1047 ++ if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
1048 ++ mask |= POLLHUP;
1049 + if (input_available_p(tty, TIME_CHAR(tty) ? 0 : MIN_CHAR(tty)))
1050 + mask |= POLLIN | POLLRDNORM;
1051 ++ else if (mask & POLLHUP) {
1052 ++ tty_flush_to_ldisc(tty);
1053 ++ if (input_available_p(tty, TIME_CHAR(tty) ? 0 : MIN_CHAR(tty)))
1054 ++ mask |= POLLIN | POLLRDNORM;
1055 ++ }
1056 + if (tty->packet && tty->link->ctrl_status)
1057 + mask |= POLLPRI | POLLIN | POLLRDNORM;
1058 +- if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
1059 +- mask |= POLLHUP;
1060 + if (tty_hung_up_p(file))
1061 + mask |= POLLHUP;
1062 + if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) {
1063 +diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
1064 +index dfd29438a11e..e3101cec93c9 100644
1065 +--- a/drivers/usb/gadget/at91_udc.c
1066 ++++ b/drivers/usb/gadget/at91_udc.c
1067 +@@ -871,12 +871,10 @@ static void clk_on(struct at91_udc *udc)
1068 + return;
1069 + udc->clocked = 1;
1070 +
1071 +- if (IS_ENABLED(CONFIG_COMMON_CLK)) {
1072 +- clk_set_rate(udc->uclk, 48000000);
1073 +- clk_prepare_enable(udc->uclk);
1074 +- }
1075 +- clk_prepare_enable(udc->iclk);
1076 +- clk_prepare_enable(udc->fclk);
1077 ++ if (IS_ENABLED(CONFIG_COMMON_CLK))
1078 ++ clk_enable(udc->uclk);
1079 ++ clk_enable(udc->iclk);
1080 ++ clk_enable(udc->fclk);
1081 + }
1082 +
1083 + static void clk_off(struct at91_udc *udc)
1084 +@@ -885,10 +883,10 @@ static void clk_off(struct at91_udc *udc)
1085 + return;
1086 + udc->clocked = 0;
1087 + udc->gadget.speed = USB_SPEED_UNKNOWN;
1088 +- clk_disable_unprepare(udc->fclk);
1089 +- clk_disable_unprepare(udc->iclk);
1090 ++ clk_disable(udc->fclk);
1091 ++ clk_disable(udc->iclk);
1092 + if (IS_ENABLED(CONFIG_COMMON_CLK))
1093 +- clk_disable_unprepare(udc->uclk);
1094 ++ clk_disable(udc->uclk);
1095 + }
1096 +
1097 + /*
1098 +@@ -1781,14 +1779,24 @@ static int at91udc_probe(struct platform_device *pdev)
1099 + }
1100 +
1101 + /* don't do anything until we have both gadget driver and VBUS */
1102 ++ if (IS_ENABLED(CONFIG_COMMON_CLK)) {
1103 ++ clk_set_rate(udc->uclk, 48000000);
1104 ++ retval = clk_prepare(udc->uclk);
1105 ++ if (retval)
1106 ++ goto fail1;
1107 ++ }
1108 ++ retval = clk_prepare(udc->fclk);
1109 ++ if (retval)
1110 ++ goto fail1a;
1111 ++
1112 + retval = clk_prepare_enable(udc->iclk);
1113 + if (retval)
1114 +- goto fail1;
1115 ++ goto fail1b;
1116 + at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
1117 + at91_udp_write(udc, AT91_UDP_IDR, 0xffffffff);
1118 + /* Clear all pending interrupts - UDP may be used by bootloader. */
1119 + at91_udp_write(udc, AT91_UDP_ICR, 0xffffffff);
1120 +- clk_disable_unprepare(udc->iclk);
1121 ++ clk_disable(udc->iclk);
1122 +
1123 + /* request UDC and maybe VBUS irqs */
1124 + udc->udp_irq = platform_get_irq(pdev, 0);
1125 +@@ -1796,7 +1804,7 @@ static int at91udc_probe(struct platform_device *pdev)
1126 + 0, driver_name, udc);
1127 + if (retval < 0) {
1128 + DBG("request irq %d failed\n", udc->udp_irq);
1129 +- goto fail1;
1130 ++ goto fail1c;
1131 + }
1132 + if (gpio_is_valid(udc->board.vbus_pin)) {
1133 + retval = gpio_request(udc->board.vbus_pin, "udc_vbus");
1134 +@@ -1849,6 +1857,13 @@ fail3:
1135 + gpio_free(udc->board.vbus_pin);
1136 + fail2:
1137 + free_irq(udc->udp_irq, udc);
1138 ++fail1c:
1139 ++ clk_unprepare(udc->iclk);
1140 ++fail1b:
1141 ++ clk_unprepare(udc->fclk);
1142 ++fail1a:
1143 ++ if (IS_ENABLED(CONFIG_COMMON_CLK))
1144 ++ clk_unprepare(udc->uclk);
1145 + fail1:
1146 + if (IS_ENABLED(CONFIG_COMMON_CLK) && !IS_ERR(udc->uclk))
1147 + clk_put(udc->uclk);
1148 +@@ -1897,6 +1912,11 @@ static int __exit at91udc_remove(struct platform_device *pdev)
1149 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1150 + release_mem_region(res->start, resource_size(res));
1151 +
1152 ++ if (IS_ENABLED(CONFIG_COMMON_CLK))
1153 ++ clk_unprepare(udc->uclk);
1154 ++ clk_unprepare(udc->fclk);
1155 ++ clk_unprepare(udc->iclk);
1156 ++
1157 + clk_put(udc->iclk);
1158 + clk_put(udc->fclk);
1159 + if (IS_ENABLED(CONFIG_COMMON_CLK))
1160 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1161 +index d761c040ee2e..6f052daed694 100644
1162 +--- a/drivers/usb/host/xhci-ring.c
1163 ++++ b/drivers/usb/host/xhci-ring.c
1164 +@@ -1965,22 +1965,13 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
1165 + ep->stopped_td = td;
1166 + return 0;
1167 + } else {
1168 +- if (trb_comp_code == COMP_STALL) {
1169 +- /* The transfer is completed from the driver's
1170 +- * perspective, but we need to issue a set dequeue
1171 +- * command for this stalled endpoint to move the dequeue
1172 +- * pointer past the TD. We can't do that here because
1173 +- * the halt condition must be cleared first. Let the
1174 +- * USB class driver clear the stall later.
1175 +- */
1176 +- ep->stopped_td = td;
1177 +- ep->stopped_stream = ep_ring->stream_id;
1178 +- } else if (xhci_requires_manual_halt_cleanup(xhci,
1179 +- ep_ctx, trb_comp_code)) {
1180 +- /* Other types of errors halt the endpoint, but the
1181 +- * class driver doesn't call usb_reset_endpoint() unless
1182 +- * the error is -EPIPE. Clear the halted status in the
1183 +- * xHCI hardware manually.
1184 ++ if (trb_comp_code == COMP_STALL ||
1185 ++ xhci_requires_manual_halt_cleanup(xhci, ep_ctx,
1186 ++ trb_comp_code)) {
1187 ++ /* Issue a reset endpoint command to clear the host side
1188 ++ * halt, followed by a set dequeue command to move the
1189 ++ * dequeue pointer past the TD.
1190 ++ * The class driver clears the device side halt later.
1191 + */
1192 + xhci_cleanup_halted_endpoint(xhci,
1193 + slot_id, ep_index, ep_ring->stream_id,
1194 +@@ -2100,9 +2091,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
1195 + else
1196 + td->urb->actual_length = 0;
1197 +
1198 +- xhci_cleanup_halted_endpoint(xhci,
1199 +- slot_id, ep_index, 0, td, event_trb);
1200 +- return finish_td(xhci, td, event_trb, event, ep, status, true);
1201 ++ return finish_td(xhci, td, event_trb, event, ep, status, false);
1202 + }
1203 + /*
1204 + * Did we transfer any data, despite the errors that might have
1205 +@@ -2656,17 +2645,8 @@ cleanup:
1206 + if (ret) {
1207 + urb = td->urb;
1208 + urb_priv = urb->hcpriv;
1209 +- /* Leave the TD around for the reset endpoint function
1210 +- * to use(but only if it's not a control endpoint,
1211 +- * since we already queued the Set TR dequeue pointer
1212 +- * command for stalled control endpoints).
1213 +- */
1214 +- if (usb_endpoint_xfer_control(&urb->ep->desc) ||
1215 +- (trb_comp_code != COMP_STALL &&
1216 +- trb_comp_code != COMP_BABBLE))
1217 +- xhci_urb_free_priv(xhci, urb_priv);
1218 +- else
1219 +- kfree(urb_priv);
1220 ++
1221 ++ xhci_urb_free_priv(xhci, urb_priv);
1222 +
1223 + usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb);
1224 + if ((urb->actual_length != urb->transfer_buffer_length &&
1225 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1226 +index 381965957a67..e0ccc95c91e2 100644
1227 +--- a/drivers/usb/host/xhci.c
1228 ++++ b/drivers/usb/host/xhci.c
1229 +@@ -2924,63 +2924,33 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
1230 + }
1231 + }
1232 +
1233 +-/* Deal with stalled endpoints. The core should have sent the control message
1234 +- * to clear the halt condition. However, we need to make the xHCI hardware
1235 +- * reset its sequence number, since a device will expect a sequence number of
1236 +- * zero after the halt condition is cleared.
1237 ++/* Called when clearing halted device. The core should have sent the control
1238 ++ * message to clear the device halt condition. The host side of the halt should
1239 ++ * already be cleared with a reset endpoint command issued when the STALL tx
1240 ++ * event was received.
1241 ++ *
1242 + * Context: in_interrupt
1243 + */
1244 ++
1245 + void xhci_endpoint_reset(struct usb_hcd *hcd,
1246 + struct usb_host_endpoint *ep)
1247 + {
1248 + struct xhci_hcd *xhci;
1249 +- struct usb_device *udev;
1250 +- unsigned int ep_index;
1251 +- unsigned long flags;
1252 +- int ret;
1253 +- struct xhci_virt_ep *virt_ep;
1254 +
1255 + xhci = hcd_to_xhci(hcd);
1256 +- udev = (struct usb_device *) ep->hcpriv;
1257 +- /* Called with a root hub endpoint (or an endpoint that wasn't added
1258 +- * with xhci_add_endpoint()
1259 +- */
1260 +- if (!ep->hcpriv)
1261 +- return;
1262 +- ep_index = xhci_get_endpoint_index(&ep->desc);
1263 +- virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index];
1264 +- if (!virt_ep->stopped_td) {
1265 +- xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
1266 +- "Endpoint 0x%x not halted, refusing to reset.",
1267 +- ep->desc.bEndpointAddress);
1268 +- return;
1269 +- }
1270 +- if (usb_endpoint_xfer_control(&ep->desc)) {
1271 +- xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
1272 +- "Control endpoint stall already handled.");
1273 +- return;
1274 +- }
1275 +
1276 +- xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
1277 +- "Queueing reset endpoint command");
1278 +- spin_lock_irqsave(&xhci->lock, flags);
1279 +- ret = xhci_queue_reset_ep(xhci, udev->slot_id, ep_index);
1280 + /*
1281 +- * Can't change the ring dequeue pointer until it's transitioned to the
1282 +- * stopped state, which is only upon a successful reset endpoint
1283 +- * command. Better hope that last command worked!
1284 ++ * We might need to implement the config ep cmd in xhci 4.8.1 note:
1285 ++ * The Reset Endpoint Command may only be issued to endpoints in the
1286 ++ * Halted state. If software wishes reset the Data Toggle or Sequence
1287 ++ * Number of an endpoint that isn't in the Halted state, then software
1288 ++ * may issue a Configure Endpoint Command with the Drop and Add bits set
1289 ++ * for the target endpoint. that is in the Stopped state.
1290 + */
1291 +- if (!ret) {
1292 +- xhci_cleanup_stalled_ring(xhci, udev, ep_index);
1293 +- kfree(virt_ep->stopped_td);
1294 +- xhci_ring_cmd_db(xhci);
1295 +- }
1296 +- virt_ep->stopped_td = NULL;
1297 +- virt_ep->stopped_stream = 0;
1298 +- spin_unlock_irqrestore(&xhci->lock, flags);
1299 +
1300 +- if (ret)
1301 +- xhci_warn(xhci, "FIXME allocate a new ring segment\n");
1302 ++ /* For now just print debug to follow the situation */
1303 ++ xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n",
1304 ++ ep->desc.bEndpointAddress);
1305 + }
1306 +
1307 + static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
1308 +diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
1309 +index 8964b59fee92..f46ad53626be 100644
1310 +--- a/fs/btrfs/disk-io.c
1311 ++++ b/fs/btrfs/disk-io.c
1312 +@@ -3995,12 +3995,6 @@ again:
1313 + if (ret)
1314 + break;
1315 +
1316 +- /* opt_discard */
1317 +- if (btrfs_test_opt(root, DISCARD))
1318 +- ret = btrfs_error_discard_extent(root, start,
1319 +- end + 1 - start,
1320 +- NULL);
1321 +-
1322 + clear_extent_dirty(unpin, start, end, GFP_NOFS);
1323 + btrfs_error_unpin_extent_range(root, start, end);
1324 + cond_resched();
1325 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1326 +index 63ee604efa6c..b1c6e490379c 100644
1327 +--- a/fs/btrfs/extent-tree.c
1328 ++++ b/fs/btrfs/extent-tree.c
1329 +@@ -5476,7 +5476,8 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
1330 + update_global_block_rsv(fs_info);
1331 + }
1332 +
1333 +-static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end)
1334 ++static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end,
1335 ++ const bool return_free_space)
1336 + {
1337 + struct btrfs_fs_info *fs_info = root->fs_info;
1338 + struct btrfs_block_group_cache *cache = NULL;
1339 +@@ -5500,7 +5501,8 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end)
1340 +
1341 + if (start < cache->last_byte_to_unpin) {
1342 + len = min(len, cache->last_byte_to_unpin - start);
1343 +- btrfs_add_free_space(cache, start, len);
1344 ++ if (return_free_space)
1345 ++ btrfs_add_free_space(cache, start, len);
1346 + }
1347 +
1348 + start += len;
1349 +@@ -5563,7 +5565,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
1350 + end + 1 - start, NULL);
1351 +
1352 + clear_extent_dirty(unpin, start, end, GFP_NOFS);
1353 +- unpin_extent_range(root, start, end);
1354 ++ unpin_extent_range(root, start, end, true);
1355 + cond_resched();
1356 + }
1357 +
1358 +@@ -8809,7 +8811,7 @@ out:
1359 +
1360 + int btrfs_error_unpin_extent_range(struct btrfs_root *root, u64 start, u64 end)
1361 + {
1362 +- return unpin_extent_range(root, start, end);
1363 ++ return unpin_extent_range(root, start, end, false);
1364 + }
1365 +
1366 + int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr,
1367 +diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
1368 +index a4a7a1a8da95..0a3809500599 100644
1369 +--- a/fs/btrfs/extent_map.c
1370 ++++ b/fs/btrfs/extent_map.c
1371 +@@ -263,8 +263,6 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
1372 + if (!em)
1373 + goto out;
1374 +
1375 +- if (!test_bit(EXTENT_FLAG_LOGGING, &em->flags))
1376 +- list_move(&em->list, &tree->modified_extents);
1377 + em->generation = gen;
1378 + clear_bit(EXTENT_FLAG_PINNED, &em->flags);
1379 + em->mod_start = em->start;
1380 +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
1381 +index 788901552eb1..6f1161324f91 100644
1382 +--- a/fs/ceph/mds_client.c
1383 ++++ b/fs/ceph/mds_client.c
1384 +@@ -1420,15 +1420,18 @@ static void discard_cap_releases(struct ceph_mds_client *mdsc,
1385 + dout("discard_cap_releases mds%d\n", session->s_mds);
1386 + spin_lock(&session->s_cap_lock);
1387 +
1388 +- /* zero out the in-progress message */
1389 +- msg = list_first_entry(&session->s_cap_releases,
1390 +- struct ceph_msg, list_head);
1391 +- head = msg->front.iov_base;
1392 +- num = le32_to_cpu(head->num);
1393 +- dout("discard_cap_releases mds%d %p %u\n", session->s_mds, msg, num);
1394 +- head->num = cpu_to_le32(0);
1395 +- msg->front.iov_len = sizeof(*head);
1396 +- session->s_num_cap_releases += num;
1397 ++ if (!list_empty(&session->s_cap_releases)) {
1398 ++ /* zero out the in-progress message */
1399 ++ msg = list_first_entry(&session->s_cap_releases,
1400 ++ struct ceph_msg, list_head);
1401 ++ head = msg->front.iov_base;
1402 ++ num = le32_to_cpu(head->num);
1403 ++ dout("discard_cap_releases mds%d %p %u\n",
1404 ++ session->s_mds, msg, num);
1405 ++ head->num = cpu_to_le32(0);
1406 ++ msg->front.iov_len = sizeof(*head);
1407 ++ session->s_num_cap_releases += num;
1408 ++ }
1409 +
1410 + /* requeue completed messages */
1411 + while (!list_empty(&session->s_cap_releases_done)) {
1412 +diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
1413 +index 000eae2782b6..bf926f7a5f0c 100644
1414 +--- a/fs/ecryptfs/crypto.c
1415 ++++ b/fs/ecryptfs/crypto.c
1416 +@@ -1917,7 +1917,6 @@ ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
1417 + break;
1418 + case 2:
1419 + dst[dst_byte_offset++] |= (src_byte);
1420 +- dst[dst_byte_offset] = 0;
1421 + current_bit_offset = 0;
1422 + break;
1423 + }
1424 +diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
1425 +index 992cf95830b5..f3fd66acae47 100644
1426 +--- a/fs/ecryptfs/file.c
1427 ++++ b/fs/ecryptfs/file.c
1428 +@@ -191,23 +191,11 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
1429 + {
1430 + int rc = 0;
1431 + struct ecryptfs_crypt_stat *crypt_stat = NULL;
1432 +- struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
1433 + struct dentry *ecryptfs_dentry = file->f_path.dentry;
1434 + /* Private value of ecryptfs_dentry allocated in
1435 + * ecryptfs_lookup() */
1436 + struct ecryptfs_file_info *file_info;
1437 +
1438 +- mount_crypt_stat = &ecryptfs_superblock_to_private(
1439 +- ecryptfs_dentry->d_sb)->mount_crypt_stat;
1440 +- if ((mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
1441 +- && ((file->f_flags & O_WRONLY) || (file->f_flags & O_RDWR)
1442 +- || (file->f_flags & O_CREAT) || (file->f_flags & O_TRUNC)
1443 +- || (file->f_flags & O_APPEND))) {
1444 +- printk(KERN_WARNING "Mount has encrypted view enabled; "
1445 +- "files may only be read\n");
1446 +- rc = -EPERM;
1447 +- goto out;
1448 +- }
1449 + /* Released in ecryptfs_release or end of function if failure */
1450 + file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
1451 + ecryptfs_set_file_private(file, file_info);
1452 +diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
1453 +index eb1c5979ecaf..539a399b8339 100644
1454 +--- a/fs/ecryptfs/main.c
1455 ++++ b/fs/ecryptfs/main.c
1456 +@@ -493,6 +493,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
1457 + {
1458 + struct super_block *s;
1459 + struct ecryptfs_sb_info *sbi;
1460 ++ struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
1461 + struct ecryptfs_dentry_info *root_info;
1462 + const char *err = "Getting sb failed";
1463 + struct inode *inode;
1464 +@@ -511,6 +512,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
1465 + err = "Error parsing options";
1466 + goto out;
1467 + }
1468 ++ mount_crypt_stat = &sbi->mount_crypt_stat;
1469 +
1470 + s = sget(fs_type, NULL, set_anon_super, flags, NULL);
1471 + if (IS_ERR(s)) {
1472 +@@ -557,11 +559,19 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
1473 +
1474 + /**
1475 + * Set the POSIX ACL flag based on whether they're enabled in the lower
1476 +- * mount. Force a read-only eCryptfs mount if the lower mount is ro.
1477 +- * Allow a ro eCryptfs mount even when the lower mount is rw.
1478 ++ * mount.
1479 + */
1480 + s->s_flags = flags & ~MS_POSIXACL;
1481 +- s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL);
1482 ++ s->s_flags |= path.dentry->d_sb->s_flags & MS_POSIXACL;
1483 ++
1484 ++ /**
1485 ++ * Force a read-only eCryptfs mount when:
1486 ++ * 1) The lower mount is ro
1487 ++ * 2) The ecryptfs_encrypted_view mount option is specified
1488 ++ */
1489 ++ if (path.dentry->d_sb->s_flags & MS_RDONLY ||
1490 ++ mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
1491 ++ s->s_flags |= MS_RDONLY;
1492 +
1493 + s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
1494 + s->s_blocksize = path.dentry->d_sb->s_blocksize;
1495 +diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
1496 +index f488bbae541a..735d7522a3a9 100644
1497 +--- a/fs/isofs/rock.c
1498 ++++ b/fs/isofs/rock.c
1499 +@@ -30,6 +30,7 @@ struct rock_state {
1500 + int cont_size;
1501 + int cont_extent;
1502 + int cont_offset;
1503 ++ int cont_loops;
1504 + struct inode *inode;
1505 + };
1506 +
1507 +@@ -73,6 +74,9 @@ static void init_rock_state(struct rock_state *rs, struct inode *inode)
1508 + rs->inode = inode;
1509 + }
1510 +
1511 ++/* Maximum number of Rock Ridge continuation entries */
1512 ++#define RR_MAX_CE_ENTRIES 32
1513 ++
1514 + /*
1515 + * Returns 0 if the caller should continue scanning, 1 if the scan must end
1516 + * and -ve on error.
1517 +@@ -105,6 +109,8 @@ static int rock_continue(struct rock_state *rs)
1518 + goto out;
1519 + }
1520 + ret = -EIO;
1521 ++ if (++rs->cont_loops >= RR_MAX_CE_ENTRIES)
1522 ++ goto out;
1523 + bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
1524 + if (bh) {
1525 + memcpy(rs->buffer, bh->b_data + rs->cont_offset,
1526 +@@ -356,6 +362,9 @@ repeat:
1527 + rs.cont_size = isonum_733(rr->u.CE.size);
1528 + break;
1529 + case SIG('E', 'R'):
1530 ++ /* Invalid length of ER tag id? */
1531 ++ if (rr->u.ER.len_id + offsetof(struct rock_ridge, u.ER.data) > rr->len)
1532 ++ goto out;
1533 + ISOFS_SB(inode->i_sb)->s_rock = 1;
1534 + printk(KERN_DEBUG "ISO 9660 Extensions: ");
1535 + {
1536 +diff --git a/fs/namespace.c b/fs/namespace.c
1537 +index d00750d2f91e..7c3c0f6d2744 100644
1538 +--- a/fs/namespace.c
1539 ++++ b/fs/namespace.c
1540 +@@ -1347,6 +1347,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1541 + goto dput_and_out;
1542 + if (mnt->mnt.mnt_flags & MNT_LOCKED)
1543 + goto dput_and_out;
1544 ++ retval = -EPERM;
1545 ++ if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))
1546 ++ goto dput_and_out;
1547 +
1548 + retval = do_umount(mnt, flags);
1549 + dput_and_out:
1550 +@@ -1858,7 +1861,13 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
1551 + }
1552 + if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&
1553 + !(mnt_flags & MNT_NODEV)) {
1554 +- return -EPERM;
1555 ++ /* Was the nodev implicitly added in mount? */
1556 ++ if ((mnt->mnt_ns->user_ns != &init_user_ns) &&
1557 ++ !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) {
1558 ++ mnt_flags |= MNT_NODEV;
1559 ++ } else {
1560 ++ return -EPERM;
1561 ++ }
1562 + }
1563 + if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&
1564 + !(mnt_flags & MNT_NOSUID)) {
1565 +diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
1566 +index 60426ccb3b65..2f970de02b16 100644
1567 +--- a/fs/ncpfs/ioctl.c
1568 ++++ b/fs/ncpfs/ioctl.c
1569 +@@ -448,7 +448,6 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
1570 + result = -EIO;
1571 + }
1572 + }
1573 +- result = 0;
1574 + }
1575 + mutex_unlock(&server->root_setup_lock);
1576 +
1577 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1578 +index 759875038791..43c27110387a 100644
1579 +--- a/fs/nfs/nfs4proc.c
1580 ++++ b/fs/nfs/nfs4proc.c
1581 +@@ -7238,6 +7238,9 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
1582 +
1583 + dprintk("--> %s\n", __func__);
1584 +
1585 ++ /* nfs4_layoutget_release calls pnfs_put_layout_hdr */
1586 ++ pnfs_get_layout_hdr(NFS_I(inode)->layout);
1587 ++
1588 + lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags);
1589 + if (!lgp->args.layout.pages) {
1590 + nfs4_layoutget_release(lgp);
1591 +@@ -7250,9 +7253,6 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
1592 + lgp->res.seq_res.sr_slot = NULL;
1593 + nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0);
1594 +
1595 +- /* nfs4_layoutget_release calls pnfs_put_layout_hdr */
1596 +- pnfs_get_layout_hdr(NFS_I(inode)->layout);
1597 +-
1598 + task = rpc_run_task(&task_setup_data);
1599 + if (IS_ERR(task))
1600 + return ERR_CAST(task);
1601 +diff --git a/fs/proc/base.c b/fs/proc/base.c
1602 +index c35eaa404933..dfce13e5327b 100644
1603 +--- a/fs/proc/base.c
1604 ++++ b/fs/proc/base.c
1605 +@@ -2544,6 +2544,57 @@ static const struct file_operations proc_projid_map_operations = {
1606 + .llseek = seq_lseek,
1607 + .release = proc_id_map_release,
1608 + };
1609 ++
1610 ++static int proc_setgroups_open(struct inode *inode, struct file *file)
1611 ++{
1612 ++ struct user_namespace *ns = NULL;
1613 ++ struct task_struct *task;
1614 ++ int ret;
1615 ++
1616 ++ ret = -ESRCH;
1617 ++ task = get_proc_task(inode);
1618 ++ if (task) {
1619 ++ rcu_read_lock();
1620 ++ ns = get_user_ns(task_cred_xxx(task, user_ns));
1621 ++ rcu_read_unlock();
1622 ++ put_task_struct(task);
1623 ++ }
1624 ++ if (!ns)
1625 ++ goto err;
1626 ++
1627 ++ if (file->f_mode & FMODE_WRITE) {
1628 ++ ret = -EACCES;
1629 ++ if (!ns_capable(ns, CAP_SYS_ADMIN))
1630 ++ goto err_put_ns;
1631 ++ }
1632 ++
1633 ++ ret = single_open(file, &proc_setgroups_show, ns);
1634 ++ if (ret)
1635 ++ goto err_put_ns;
1636 ++
1637 ++ return 0;
1638 ++err_put_ns:
1639 ++ put_user_ns(ns);
1640 ++err:
1641 ++ return ret;
1642 ++}
1643 ++
1644 ++static int proc_setgroups_release(struct inode *inode, struct file *file)
1645 ++{
1646 ++ struct seq_file *seq = file->private_data;
1647 ++ struct user_namespace *ns = seq->private;
1648 ++ int ret = single_release(inode, file);
1649 ++ put_user_ns(ns);
1650 ++ return ret;
1651 ++}
1652 ++
1653 ++static const struct file_operations proc_setgroups_operations = {
1654 ++ .open = proc_setgroups_open,
1655 ++ .write = proc_setgroups_write,
1656 ++ .read = seq_read,
1657 ++ .llseek = seq_lseek,
1658 ++ .release = proc_setgroups_release,
1659 ++};
1660 + #endif /* CONFIG_USER_NS */
1661 +
1662 + static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
1663 +@@ -2652,6 +2703,7 @@ static const struct pid_entry tgid_base_stuff[] = {
1664 + REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations),
1665 + REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations),
1666 + REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
1667 ++ REG("setgroups", S_IRUGO|S_IWUSR, proc_setgroups_operations),
1668 + #endif
1669 + #ifdef CONFIG_CHECKPOINT_RESTORE
1670 + REG("timers", S_IRUGO, proc_timers_operations),
1671 +@@ -2987,6 +3039,7 @@ static const struct pid_entry tid_base_stuff[] = {
1672 + REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations),
1673 + REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations),
1674 + REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
1675 ++ REG("setgroups", S_IRUGO|S_IWUSR, proc_setgroups_operations),
1676 + #endif
1677 + };
1678 +
1679 +diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
1680 +index d7c6dbe4194b..d89f324bc387 100644
1681 +--- a/fs/udf/symlink.c
1682 ++++ b/fs/udf/symlink.c
1683 +@@ -80,11 +80,17 @@ static int udf_symlink_filler(struct file *file, struct page *page)
1684 + struct inode *inode = page->mapping->host;
1685 + struct buffer_head *bh = NULL;
1686 + unsigned char *symlink;
1687 +- int err = -EIO;
1688 ++ int err;
1689 + unsigned char *p = kmap(page);
1690 + struct udf_inode_info *iinfo;
1691 + uint32_t pos;
1692 +
1693 ++ /* We don't support symlinks longer than one block */
1694 ++ if (inode->i_size > inode->i_sb->s_blocksize) {
1695 ++ err = -ENAMETOOLONG;
1696 ++ goto out_unmap;
1697 ++ }
1698 ++
1699 + iinfo = UDF_I(inode);
1700 + pos = udf_block_map(inode, 0);
1701 +
1702 +@@ -94,8 +100,10 @@ static int udf_symlink_filler(struct file *file, struct page *page)
1703 + } else {
1704 + bh = sb_bread(inode->i_sb, pos);
1705 +
1706 +- if (!bh)
1707 +- goto out;
1708 ++ if (!bh) {
1709 ++ err = -EIO;
1710 ++ goto out_unlock_inode;
1711 ++ }
1712 +
1713 + symlink = bh->b_data;
1714 + }
1715 +@@ -109,9 +117,10 @@ static int udf_symlink_filler(struct file *file, struct page *page)
1716 + unlock_page(page);
1717 + return 0;
1718 +
1719 +-out:
1720 ++out_unlock_inode:
1721 + up_read(&iinfo->i_data_sem);
1722 + SetPageError(page);
1723 ++out_unmap:
1724 + kunmap(page);
1725 + unlock_page(page);
1726 + return err;
1727 +diff --git a/include/linux/audit.h b/include/linux/audit.h
1728 +index 4fb28b23a4a4..c25cb64db967 100644
1729 +--- a/include/linux/audit.h
1730 ++++ b/include/linux/audit.h
1731 +@@ -46,6 +46,7 @@ struct audit_tree;
1732 +
1733 + struct audit_krule {
1734 + int vers_ops;
1735 ++ u32 pflags;
1736 + u32 flags;
1737 + u32 listnr;
1738 + u32 action;
1739 +@@ -63,6 +64,9 @@ struct audit_krule {
1740 + u64 prio;
1741 + };
1742 +
1743 ++/* Flag to indicate legacy AUDIT_LOGINUID unset usage */
1744 ++#define AUDIT_LOGINUID_LEGACY 0x1
1745 ++
1746 + struct audit_field {
1747 + u32 type;
1748 + u32 val;
1749 +diff --git a/include/linux/cred.h b/include/linux/cred.h
1750 +index 04421e825365..6c58dd7cb9ac 100644
1751 +--- a/include/linux/cred.h
1752 ++++ b/include/linux/cred.h
1753 +@@ -68,6 +68,7 @@ extern void groups_free(struct group_info *);
1754 + extern int set_current_groups(struct group_info *);
1755 + extern int set_groups(struct cred *, struct group_info *);
1756 + extern int groups_search(const struct group_info *, kgid_t);
1757 ++extern bool may_setgroups(void);
1758 +
1759 + /* access the groups "array" with this macro */
1760 + #define GROUP_AT(gi, i) \
1761 +diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
1762 +index 4db29859464f..67c11082bde2 100644
1763 +--- a/include/linux/user_namespace.h
1764 ++++ b/include/linux/user_namespace.h
1765 +@@ -17,6 +17,10 @@ struct uid_gid_map { /* 64 bytes -- 1 cache line */
1766 + } extent[UID_GID_MAP_MAX_EXTENTS];
1767 + };
1768 +
1769 ++#define USERNS_SETGROUPS_ALLOWED 1UL
1770 ++
1771 ++#define USERNS_INIT_FLAGS USERNS_SETGROUPS_ALLOWED
1772 ++
1773 + struct user_namespace {
1774 + struct uid_gid_map uid_map;
1775 + struct uid_gid_map gid_map;
1776 +@@ -27,6 +31,7 @@ struct user_namespace {
1777 + kuid_t owner;
1778 + kgid_t group;
1779 + unsigned int proc_inum;
1780 ++ unsigned long flags;
1781 + };
1782 +
1783 + extern struct user_namespace init_user_ns;
1784 +@@ -57,6 +62,9 @@ extern struct seq_operations proc_projid_seq_operations;
1785 + extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
1786 + extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
1787 + extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
1788 ++extern ssize_t proc_setgroups_write(struct file *, const char __user *, size_t, loff_t *);
1789 ++extern int proc_setgroups_show(struct seq_file *m, void *v);
1790 ++extern bool userns_may_setgroups(const struct user_namespace *ns);
1791 + #else
1792 +
1793 + static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
1794 +@@ -81,6 +89,10 @@ static inline void put_user_ns(struct user_namespace *ns)
1795 + {
1796 + }
1797 +
1798 ++static inline bool userns_may_setgroups(const struct user_namespace *ns)
1799 ++{
1800 ++ return true;
1801 ++}
1802 + #endif
1803 +
1804 + #endif /* _LINUX_USER_H */
1805 +diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
1806 +index 75cef3fd97ad..b7cb978ed579 100644
1807 +--- a/include/uapi/linux/audit.h
1808 ++++ b/include/uapi/linux/audit.h
1809 +@@ -374,6 +374,8 @@ struct audit_tty_status {
1810 + __u32 log_passwd; /* 1 = enabled, 0 = disabled */
1811 + };
1812 +
1813 ++#define AUDIT_UID_UNSET (unsigned int)-1
1814 ++
1815 + /* audit_rule_data supports filter rules with both integer and string
1816 + * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
1817 + * AUDIT_LIST_RULES requests.
1818 +diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
1819 +index f7aee8be7fb2..dfd2f4af81a9 100644
1820 +--- a/kernel/auditfilter.c
1821 ++++ b/kernel/auditfilter.c
1822 +@@ -423,9 +423,10 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
1823 + f->lsm_rule = NULL;
1824 +
1825 + /* Support legacy tests for a valid loginuid */
1826 +- if ((f->type == AUDIT_LOGINUID) && (f->val == ~0U)) {
1827 ++ if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) {
1828 + f->type = AUDIT_LOGINUID_SET;
1829 + f->val = 0;
1830 ++ entry->rule.pflags |= AUDIT_LOGINUID_LEGACY;
1831 + }
1832 +
1833 + err = audit_field_valid(entry, f);
1834 +@@ -601,6 +602,13 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule)
1835 + data->buflen += data->values[i] =
1836 + audit_pack_string(&bufp, krule->filterkey);
1837 + break;
1838 ++ case AUDIT_LOGINUID_SET:
1839 ++ if (krule->pflags & AUDIT_LOGINUID_LEGACY && !f->val) {
1840 ++ data->fields[i] = AUDIT_LOGINUID;
1841 ++ data->values[i] = AUDIT_UID_UNSET;
1842 ++ break;
1843 ++ }
1844 ++ /* fallthrough if set */
1845 + default:
1846 + data->values[i] = f->val;
1847 + }
1848 +@@ -617,6 +625,7 @@ static int audit_compare_rule(struct audit_krule *a, struct audit_krule *b)
1849 + int i;
1850 +
1851 + if (a->flags != b->flags ||
1852 ++ a->pflags != b->pflags ||
1853 + a->listnr != b->listnr ||
1854 + a->action != b->action ||
1855 + a->field_count != b->field_count)
1856 +@@ -735,6 +744,7 @@ struct audit_entry *audit_dupe_rule(struct audit_krule *old)
1857 + new = &entry->rule;
1858 + new->vers_ops = old->vers_ops;
1859 + new->flags = old->flags;
1860 ++ new->pflags = old->pflags;
1861 + new->listnr = old->listnr;
1862 + new->action = old->action;
1863 + for (i = 0; i < AUDIT_BITMASK_SIZE; i++)
1864 +diff --git a/kernel/groups.c b/kernel/groups.c
1865 +index 90cf1c38c8ea..67b4ba30475f 100644
1866 +--- a/kernel/groups.c
1867 ++++ b/kernel/groups.c
1868 +@@ -6,6 +6,7 @@
1869 + #include <linux/slab.h>
1870 + #include <linux/security.h>
1871 + #include <linux/syscalls.h>
1872 ++#include <linux/user_namespace.h>
1873 + #include <asm/uaccess.h>
1874 +
1875 + /* init to 2 - one for init_task, one to ensure it is never freed */
1876 +@@ -223,6 +224,14 @@ out:
1877 + return i;
1878 + }
1879 +
1880 ++bool may_setgroups(void)
1881 ++{
1882 ++ struct user_namespace *user_ns = current_user_ns();
1883 ++
1884 ++ return ns_capable(user_ns, CAP_SETGID) &&
1885 ++ userns_may_setgroups(user_ns);
1886 ++}
1887 ++
1888 + /*
1889 + * SMP: Our groups are copy-on-write. We can set them safely
1890 + * without another task interfering.
1891 +@@ -233,7 +242,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
1892 + struct group_info *group_info;
1893 + int retval;
1894 +
1895 +- if (!ns_capable(current_user_ns(), CAP_SETGID))
1896 ++ if (!may_setgroups())
1897 + return -EPERM;
1898 + if ((unsigned)gidsetsize > NGROUPS_MAX)
1899 + return -EINVAL;
1900 +diff --git a/kernel/pid.c b/kernel/pid.c
1901 +index 9b9a26698144..82430c858d69 100644
1902 +--- a/kernel/pid.c
1903 ++++ b/kernel/pid.c
1904 +@@ -341,6 +341,8 @@ out:
1905 +
1906 + out_unlock:
1907 + spin_unlock_irq(&pidmap_lock);
1908 ++ put_pid_ns(ns);
1909 ++
1910 + out_free:
1911 + while (++i <= ns->level)
1912 + free_pidmap(pid->numbers + i);
1913 +diff --git a/kernel/uid16.c b/kernel/uid16.c
1914 +index 602e5bbbceff..d58cc4d8f0d1 100644
1915 +--- a/kernel/uid16.c
1916 ++++ b/kernel/uid16.c
1917 +@@ -176,7 +176,7 @@ SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
1918 + struct group_info *group_info;
1919 + int retval;
1920 +
1921 +- if (!ns_capable(current_user_ns(), CAP_SETGID))
1922 ++ if (!may_setgroups())
1923 + return -EPERM;
1924 + if ((unsigned)gidsetsize > NGROUPS_MAX)
1925 + return -EINVAL;
1926 +diff --git a/kernel/user.c b/kernel/user.c
1927 +index 5bbb91988e69..75774ce9bf58 100644
1928 +--- a/kernel/user.c
1929 ++++ b/kernel/user.c
1930 +@@ -51,6 +51,7 @@ struct user_namespace init_user_ns = {
1931 + .owner = GLOBAL_ROOT_UID,
1932 + .group = GLOBAL_ROOT_GID,
1933 + .proc_inum = PROC_USER_INIT_INO,
1934 ++ .flags = USERNS_INIT_FLAGS,
1935 + };
1936 + EXPORT_SYMBOL_GPL(init_user_ns);
1937 +
1938 +diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
1939 +index 6991139e3303..c09fe8b87cb0 100644
1940 +--- a/kernel/user_namespace.c
1941 ++++ b/kernel/user_namespace.c
1942 +@@ -24,6 +24,7 @@
1943 + #include <linux/fs_struct.h>
1944 +
1945 + static struct kmem_cache *user_ns_cachep __read_mostly;
1946 ++static DEFINE_MUTEX(userns_state_mutex);
1947 +
1948 + static bool new_idmap_permitted(const struct file *file,
1949 + struct user_namespace *ns, int cap_setid,
1950 +@@ -99,6 +100,11 @@ int create_user_ns(struct cred *new)
1951 + ns->owner = owner;
1952 + ns->group = group;
1953 +
1954 ++ /* Inherit USERNS_SETGROUPS_ALLOWED from our parent */
1955 ++ mutex_lock(&userns_state_mutex);
1956 ++ ns->flags = parent_ns->flags;
1957 ++ mutex_unlock(&userns_state_mutex);
1958 ++
1959 + set_cred_user_ns(new, ns);
1960 +
1961 + return 0;
1962 +@@ -575,9 +581,6 @@ static bool mappings_overlap(struct uid_gid_map *new_map, struct uid_gid_extent
1963 + return false;
1964 + }
1965 +
1966 +-
1967 +-static DEFINE_MUTEX(id_map_mutex);
1968 +-
1969 + static ssize_t map_write(struct file *file, const char __user *buf,
1970 + size_t count, loff_t *ppos,
1971 + int cap_setid,
1972 +@@ -594,7 +597,7 @@ static ssize_t map_write(struct file *file, const char __user *buf,
1973 + ssize_t ret = -EINVAL;
1974 +
1975 + /*
1976 +- * The id_map_mutex serializes all writes to any given map.
1977 ++ * The userns_state_mutex serializes all writes to any given map.
1978 + *
1979 + * Any map is only ever written once.
1980 + *
1981 +@@ -612,7 +615,7 @@ static ssize_t map_write(struct file *file, const char __user *buf,
1982 + * order and smp_rmb() is guaranteed that we don't have crazy
1983 + * architectures returning stale data.
1984 + */
1985 +- mutex_lock(&id_map_mutex);
1986 ++ mutex_lock(&userns_state_mutex);
1987 +
1988 + ret = -EPERM;
1989 + /* Only allow one successful write to the map */
1990 +@@ -739,7 +742,7 @@ static ssize_t map_write(struct file *file, const char __user *buf,
1991 + *ppos = count;
1992 + ret = count;
1993 + out:
1994 +- mutex_unlock(&id_map_mutex);
1995 ++ mutex_unlock(&userns_state_mutex);
1996 + if (page)
1997 + free_page(page);
1998 + return ret;
1999 +@@ -798,17 +801,21 @@ static bool new_idmap_permitted(const struct file *file,
2000 + struct user_namespace *ns, int cap_setid,
2001 + struct uid_gid_map *new_map)
2002 + {
2003 +- /* Allow mapping to your own filesystem ids */
2004 +- if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1)) {
2005 ++ const struct cred *cred = file->f_cred;
2006 ++ /* Don't allow mappings that would allow anything that wouldn't
2007 ++ * be allowed without the establishment of unprivileged mappings.
2008 ++ */
2009 ++ if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1) &&
2010 ++ uid_eq(ns->owner, cred->euid)) {
2011 + u32 id = new_map->extent[0].lower_first;
2012 + if (cap_setid == CAP_SETUID) {
2013 + kuid_t uid = make_kuid(ns->parent, id);
2014 +- if (uid_eq(uid, file->f_cred->fsuid))
2015 ++ if (uid_eq(uid, cred->euid))
2016 + return true;
2017 +- }
2018 +- else if (cap_setid == CAP_SETGID) {
2019 ++ } else if (cap_setid == CAP_SETGID) {
2020 + kgid_t gid = make_kgid(ns->parent, id);
2021 +- if (gid_eq(gid, file->f_cred->fsgid))
2022 ++ if (!(ns->flags & USERNS_SETGROUPS_ALLOWED) &&
2023 ++ gid_eq(gid, cred->egid))
2024 + return true;
2025 + }
2026 + }
2027 +@@ -828,6 +835,100 @@ static bool new_idmap_permitted(const struct file *file,
2028 + return false;
2029 + }
2030 +
2031 ++int proc_setgroups_show(struct seq_file *seq, void *v)
2032 ++{
2033 ++ struct user_namespace *ns = seq->private;
2034 ++ unsigned long userns_flags = ACCESS_ONCE(ns->flags);
2035 ++
2036 ++ seq_printf(seq, "%s\n",
2037 ++ (userns_flags & USERNS_SETGROUPS_ALLOWED) ?
2038 ++ "allow" : "deny");
2039 ++ return 0;
2040 ++}
2041 ++
2042 ++ssize_t proc_setgroups_write(struct file *file, const char __user *buf,
2043 ++ size_t count, loff_t *ppos)
2044 ++{
2045 ++ struct seq_file *seq = file->private_data;
2046 ++ struct user_namespace *ns = seq->private;
2047 ++ char kbuf[8], *pos;
2048 ++ bool setgroups_allowed;
2049 ++ ssize_t ret;
2050 ++
2051 ++ /* Only allow a very narrow range of strings to be written */
2052 ++ ret = -EINVAL;
2053 ++ if ((*ppos != 0) || (count >= sizeof(kbuf)))
2054 ++ goto out;
2055 ++
2056 ++ /* What was written? */
2057 ++ ret = -EFAULT;
2058 ++ if (copy_from_user(kbuf, buf, count))
2059 ++ goto out;
2060 ++ kbuf[count] = '\0';
2061 ++ pos = kbuf;
2062 ++
2063 ++ /* What is being requested? */
2064 ++ ret = -EINVAL;
2065 ++ if (strncmp(pos, "allow", 5) == 0) {
2066 ++ pos += 5;
2067 ++ setgroups_allowed = true;
2068 ++ }
2069 ++ else if (strncmp(pos, "deny", 4) == 0) {
2070 ++ pos += 4;
2071 ++ setgroups_allowed = false;
2072 ++ }
2073 ++ else
2074 ++ goto out;
2075 ++
2076 ++ /* Verify there is not trailing junk on the line */
2077 ++ pos = skip_spaces(pos);
2078 ++ if (*pos != '\0')
2079 ++ goto out;
2080 ++
2081 ++ ret = -EPERM;
2082 ++ mutex_lock(&userns_state_mutex);
2083 ++ if (setgroups_allowed) {
2084 ++ /* Enabling setgroups after setgroups has been disabled
2085 ++ * is not allowed.
2086 ++ */
2087 ++ if (!(ns->flags & USERNS_SETGROUPS_ALLOWED))
2088 ++ goto out_unlock;
2089 ++ } else {
2090 ++ /* Permanently disabling setgroups after setgroups has
2091 ++ * been enabled by writing the gid_map is not allowed.
2092 ++ */
2093 ++ if (ns->gid_map.nr_extents != 0)
2094 ++ goto out_unlock;
2095 ++ ns->flags &= ~USERNS_SETGROUPS_ALLOWED;
2096 ++ }
2097 ++ mutex_unlock(&userns_state_mutex);
2098 ++
2099 ++ /* Report a successful write */
2100 ++ *ppos = count;
2101 ++ ret = count;
2102 ++out:
2103 ++ return ret;
2104 ++out_unlock:
2105 ++ mutex_unlock(&userns_state_mutex);
2106 ++ goto out;
2107 ++}
2108 ++
2109 ++bool userns_may_setgroups(const struct user_namespace *ns)
2110 ++{
2111 ++ bool allowed;
2112 ++
2113 ++ mutex_lock(&userns_state_mutex);
2114 ++ /* It is not safe to use setgroups until a gid mapping in
2115 ++ * the user namespace has been established.
2116 ++ */
2117 ++ allowed = ns->gid_map.nr_extents != 0;
2118 ++ /* Is setgroups allowed? */
2119 ++ allowed = allowed && (ns->flags & USERNS_SETGROUPS_ALLOWED);
2120 ++ mutex_unlock(&userns_state_mutex);
2121 ++
2122 ++ return allowed;
2123 ++}
2124 ++
2125 + static void *userns_get(struct task_struct *task)
2126 + {
2127 + struct user_namespace *user_ns;
2128 +diff --git a/mm/frontswap.c b/mm/frontswap.c
2129 +index c30eec536f03..f2a3571c6e22 100644
2130 +--- a/mm/frontswap.c
2131 ++++ b/mm/frontswap.c
2132 +@@ -244,8 +244,10 @@ int __frontswap_store(struct page *page)
2133 + the (older) page from frontswap
2134 + */
2135 + inc_frontswap_failed_stores();
2136 +- if (dup)
2137 ++ if (dup) {
2138 + __frontswap_clear(sis, offset);
2139 ++ frontswap_ops->invalidate_page(type, offset);
2140 ++ }
2141 + }
2142 + if (frontswap_writethrough_enabled)
2143 + /* report failure so swap also writes to swap device */
2144 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
2145 +index e497843f5f65..04535b64119c 100644
2146 +--- a/mm/huge_memory.c
2147 ++++ b/mm/huge_memory.c
2148 +@@ -1541,15 +1541,22 @@ pmd_t *page_check_address_pmd(struct page *page,
2149 + unsigned long address,
2150 + enum page_check_address_pmd_flag flag)
2151 + {
2152 ++ pgd_t *pgd;
2153 ++ pud_t *pud;
2154 + pmd_t *pmd, *ret = NULL;
2155 +
2156 + if (address & ~HPAGE_PMD_MASK)
2157 + goto out;
2158 +
2159 +- pmd = mm_find_pmd(mm, address);
2160 +- if (!pmd)
2161 ++ pgd = pgd_offset(mm, address);
2162 ++ if (!pgd_present(*pgd))
2163 ++ goto out;
2164 ++ pud = pud_offset(pgd, address);
2165 ++ if (!pud_present(*pud))
2166 + goto out;
2167 +- if (pmd_none(*pmd))
2168 ++ pmd = pmd_offset(pud, address);
2169 ++
2170 ++ if (!pmd_present(*pmd))
2171 + goto out;
2172 + if (pmd_page(*pmd) != page)
2173 + goto out;
2174 +@@ -2408,8 +2415,6 @@ static void collapse_huge_page(struct mm_struct *mm,
2175 + pmd = mm_find_pmd(mm, address);
2176 + if (!pmd)
2177 + goto out;
2178 +- if (pmd_trans_huge(*pmd))
2179 +- goto out;
2180 +
2181 + anon_vma_lock_write(vma->anon_vma);
2182 +
2183 +@@ -2508,8 +2513,6 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
2184 + pmd = mm_find_pmd(mm, address);
2185 + if (!pmd)
2186 + goto out;
2187 +- if (pmd_trans_huge(*pmd))
2188 +- goto out;
2189 +
2190 + memset(khugepaged_node_load, 0, sizeof(khugepaged_node_load));
2191 + pte = pte_offset_map_lock(mm, pmd, address, &ptl);
2192 +@@ -2863,12 +2866,22 @@ void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address,
2193 + static void split_huge_page_address(struct mm_struct *mm,
2194 + unsigned long address)
2195 + {
2196 ++ pgd_t *pgd;
2197 ++ pud_t *pud;
2198 + pmd_t *pmd;
2199 +
2200 + VM_BUG_ON(!(address & ~HPAGE_PMD_MASK));
2201 +
2202 +- pmd = mm_find_pmd(mm, address);
2203 +- if (!pmd)
2204 ++ pgd = pgd_offset(mm, address);
2205 ++ if (!pgd_present(*pgd))
2206 ++ return;
2207 ++
2208 ++ pud = pud_offset(pgd, address);
2209 ++ if (!pud_present(*pud))
2210 ++ return;
2211 ++
2212 ++ pmd = pmd_offset(pud, address);
2213 ++ if (!pmd_present(*pmd))
2214 + return;
2215 + /*
2216 + * Caller holds the mmap_sem write mode, so a huge pmd cannot
2217 +diff --git a/mm/ksm.c b/mm/ksm.c
2218 +index c78fff1e9eae..29cbd06c4884 100644
2219 +--- a/mm/ksm.c
2220 ++++ b/mm/ksm.c
2221 +@@ -945,7 +945,6 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
2222 + pmd = mm_find_pmd(mm, addr);
2223 + if (!pmd)
2224 + goto out;
2225 +- BUG_ON(pmd_trans_huge(*pmd));
2226 +
2227 + mmun_start = addr;
2228 + mmun_end = addr + PAGE_SIZE;
2229 +diff --git a/mm/memory.c b/mm/memory.c
2230 +index b5901068495f..827a7ed7f5a2 100644
2231 +--- a/mm/memory.c
2232 ++++ b/mm/memory.c
2233 +@@ -808,20 +808,20 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
2234 + if (!pte_file(pte)) {
2235 + swp_entry_t entry = pte_to_swp_entry(pte);
2236 +
2237 +- if (swap_duplicate(entry) < 0)
2238 +- return entry.val;
2239 +-
2240 +- /* make sure dst_mm is on swapoff's mmlist. */
2241 +- if (unlikely(list_empty(&dst_mm->mmlist))) {
2242 +- spin_lock(&mmlist_lock);
2243 +- if (list_empty(&dst_mm->mmlist))
2244 +- list_add(&dst_mm->mmlist,
2245 +- &src_mm->mmlist);
2246 +- spin_unlock(&mmlist_lock);
2247 +- }
2248 +- if (likely(!non_swap_entry(entry)))
2249 ++ if (likely(!non_swap_entry(entry))) {
2250 ++ if (swap_duplicate(entry) < 0)
2251 ++ return entry.val;
2252 ++
2253 ++ /* make sure dst_mm is on swapoff's mmlist. */
2254 ++ if (unlikely(list_empty(&dst_mm->mmlist))) {
2255 ++ spin_lock(&mmlist_lock);
2256 ++ if (list_empty(&dst_mm->mmlist))
2257 ++ list_add(&dst_mm->mmlist,
2258 ++ &src_mm->mmlist);
2259 ++ spin_unlock(&mmlist_lock);
2260 ++ }
2261 + rss[MM_SWAPENTS]++;
2262 +- else if (is_migration_entry(entry)) {
2263 ++ } else if (is_migration_entry(entry)) {
2264 + page = migration_entry_to_page(entry);
2265 +
2266 + if (PageAnon(page))
2267 +diff --git a/mm/migrate.c b/mm/migrate.c
2268 +index d5c84b0a5243..fac5fa0813c4 100644
2269 +--- a/mm/migrate.c
2270 ++++ b/mm/migrate.c
2271 +@@ -136,8 +136,6 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
2272 + pmd = mm_find_pmd(mm, addr);
2273 + if (!pmd)
2274 + goto out;
2275 +- if (pmd_trans_huge(*pmd))
2276 +- goto out;
2277 +
2278 + ptep = pte_offset_map(pmd, addr);
2279 +
2280 +diff --git a/mm/mmap.c b/mm/mmap.c
2281 +index c1249cb7dc15..15e07d5a75cb 100644
2282 +--- a/mm/mmap.c
2283 ++++ b/mm/mmap.c
2284 +@@ -746,8 +746,11 @@ again: remove_next = 1 + (end > next->vm_end);
2285 + * shrinking vma had, to cover any anon pages imported.
2286 + */
2287 + if (exporter && exporter->anon_vma && !importer->anon_vma) {
2288 +- if (anon_vma_clone(importer, exporter))
2289 +- return -ENOMEM;
2290 ++ int error;
2291 ++
2292 ++ error = anon_vma_clone(importer, exporter);
2293 ++ if (error)
2294 ++ return error;
2295 + importer->anon_vma = exporter->anon_vma;
2296 + }
2297 + }
2298 +@@ -2419,7 +2422,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
2299 + if (err)
2300 + goto out_free_vma;
2301 +
2302 +- if (anon_vma_clone(new, vma))
2303 ++ err = anon_vma_clone(new, vma);
2304 ++ if (err)
2305 + goto out_free_mpol;
2306 +
2307 + if (new->vm_file)
2308 +diff --git a/mm/rmap.c b/mm/rmap.c
2309 +index 4271107aa46e..440c71c43b8d 100644
2310 +--- a/mm/rmap.c
2311 ++++ b/mm/rmap.c
2312 +@@ -274,6 +274,7 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma)
2313 + {
2314 + struct anon_vma_chain *avc;
2315 + struct anon_vma *anon_vma;
2316 ++ int error;
2317 +
2318 + /* Don't bother if the parent process has no anon_vma here. */
2319 + if (!pvma->anon_vma)
2320 +@@ -283,8 +284,9 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma)
2321 + * First, attach the new VMA to the parent VMA's anon_vmas,
2322 + * so rmap can find non-COWed pages in child processes.
2323 + */
2324 +- if (anon_vma_clone(vma, pvma))
2325 +- return -ENOMEM;
2326 ++ error = anon_vma_clone(vma, pvma);
2327 ++ if (error)
2328 ++ return error;
2329 +
2330 + /* Then add our own anon_vma. */
2331 + anon_vma = anon_vma_alloc();
2332 +@@ -569,6 +571,7 @@ pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address)
2333 + pgd_t *pgd;
2334 + pud_t *pud;
2335 + pmd_t *pmd = NULL;
2336 ++ pmd_t pmde;
2337 +
2338 + pgd = pgd_offset(mm, address);
2339 + if (!pgd_present(*pgd))
2340 +@@ -579,7 +582,13 @@ pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address)
2341 + goto out;
2342 +
2343 + pmd = pmd_offset(pud, address);
2344 +- if (!pmd_present(*pmd))
2345 ++ /*
2346 ++ * Some THP functions use the sequence pmdp_clear_flush(), set_pmd_at()
2347 ++ * without holding anon_vma lock for write. So when looking for a
2348 ++ * genuine pmde (in which to find pte), test present and !THP together.
2349 ++ */
2350 ++ pmde = ACCESS_ONCE(*pmd);
2351 ++ if (!pmd_present(pmde) || pmd_trans_huge(pmde))
2352 + pmd = NULL;
2353 + out:
2354 + return pmd;
2355 +@@ -615,9 +624,6 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm,
2356 + if (!pmd)
2357 + return NULL;
2358 +
2359 +- if (pmd_trans_huge(*pmd))
2360 +- return NULL;
2361 +-
2362 + pte = pte_offset_map(pmd, address);
2363 + /* Make a quick check before getting the lock */
2364 + if (!sync && !pte_present(*pte)) {
2365 +diff --git a/mm/vmpressure.c b/mm/vmpressure.c
2366 +index e0f62837c3f4..c98b14ee69d6 100644
2367 +--- a/mm/vmpressure.c
2368 ++++ b/mm/vmpressure.c
2369 +@@ -164,6 +164,7 @@ static void vmpressure_work_fn(struct work_struct *work)
2370 + unsigned long scanned;
2371 + unsigned long reclaimed;
2372 +
2373 ++ spin_lock(&vmpr->sr_lock);
2374 + /*
2375 + * Several contexts might be calling vmpressure(), so it is
2376 + * possible that the work was rescheduled again before the old
2377 +@@ -172,11 +173,12 @@ static void vmpressure_work_fn(struct work_struct *work)
2378 + * here. No need for any locks here since we don't care if
2379 + * vmpr->reclaimed is in sync.
2380 + */
2381 +- if (!vmpr->scanned)
2382 ++ scanned = vmpr->scanned;
2383 ++ if (!scanned) {
2384 ++ spin_unlock(&vmpr->sr_lock);
2385 + return;
2386 ++ }
2387 +
2388 +- spin_lock(&vmpr->sr_lock);
2389 +- scanned = vmpr->scanned;
2390 + reclaimed = vmpr->reclaimed;
2391 + vmpr->scanned = 0;
2392 + vmpr->reclaimed = 0;
2393 +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
2394 +index 93ad6c5b2d77..f3224755b328 100644
2395 +--- a/net/core/rtnetlink.c
2396 ++++ b/net/core/rtnetlink.c
2397 +@@ -1391,6 +1391,7 @@ static int do_setlink(const struct sk_buff *skb,
2398 + goto errout;
2399 + }
2400 + if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {
2401 ++ put_net(net);
2402 + err = -EPERM;
2403 + goto errout;
2404 + }
2405 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
2406 +index 88774ccb3dda..7d640f276e87 100644
2407 +--- a/net/ipv6/ip6_gre.c
2408 ++++ b/net/ipv6/ip6_gre.c
2409 +@@ -511,11 +511,11 @@ static int ip6gre_rcv(struct sk_buff *skb)
2410 +
2411 + skb->protocol = gre_proto;
2412 + /* WCCP version 1 and 2 protocol decoding.
2413 +- * - Change protocol to IP
2414 ++ * - Change protocol to IPv6
2415 + * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header
2416 + */
2417 + if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) {
2418 +- skb->protocol = htons(ETH_P_IP);
2419 ++ skb->protocol = htons(ETH_P_IPV6);
2420 + if ((*(h + offset) & 0xF0) != 0x40)
2421 + offset += 4;
2422 + }
2423 +diff --git a/net/mac80211/key.c b/net/mac80211/key.c
2424 +index 620677e897bd..23dfd244c892 100644
2425 +--- a/net/mac80211/key.c
2426 ++++ b/net/mac80211/key.c
2427 +@@ -615,7 +615,7 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
2428 + int i;
2429 +
2430 + mutex_lock(&local->key_mtx);
2431 +- for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
2432 ++ for (i = 0; i < ARRAY_SIZE(sta->gtk); i++) {
2433 + key = key_mtx_dereference(local, sta->gtk[i]);
2434 + if (!key)
2435 + continue;
2436 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
2437 +index 275cb85bfa31..ef3bdba9309e 100644
2438 +--- a/net/mac80211/rx.c
2439 ++++ b/net/mac80211/rx.c
2440 +@@ -1646,14 +1646,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
2441 + sc = le16_to_cpu(hdr->seq_ctrl);
2442 + frag = sc & IEEE80211_SCTL_FRAG;
2443 +
2444 +- if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
2445 +- goto out;
2446 +-
2447 + if (is_multicast_ether_addr(hdr->addr1)) {
2448 + rx->local->dot11MulticastReceivedFrameCount++;
2449 +- goto out;
2450 ++ goto out_no_led;
2451 + }
2452 +
2453 ++ if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
2454 ++ goto out;
2455 ++
2456 + I802_DEBUG_INC(rx->local->rx_handlers_fragments);
2457 +
2458 + if (skb_linearize(rx->skb))
2459 +@@ -1744,9 +1744,10 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
2460 + status->rx_flags |= IEEE80211_RX_FRAGMENTED;
2461 +
2462 + out:
2463 ++ ieee80211_led_rx(rx->local);
2464 ++ out_no_led:
2465 + if (rx->sta)
2466 + rx->sta->rx_packets++;
2467 +- ieee80211_led_rx(rx->local);
2468 + return RX_CONTINUE;
2469 + }
2470 +
2471 +diff --git a/net/sctp/output.c b/net/sctp/output.c
2472 +index 2a41465729ab..69faf79a48c6 100644
2473 +--- a/net/sctp/output.c
2474 ++++ b/net/sctp/output.c
2475 +@@ -403,12 +403,12 @@ int sctp_packet_transmit(struct sctp_packet *packet)
2476 + sk = chunk->skb->sk;
2477 +
2478 + /* Allocate the new skb. */
2479 +- nskb = alloc_skb(packet->size + LL_MAX_HEADER, GFP_ATOMIC);
2480 ++ nskb = alloc_skb(packet->size + MAX_HEADER, GFP_ATOMIC);
2481 + if (!nskb)
2482 + goto nomem;
2483 +
2484 + /* Make sure the outbound skb has enough header room reserved. */
2485 +- skb_reserve(nskb, packet->overhead + LL_MAX_HEADER);
2486 ++ skb_reserve(nskb, packet->overhead + MAX_HEADER);
2487 +
2488 + /* Set the owning socket so that we know where to get the
2489 + * destination IP address.
2490 +diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
2491 +index 9e1e005c7596..c4c8df4b214d 100644
2492 +--- a/security/keys/encrypted-keys/encrypted.c
2493 ++++ b/security/keys/encrypted-keys/encrypted.c
2494 +@@ -1018,10 +1018,13 @@ static int __init init_encrypted(void)
2495 + ret = encrypted_shash_alloc();
2496 + if (ret < 0)
2497 + return ret;
2498 ++ ret = aes_get_sizes();
2499 ++ if (ret < 0)
2500 ++ goto out;
2501 + ret = register_key_type(&key_type_encrypted);
2502 + if (ret < 0)
2503 + goto out;
2504 +- return aes_get_sizes();
2505 ++ return 0;
2506 + out:
2507 + encrypted_shash_release();
2508 + return ret;
2509 +diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
2510 +index 01338064260e..10dc0c8fbb87 100644
2511 +--- a/sound/pci/hda/patch_analog.c
2512 ++++ b/sound/pci/hda/patch_analog.c
2513 +@@ -316,6 +316,7 @@ static const struct hda_fixup ad1986a_fixups[] = {
2514 +
2515 + static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
2516 + SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
2517 ++ SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
2518 + SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
2519 + SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
2520 + SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
2521 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2522 +index 8be86358f640..09193457d0b0 100644
2523 +--- a/sound/pci/hda/patch_realtek.c
2524 ++++ b/sound/pci/hda/patch_realtek.c
2525 +@@ -4147,6 +4147,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2526 + SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
2527 + SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
2528 + SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
2529 ++ SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
2530 + SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
2531 + SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
2532 + SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
2533 +diff --git a/sound/usb/midi.c b/sound/usb/midi.c
2534 +index b901f468b67a..c7aa71ee775b 100644
2535 +--- a/sound/usb/midi.c
2536 ++++ b/sound/usb/midi.c
2537 +@@ -364,6 +364,8 @@ static void snd_usbmidi_error_timer(unsigned long data)
2538 + if (in && in->error_resubmit) {
2539 + in->error_resubmit = 0;
2540 + for (j = 0; j < INPUT_URBS; ++j) {
2541 ++ if (atomic_read(&in->urbs[j]->use_count))
2542 ++ continue;
2543 + in->urbs[j]->dev = umidi->dev;
2544 + snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC);
2545 + }
2546 +diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c
2547 +index 1b3ff2fda4d0..517785052f1c 100644
2548 +--- a/tools/testing/selftests/mount/unprivileged-remount-test.c
2549 ++++ b/tools/testing/selftests/mount/unprivileged-remount-test.c
2550 +@@ -6,6 +6,8 @@
2551 + #include <sys/types.h>
2552 + #include <sys/mount.h>
2553 + #include <sys/wait.h>
2554 ++#include <sys/vfs.h>
2555 ++#include <sys/statvfs.h>
2556 + #include <stdlib.h>
2557 + #include <unistd.h>
2558 + #include <fcntl.h>
2559 +@@ -32,11 +34,14 @@
2560 + # define CLONE_NEWPID 0x20000000
2561 + #endif
2562 +
2563 ++#ifndef MS_REC
2564 ++# define MS_REC 16384
2565 ++#endif
2566 + #ifndef MS_RELATIME
2567 +-#define MS_RELATIME (1 << 21)
2568 ++# define MS_RELATIME (1 << 21)
2569 + #endif
2570 + #ifndef MS_STRICTATIME
2571 +-#define MS_STRICTATIME (1 << 24)
2572 ++# define MS_STRICTATIME (1 << 24)
2573 + #endif
2574 +
2575 + static void die(char *fmt, ...)
2576 +@@ -48,17 +53,14 @@ static void die(char *fmt, ...)
2577 + exit(EXIT_FAILURE);
2578 + }
2579 +
2580 +-static void write_file(char *filename, char *fmt, ...)
2581 ++static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list ap)
2582 + {
2583 + char buf[4096];
2584 + int fd;
2585 + ssize_t written;
2586 + int buf_len;
2587 +- va_list ap;
2588 +
2589 +- va_start(ap, fmt);
2590 + buf_len = vsnprintf(buf, sizeof(buf), fmt, ap);
2591 +- va_end(ap);
2592 + if (buf_len < 0) {
2593 + die("vsnprintf failed: %s\n",
2594 + strerror(errno));
2595 +@@ -69,6 +71,8 @@ static void write_file(char *filename, char *fmt, ...)
2596 +
2597 + fd = open(filename, O_WRONLY);
2598 + if (fd < 0) {
2599 ++ if ((errno == ENOENT) && enoent_ok)
2600 ++ return;
2601 + die("open of %s failed: %s\n",
2602 + filename, strerror(errno));
2603 + }
2604 +@@ -87,6 +91,65 @@ static void write_file(char *filename, char *fmt, ...)
2605 + }
2606 + }
2607 +
2608 ++static void maybe_write_file(char *filename, char *fmt, ...)
2609 ++{
2610 ++ va_list ap;
2611 ++
2612 ++ va_start(ap, fmt);
2613 ++ vmaybe_write_file(true, filename, fmt, ap);
2614 ++ va_end(ap);
2615 ++
2616 ++}
2617 ++
2618 ++static void write_file(char *filename, char *fmt, ...)
2619 ++{
2620 ++ va_list ap;
2621 ++
2622 ++ va_start(ap, fmt);
2623 ++ vmaybe_write_file(false, filename, fmt, ap);
2624 ++ va_end(ap);
2625 ++
2626 ++}
2627 ++
2628 ++static int read_mnt_flags(const char *path)
2629 ++{
2630 ++ int ret;
2631 ++ struct statvfs stat;
2632 ++ int mnt_flags;
2633 ++
2634 ++ ret = statvfs(path, &stat);
2635 ++ if (ret != 0) {
2636 ++ die("statvfs of %s failed: %s\n",
2637 ++ path, strerror(errno));
2638 ++ }
2639 ++ if (stat.f_flag & ~(ST_RDONLY | ST_NOSUID | ST_NODEV | \
2640 ++ ST_NOEXEC | ST_NOATIME | ST_NODIRATIME | ST_RELATIME | \
2641 ++ ST_SYNCHRONOUS | ST_MANDLOCK)) {
2642 ++ die("Unrecognized mount flags\n");
2643 ++ }
2644 ++ mnt_flags = 0;
2645 ++ if (stat.f_flag & ST_RDONLY)
2646 ++ mnt_flags |= MS_RDONLY;
2647 ++ if (stat.f_flag & ST_NOSUID)
2648 ++ mnt_flags |= MS_NOSUID;
2649 ++ if (stat.f_flag & ST_NODEV)
2650 ++ mnt_flags |= MS_NODEV;
2651 ++ if (stat.f_flag & ST_NOEXEC)
2652 ++ mnt_flags |= MS_NOEXEC;
2653 ++ if (stat.f_flag & ST_NOATIME)
2654 ++ mnt_flags |= MS_NOATIME;
2655 ++ if (stat.f_flag & ST_NODIRATIME)
2656 ++ mnt_flags |= MS_NODIRATIME;
2657 ++ if (stat.f_flag & ST_RELATIME)
2658 ++ mnt_flags |= MS_RELATIME;
2659 ++ if (stat.f_flag & ST_SYNCHRONOUS)
2660 ++ mnt_flags |= MS_SYNCHRONOUS;
2661 ++ if (stat.f_flag & ST_MANDLOCK)
2662 ++ mnt_flags |= ST_MANDLOCK;
2663 ++
2664 ++ return mnt_flags;
2665 ++}
2666 ++
2667 + static void create_and_enter_userns(void)
2668 + {
2669 + uid_t uid;
2670 +@@ -100,13 +163,10 @@ static void create_and_enter_userns(void)
2671 + strerror(errno));
2672 + }
2673 +
2674 ++ maybe_write_file("/proc/self/setgroups", "deny");
2675 + write_file("/proc/self/uid_map", "0 %d 1", uid);
2676 + write_file("/proc/self/gid_map", "0 %d 1", gid);
2677 +
2678 +- if (setgroups(0, NULL) != 0) {
2679 +- die("setgroups failed: %s\n",
2680 +- strerror(errno));
2681 +- }
2682 + if (setgid(0) != 0) {
2683 + die ("setgid(0) failed %s\n",
2684 + strerror(errno));
2685 +@@ -118,7 +178,8 @@ static void create_and_enter_userns(void)
2686 + }
2687 +
2688 + static
2689 +-bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags)
2690 ++bool test_unpriv_remount(const char *fstype, const char *mount_options,
2691 ++ int mount_flags, int remount_flags, int invalid_flags)
2692 + {
2693 + pid_t child;
2694 +
2695 +@@ -151,9 +212,11 @@ bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags)
2696 + strerror(errno));
2697 + }
2698 +
2699 +- if (mount("testing", "/tmp", "ramfs", mount_flags, NULL) != 0) {
2700 +- die("mount of /tmp failed: %s\n",
2701 +- strerror(errno));
2702 ++ if (mount("testing", "/tmp", fstype, mount_flags, mount_options) != 0) {
2703 ++ die("mount of %s with options '%s' on /tmp failed: %s\n",
2704 ++ fstype,
2705 ++ mount_options? mount_options : "",
2706 ++ strerror(errno));
2707 + }
2708 +
2709 + create_and_enter_userns();
2710 +@@ -181,62 +244,127 @@ bool test_unpriv_remount(int mount_flags, int remount_flags, int invalid_flags)
2711 +
2712 + static bool test_unpriv_remount_simple(int mount_flags)
2713 + {
2714 +- return test_unpriv_remount(mount_flags, mount_flags, 0);
2715 ++ return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags, 0);
2716 + }
2717 +
2718 + static bool test_unpriv_remount_atime(int mount_flags, int invalid_flags)
2719 + {
2720 +- return test_unpriv_remount(mount_flags, mount_flags, invalid_flags);
2721 ++ return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags,
2722 ++ invalid_flags);
2723 ++}
2724 ++
2725 ++static bool test_priv_mount_unpriv_remount(void)
2726 ++{
2727 ++ pid_t child;
2728 ++ int ret;
2729 ++ const char *orig_path = "/dev";
2730 ++ const char *dest_path = "/tmp";
2731 ++ int orig_mnt_flags, remount_mnt_flags;
2732 ++
2733 ++ child = fork();
2734 ++ if (child == -1) {
2735 ++ die("fork failed: %s\n",
2736 ++ strerror(errno));
2737 ++ }
2738 ++ if (child != 0) { /* parent */
2739 ++ pid_t pid;
2740 ++ int status;
2741 ++ pid = waitpid(child, &status, 0);
2742 ++ if (pid == -1) {
2743 ++ die("waitpid failed: %s\n",
2744 ++ strerror(errno));
2745 ++ }
2746 ++ if (pid != child) {
2747 ++ die("waited for %d got %d\n",
2748 ++ child, pid);
2749 ++ }
2750 ++ if (!WIFEXITED(status)) {
2751 ++ die("child did not terminate cleanly\n");
2752 ++ }
2753 ++ return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false;
2754 ++ }
2755 ++
2756 ++ orig_mnt_flags = read_mnt_flags(orig_path);
2757 ++
2758 ++ create_and_enter_userns();
2759 ++ ret = unshare(CLONE_NEWNS);
2760 ++ if (ret != 0) {
2761 ++ die("unshare(CLONE_NEWNS) failed: %s\n",
2762 ++ strerror(errno));
2763 ++ }
2764 ++
2765 ++ ret = mount(orig_path, dest_path, "bind", MS_BIND | MS_REC, NULL);
2766 ++ if (ret != 0) {
2767 ++ die("recursive bind mount of %s onto %s failed: %s\n",
2768 ++ orig_path, dest_path, strerror(errno));
2769 ++ }
2770 ++
2771 ++ ret = mount(dest_path, dest_path, "none",
2772 ++ MS_REMOUNT | MS_BIND | orig_mnt_flags , NULL);
2773 ++ if (ret != 0) {
2774 ++ /* system("cat /proc/self/mounts"); */
2775 ++ die("remount of /tmp failed: %s\n",
2776 ++ strerror(errno));
2777 ++ }
2778 ++
2779 ++ remount_mnt_flags = read_mnt_flags(dest_path);
2780 ++ if (orig_mnt_flags != remount_mnt_flags) {
2781 ++ die("Mount flags unexpectedly changed during remount of %s originally mounted on %s\n",
2782 ++ dest_path, orig_path);
2783 ++ }
2784 ++ exit(EXIT_SUCCESS);
2785 + }
2786 +
2787 + int main(int argc, char **argv)
2788 + {
2789 +- if (!test_unpriv_remount_simple(MS_RDONLY|MS_NODEV)) {
2790 ++ if (!test_unpriv_remount_simple(MS_RDONLY)) {
2791 + die("MS_RDONLY malfunctions\n");
2792 + }
2793 +- if (!test_unpriv_remount_simple(MS_NODEV)) {
2794 ++ if (!test_unpriv_remount("devpts", "newinstance", MS_NODEV, MS_NODEV, 0)) {
2795 + die("MS_NODEV malfunctions\n");
2796 + }
2797 +- if (!test_unpriv_remount_simple(MS_NOSUID|MS_NODEV)) {
2798 ++ if (!test_unpriv_remount_simple(MS_NOSUID)) {
2799 + die("MS_NOSUID malfunctions\n");
2800 + }
2801 +- if (!test_unpriv_remount_simple(MS_NOEXEC|MS_NODEV)) {
2802 ++ if (!test_unpriv_remount_simple(MS_NOEXEC)) {
2803 + die("MS_NOEXEC malfunctions\n");
2804 + }
2805 +- if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODEV,
2806 +- MS_NOATIME|MS_NODEV))
2807 ++ if (!test_unpriv_remount_atime(MS_RELATIME,
2808 ++ MS_NOATIME))
2809 + {
2810 + die("MS_RELATIME malfunctions\n");
2811 + }
2812 +- if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODEV,
2813 +- MS_NOATIME|MS_NODEV))
2814 ++ if (!test_unpriv_remount_atime(MS_STRICTATIME,
2815 ++ MS_NOATIME))
2816 + {
2817 + die("MS_STRICTATIME malfunctions\n");
2818 + }
2819 +- if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODEV,
2820 +- MS_STRICTATIME|MS_NODEV))
2821 ++ if (!test_unpriv_remount_atime(MS_NOATIME,
2822 ++ MS_STRICTATIME))
2823 + {
2824 +- die("MS_RELATIME malfunctions\n");
2825 ++ die("MS_NOATIME malfunctions\n");
2826 + }
2827 +- if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODIRATIME|MS_NODEV,
2828 +- MS_NOATIME|MS_NODEV))
2829 ++ if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODIRATIME,
2830 ++ MS_NOATIME))
2831 + {
2832 +- die("MS_RELATIME malfunctions\n");
2833 ++ die("MS_RELATIME|MS_NODIRATIME malfunctions\n");
2834 + }
2835 +- if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODIRATIME|MS_NODEV,
2836 +- MS_NOATIME|MS_NODEV))
2837 ++ if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODIRATIME,
2838 ++ MS_NOATIME))
2839 + {
2840 +- die("MS_RELATIME malfunctions\n");
2841 ++ die("MS_STRICTATIME|MS_NODIRATIME malfunctions\n");
2842 + }
2843 +- if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODIRATIME|MS_NODEV,
2844 +- MS_STRICTATIME|MS_NODEV))
2845 ++ if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODIRATIME,
2846 ++ MS_STRICTATIME))
2847 + {
2848 +- die("MS_RELATIME malfunctions\n");
2849 ++ die("MS_NOATIME|MS_DIRATIME malfunctions\n");
2850 + }
2851 +- if (!test_unpriv_remount(MS_STRICTATIME|MS_NODEV, MS_NODEV,
2852 +- MS_NOATIME|MS_NODEV))
2853 ++ if (!test_unpriv_remount("ramfs", NULL, MS_STRICTATIME, 0, MS_NOATIME))
2854 + {
2855 + die("Default atime malfunctions\n");
2856 + }
2857 ++ if (!test_priv_mount_unpriv_remount()) {
2858 ++ die("Mount flags unexpectedly changed after remount\n");
2859 ++ }
2860 + return EXIT_SUCCESS;
2861 + }
2862
2863 diff --git a/1036_linux-3.12.37.patch b/1036_linux-3.12.37.patch
2864 new file mode 100644
2865 index 0000000..323665b
2866 --- /dev/null
2867 +++ b/1036_linux-3.12.37.patch
2868 @@ -0,0 +1,8810 @@
2869 +diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
2870 +index 789b8941a0c6..64c6734da6d8 100644
2871 +--- a/Documentation/kernel-parameters.txt
2872 ++++ b/Documentation/kernel-parameters.txt
2873 +@@ -1119,6 +1119,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2874 + i8042.notimeout [HW] Ignore timeout condition signalled by controller
2875 + i8042.reset [HW] Reset the controller during init and cleanup
2876 + i8042.unlock [HW] Unlock (ignore) the keylock
2877 ++ i8042.kbdreset [HW] Reset device connected to KBD port
2878 +
2879 + i810= [HW,DRM]
2880 +
2881 +diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt
2882 +index 69b3cac4749d..5d8675615e59 100644
2883 +--- a/Documentation/ramoops.txt
2884 ++++ b/Documentation/ramoops.txt
2885 +@@ -14,11 +14,19 @@ survive after a restart.
2886 +
2887 + 1. Ramoops concepts
2888 +
2889 +-Ramoops uses a predefined memory area to store the dump. The start and size of
2890 +-the memory area are set using two variables:
2891 ++Ramoops uses a predefined memory area to store the dump. The start and size
2892 ++and type of the memory area are set using three variables:
2893 + * "mem_address" for the start
2894 + * "mem_size" for the size. The memory size will be rounded down to a
2895 + power of two.
2896 ++ * "mem_type" to specifiy if the memory type (default is pgprot_writecombine).
2897 ++
2898 ++Typically the default value of mem_type=0 should be used as that sets the pstore
2899 ++mapping to pgprot_writecombine. Setting mem_type=1 attempts to use
2900 ++pgprot_noncached, which only works on some platforms. This is because pstore
2901 ++depends on atomic operations. At least on ARM, pgprot_noncached causes the
2902 ++memory to be mapped strongly ordered, and atomic operations on strongly ordered
2903 ++memory are implementation defined, and won't work on many ARMs such as omaps.
2904 +
2905 + The memory area is divided into "record_size" chunks (also rounded down to
2906 + power of two) and each oops/panic writes a "record_size" chunk of
2907 +@@ -55,6 +63,7 @@ Setting the ramoops parameters can be done in 2 different manners:
2908 + static struct ramoops_platform_data ramoops_data = {
2909 + .mem_size = <...>,
2910 + .mem_address = <...>,
2911 ++ .mem_type = <...>,
2912 + .record_size = <...>,
2913 + .dump_oops = <...>,
2914 + .ecc = <...>,
2915 +diff --git a/Makefile b/Makefile
2916 +index dfc8fa6f72d3..e3c56b405ffe 100644
2917 +--- a/Makefile
2918 ++++ b/Makefile
2919 +@@ -1,6 +1,6 @@
2920 + VERSION = 3
2921 + PATCHLEVEL = 12
2922 +-SUBLEVEL = 36
2923 ++SUBLEVEL = 37
2924 + EXTRAVERSION =
2925 + NAME = One Giant Leap for Frogkind
2926 +
2927 +diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
2928 +index de1611966d8b..cf3300a3071d 100644
2929 +--- a/arch/arm/boot/dts/imx25.dtsi
2930 ++++ b/arch/arm/boot/dts/imx25.dtsi
2931 +@@ -158,7 +158,7 @@
2932 + #size-cells = <0>;
2933 + compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
2934 + reg = <0x43fa4000 0x4000>;
2935 +- clocks = <&clks 62>, <&clks 62>;
2936 ++ clocks = <&clks 78>, <&clks 78>;
2937 + clock-names = "ipg", "per";
2938 + interrupts = <14>;
2939 + status = "disabled";
2940 +@@ -352,7 +352,7 @@
2941 + compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
2942 + #pwm-cells = <2>;
2943 + reg = <0x53fa0000 0x4000>;
2944 +- clocks = <&clks 106>, <&clks 36>;
2945 ++ clocks = <&clks 106>, <&clks 52>;
2946 + clock-names = "ipg", "per";
2947 + interrupts = <36>;
2948 + };
2949 +@@ -371,7 +371,7 @@
2950 + compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
2951 + #pwm-cells = <2>;
2952 + reg = <0x53fa8000 0x4000>;
2953 +- clocks = <&clks 107>, <&clks 36>;
2954 ++ clocks = <&clks 107>, <&clks 52>;
2955 + clock-names = "ipg", "per";
2956 + interrupts = <41>;
2957 + };
2958 +@@ -412,7 +412,7 @@
2959 + pwm4: pwm@53fc8000 {
2960 + compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
2961 + reg = <0x53fc8000 0x4000>;
2962 +- clocks = <&clks 108>, <&clks 36>;
2963 ++ clocks = <&clks 108>, <&clks 52>;
2964 + clock-names = "ipg", "per";
2965 + interrupts = <42>;
2966 + };
2967 +@@ -458,7 +458,7 @@
2968 + compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
2969 + #pwm-cells = <2>;
2970 + reg = <0x53fe0000 0x4000>;
2971 +- clocks = <&clks 105>, <&clks 36>;
2972 ++ clocks = <&clks 105>, <&clks 52>;
2973 + clock-names = "ipg", "per";
2974 + interrupts = <26>;
2975 + };
2976 +diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
2977 +index fe88105a0421..f8bca690569d 100644
2978 +--- a/arch/arm/configs/multi_v7_defconfig
2979 ++++ b/arch/arm/configs/multi_v7_defconfig
2980 +@@ -116,6 +116,7 @@ CONFIG_FB_SIMPLE=y
2981 + CONFIG_USB=y
2982 + CONFIG_USB_XHCI_HCD=y
2983 + CONFIG_USB_EHCI_HCD=y
2984 ++CONFIG_USB_EHCI_EXYNOS=y
2985 + CONFIG_USB_EHCI_TEGRA=y
2986 + CONFIG_USB_EHCI_HCD_PLATFORM=y
2987 + CONFIG_USB_ISP1760_HCD=y
2988 +diff --git a/arch/arm/crypto/aes_glue.c b/arch/arm/crypto/aes_glue.c
2989 +index 59f7877ead6a..e73ec2ab1316 100644
2990 +--- a/arch/arm/crypto/aes_glue.c
2991 ++++ b/arch/arm/crypto/aes_glue.c
2992 +@@ -103,6 +103,6 @@ module_exit(aes_fini);
2993 +
2994 + MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm (ASM)");
2995 + MODULE_LICENSE("GPL");
2996 +-MODULE_ALIAS("aes");
2997 +-MODULE_ALIAS("aes-asm");
2998 ++MODULE_ALIAS_CRYPTO("aes");
2999 ++MODULE_ALIAS_CRYPTO("aes-asm");
3000 + MODULE_AUTHOR("David McCullough <ucdevel@×××××.com>");
3001 +diff --git a/arch/arm/crypto/sha1_glue.c b/arch/arm/crypto/sha1_glue.c
3002 +index 76cd976230bc..ace4cd67464c 100644
3003 +--- a/arch/arm/crypto/sha1_glue.c
3004 ++++ b/arch/arm/crypto/sha1_glue.c
3005 +@@ -175,5 +175,5 @@ module_exit(sha1_mod_fini);
3006 +
3007 + MODULE_LICENSE("GPL");
3008 + MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (ARM)");
3009 +-MODULE_ALIAS("sha1");
3010 ++MODULE_ALIAS_CRYPTO("sha1");
3011 + MODULE_AUTHOR("David McCullough <ucdevel@×××××.com>");
3012 +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
3013 +index 2a767d262c17..6ebeaf45fc5d 100644
3014 +--- a/arch/arm/kernel/setup.c
3015 ++++ b/arch/arm/kernel/setup.c
3016 +@@ -1016,6 +1016,15 @@ static int c_show(struct seq_file *m, void *v)
3017 + seq_printf(m, "model name\t: %s rev %d (%s)\n",
3018 + cpu_name, cpuid & 15, elf_platform);
3019 +
3020 ++#if defined(CONFIG_SMP)
3021 ++ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
3022 ++ per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
3023 ++ (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
3024 ++#else
3025 ++ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
3026 ++ loops_per_jiffy / (500000/HZ),
3027 ++ (loops_per_jiffy / (5000/HZ)) % 100);
3028 ++#endif
3029 + /* dump out the processor features */
3030 + seq_puts(m, "Features\t: ");
3031 +
3032 +diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
3033 +index 72024ea8a3a6..bd1b9e633356 100644
3034 +--- a/arch/arm/kernel/smp.c
3035 ++++ b/arch/arm/kernel/smp.c
3036 +@@ -383,8 +383,17 @@ asmlinkage void secondary_start_kernel(void)
3037 +
3038 + void __init smp_cpus_done(unsigned int max_cpus)
3039 + {
3040 +- printk(KERN_INFO "SMP: Total of %d processors activated.\n",
3041 +- num_online_cpus());
3042 ++ int cpu;
3043 ++ unsigned long bogosum = 0;
3044 ++
3045 ++ for_each_online_cpu(cpu)
3046 ++ bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy;
3047 ++
3048 ++ printk(KERN_INFO "SMP: Total of %d processors activated "
3049 ++ "(%lu.%02lu BogoMIPS).\n",
3050 ++ num_online_cpus(),
3051 ++ bogosum / (500000/HZ),
3052 ++ (bogosum / (5000/HZ)) % 100);
3053 +
3054 + hyp_mode_check();
3055 + }
3056 +diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
3057 +index ef85ac49d9ac..2eed3cf8a36f 100644
3058 +--- a/arch/arm/mach-imx/clk-imx6q.c
3059 ++++ b/arch/arm/mach-imx/clk-imx6q.c
3060 +@@ -304,8 +304,8 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
3061 + post_div_table[1].div = 1;
3062 + post_div_table[2].div = 1;
3063 + video_div_table[1].div = 1;
3064 +- video_div_table[2].div = 1;
3065 +- };
3066 ++ video_div_table[3].div = 1;
3067 ++ }
3068 +
3069 + /* type name parent_name base div_mask */
3070 + clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
3071 +diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
3072 +index 58adf2fd9cfc..7e0529ba3bca 100644
3073 +--- a/arch/arm/mach-mvebu/coherency.c
3074 ++++ b/arch/arm/mach-mvebu/coherency.c
3075 +@@ -124,6 +124,29 @@ int __init coherency_init(void)
3076 + {
3077 + struct device_node *np;
3078 +
3079 ++ /*
3080 ++ * The coherency fabric is needed:
3081 ++ * - For coherency between processors on Armada XP, so only
3082 ++ * when SMP is enabled.
3083 ++ * - For coherency between the processor and I/O devices, but
3084 ++ * this coherency requires many pre-requisites (write
3085 ++ * allocate cache policy, shareable pages, SMP bit set) that
3086 ++ * are only meant in SMP situations.
3087 ++ *
3088 ++ * Note that this means that on Armada 370, there is currently
3089 ++ * no way to use hardware I/O coherency, because even when
3090 ++ * CONFIG_SMP is enabled, is_smp() returns false due to the
3091 ++ * Armada 370 being a single-core processor. To lift this
3092 ++ * limitation, we would have to find a way to make the cache
3093 ++ * policy set to write-allocate (on all Armada SoCs), and to
3094 ++ * set the shareable attribute in page tables (on all Armada
3095 ++ * SoCs except the Armada 370). Unfortunately, such decisions
3096 ++ * are taken very early in the kernel boot process, at a point
3097 ++ * where we don't know yet on which SoC we are running.
3098 ++ */
3099 ++ if (!is_smp())
3100 ++ return 0;
3101 ++
3102 + np = of_find_matching_node(NULL, of_coherency_table);
3103 + if (np) {
3104 + struct resource res;
3105 +@@ -150,6 +173,9 @@ static int __init coherency_late_init(void)
3106 + {
3107 + struct device_node *np;
3108 +
3109 ++ if (!is_smp())
3110 ++ return 0;
3111 ++
3112 + np = of_find_matching_node(NULL, of_coherency_table);
3113 + if (np) {
3114 + bus_register_notifier(&platform_bus_type,
3115 +diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
3116 +index 82f0698933d8..6be33ceb9853 100644
3117 +--- a/arch/arm/mach-omap2/pm44xx.c
3118 ++++ b/arch/arm/mach-omap2/pm44xx.c
3119 +@@ -146,26 +146,6 @@ static inline int omap4_init_static_deps(void)
3120 + struct clockdomain *ducati_clkdm, *l3_2_clkdm;
3121 + int ret = 0;
3122 +
3123 +- if (omap_rev() == OMAP4430_REV_ES1_0) {
3124 +- WARN(1, "Power Management not supported on OMAP4430 ES1.0\n");
3125 +- return -ENODEV;
3126 +- }
3127 +-
3128 +- pr_err("Power Management for TI OMAP4.\n");
3129 +- /*
3130 +- * OMAP4 chip PM currently works only with certain (newer)
3131 +- * versions of bootloaders. This is due to missing code in the
3132 +- * kernel to properly reset and initialize some devices.
3133 +- * http://www.spinics.net/lists/arm-kernel/msg218641.html
3134 +- */
3135 +- pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
3136 +-
3137 +- ret = pwrdm_for_each(pwrdms_setup, NULL);
3138 +- if (ret) {
3139 +- pr_err("Failed to setup powerdomains\n");
3140 +- return ret;
3141 +- }
3142 +-
3143 + /*
3144 + * The dynamic dependency between MPUSS -> MEMIF and
3145 + * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
3146 +@@ -216,6 +196,15 @@ int __init omap4_pm_init(void)
3147 +
3148 + pr_info("Power Management for TI OMAP4+ devices.\n");
3149 +
3150 ++ /*
3151 ++ * OMAP4 chip PM currently works only with certain (newer)
3152 ++ * versions of bootloaders. This is due to missing code in the
3153 ++ * kernel to properly reset and initialize some devices.
3154 ++ * http://www.spinics.net/lists/arm-kernel/msg218641.html
3155 ++ */
3156 ++ if (cpu_is_omap44xx())
3157 ++ pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
3158 ++
3159 + ret = pwrdm_for_each(pwrdms_setup, NULL);
3160 + if (ret) {
3161 + pr_err("Failed to setup powerdomains.\n");
3162 +diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
3163 +index ead48fa5715e..bf83df1a2db4 100644
3164 +--- a/arch/arm/mach-omap2/timer.c
3165 ++++ b/arch/arm/mach-omap2/timer.c
3166 +@@ -503,11 +503,11 @@ static void __init realtime_counter_init(void)
3167 + rate = clk_get_rate(sys_clk);
3168 + /* Numerator/denumerator values refer TRM Realtime Counter section */
3169 + switch (rate) {
3170 +- case 1200000:
3171 ++ case 12000000:
3172 + num = 64;
3173 + den = 125;
3174 + break;
3175 +- case 1300000:
3176 ++ case 13000000:
3177 + num = 768;
3178 + den = 1625;
3179 + break;
3180 +@@ -515,11 +515,11 @@ static void __init realtime_counter_init(void)
3181 + num = 8;
3182 + den = 25;
3183 + break;
3184 +- case 2600000:
3185 ++ case 26000000:
3186 + num = 384;
3187 + den = 1625;
3188 + break;
3189 +- case 2700000:
3190 ++ case 27000000:
3191 + num = 256;
3192 + den = 1125;
3193 + break;
3194 +diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
3195 +index 22de17417fd7..a10565d720c5 100644
3196 +--- a/arch/arm/mach-shmobile/setup-sh73a0.c
3197 ++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
3198 +@@ -746,6 +746,7 @@ static struct platform_device ipmmu_device = {
3199 +
3200 + static struct renesas_intc_irqpin_config irqpin0_platform_data = {
3201 + .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
3202 ++ .control_parent = true,
3203 + };
3204 +
3205 + static struct resource irqpin0_resources[] = {
3206 +@@ -807,6 +808,7 @@ static struct platform_device irqpin1_device = {
3207 +
3208 + static struct renesas_intc_irqpin_config irqpin2_platform_data = {
3209 + .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
3210 ++ .control_parent = true,
3211 + };
3212 +
3213 + static struct resource irqpin2_resources[] = {
3214 +@@ -837,6 +839,7 @@ static struct platform_device irqpin2_device = {
3215 +
3216 + static struct renesas_intc_irqpin_config irqpin3_platform_data = {
3217 + .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
3218 ++ .control_parent = true,
3219 + };
3220 +
3221 + static struct resource irqpin3_resources[] = {
3222 +diff --git a/arch/powerpc/crypto/sha1.c b/arch/powerpc/crypto/sha1.c
3223 +index f9e8b9491efc..b51da9132744 100644
3224 +--- a/arch/powerpc/crypto/sha1.c
3225 ++++ b/arch/powerpc/crypto/sha1.c
3226 +@@ -154,4 +154,5 @@ module_exit(sha1_powerpc_mod_fini);
3227 + MODULE_LICENSE("GPL");
3228 + MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm");
3229 +
3230 +-MODULE_ALIAS("sha1-powerpc");
3231 ++MODULE_ALIAS_CRYPTO("sha1");
3232 ++MODULE_ALIAS_CRYPTO("sha1-powerpc");
3233 +diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
3234 +index cb9c1740cee0..390e09872b77 100644
3235 +--- a/arch/powerpc/include/asm/reg.h
3236 ++++ b/arch/powerpc/include/asm/reg.h
3237 +@@ -116,6 +116,7 @@
3238 +
3239 + /* Server variant */
3240 + #define MSR_ (MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV)
3241 ++#define MSR_IDLE (MSR_ME | MSR_SF | MSR_HV)
3242 + #define MSR_KERNEL (MSR_ | MSR_64BIT)
3243 + #define MSR_USER32 (MSR_ | MSR_PR | MSR_EE)
3244 + #define MSR_USER64 (MSR_USER32 | MSR_64BIT)
3245 +diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S
3246 +index e11863f4e595..df930727f73b 100644
3247 +--- a/arch/powerpc/kernel/idle_power7.S
3248 ++++ b/arch/powerpc/kernel/idle_power7.S
3249 +@@ -84,6 +84,22 @@ _GLOBAL(power7_nap)
3250 + std r9,_MSR(r1)
3251 + std r1,PACAR1(r13)
3252 +
3253 ++ /*
3254 ++ * Go to real mode to do the nap, as required by the architecture.
3255 ++ * Also, we need to be in real mode before setting hwthread_state,
3256 ++ * because as soon as we do that, another thread can switch
3257 ++ * the MMU context to the guest.
3258 ++ */
3259 ++ LOAD_REG_IMMEDIATE(r5, MSR_IDLE)
3260 ++ li r6, MSR_RI
3261 ++ andc r6, r9, r6
3262 ++ LOAD_REG_ADDR(r7, power7_enter_nap_mode)
3263 ++ mtmsrd r6, 1 /* clear RI before setting SRR0/1 */
3264 ++ mtspr SPRN_SRR0, r7
3265 ++ mtspr SPRN_SRR1, r5
3266 ++ rfid
3267 ++
3268 ++power7_enter_nap_mode:
3269 + #ifdef CONFIG_KVM_BOOK3S_64_HV
3270 + /* Tell KVM we're napping */
3271 + li r4,KVM_HWTHREAD_IN_NAP
3272 +diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
3273 +index 75702e207b29..f7089fcfaa5d 100644
3274 +--- a/arch/powerpc/kernel/udbg_16550.c
3275 ++++ b/arch/powerpc/kernel/udbg_16550.c
3276 +@@ -69,8 +69,12 @@ static void udbg_uart_putc(char c)
3277 +
3278 + static int udbg_uart_getc_poll(void)
3279 + {
3280 +- if (!udbg_uart_in || !(udbg_uart_in(UART_LSR) & LSR_DR))
3281 ++ if (!udbg_uart_in)
3282 ++ return -1;
3283 ++
3284 ++ if (!(udbg_uart_in(UART_LSR) & LSR_DR))
3285 + return udbg_uart_in(UART_RBR);
3286 ++
3287 + return -1;
3288 + }
3289 +
3290 +diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
3291 +index 87ba7cf99cd7..65d633f20d37 100644
3292 +--- a/arch/powerpc/platforms/cell/spufs/inode.c
3293 ++++ b/arch/powerpc/platforms/cell/spufs/inode.c
3294 +@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentry *dir)
3295 + struct dentry *dentry, *tmp;
3296 +
3297 + mutex_lock(&dir->d_inode->i_mutex);
3298 +- list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
3299 ++ list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
3300 + spin_lock(&dentry->d_lock);
3301 + if (!(d_unhashed(dentry)) && dentry->d_inode) {
3302 + dget_dlock(dentry);
3303 +diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
3304 +index 2a245b55bb71..f8d9cb14adce 100644
3305 +--- a/arch/s390/crypto/aes_s390.c
3306 ++++ b/arch/s390/crypto/aes_s390.c
3307 +@@ -967,7 +967,7 @@ static void __exit aes_s390_fini(void)
3308 + module_init(aes_s390_init);
3309 + module_exit(aes_s390_fini);
3310 +
3311 +-MODULE_ALIAS("aes-all");
3312 ++MODULE_ALIAS_CRYPTO("aes-all");
3313 +
3314 + MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
3315 + MODULE_LICENSE("GPL");
3316 +diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
3317 +index 2d96e68febb2..a3e24d4d2530 100644
3318 +--- a/arch/s390/crypto/des_s390.c
3319 ++++ b/arch/s390/crypto/des_s390.c
3320 +@@ -616,8 +616,8 @@ static void __exit des_s390_exit(void)
3321 + module_init(des_s390_init);
3322 + module_exit(des_s390_exit);
3323 +
3324 +-MODULE_ALIAS("des");
3325 +-MODULE_ALIAS("des3_ede");
3326 ++MODULE_ALIAS_CRYPTO("des");
3327 ++MODULE_ALIAS_CRYPTO("des3_ede");
3328 +
3329 + MODULE_LICENSE("GPL");
3330 + MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms");
3331 +diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c
3332 +index d43485d142e9..7940dc90e80b 100644
3333 +--- a/arch/s390/crypto/ghash_s390.c
3334 ++++ b/arch/s390/crypto/ghash_s390.c
3335 +@@ -160,7 +160,7 @@ static void __exit ghash_mod_exit(void)
3336 + module_init(ghash_mod_init);
3337 + module_exit(ghash_mod_exit);
3338 +
3339 +-MODULE_ALIAS("ghash");
3340 ++MODULE_ALIAS_CRYPTO("ghash");
3341 +
3342 + MODULE_LICENSE("GPL");
3343 + MODULE_DESCRIPTION("GHASH Message Digest Algorithm, s390 implementation");
3344 +diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c
3345 +index a1b3a9dc9d8a..5b2bee323694 100644
3346 +--- a/arch/s390/crypto/sha1_s390.c
3347 ++++ b/arch/s390/crypto/sha1_s390.c
3348 +@@ -103,6 +103,6 @@ static void __exit sha1_s390_fini(void)
3349 + module_init(sha1_s390_init);
3350 + module_exit(sha1_s390_fini);
3351 +
3352 +-MODULE_ALIAS("sha1");
3353 ++MODULE_ALIAS_CRYPTO("sha1");
3354 + MODULE_LICENSE("GPL");
3355 + MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm");
3356 +diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
3357 +index 9b853809a492..b74ff158108c 100644
3358 +--- a/arch/s390/crypto/sha256_s390.c
3359 ++++ b/arch/s390/crypto/sha256_s390.c
3360 +@@ -143,7 +143,7 @@ static void __exit sha256_s390_fini(void)
3361 + module_init(sha256_s390_init);
3362 + module_exit(sha256_s390_fini);
3363 +
3364 +-MODULE_ALIAS("sha256");
3365 +-MODULE_ALIAS("sha224");
3366 ++MODULE_ALIAS_CRYPTO("sha256");
3367 ++MODULE_ALIAS_CRYPTO("sha224");
3368 + MODULE_LICENSE("GPL");
3369 + MODULE_DESCRIPTION("SHA256 and SHA224 Secure Hash Algorithm");
3370 +diff --git a/arch/s390/crypto/sha512_s390.c b/arch/s390/crypto/sha512_s390.c
3371 +index 32a81383b69c..0c36989ba182 100644
3372 +--- a/arch/s390/crypto/sha512_s390.c
3373 ++++ b/arch/s390/crypto/sha512_s390.c
3374 +@@ -86,7 +86,7 @@ static struct shash_alg sha512_alg = {
3375 + }
3376 + };
3377 +
3378 +-MODULE_ALIAS("sha512");
3379 ++MODULE_ALIAS_CRYPTO("sha512");
3380 +
3381 + static int sha384_init(struct shash_desc *desc)
3382 + {
3383 +@@ -126,7 +126,7 @@ static struct shash_alg sha384_alg = {
3384 + }
3385 + };
3386 +
3387 +-MODULE_ALIAS("sha384");
3388 ++MODULE_ALIAS_CRYPTO("sha384");
3389 +
3390 + static int __init init(void)
3391 + {
3392 +diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
3393 +index 503e6d96ad4e..ded4cee35318 100644
3394 +--- a/arch/sparc/crypto/aes_glue.c
3395 ++++ b/arch/sparc/crypto/aes_glue.c
3396 +@@ -499,6 +499,6 @@ module_exit(aes_sparc64_mod_fini);
3397 + MODULE_LICENSE("GPL");
3398 + MODULE_DESCRIPTION("AES Secure Hash Algorithm, sparc64 aes opcode accelerated");
3399 +
3400 +-MODULE_ALIAS("aes");
3401 ++MODULE_ALIAS_CRYPTO("aes");
3402 +
3403 + #include "crop_devid.c"
3404 +diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c
3405 +index 888f6260b4ec..641f55cb61c3 100644
3406 +--- a/arch/sparc/crypto/camellia_glue.c
3407 ++++ b/arch/sparc/crypto/camellia_glue.c
3408 +@@ -322,6 +322,6 @@ module_exit(camellia_sparc64_mod_fini);
3409 + MODULE_LICENSE("GPL");
3410 + MODULE_DESCRIPTION("Camellia Cipher Algorithm, sparc64 camellia opcode accelerated");
3411 +
3412 +-MODULE_ALIAS("aes");
3413 ++MODULE_ALIAS_CRYPTO("aes");
3414 +
3415 + #include "crop_devid.c"
3416 +diff --git a/arch/sparc/crypto/crc32c_glue.c b/arch/sparc/crypto/crc32c_glue.c
3417 +index 5162fad912ce..d1064e46efe8 100644
3418 +--- a/arch/sparc/crypto/crc32c_glue.c
3419 ++++ b/arch/sparc/crypto/crc32c_glue.c
3420 +@@ -176,6 +176,6 @@ module_exit(crc32c_sparc64_mod_fini);
3421 + MODULE_LICENSE("GPL");
3422 + MODULE_DESCRIPTION("CRC32c (Castagnoli), sparc64 crc32c opcode accelerated");
3423 +
3424 +-MODULE_ALIAS("crc32c");
3425 ++MODULE_ALIAS_CRYPTO("crc32c");
3426 +
3427 + #include "crop_devid.c"
3428 +diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c
3429 +index 3065bc61f9d3..d11500972994 100644
3430 +--- a/arch/sparc/crypto/des_glue.c
3431 ++++ b/arch/sparc/crypto/des_glue.c
3432 +@@ -532,6 +532,6 @@ module_exit(des_sparc64_mod_fini);
3433 + MODULE_LICENSE("GPL");
3434 + MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated");
3435 +
3436 +-MODULE_ALIAS("des");
3437 ++MODULE_ALIAS_CRYPTO("des");
3438 +
3439 + #include "crop_devid.c"
3440 +diff --git a/arch/sparc/crypto/md5_glue.c b/arch/sparc/crypto/md5_glue.c
3441 +index 09a9ea1dfb69..64c7ff5f72a9 100644
3442 +--- a/arch/sparc/crypto/md5_glue.c
3443 ++++ b/arch/sparc/crypto/md5_glue.c
3444 +@@ -185,6 +185,6 @@ module_exit(md5_sparc64_mod_fini);
3445 + MODULE_LICENSE("GPL");
3446 + MODULE_DESCRIPTION("MD5 Secure Hash Algorithm, sparc64 md5 opcode accelerated");
3447 +
3448 +-MODULE_ALIAS("md5");
3449 ++MODULE_ALIAS_CRYPTO("md5");
3450 +
3451 + #include "crop_devid.c"
3452 +diff --git a/arch/sparc/crypto/sha1_glue.c b/arch/sparc/crypto/sha1_glue.c
3453 +index 6cd5f29e1e0d..1b3e47accc74 100644
3454 +--- a/arch/sparc/crypto/sha1_glue.c
3455 ++++ b/arch/sparc/crypto/sha1_glue.c
3456 +@@ -180,6 +180,6 @@ module_exit(sha1_sparc64_mod_fini);
3457 + MODULE_LICENSE("GPL");
3458 + MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated");
3459 +
3460 +-MODULE_ALIAS("sha1");
3461 ++MODULE_ALIAS_CRYPTO("sha1");
3462 +
3463 + #include "crop_devid.c"
3464 +diff --git a/arch/sparc/crypto/sha256_glue.c b/arch/sparc/crypto/sha256_glue.c
3465 +index 04f555ab2680..41f27cca2a22 100644
3466 +--- a/arch/sparc/crypto/sha256_glue.c
3467 ++++ b/arch/sparc/crypto/sha256_glue.c
3468 +@@ -237,7 +237,7 @@ module_exit(sha256_sparc64_mod_fini);
3469 + MODULE_LICENSE("GPL");
3470 + MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm, sparc64 sha256 opcode accelerated");
3471 +
3472 +-MODULE_ALIAS("sha224");
3473 +-MODULE_ALIAS("sha256");
3474 ++MODULE_ALIAS_CRYPTO("sha224");
3475 ++MODULE_ALIAS_CRYPTO("sha256");
3476 +
3477 + #include "crop_devid.c"
3478 +diff --git a/arch/sparc/crypto/sha512_glue.c b/arch/sparc/crypto/sha512_glue.c
3479 +index f04d1994d19a..9fff88541b8c 100644
3480 +--- a/arch/sparc/crypto/sha512_glue.c
3481 ++++ b/arch/sparc/crypto/sha512_glue.c
3482 +@@ -222,7 +222,7 @@ module_exit(sha512_sparc64_mod_fini);
3483 + MODULE_LICENSE("GPL");
3484 + MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithm, sparc64 sha512 opcode accelerated");
3485 +
3486 +-MODULE_ALIAS("sha384");
3487 +-MODULE_ALIAS("sha512");
3488 ++MODULE_ALIAS_CRYPTO("sha384");
3489 ++MODULE_ALIAS_CRYPTO("sha512");
3490 +
3491 + #include "crop_devid.c"
3492 +diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
3493 +index 8ddea1f8006a..0228a6ab9b18 100644
3494 +--- a/arch/um/Kconfig.common
3495 ++++ b/arch/um/Kconfig.common
3496 +@@ -7,6 +7,7 @@ config UML
3497 + bool
3498 + default y
3499 + select HAVE_UID16
3500 ++ select HAVE_FUTEX_CMPXCHG if FUTEX
3501 + select GENERIC_IRQ_SHOW
3502 + select GENERIC_CPU_DEVICES
3503 + select GENERIC_IO
3504 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
3505 +index f968d8527190..5b5c6ea1a76c 100644
3506 +--- a/arch/x86/Kconfig
3507 ++++ b/arch/x86/Kconfig
3508 +@@ -861,7 +861,7 @@ source "kernel/Kconfig.preempt"
3509 +
3510 + config X86_UP_APIC
3511 + bool "Local APIC support on uniprocessors"
3512 +- depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI
3513 ++ depends on X86_32 && !SMP && !X86_32_NON_STANDARD
3514 + ---help---
3515 + A local APIC (Advanced Programmable Interrupt Controller) is an
3516 + integrated interrupt controller in the CPU. If you have a single-CPU
3517 +@@ -872,6 +872,10 @@ config X86_UP_APIC
3518 + performance counters), and the NMI watchdog which detects hard
3519 + lockups.
3520 +
3521 ++config X86_UP_APIC_MSI
3522 ++ def_bool y
3523 ++ select X86_UP_APIC if X86_32 && !SMP && !X86_32_NON_STANDARD && PCI_MSI
3524 ++
3525 + config X86_UP_IOAPIC
3526 + bool "IO-APIC support on uniprocessors"
3527 + depends on X86_UP_APIC
3528 +diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
3529 +index 434f077d2c4d..1b05afd8cd7f 100644
3530 +--- a/arch/x86/boot/compressed/misc.c
3531 ++++ b/arch/x86/boot/compressed/misc.c
3532 +@@ -401,6 +401,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
3533 + unsigned char *output,
3534 + unsigned long output_len)
3535 + {
3536 ++ unsigned char *output_orig = output;
3537 ++
3538 + real_mode = rmode;
3539 +
3540 + sanitize_boot_params(real_mode);
3541 +@@ -439,7 +441,12 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
3542 + debug_putstr("\nDecompressing Linux... ");
3543 + decompress(input_data, input_len, NULL, NULL, output, NULL, error);
3544 + parse_elf(output);
3545 +- handle_relocations(output, output_len);
3546 ++ /*
3547 ++ * 32-bit always performs relocations. 64-bit relocations are only
3548 ++ * needed if kASLR has chosen a different load address.
3549 ++ */
3550 ++ if (!IS_ENABLED(CONFIG_X86_64) || output != output_orig)
3551 ++ handle_relocations(output, output_len);
3552 + debug_putstr("done.\nBooting the kernel.\n");
3553 + return;
3554 + }
3555 +diff --git a/arch/x86/crypto/aes_glue.c b/arch/x86/crypto/aes_glue.c
3556 +index aafe8ce0d65d..e26984f7ab8d 100644
3557 +--- a/arch/x86/crypto/aes_glue.c
3558 ++++ b/arch/x86/crypto/aes_glue.c
3559 +@@ -66,5 +66,5 @@ module_exit(aes_fini);
3560 +
3561 + MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized");
3562 + MODULE_LICENSE("GPL");
3563 +-MODULE_ALIAS("aes");
3564 +-MODULE_ALIAS("aes-asm");
3565 ++MODULE_ALIAS_CRYPTO("aes");
3566 ++MODULE_ALIAS_CRYPTO("aes-asm");
3567 +diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
3568 +index f80e668785c0..f89e7490d303 100644
3569 +--- a/arch/x86/crypto/aesni-intel_glue.c
3570 ++++ b/arch/x86/crypto/aesni-intel_glue.c
3571 +@@ -1373,4 +1373,4 @@ module_exit(aesni_exit);
3572 +
3573 + MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, Intel AES-NI instructions optimized");
3574 + MODULE_LICENSE("GPL");
3575 +-MODULE_ALIAS("aes");
3576 ++MODULE_ALIAS_CRYPTO("aes");
3577 +diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
3578 +index 50ec333b70e6..1477cfcdbf6b 100644
3579 +--- a/arch/x86/crypto/blowfish_glue.c
3580 ++++ b/arch/x86/crypto/blowfish_glue.c
3581 +@@ -481,5 +481,5 @@ module_exit(fini);
3582 +
3583 + MODULE_LICENSE("GPL");
3584 + MODULE_DESCRIPTION("Blowfish Cipher Algorithm, asm optimized");
3585 +-MODULE_ALIAS("blowfish");
3586 +-MODULE_ALIAS("blowfish-asm");
3587 ++MODULE_ALIAS_CRYPTO("blowfish");
3588 ++MODULE_ALIAS_CRYPTO("blowfish-asm");
3589 +diff --git a/arch/x86/crypto/camellia_aesni_avx2_glue.c b/arch/x86/crypto/camellia_aesni_avx2_glue.c
3590 +index 414fe5d7946b..da710fcf8631 100644
3591 +--- a/arch/x86/crypto/camellia_aesni_avx2_glue.c
3592 ++++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c
3593 +@@ -582,5 +582,5 @@ module_exit(camellia_aesni_fini);
3594 +
3595 + MODULE_LICENSE("GPL");
3596 + MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX2 optimized");
3597 +-MODULE_ALIAS("camellia");
3598 +-MODULE_ALIAS("camellia-asm");
3599 ++MODULE_ALIAS_CRYPTO("camellia");
3600 ++MODULE_ALIAS_CRYPTO("camellia-asm");
3601 +diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c
3602 +index 37fd0c0a81ea..883e1af10dc5 100644
3603 +--- a/arch/x86/crypto/camellia_aesni_avx_glue.c
3604 ++++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
3605 +@@ -574,5 +574,5 @@ module_exit(camellia_aesni_fini);
3606 +
3607 + MODULE_LICENSE("GPL");
3608 + MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX optimized");
3609 +-MODULE_ALIAS("camellia");
3610 +-MODULE_ALIAS("camellia-asm");
3611 ++MODULE_ALIAS_CRYPTO("camellia");
3612 ++MODULE_ALIAS_CRYPTO("camellia-asm");
3613 +diff --git a/arch/x86/crypto/camellia_glue.c b/arch/x86/crypto/camellia_glue.c
3614 +index c171dcbf192d..5c8b6266a394 100644
3615 +--- a/arch/x86/crypto/camellia_glue.c
3616 ++++ b/arch/x86/crypto/camellia_glue.c
3617 +@@ -1725,5 +1725,5 @@ module_exit(fini);
3618 +
3619 + MODULE_LICENSE("GPL");
3620 + MODULE_DESCRIPTION("Camellia Cipher Algorithm, asm optimized");
3621 +-MODULE_ALIAS("camellia");
3622 +-MODULE_ALIAS("camellia-asm");
3623 ++MODULE_ALIAS_CRYPTO("camellia");
3624 ++MODULE_ALIAS_CRYPTO("camellia-asm");
3625 +diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c
3626 +index c6631813dc11..d416069e3184 100644
3627 +--- a/arch/x86/crypto/cast5_avx_glue.c
3628 ++++ b/arch/x86/crypto/cast5_avx_glue.c
3629 +@@ -494,4 +494,4 @@ module_exit(cast5_exit);
3630 +
3631 + MODULE_DESCRIPTION("Cast5 Cipher Algorithm, AVX optimized");
3632 + MODULE_LICENSE("GPL");
3633 +-MODULE_ALIAS("cast5");
3634 ++MODULE_ALIAS_CRYPTO("cast5");
3635 +diff --git a/arch/x86/crypto/cast6_avx_glue.c b/arch/x86/crypto/cast6_avx_glue.c
3636 +index 8d0dfb86a559..c19756265d4e 100644
3637 +--- a/arch/x86/crypto/cast6_avx_glue.c
3638 ++++ b/arch/x86/crypto/cast6_avx_glue.c
3639 +@@ -611,4 +611,4 @@ module_exit(cast6_exit);
3640 +
3641 + MODULE_DESCRIPTION("Cast6 Cipher Algorithm, AVX optimized");
3642 + MODULE_LICENSE("GPL");
3643 +-MODULE_ALIAS("cast6");
3644 ++MODULE_ALIAS_CRYPTO("cast6");
3645 +diff --git a/arch/x86/crypto/crc32-pclmul_glue.c b/arch/x86/crypto/crc32-pclmul_glue.c
3646 +index 9d014a74ef96..1937fc1d8763 100644
3647 +--- a/arch/x86/crypto/crc32-pclmul_glue.c
3648 ++++ b/arch/x86/crypto/crc32-pclmul_glue.c
3649 +@@ -197,5 +197,5 @@ module_exit(crc32_pclmul_mod_fini);
3650 + MODULE_AUTHOR("Alexander Boyko <alexander_boyko@×××××××.com>");
3651 + MODULE_LICENSE("GPL");
3652 +
3653 +-MODULE_ALIAS("crc32");
3654 +-MODULE_ALIAS("crc32-pclmul");
3655 ++MODULE_ALIAS_CRYPTO("crc32");
3656 ++MODULE_ALIAS_CRYPTO("crc32-pclmul");
3657 +diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c
3658 +index 6812ad98355c..28640c3d6af7 100644
3659 +--- a/arch/x86/crypto/crc32c-intel_glue.c
3660 ++++ b/arch/x86/crypto/crc32c-intel_glue.c
3661 +@@ -280,5 +280,5 @@ MODULE_AUTHOR("Austin Zhang <austin.zhang@×××××.com>, Kent Liu <kent.liu@intel.c
3662 + MODULE_DESCRIPTION("CRC32c (Castagnoli) optimization using Intel Hardware.");
3663 + MODULE_LICENSE("GPL");
3664 +
3665 +-MODULE_ALIAS("crc32c");
3666 +-MODULE_ALIAS("crc32c-intel");
3667 ++MODULE_ALIAS_CRYPTO("crc32c");
3668 ++MODULE_ALIAS_CRYPTO("crc32c-intel");
3669 +diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c
3670 +index 7845d7fd54c0..b6c67bf30fdf 100644
3671 +--- a/arch/x86/crypto/crct10dif-pclmul_glue.c
3672 ++++ b/arch/x86/crypto/crct10dif-pclmul_glue.c
3673 +@@ -147,5 +147,5 @@ MODULE_AUTHOR("Tim Chen <tim.c.chen@×××××××××××.com>");
3674 + MODULE_DESCRIPTION("T10 DIF CRC calculation accelerated with PCLMULQDQ.");
3675 + MODULE_LICENSE("GPL");
3676 +
3677 +-MODULE_ALIAS("crct10dif");
3678 +-MODULE_ALIAS("crct10dif-pclmul");
3679 ++MODULE_ALIAS_CRYPTO("crct10dif");
3680 ++MODULE_ALIAS_CRYPTO("crct10dif-pclmul");
3681 +diff --git a/arch/x86/crypto/fpu.c b/arch/x86/crypto/fpu.c
3682 +index 98d7a188f46b..f368ba261739 100644
3683 +--- a/arch/x86/crypto/fpu.c
3684 ++++ b/arch/x86/crypto/fpu.c
3685 +@@ -17,6 +17,7 @@
3686 + #include <linux/kernel.h>
3687 + #include <linux/module.h>
3688 + #include <linux/slab.h>
3689 ++#include <linux/crypto.h>
3690 + #include <asm/i387.h>
3691 +
3692 + struct crypto_fpu_ctx {
3693 +@@ -159,3 +160,5 @@ void __exit crypto_fpu_exit(void)
3694 + {
3695 + crypto_unregister_template(&crypto_fpu_tmpl);
3696 + }
3697 ++
3698 ++MODULE_ALIAS_CRYPTO("fpu");
3699 +diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c
3700 +index d785cf2c529c..a8d6f69f92a3 100644
3701 +--- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
3702 ++++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
3703 +@@ -341,4 +341,4 @@ module_exit(ghash_pclmulqdqni_mod_exit);
3704 + MODULE_LICENSE("GPL");
3705 + MODULE_DESCRIPTION("GHASH Message Digest Algorithm, "
3706 + "acclerated by PCLMULQDQ-NI");
3707 +-MODULE_ALIAS("ghash");
3708 ++MODULE_ALIAS_CRYPTO("ghash");
3709 +diff --git a/arch/x86/crypto/salsa20_glue.c b/arch/x86/crypto/salsa20_glue.c
3710 +index 5e8e67739bb5..399a29d067d6 100644
3711 +--- a/arch/x86/crypto/salsa20_glue.c
3712 ++++ b/arch/x86/crypto/salsa20_glue.c
3713 +@@ -119,5 +119,5 @@ module_exit(fini);
3714 +
3715 + MODULE_LICENSE("GPL");
3716 + MODULE_DESCRIPTION ("Salsa20 stream cipher algorithm (optimized assembly version)");
3717 +-MODULE_ALIAS("salsa20");
3718 +-MODULE_ALIAS("salsa20-asm");
3719 ++MODULE_ALIAS_CRYPTO("salsa20");
3720 ++MODULE_ALIAS_CRYPTO("salsa20-asm");
3721 +diff --git a/arch/x86/crypto/serpent_avx2_glue.c b/arch/x86/crypto/serpent_avx2_glue.c
3722 +index 23aabc6c20a5..cb57caf13ef7 100644
3723 +--- a/arch/x86/crypto/serpent_avx2_glue.c
3724 ++++ b/arch/x86/crypto/serpent_avx2_glue.c
3725 +@@ -558,5 +558,5 @@ module_exit(fini);
3726 +
3727 + MODULE_LICENSE("GPL");
3728 + MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX2 optimized");
3729 +-MODULE_ALIAS("serpent");
3730 +-MODULE_ALIAS("serpent-asm");
3731 ++MODULE_ALIAS_CRYPTO("serpent");
3732 ++MODULE_ALIAS_CRYPTO("serpent-asm");
3733 +diff --git a/arch/x86/crypto/serpent_avx_glue.c b/arch/x86/crypto/serpent_avx_glue.c
3734 +index 9ae83cf8d21e..0a86e8b65e60 100644
3735 +--- a/arch/x86/crypto/serpent_avx_glue.c
3736 ++++ b/arch/x86/crypto/serpent_avx_glue.c
3737 +@@ -617,4 +617,4 @@ module_exit(serpent_exit);
3738 +
3739 + MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX optimized");
3740 + MODULE_LICENSE("GPL");
3741 +-MODULE_ALIAS("serpent");
3742 ++MODULE_ALIAS_CRYPTO("serpent");
3743 +diff --git a/arch/x86/crypto/serpent_sse2_glue.c b/arch/x86/crypto/serpent_sse2_glue.c
3744 +index 97a356ece24d..279f3899c779 100644
3745 +--- a/arch/x86/crypto/serpent_sse2_glue.c
3746 ++++ b/arch/x86/crypto/serpent_sse2_glue.c
3747 +@@ -618,4 +618,4 @@ module_exit(serpent_sse2_exit);
3748 +
3749 + MODULE_DESCRIPTION("Serpent Cipher Algorithm, SSE2 optimized");
3750 + MODULE_LICENSE("GPL");
3751 +-MODULE_ALIAS("serpent");
3752 ++MODULE_ALIAS_CRYPTO("serpent");
3753 +diff --git a/arch/x86/crypto/sha1_ssse3_glue.c b/arch/x86/crypto/sha1_ssse3_glue.c
3754 +index 4a11a9d72451..29e1060e9001 100644
3755 +--- a/arch/x86/crypto/sha1_ssse3_glue.c
3756 ++++ b/arch/x86/crypto/sha1_ssse3_glue.c
3757 +@@ -237,4 +237,4 @@ module_exit(sha1_ssse3_mod_fini);
3758 + MODULE_LICENSE("GPL");
3759 + MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, Supplemental SSE3 accelerated");
3760 +
3761 +-MODULE_ALIAS("sha1");
3762 ++MODULE_ALIAS_CRYPTO("sha1");
3763 +diff --git a/arch/x86/crypto/sha256_ssse3_glue.c b/arch/x86/crypto/sha256_ssse3_glue.c
3764 +index e52947f80e68..4dc100d82902 100644
3765 +--- a/arch/x86/crypto/sha256_ssse3_glue.c
3766 ++++ b/arch/x86/crypto/sha256_ssse3_glue.c
3767 +@@ -318,5 +318,5 @@ module_exit(sha256_ssse3_mod_fini);
3768 + MODULE_LICENSE("GPL");
3769 + MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated");
3770 +
3771 +-MODULE_ALIAS("sha256");
3772 +-MODULE_ALIAS("sha384");
3773 ++MODULE_ALIAS_CRYPTO("sha256");
3774 ++MODULE_ALIAS_CRYPTO("sha224");
3775 +diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c
3776 +index 8626b03e83b7..26a5898a6f26 100644
3777 +--- a/arch/x86/crypto/sha512_ssse3_glue.c
3778 ++++ b/arch/x86/crypto/sha512_ssse3_glue.c
3779 +@@ -326,5 +326,5 @@ module_exit(sha512_ssse3_mod_fini);
3780 + MODULE_LICENSE("GPL");
3781 + MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, Supplemental SSE3 accelerated");
3782 +
3783 +-MODULE_ALIAS("sha512");
3784 +-MODULE_ALIAS("sha384");
3785 ++MODULE_ALIAS_CRYPTO("sha512");
3786 ++MODULE_ALIAS_CRYPTO("sha384");
3787 +diff --git a/arch/x86/crypto/twofish_avx_glue.c b/arch/x86/crypto/twofish_avx_glue.c
3788 +index a62ba541884e..c8c12c13d105 100644
3789 +--- a/arch/x86/crypto/twofish_avx_glue.c
3790 ++++ b/arch/x86/crypto/twofish_avx_glue.c
3791 +@@ -579,4 +579,4 @@ module_exit(twofish_exit);
3792 +
3793 + MODULE_DESCRIPTION("Twofish Cipher Algorithm, AVX optimized");
3794 + MODULE_LICENSE("GPL");
3795 +-MODULE_ALIAS("twofish");
3796 ++MODULE_ALIAS_CRYPTO("twofish");
3797 +diff --git a/arch/x86/crypto/twofish_glue.c b/arch/x86/crypto/twofish_glue.c
3798 +index 0a5202303501..77e06c2da83d 100644
3799 +--- a/arch/x86/crypto/twofish_glue.c
3800 ++++ b/arch/x86/crypto/twofish_glue.c
3801 +@@ -96,5 +96,5 @@ module_exit(fini);
3802 +
3803 + MODULE_LICENSE("GPL");
3804 + MODULE_DESCRIPTION ("Twofish Cipher Algorithm, asm optimized");
3805 +-MODULE_ALIAS("twofish");
3806 +-MODULE_ALIAS("twofish-asm");
3807 ++MODULE_ALIAS_CRYPTO("twofish");
3808 ++MODULE_ALIAS_CRYPTO("twofish-asm");
3809 +diff --git a/arch/x86/crypto/twofish_glue_3way.c b/arch/x86/crypto/twofish_glue_3way.c
3810 +index 13e63b3e1dfb..56d8a08ee479 100644
3811 +--- a/arch/x86/crypto/twofish_glue_3way.c
3812 ++++ b/arch/x86/crypto/twofish_glue_3way.c
3813 +@@ -495,5 +495,5 @@ module_exit(fini);
3814 +
3815 + MODULE_LICENSE("GPL");
3816 + MODULE_DESCRIPTION("Twofish Cipher Algorithm, 3-way parallel asm optimized");
3817 +-MODULE_ALIAS("twofish");
3818 +-MODULE_ALIAS("twofish-asm");
3819 ++MODULE_ALIAS_CRYPTO("twofish");
3820 ++MODULE_ALIAS_CRYPTO("twofish-asm");
3821 +diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
3822 +index b90e5dfeee46..f6aaf7d16571 100644
3823 +--- a/arch/x86/include/asm/desc.h
3824 ++++ b/arch/x86/include/asm/desc.h
3825 +@@ -251,7 +251,8 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
3826 + gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i];
3827 + }
3828 +
3829 +-#define _LDT_empty(info) \
3830 ++/* This intentionally ignores lm, since 32-bit apps don't have that field. */
3831 ++#define LDT_empty(info) \
3832 + ((info)->base_addr == 0 && \
3833 + (info)->limit == 0 && \
3834 + (info)->contents == 0 && \
3835 +@@ -261,11 +262,18 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
3836 + (info)->seg_not_present == 1 && \
3837 + (info)->useable == 0)
3838 +
3839 +-#ifdef CONFIG_X86_64
3840 +-#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
3841 +-#else
3842 +-#define LDT_empty(info) (_LDT_empty(info))
3843 +-#endif
3844 ++/* Lots of programs expect an all-zero user_desc to mean "no segment at all". */
3845 ++static inline bool LDT_zero(const struct user_desc *info)
3846 ++{
3847 ++ return (info->base_addr == 0 &&
3848 ++ info->limit == 0 &&
3849 ++ info->contents == 0 &&
3850 ++ info->read_exec_only == 0 &&
3851 ++ info->seg_32bit == 0 &&
3852 ++ info->limit_in_pages == 0 &&
3853 ++ info->seg_not_present == 0 &&
3854 ++ info->useable == 0);
3855 ++}
3856 +
3857 + static inline void clear_LDT(void)
3858 + {
3859 +diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
3860 +index 2a46ca720afc..2874be9aef0a 100644
3861 +--- a/arch/x86/include/asm/vsyscall.h
3862 ++++ b/arch/x86/include/asm/vsyscall.h
3863 +@@ -34,7 +34,7 @@ static inline unsigned int __getcpu(void)
3864 + native_read_tscp(&p);
3865 + } else {
3866 + /* Load per CPU data from GDT */
3867 +- asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
3868 ++ asm volatile ("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
3869 + }
3870 +
3871 + return p;
3872 +diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
3873 +index 71a39f3621ba..647480716ff1 100644
3874 +--- a/arch/x86/kernel/cpu/mshyperv.c
3875 ++++ b/arch/x86/kernel/cpu/mshyperv.c
3876 +@@ -63,6 +63,7 @@ static struct clocksource hyperv_cs = {
3877 + .rating = 400, /* use this when running on Hyperv*/
3878 + .read = read_hv_clock,
3879 + .mask = CLOCKSOURCE_MASK(64),
3880 ++ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
3881 + };
3882 +
3883 + static void __init ms_hyperv_init_platform(void)
3884 +diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
3885 +index 4118f9f68315..3e1cfbb5a6cf 100644
3886 +--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
3887 ++++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
3888 +@@ -2764,6 +2764,17 @@ static struct intel_uncore_box *uncore_event_to_box(struct perf_event *event)
3889 + return uncore_pmu_to_box(uncore_event_to_pmu(event), smp_processor_id());
3890 + }
3891 +
3892 ++/*
3893 ++ * Using uncore_pmu_event_init pmu event_init callback
3894 ++ * as a detection point for uncore events.
3895 ++ */
3896 ++static int uncore_pmu_event_init(struct perf_event *event);
3897 ++
3898 ++static bool is_uncore_event(struct perf_event *event)
3899 ++{
3900 ++ return event->pmu->event_init == uncore_pmu_event_init;
3901 ++}
3902 ++
3903 + static int
3904 + uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, bool dogrp)
3905 + {
3906 +@@ -2778,13 +2789,18 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, b
3907 + return -EINVAL;
3908 +
3909 + n = box->n_events;
3910 +- box->event_list[n] = leader;
3911 +- n++;
3912 ++
3913 ++ if (is_uncore_event(leader)) {
3914 ++ box->event_list[n] = leader;
3915 ++ n++;
3916 ++ }
3917 ++
3918 + if (!dogrp)
3919 + return n;
3920 +
3921 + list_for_each_entry(event, &leader->sibling_list, group_entry) {
3922 +- if (event->state <= PERF_EVENT_STATE_OFF)
3923 ++ if (!is_uncore_event(event) ||
3924 ++ event->state <= PERF_EVENT_STATE_OFF)
3925 + continue;
3926 +
3927 + if (n >= max_count)
3928 +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
3929 +index 79a3f9682871..a1f5b1866cbe 100644
3930 +--- a/arch/x86/kernel/kprobes/core.c
3931 ++++ b/arch/x86/kernel/kprobes/core.c
3932 +@@ -1017,6 +1017,15 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
3933 + regs->flags &= ~X86_EFLAGS_IF;
3934 + trace_hardirqs_off();
3935 + regs->ip = (unsigned long)(jp->entry);
3936 ++
3937 ++ /*
3938 ++ * jprobes use jprobe_return() which skips the normal return
3939 ++ * path of the function, and this messes up the accounting of the
3940 ++ * function graph tracer to get messed up.
3941 ++ *
3942 ++ * Pause function graph tracing while performing the jprobe function.
3943 ++ */
3944 ++ pause_graph_tracing();
3945 + return 1;
3946 + }
3947 +
3948 +@@ -1042,24 +1051,25 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
3949 + struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
3950 + u8 *addr = (u8 *) (regs->ip - 1);
3951 + struct jprobe *jp = container_of(p, struct jprobe, kp);
3952 ++ void *saved_sp = kcb->jprobe_saved_sp;
3953 +
3954 + if ((addr > (u8 *) jprobe_return) &&
3955 + (addr < (u8 *) jprobe_return_end)) {
3956 +- if (stack_addr(regs) != kcb->jprobe_saved_sp) {
3957 ++ if (stack_addr(regs) != saved_sp) {
3958 + struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
3959 + printk(KERN_ERR
3960 + "current sp %p does not match saved sp %p\n",
3961 +- stack_addr(regs), kcb->jprobe_saved_sp);
3962 ++ stack_addr(regs), saved_sp);
3963 + printk(KERN_ERR "Saved registers for jprobe %p\n", jp);
3964 + show_regs(saved_regs);
3965 + printk(KERN_ERR "Current registers\n");
3966 + show_regs(regs);
3967 + BUG();
3968 + }
3969 ++ /* It's OK to start function graph tracing again */
3970 ++ unpause_graph_tracing();
3971 + *regs = kcb->jprobe_saved_regs;
3972 +- memcpy((kprobe_opcode_t *)(kcb->jprobe_saved_sp),
3973 +- kcb->jprobes_stack,
3974 +- MIN_STACK_SIZE(kcb->jprobe_saved_sp));
3975 ++ memcpy(saved_sp, kcb->jprobes_stack, MIN_STACK_SIZE(saved_sp));
3976 + preempt_enable_no_resched();
3977 + return 1;
3978 + }
3979 +diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
3980 +index 4e942f31b1a7..7fc5e843f247 100644
3981 +--- a/arch/x86/kernel/tls.c
3982 ++++ b/arch/x86/kernel/tls.c
3983 +@@ -29,7 +29,28 @@ static int get_free_idx(void)
3984 +
3985 + static bool tls_desc_okay(const struct user_desc *info)
3986 + {
3987 +- if (LDT_empty(info))
3988 ++ /*
3989 ++ * For historical reasons (i.e. no one ever documented how any
3990 ++ * of the segmentation APIs work), user programs can and do
3991 ++ * assume that a struct user_desc that's all zeros except for
3992 ++ * entry_number means "no segment at all". This never actually
3993 ++ * worked. In fact, up to Linux 3.19, a struct user_desc like
3994 ++ * this would create a 16-bit read-write segment with base and
3995 ++ * limit both equal to zero.
3996 ++ *
3997 ++ * That was close enough to "no segment at all" until we
3998 ++ * hardened this function to disallow 16-bit TLS segments. Fix
3999 ++ * it up by interpreting these zeroed segments the way that they
4000 ++ * were almost certainly intended to be interpreted.
4001 ++ *
4002 ++ * The correct way to ask for "no segment at all" is to specify
4003 ++ * a user_desc that satisfies LDT_empty. To keep everything
4004 ++ * working, we accept both.
4005 ++ *
4006 ++ * Note that there's a similar kludge in modify_ldt -- look at
4007 ++ * the distinction between modes 1 and 0x11.
4008 ++ */
4009 ++ if (LDT_empty(info) || LDT_zero(info))
4010 + return true;
4011 +
4012 + /*
4013 +@@ -71,7 +92,7 @@ static void set_tls_desc(struct task_struct *p, int idx,
4014 + cpu = get_cpu();
4015 +
4016 + while (n-- > 0) {
4017 +- if (LDT_empty(info))
4018 ++ if (LDT_empty(info) || LDT_zero(info))
4019 + desc->a = desc->b = 0;
4020 + else
4021 + fill_ldt(desc, info);
4022 +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
4023 +index 5739ab5359a3..88f3d3b86802 100644
4024 +--- a/arch/x86/kernel/traps.c
4025 ++++ b/arch/x86/kernel/traps.c
4026 +@@ -369,7 +369,7 @@ exit:
4027 + * for scheduling or signal handling. The actual stack switch is done in
4028 + * entry.S
4029 + */
4030 +-asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
4031 ++asmlinkage notrace __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
4032 + {
4033 + struct pt_regs *regs = eregs;
4034 + /* Did already sync */
4035 +@@ -394,7 +394,7 @@ struct bad_iret_stack {
4036 + struct pt_regs regs;
4037 + };
4038 +
4039 +-asmlinkage __visible
4040 ++asmlinkage __visible notrace __kprobes
4041 + struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
4042 + {
4043 + /*
4044 +diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
4045 +index a7fef605b1c0..cefe57ce4ebd 100644
4046 +--- a/arch/x86/kernel/tsc.c
4047 ++++ b/arch/x86/kernel/tsc.c
4048 +@@ -386,7 +386,7 @@ static unsigned long quick_pit_calibrate(void)
4049 + goto success;
4050 + }
4051 + }
4052 +- pr_err("Fast TSC calibration failed\n");
4053 ++ pr_info("Fast TSC calibration failed\n");
4054 + return 0;
4055 +
4056 + success:
4057 +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
4058 +index 073b39d13696..8ad01b4e60cc 100644
4059 +--- a/arch/x86/kvm/mmu.c
4060 ++++ b/arch/x86/kvm/mmu.c
4061 +@@ -4429,7 +4429,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm)
4062 + * zap all shadow pages.
4063 + */
4064 + if (unlikely(kvm_current_mmio_generation(kvm) == 0)) {
4065 +- printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n");
4066 ++ printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n");
4067 + kvm_mmu_invalidate_zap_all_pages(kvm);
4068 + }
4069 + }
4070 +diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c
4071 +index 531d4269e2e3..bd16d6c370ec 100644
4072 +--- a/arch/x86/um/sys_call_table_32.c
4073 ++++ b/arch/x86/um/sys_call_table_32.c
4074 +@@ -34,7 +34,7 @@ typedef asmlinkage void (*sys_call_ptr_t)(void);
4075 +
4076 + extern asmlinkage void sys_ni_syscall(void);
4077 +
4078 +-const sys_call_ptr_t sys_call_table[] __cacheline_aligned = {
4079 ++const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
4080 + /*
4081 + * Smells like a compiler bug -- it doesn't work
4082 + * when the & below is removed.
4083 +diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c
4084 +index f2f0723070ca..95783087f0d3 100644
4085 +--- a/arch/x86/um/sys_call_table_64.c
4086 ++++ b/arch/x86/um/sys_call_table_64.c
4087 +@@ -46,7 +46,7 @@ typedef void (*sys_call_ptr_t)(void);
4088 +
4089 + extern void sys_ni_syscall(void);
4090 +
4091 +-const sys_call_ptr_t sys_call_table[] __cacheline_aligned = {
4092 ++const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
4093 + /*
4094 + * Smells like a compiler bug -- it doesn't work
4095 + * when the & below is removed.
4096 +diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
4097 +index 431e87544411..ab6ba35a9357 100644
4098 +--- a/arch/x86/vdso/vma.c
4099 ++++ b/arch/x86/vdso/vma.c
4100 +@@ -117,30 +117,45 @@ subsys_initcall(init_vdso);
4101 +
4102 + struct linux_binprm;
4103 +
4104 +-/* Put the vdso above the (randomized) stack with another randomized offset.
4105 +- This way there is no hole in the middle of address space.
4106 +- To save memory make sure it is still in the same PTE as the stack top.
4107 +- This doesn't give that many random bits */
4108 ++/*
4109 ++ * Put the vdso above the (randomized) stack with another randomized
4110 ++ * offset. This way there is no hole in the middle of address space.
4111 ++ * To save memory make sure it is still in the same PTE as the stack
4112 ++ * top. This doesn't give that many random bits.
4113 ++ *
4114 ++ * Note that this algorithm is imperfect: the distribution of the vdso
4115 ++ * start address within a PMD is biased toward the end.
4116 ++ *
4117 ++ * Only used for the 64-bit and x32 vdsos.
4118 ++ */
4119 + static unsigned long vdso_addr(unsigned long start, unsigned len)
4120 + {
4121 + unsigned long addr, end;
4122 + unsigned offset;
4123 +- end = (start + PMD_SIZE - 1) & PMD_MASK;
4124 ++
4125 ++ /*
4126 ++ * Round up the start address. It can start out unaligned as a result
4127 ++ * of stack start randomization.
4128 ++ */
4129 ++ start = PAGE_ALIGN(start);
4130 ++
4131 ++ /* Round the lowest possible end address up to a PMD boundary. */
4132 ++ end = (start + len + PMD_SIZE - 1) & PMD_MASK;
4133 + if (end >= TASK_SIZE_MAX)
4134 + end = TASK_SIZE_MAX;
4135 + end -= len;
4136 +- /* This loses some more bits than a modulo, but is cheaper */
4137 +- offset = get_random_int() & (PTRS_PER_PTE - 1);
4138 +- addr = start + (offset << PAGE_SHIFT);
4139 +- if (addr >= end)
4140 +- addr = end;
4141 ++
4142 ++ if (end > start) {
4143 ++ offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1);
4144 ++ addr = start + (offset << PAGE_SHIFT);
4145 ++ } else {
4146 ++ addr = start;
4147 ++ }
4148 +
4149 + /*
4150 +- * page-align it here so that get_unmapped_area doesn't
4151 +- * align it wrongfully again to the next page. addr can come in 4K
4152 +- * unaligned here as a result of stack start randomization.
4153 ++ * Forcibly align the final address in case we have a hardware
4154 ++ * issue that requires alignment for performance reasons.
4155 + */
4156 +- addr = PAGE_ALIGN(addr);
4157 + addr = align_vdso_addr(addr);
4158 +
4159 + return addr;
4160 +diff --git a/block/genhd.c b/block/genhd.c
4161 +index e6723bd4d7a1..a8d586a729bb 100644
4162 +--- a/block/genhd.c
4163 ++++ b/block/genhd.c
4164 +@@ -1070,9 +1070,16 @@ int disk_expand_part_tbl(struct gendisk *disk, int partno)
4165 + struct disk_part_tbl *old_ptbl = disk->part_tbl;
4166 + struct disk_part_tbl *new_ptbl;
4167 + int len = old_ptbl ? old_ptbl->len : 0;
4168 +- int target = partno + 1;
4169 ++ int i, target;
4170 + size_t size;
4171 +- int i;
4172 ++
4173 ++ /*
4174 ++ * check for int overflow, since we can get here from blkpg_ioctl()
4175 ++ * with a user passed 'partno'.
4176 ++ */
4177 ++ target = partno + 1;
4178 ++ if (target < 0)
4179 ++ return -EINVAL;
4180 +
4181 + /* disk_max_parts() is zero during initialization, ignore if so */
4182 + if (disk_max_parts(disk) && target > disk_max_parts(disk))
4183 +diff --git a/crypto/842.c b/crypto/842.c
4184 +index 65c7a89cfa09..b48f4f108c47 100644
4185 +--- a/crypto/842.c
4186 ++++ b/crypto/842.c
4187 +@@ -180,3 +180,4 @@ module_exit(nx842_mod_exit);
4188 +
4189 + MODULE_LICENSE("GPL");
4190 + MODULE_DESCRIPTION("842 Compression Algorithm");
4191 ++MODULE_ALIAS_CRYPTO("842");
4192 +diff --git a/crypto/aes_generic.c b/crypto/aes_generic.c
4193 +index fd0d6b454975..3dd101144a58 100644
4194 +--- a/crypto/aes_generic.c
4195 ++++ b/crypto/aes_generic.c
4196 +@@ -1474,4 +1474,5 @@ module_exit(aes_fini);
4197 +
4198 + MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
4199 + MODULE_LICENSE("Dual BSD/GPL");
4200 +-MODULE_ALIAS("aes");
4201 ++MODULE_ALIAS_CRYPTO("aes");
4202 ++MODULE_ALIAS_CRYPTO("aes-generic");
4203 +diff --git a/crypto/algapi.c b/crypto/algapi.c
4204 +index 7a1ae87f1683..00d8d939733b 100644
4205 +--- a/crypto/algapi.c
4206 ++++ b/crypto/algapi.c
4207 +@@ -495,8 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)
4208 +
4209 + struct crypto_template *crypto_lookup_template(const char *name)
4210 + {
4211 +- return try_then_request_module(__crypto_lookup_template(name), "%s",
4212 +- name);
4213 ++ return try_then_request_module(__crypto_lookup_template(name),
4214 ++ "crypto-%s", name);
4215 + }
4216 + EXPORT_SYMBOL_GPL(crypto_lookup_template);
4217 +
4218 +diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
4219 +index 666f1962a160..6f5bebc9bf01 100644
4220 +--- a/crypto/ansi_cprng.c
4221 ++++ b/crypto/ansi_cprng.c
4222 +@@ -476,4 +476,5 @@ module_param(dbg, int, 0);
4223 + MODULE_PARM_DESC(dbg, "Boolean to enable debugging (0/1 == off/on)");
4224 + module_init(prng_mod_init);
4225 + module_exit(prng_mod_fini);
4226 +-MODULE_ALIAS("stdrng");
4227 ++MODULE_ALIAS_CRYPTO("stdrng");
4228 ++MODULE_ALIAS_CRYPTO("ansi_cprng");
4229 +diff --git a/crypto/anubis.c b/crypto/anubis.c
4230 +index 008c8a4fb67c..4bb187c2a902 100644
4231 +--- a/crypto/anubis.c
4232 ++++ b/crypto/anubis.c
4233 +@@ -704,3 +704,4 @@ module_exit(anubis_mod_fini);
4234 +
4235 + MODULE_LICENSE("GPL");
4236 + MODULE_DESCRIPTION("Anubis Cryptographic Algorithm");
4237 ++MODULE_ALIAS_CRYPTO("anubis");
4238 +diff --git a/crypto/api.c b/crypto/api.c
4239 +index a2b39c5f3649..2a81e98a0021 100644
4240 +--- a/crypto/api.c
4241 ++++ b/crypto/api.c
4242 +@@ -216,11 +216,11 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
4243 +
4244 + alg = crypto_alg_lookup(name, type, mask);
4245 + if (!alg) {
4246 +- request_module("%s", name);
4247 ++ request_module("crypto-%s", name);
4248 +
4249 + if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
4250 + CRYPTO_ALG_NEED_FALLBACK))
4251 +- request_module("%s-all", name);
4252 ++ request_module("crypto-%s-all", name);
4253 +
4254 + alg = crypto_alg_lookup(name, type, mask);
4255 + }
4256 +diff --git a/crypto/arc4.c b/crypto/arc4.c
4257 +index 5a772c3657d5..f1a81925558f 100644
4258 +--- a/crypto/arc4.c
4259 ++++ b/crypto/arc4.c
4260 +@@ -166,3 +166,4 @@ module_exit(arc4_exit);
4261 + MODULE_LICENSE("GPL");
4262 + MODULE_DESCRIPTION("ARC4 Cipher Algorithm");
4263 + MODULE_AUTHOR("Jon Oberheide <jon@×××××××××.org>");
4264 ++MODULE_ALIAS_CRYPTO("arc4");
4265 +diff --git a/crypto/authenc.c b/crypto/authenc.c
4266 +index 528b00bc4769..a2cfae251dd5 100644
4267 +--- a/crypto/authenc.c
4268 ++++ b/crypto/authenc.c
4269 +@@ -709,3 +709,4 @@ module_exit(crypto_authenc_module_exit);
4270 +
4271 + MODULE_LICENSE("GPL");
4272 + MODULE_DESCRIPTION("Simple AEAD wrapper for IPsec");
4273 ++MODULE_ALIAS_CRYPTO("authenc");
4274 +diff --git a/crypto/authencesn.c b/crypto/authencesn.c
4275 +index ab53762fc309..16c225cb28c2 100644
4276 +--- a/crypto/authencesn.c
4277 ++++ b/crypto/authencesn.c
4278 +@@ -832,3 +832,4 @@ module_exit(crypto_authenc_esn_module_exit);
4279 + MODULE_LICENSE("GPL");
4280 + MODULE_AUTHOR("Steffen Klassert <steffen.klassert@×××××××.com>");
4281 + MODULE_DESCRIPTION("AEAD wrapper for IPsec with extended sequence numbers");
4282 ++MODULE_ALIAS_CRYPTO("authencesn");
4283 +diff --git a/crypto/blowfish_generic.c b/crypto/blowfish_generic.c
4284 +index 8baf5447d35b..87b392a77a93 100644
4285 +--- a/crypto/blowfish_generic.c
4286 ++++ b/crypto/blowfish_generic.c
4287 +@@ -138,4 +138,5 @@ module_exit(blowfish_mod_fini);
4288 +
4289 + MODULE_LICENSE("GPL");
4290 + MODULE_DESCRIPTION("Blowfish Cipher Algorithm");
4291 +-MODULE_ALIAS("blowfish");
4292 ++MODULE_ALIAS_CRYPTO("blowfish");
4293 ++MODULE_ALIAS_CRYPTO("blowfish-generic");
4294 +diff --git a/crypto/camellia_generic.c b/crypto/camellia_generic.c
4295 +index 26bcd7a2d6b4..a02286bf319e 100644
4296 +--- a/crypto/camellia_generic.c
4297 ++++ b/crypto/camellia_generic.c
4298 +@@ -1098,4 +1098,5 @@ module_exit(camellia_fini);
4299 +
4300 + MODULE_DESCRIPTION("Camellia Cipher Algorithm");
4301 + MODULE_LICENSE("GPL");
4302 +-MODULE_ALIAS("camellia");
4303 ++MODULE_ALIAS_CRYPTO("camellia");
4304 ++MODULE_ALIAS_CRYPTO("camellia-generic");
4305 +diff --git a/crypto/cast5_generic.c b/crypto/cast5_generic.c
4306 +index 5558f630a0eb..df5c72629383 100644
4307 +--- a/crypto/cast5_generic.c
4308 ++++ b/crypto/cast5_generic.c
4309 +@@ -549,4 +549,5 @@ module_exit(cast5_mod_fini);
4310 +
4311 + MODULE_LICENSE("GPL");
4312 + MODULE_DESCRIPTION("Cast5 Cipher Algorithm");
4313 +-MODULE_ALIAS("cast5");
4314 ++MODULE_ALIAS_CRYPTO("cast5");
4315 ++MODULE_ALIAS_CRYPTO("cast5-generic");
4316 +diff --git a/crypto/cast6_generic.c b/crypto/cast6_generic.c
4317 +index de732528a430..058c8d755d03 100644
4318 +--- a/crypto/cast6_generic.c
4319 ++++ b/crypto/cast6_generic.c
4320 +@@ -291,4 +291,5 @@ module_exit(cast6_mod_fini);
4321 +
4322 + MODULE_LICENSE("GPL");
4323 + MODULE_DESCRIPTION("Cast6 Cipher Algorithm");
4324 +-MODULE_ALIAS("cast6");
4325 ++MODULE_ALIAS_CRYPTO("cast6");
4326 ++MODULE_ALIAS_CRYPTO("cast6-generic");
4327 +diff --git a/crypto/cbc.c b/crypto/cbc.c
4328 +index 61ac42e1e32b..780ee27b2d43 100644
4329 +--- a/crypto/cbc.c
4330 ++++ b/crypto/cbc.c
4331 +@@ -289,3 +289,4 @@ module_exit(crypto_cbc_module_exit);
4332 +
4333 + MODULE_LICENSE("GPL");
4334 + MODULE_DESCRIPTION("CBC block cipher algorithm");
4335 ++MODULE_ALIAS_CRYPTO("cbc");
4336 +diff --git a/crypto/ccm.c b/crypto/ccm.c
4337 +index ed009b77e67d..c569c9c6afe3 100644
4338 +--- a/crypto/ccm.c
4339 ++++ b/crypto/ccm.c
4340 +@@ -879,5 +879,6 @@ module_exit(crypto_ccm_module_exit);
4341 +
4342 + MODULE_LICENSE("GPL");
4343 + MODULE_DESCRIPTION("Counter with CBC MAC");
4344 +-MODULE_ALIAS("ccm_base");
4345 +-MODULE_ALIAS("rfc4309");
4346 ++MODULE_ALIAS_CRYPTO("ccm_base");
4347 ++MODULE_ALIAS_CRYPTO("rfc4309");
4348 ++MODULE_ALIAS_CRYPTO("ccm");
4349 +diff --git a/crypto/chainiv.c b/crypto/chainiv.c
4350 +index 834d8dd3d4fc..22b7e55b0e1b 100644
4351 +--- a/crypto/chainiv.c
4352 ++++ b/crypto/chainiv.c
4353 +@@ -359,3 +359,4 @@ module_exit(chainiv_module_exit);
4354 +
4355 + MODULE_LICENSE("GPL");
4356 + MODULE_DESCRIPTION("Chain IV Generator");
4357 ++MODULE_ALIAS_CRYPTO("chainiv");
4358 +diff --git a/crypto/cmac.c b/crypto/cmac.c
4359 +index 50880cf17fad..7a8bfbd548f6 100644
4360 +--- a/crypto/cmac.c
4361 ++++ b/crypto/cmac.c
4362 +@@ -313,3 +313,4 @@ module_exit(crypto_cmac_module_exit);
4363 +
4364 + MODULE_LICENSE("GPL");
4365 + MODULE_DESCRIPTION("CMAC keyed hash algorithm");
4366 ++MODULE_ALIAS_CRYPTO("cmac");
4367 +diff --git a/crypto/crc32.c b/crypto/crc32.c
4368 +index 9d1c41569898..187ded28cb0b 100644
4369 +--- a/crypto/crc32.c
4370 ++++ b/crypto/crc32.c
4371 +@@ -156,3 +156,4 @@ module_exit(crc32_mod_fini);
4372 + MODULE_AUTHOR("Alexander Boyko <alexander_boyko@×××××××.com>");
4373 + MODULE_DESCRIPTION("CRC32 calculations wrapper for lib/crc32");
4374 + MODULE_LICENSE("GPL");
4375 ++MODULE_ALIAS_CRYPTO("crc32");
4376 +diff --git a/crypto/crct10dif_generic.c b/crypto/crct10dif_generic.c
4377 +index 877e7114ec5c..c1229614c7e3 100644
4378 +--- a/crypto/crct10dif_generic.c
4379 ++++ b/crypto/crct10dif_generic.c
4380 +@@ -124,4 +124,5 @@ module_exit(crct10dif_mod_fini);
4381 + MODULE_AUTHOR("Tim Chen <tim.c.chen@×××××××××××.com>");
4382 + MODULE_DESCRIPTION("T10 DIF CRC calculation.");
4383 + MODULE_LICENSE("GPL");
4384 +-MODULE_ALIAS("crct10dif");
4385 ++MODULE_ALIAS_CRYPTO("crct10dif");
4386 ++MODULE_ALIAS_CRYPTO("crct10dif-generic");
4387 +diff --git a/crypto/cryptd.c b/crypto/cryptd.c
4388 +index 7bdd61b867c8..75c415d37086 100644
4389 +--- a/crypto/cryptd.c
4390 ++++ b/crypto/cryptd.c
4391 +@@ -955,3 +955,4 @@ module_exit(cryptd_exit);
4392 +
4393 + MODULE_LICENSE("GPL");
4394 + MODULE_DESCRIPTION("Software async crypto daemon");
4395 ++MODULE_ALIAS_CRYPTO("cryptd");
4396 +diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c
4397 +index fee7265cd35d..7b39fa3deac2 100644
4398 +--- a/crypto/crypto_null.c
4399 ++++ b/crypto/crypto_null.c
4400 +@@ -149,9 +149,9 @@ static struct crypto_alg null_algs[3] = { {
4401 + .coa_decompress = null_compress } }
4402 + } };
4403 +
4404 +-MODULE_ALIAS("compress_null");
4405 +-MODULE_ALIAS("digest_null");
4406 +-MODULE_ALIAS("cipher_null");
4407 ++MODULE_ALIAS_CRYPTO("compress_null");
4408 ++MODULE_ALIAS_CRYPTO("digest_null");
4409 ++MODULE_ALIAS_CRYPTO("cipher_null");
4410 +
4411 + static int __init crypto_null_mod_init(void)
4412 + {
4413 +diff --git a/crypto/ctr.c b/crypto/ctr.c
4414 +index f2b94f27bb2c..2386f7313952 100644
4415 +--- a/crypto/ctr.c
4416 ++++ b/crypto/ctr.c
4417 +@@ -466,4 +466,5 @@ module_exit(crypto_ctr_module_exit);
4418 +
4419 + MODULE_LICENSE("GPL");
4420 + MODULE_DESCRIPTION("CTR Counter block mode");
4421 +-MODULE_ALIAS("rfc3686");
4422 ++MODULE_ALIAS_CRYPTO("rfc3686");
4423 ++MODULE_ALIAS_CRYPTO("ctr");
4424 +diff --git a/crypto/cts.c b/crypto/cts.c
4425 +index 042223f8e733..60b9da3fa7c1 100644
4426 +--- a/crypto/cts.c
4427 ++++ b/crypto/cts.c
4428 +@@ -350,3 +350,4 @@ module_exit(crypto_cts_module_exit);
4429 +
4430 + MODULE_LICENSE("Dual BSD/GPL");
4431 + MODULE_DESCRIPTION("CTS-CBC CipherText Stealing for CBC");
4432 ++MODULE_ALIAS_CRYPTO("cts");
4433 +diff --git a/crypto/deflate.c b/crypto/deflate.c
4434 +index b57d70eb156b..95d8d37c5021 100644
4435 +--- a/crypto/deflate.c
4436 ++++ b/crypto/deflate.c
4437 +@@ -222,4 +222,4 @@ module_exit(deflate_mod_fini);
4438 + MODULE_LICENSE("GPL");
4439 + MODULE_DESCRIPTION("Deflate Compression Algorithm for IPCOMP");
4440 + MODULE_AUTHOR("James Morris <jmorris@×××××××××××××.au>");
4441 +-
4442 ++MODULE_ALIAS_CRYPTO("deflate");
4443 +diff --git a/crypto/des_generic.c b/crypto/des_generic.c
4444 +index f6cf63f88468..3ec6071309d9 100644
4445 +--- a/crypto/des_generic.c
4446 ++++ b/crypto/des_generic.c
4447 +@@ -971,8 +971,6 @@ static struct crypto_alg des_algs[2] = { {
4448 + .cia_decrypt = des3_ede_decrypt } }
4449 + } };
4450 +
4451 +-MODULE_ALIAS("des3_ede");
4452 +-
4453 + static int __init des_generic_mod_init(void)
4454 + {
4455 + return crypto_register_algs(des_algs, ARRAY_SIZE(des_algs));
4456 +@@ -989,4 +987,7 @@ module_exit(des_generic_mod_fini);
4457 + MODULE_LICENSE("GPL");
4458 + MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms");
4459 + MODULE_AUTHOR("Dag Arne Osvik <da@×××××.no>");
4460 +-MODULE_ALIAS("des");
4461 ++MODULE_ALIAS_CRYPTO("des");
4462 ++MODULE_ALIAS_CRYPTO("des-generic");
4463 ++MODULE_ALIAS_CRYPTO("des3_ede");
4464 ++MODULE_ALIAS_CRYPTO("des3_ede-generic");
4465 +diff --git a/crypto/ecb.c b/crypto/ecb.c
4466 +index 935cfef4aa84..12011aff0971 100644
4467 +--- a/crypto/ecb.c
4468 ++++ b/crypto/ecb.c
4469 +@@ -185,3 +185,4 @@ module_exit(crypto_ecb_module_exit);
4470 +
4471 + MODULE_LICENSE("GPL");
4472 + MODULE_DESCRIPTION("ECB block cipher algorithm");
4473 ++MODULE_ALIAS_CRYPTO("ecb");
4474 +diff --git a/crypto/eseqiv.c b/crypto/eseqiv.c
4475 +index 42ce9f570aec..388f582ab0b9 100644
4476 +--- a/crypto/eseqiv.c
4477 ++++ b/crypto/eseqiv.c
4478 +@@ -267,3 +267,4 @@ module_exit(eseqiv_module_exit);
4479 +
4480 + MODULE_LICENSE("GPL");
4481 + MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator");
4482 ++MODULE_ALIAS_CRYPTO("eseqiv");
4483 +diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c
4484 +index 021d7fec6bc8..77286ea28865 100644
4485 +--- a/crypto/fcrypt.c
4486 ++++ b/crypto/fcrypt.c
4487 +@@ -420,3 +420,4 @@ module_exit(fcrypt_mod_fini);
4488 + MODULE_LICENSE("Dual BSD/GPL");
4489 + MODULE_DESCRIPTION("FCrypt Cipher Algorithm");
4490 + MODULE_AUTHOR("David Howells <dhowells@××××××.com>");
4491 ++MODULE_ALIAS_CRYPTO("fcrypt");
4492 +diff --git a/crypto/gcm.c b/crypto/gcm.c
4493 +index 43e1fb05ea54..b4c252066f7b 100644
4494 +--- a/crypto/gcm.c
4495 ++++ b/crypto/gcm.c
4496 +@@ -1441,6 +1441,7 @@ module_exit(crypto_gcm_module_exit);
4497 + MODULE_LICENSE("GPL");
4498 + MODULE_DESCRIPTION("Galois/Counter Mode");
4499 + MODULE_AUTHOR("Mikko Herranen <mh1@×××.fi>");
4500 +-MODULE_ALIAS("gcm_base");
4501 +-MODULE_ALIAS("rfc4106");
4502 +-MODULE_ALIAS("rfc4543");
4503 ++MODULE_ALIAS_CRYPTO("gcm_base");
4504 ++MODULE_ALIAS_CRYPTO("rfc4106");
4505 ++MODULE_ALIAS_CRYPTO("rfc4543");
4506 ++MODULE_ALIAS_CRYPTO("gcm");
4507 +diff --git a/crypto/ghash-generic.c b/crypto/ghash-generic.c
4508 +index 9d3f0c69a86f..bac70995e064 100644
4509 +--- a/crypto/ghash-generic.c
4510 ++++ b/crypto/ghash-generic.c
4511 +@@ -172,4 +172,5 @@ module_exit(ghash_mod_exit);
4512 +
4513 + MODULE_LICENSE("GPL");
4514 + MODULE_DESCRIPTION("GHASH Message Digest Algorithm");
4515 +-MODULE_ALIAS("ghash");
4516 ++MODULE_ALIAS_CRYPTO("ghash");
4517 ++MODULE_ALIAS_CRYPTO("ghash-generic");
4518 +diff --git a/crypto/hmac.c b/crypto/hmac.c
4519 +index 8d9544cf8169..ade790b454e9 100644
4520 +--- a/crypto/hmac.c
4521 ++++ b/crypto/hmac.c
4522 +@@ -271,3 +271,4 @@ module_exit(hmac_module_exit);
4523 +
4524 + MODULE_LICENSE("GPL");
4525 + MODULE_DESCRIPTION("HMAC hash algorithm");
4526 ++MODULE_ALIAS_CRYPTO("hmac");
4527 +diff --git a/crypto/khazad.c b/crypto/khazad.c
4528 +index 60e7cd66facc..873eb5ded6d7 100644
4529 +--- a/crypto/khazad.c
4530 ++++ b/crypto/khazad.c
4531 +@@ -880,3 +880,4 @@ module_exit(khazad_mod_fini);
4532 +
4533 + MODULE_LICENSE("GPL");
4534 + MODULE_DESCRIPTION("Khazad Cryptographic Algorithm");
4535 ++MODULE_ALIAS_CRYPTO("khazad");
4536 +diff --git a/crypto/krng.c b/crypto/krng.c
4537 +index a2d2b72fc135..0224841b6579 100644
4538 +--- a/crypto/krng.c
4539 ++++ b/crypto/krng.c
4540 +@@ -62,4 +62,5 @@ module_exit(krng_mod_fini);
4541 +
4542 + MODULE_LICENSE("GPL");
4543 + MODULE_DESCRIPTION("Kernel Random Number Generator");
4544 +-MODULE_ALIAS("stdrng");
4545 ++MODULE_ALIAS_CRYPTO("stdrng");
4546 ++MODULE_ALIAS_CRYPTO("krng");
4547 +diff --git a/crypto/lrw.c b/crypto/lrw.c
4548 +index ba42acc4deba..6f9908a7ebcb 100644
4549 +--- a/crypto/lrw.c
4550 ++++ b/crypto/lrw.c
4551 +@@ -400,3 +400,4 @@ module_exit(crypto_module_exit);
4552 +
4553 + MODULE_LICENSE("GPL");
4554 + MODULE_DESCRIPTION("LRW block cipher mode");
4555 ++MODULE_ALIAS_CRYPTO("lrw");
4556 +diff --git a/crypto/lz4.c b/crypto/lz4.c
4557 +index 4586dd15b0d8..53279ab8c3a6 100644
4558 +--- a/crypto/lz4.c
4559 ++++ b/crypto/lz4.c
4560 +@@ -104,3 +104,4 @@ module_exit(lz4_mod_fini);
4561 +
4562 + MODULE_LICENSE("GPL");
4563 + MODULE_DESCRIPTION("LZ4 Compression Algorithm");
4564 ++MODULE_ALIAS_CRYPTO("lz4");
4565 +diff --git a/crypto/lz4hc.c b/crypto/lz4hc.c
4566 +index 151ba31d34e3..eaec5fa3debf 100644
4567 +--- a/crypto/lz4hc.c
4568 ++++ b/crypto/lz4hc.c
4569 +@@ -104,3 +104,4 @@ module_exit(lz4hc_mod_fini);
4570 +
4571 + MODULE_LICENSE("GPL");
4572 + MODULE_DESCRIPTION("LZ4HC Compression Algorithm");
4573 ++MODULE_ALIAS_CRYPTO("lz4hc");
4574 +diff --git a/crypto/lzo.c b/crypto/lzo.c
4575 +index 1c2aa69c54b8..d1ff69404353 100644
4576 +--- a/crypto/lzo.c
4577 ++++ b/crypto/lzo.c
4578 +@@ -103,3 +103,4 @@ module_exit(lzo_mod_fini);
4579 +
4580 + MODULE_LICENSE("GPL");
4581 + MODULE_DESCRIPTION("LZO Compression Algorithm");
4582 ++MODULE_ALIAS_CRYPTO("lzo");
4583 +diff --git a/crypto/md4.c b/crypto/md4.c
4584 +index 0477a6a01d58..3515af425cc9 100644
4585 +--- a/crypto/md4.c
4586 ++++ b/crypto/md4.c
4587 +@@ -255,4 +255,4 @@ module_exit(md4_mod_fini);
4588 +
4589 + MODULE_LICENSE("GPL");
4590 + MODULE_DESCRIPTION("MD4 Message Digest Algorithm");
4591 +-
4592 ++MODULE_ALIAS_CRYPTO("md4");
4593 +diff --git a/crypto/md5.c b/crypto/md5.c
4594 +index 7febeaab923b..36f5e5b103f3 100644
4595 +--- a/crypto/md5.c
4596 ++++ b/crypto/md5.c
4597 +@@ -168,3 +168,4 @@ module_exit(md5_mod_fini);
4598 +
4599 + MODULE_LICENSE("GPL");
4600 + MODULE_DESCRIPTION("MD5 Message Digest Algorithm");
4601 ++MODULE_ALIAS_CRYPTO("md5");
4602 +diff --git a/crypto/michael_mic.c b/crypto/michael_mic.c
4603 +index 079b761bc70d..46195e0d0f4d 100644
4604 +--- a/crypto/michael_mic.c
4605 ++++ b/crypto/michael_mic.c
4606 +@@ -184,3 +184,4 @@ module_exit(michael_mic_exit);
4607 + MODULE_LICENSE("GPL v2");
4608 + MODULE_DESCRIPTION("Michael MIC");
4609 + MODULE_AUTHOR("Jouni Malinen <j@××.fi>");
4610 ++MODULE_ALIAS_CRYPTO("michael_mic");
4611 +diff --git a/crypto/pcbc.c b/crypto/pcbc.c
4612 +index d1b8bdfb5855..f654965f0933 100644
4613 +--- a/crypto/pcbc.c
4614 ++++ b/crypto/pcbc.c
4615 +@@ -295,3 +295,4 @@ module_exit(crypto_pcbc_module_exit);
4616 +
4617 + MODULE_LICENSE("GPL");
4618 + MODULE_DESCRIPTION("PCBC block cipher algorithm");
4619 ++MODULE_ALIAS_CRYPTO("pcbc");
4620 +diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
4621 +index f8c920cafe63..6bc736e2926a 100644
4622 +--- a/crypto/pcrypt.c
4623 ++++ b/crypto/pcrypt.c
4624 +@@ -565,3 +565,4 @@ module_exit(pcrypt_exit);
4625 + MODULE_LICENSE("GPL");
4626 + MODULE_AUTHOR("Steffen Klassert <steffen.klassert@×××××××.com>");
4627 + MODULE_DESCRIPTION("Parallel crypto wrapper");
4628 ++MODULE_ALIAS_CRYPTO("pcrypt");
4629 +diff --git a/crypto/rmd128.c b/crypto/rmd128.c
4630 +index 8a0f68b7f257..049486ede938 100644
4631 +--- a/crypto/rmd128.c
4632 ++++ b/crypto/rmd128.c
4633 +@@ -327,3 +327,4 @@ module_exit(rmd128_mod_fini);
4634 + MODULE_LICENSE("GPL");
4635 + MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@××××××××.ch>");
4636 + MODULE_DESCRIPTION("RIPEMD-128 Message Digest");
4637 ++MODULE_ALIAS_CRYPTO("rmd128");
4638 +diff --git a/crypto/rmd160.c b/crypto/rmd160.c
4639 +index 525d7bb752cf..de585e51d455 100644
4640 +--- a/crypto/rmd160.c
4641 ++++ b/crypto/rmd160.c
4642 +@@ -371,3 +371,4 @@ module_exit(rmd160_mod_fini);
4643 + MODULE_LICENSE("GPL");
4644 + MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@××××××××.ch>");
4645 + MODULE_DESCRIPTION("RIPEMD-160 Message Digest");
4646 ++MODULE_ALIAS_CRYPTO("rmd160");
4647 +diff --git a/crypto/rmd256.c b/crypto/rmd256.c
4648 +index 69293d9b56e0..4ec02a754e09 100644
4649 +--- a/crypto/rmd256.c
4650 ++++ b/crypto/rmd256.c
4651 +@@ -346,3 +346,4 @@ module_exit(rmd256_mod_fini);
4652 + MODULE_LICENSE("GPL");
4653 + MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@××××××××.ch>");
4654 + MODULE_DESCRIPTION("RIPEMD-256 Message Digest");
4655 ++MODULE_ALIAS_CRYPTO("rmd256");
4656 +diff --git a/crypto/rmd320.c b/crypto/rmd320.c
4657 +index 09f97dfdfbba..770f2cb369f8 100644
4658 +--- a/crypto/rmd320.c
4659 ++++ b/crypto/rmd320.c
4660 +@@ -395,3 +395,4 @@ module_exit(rmd320_mod_fini);
4661 + MODULE_LICENSE("GPL");
4662 + MODULE_AUTHOR("Adrian-Ken Rueegsegger <ken@××××××××.ch>");
4663 + MODULE_DESCRIPTION("RIPEMD-320 Message Digest");
4664 ++MODULE_ALIAS_CRYPTO("rmd320");
4665 +diff --git a/crypto/salsa20_generic.c b/crypto/salsa20_generic.c
4666 +index 9a4770c02284..f550b5d94630 100644
4667 +--- a/crypto/salsa20_generic.c
4668 ++++ b/crypto/salsa20_generic.c
4669 +@@ -248,4 +248,5 @@ module_exit(salsa20_generic_mod_fini);
4670 +
4671 + MODULE_LICENSE("GPL");
4672 + MODULE_DESCRIPTION ("Salsa20 stream cipher algorithm");
4673 +-MODULE_ALIAS("salsa20");
4674 ++MODULE_ALIAS_CRYPTO("salsa20");
4675 ++MODULE_ALIAS_CRYPTO("salsa20-generic");
4676 +diff --git a/crypto/seed.c b/crypto/seed.c
4677 +index 9c904d6d2151..c6ba8438be43 100644
4678 +--- a/crypto/seed.c
4679 ++++ b/crypto/seed.c
4680 +@@ -476,3 +476,4 @@ module_exit(seed_fini);
4681 + MODULE_DESCRIPTION("SEED Cipher Algorithm");
4682 + MODULE_LICENSE("GPL");
4683 + MODULE_AUTHOR("Hye-Shik Chang <perky@×××××××.org>, Kim Hyun <hkim@×××××××.kr>");
4684 ++MODULE_ALIAS_CRYPTO("seed");
4685 +diff --git a/crypto/seqiv.c b/crypto/seqiv.c
4686 +index f2cba4ed6f25..49a4069ff453 100644
4687 +--- a/crypto/seqiv.c
4688 ++++ b/crypto/seqiv.c
4689 +@@ -362,3 +362,4 @@ module_exit(seqiv_module_exit);
4690 +
4691 + MODULE_LICENSE("GPL");
4692 + MODULE_DESCRIPTION("Sequence Number IV Generator");
4693 ++MODULE_ALIAS_CRYPTO("seqiv");
4694 +diff --git a/crypto/serpent_generic.c b/crypto/serpent_generic.c
4695 +index 7ddbd7e88859..94970a794975 100644
4696 +--- a/crypto/serpent_generic.c
4697 ++++ b/crypto/serpent_generic.c
4698 +@@ -665,5 +665,6 @@ module_exit(serpent_mod_fini);
4699 + MODULE_LICENSE("GPL");
4700 + MODULE_DESCRIPTION("Serpent and tnepres (kerneli compatible serpent reversed) Cipher Algorithm");
4701 + MODULE_AUTHOR("Dag Arne Osvik <osvik@××××××.no>");
4702 +-MODULE_ALIAS("tnepres");
4703 +-MODULE_ALIAS("serpent");
4704 ++MODULE_ALIAS_CRYPTO("tnepres");
4705 ++MODULE_ALIAS_CRYPTO("serpent");
4706 ++MODULE_ALIAS_CRYPTO("serpent-generic");
4707 +diff --git a/crypto/sha1_generic.c b/crypto/sha1_generic.c
4708 +index 42794803c480..fdf7c00de4b0 100644
4709 +--- a/crypto/sha1_generic.c
4710 ++++ b/crypto/sha1_generic.c
4711 +@@ -153,4 +153,5 @@ module_exit(sha1_generic_mod_fini);
4712 + MODULE_LICENSE("GPL");
4713 + MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm");
4714 +
4715 +-MODULE_ALIAS("sha1");
4716 ++MODULE_ALIAS_CRYPTO("sha1");
4717 ++MODULE_ALIAS_CRYPTO("sha1-generic");
4718 +diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c
4719 +index 543366779524..136381bdd48d 100644
4720 +--- a/crypto/sha256_generic.c
4721 ++++ b/crypto/sha256_generic.c
4722 +@@ -384,5 +384,7 @@ module_exit(sha256_generic_mod_fini);
4723 + MODULE_LICENSE("GPL");
4724 + MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm");
4725 +
4726 +-MODULE_ALIAS("sha224");
4727 +-MODULE_ALIAS("sha256");
4728 ++MODULE_ALIAS_CRYPTO("sha224");
4729 ++MODULE_ALIAS_CRYPTO("sha224-generic");
4730 ++MODULE_ALIAS_CRYPTO("sha256");
4731 ++MODULE_ALIAS_CRYPTO("sha256-generic");
4732 +diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c
4733 +index 6ed124f3ea0f..6c6d901a7cc1 100644
4734 +--- a/crypto/sha512_generic.c
4735 ++++ b/crypto/sha512_generic.c
4736 +@@ -287,5 +287,7 @@ module_exit(sha512_generic_mod_fini);
4737 + MODULE_LICENSE("GPL");
4738 + MODULE_DESCRIPTION("SHA-512 and SHA-384 Secure Hash Algorithms");
4739 +
4740 +-MODULE_ALIAS("sha384");
4741 +-MODULE_ALIAS("sha512");
4742 ++MODULE_ALIAS_CRYPTO("sha384");
4743 ++MODULE_ALIAS_CRYPTO("sha384-generic");
4744 ++MODULE_ALIAS_CRYPTO("sha512");
4745 ++MODULE_ALIAS_CRYPTO("sha512-generic");
4746 +diff --git a/crypto/tea.c b/crypto/tea.c
4747 +index 0a572323ee4a..b70b441c7d1e 100644
4748 +--- a/crypto/tea.c
4749 ++++ b/crypto/tea.c
4750 +@@ -270,8 +270,9 @@ static void __exit tea_mod_fini(void)
4751 + crypto_unregister_algs(tea_algs, ARRAY_SIZE(tea_algs));
4752 + }
4753 +
4754 +-MODULE_ALIAS("xtea");
4755 +-MODULE_ALIAS("xeta");
4756 ++MODULE_ALIAS_CRYPTO("tea");
4757 ++MODULE_ALIAS_CRYPTO("xtea");
4758 ++MODULE_ALIAS_CRYPTO("xeta");
4759 +
4760 + module_init(tea_mod_init);
4761 + module_exit(tea_mod_fini);
4762 +diff --git a/crypto/tgr192.c b/crypto/tgr192.c
4763 +index 87403556fd0b..f7ed2fba396c 100644
4764 +--- a/crypto/tgr192.c
4765 ++++ b/crypto/tgr192.c
4766 +@@ -676,8 +676,9 @@ static void __exit tgr192_mod_fini(void)
4767 + crypto_unregister_shashes(tgr_algs, ARRAY_SIZE(tgr_algs));
4768 + }
4769 +
4770 +-MODULE_ALIAS("tgr160");
4771 +-MODULE_ALIAS("tgr128");
4772 ++MODULE_ALIAS_CRYPTO("tgr192");
4773 ++MODULE_ALIAS_CRYPTO("tgr160");
4774 ++MODULE_ALIAS_CRYPTO("tgr128");
4775 +
4776 + module_init(tgr192_mod_init);
4777 + module_exit(tgr192_mod_fini);
4778 +diff --git a/crypto/twofish_generic.c b/crypto/twofish_generic.c
4779 +index 2d5000552d0f..ebf7a3efb572 100644
4780 +--- a/crypto/twofish_generic.c
4781 ++++ b/crypto/twofish_generic.c
4782 +@@ -211,4 +211,5 @@ module_exit(twofish_mod_fini);
4783 +
4784 + MODULE_LICENSE("GPL");
4785 + MODULE_DESCRIPTION ("Twofish Cipher Algorithm");
4786 +-MODULE_ALIAS("twofish");
4787 ++MODULE_ALIAS_CRYPTO("twofish");
4788 ++MODULE_ALIAS_CRYPTO("twofish-generic");
4789 +diff --git a/crypto/vmac.c b/crypto/vmac.c
4790 +index 2eb11a30c29c..bf2d3a89845f 100644
4791 +--- a/crypto/vmac.c
4792 ++++ b/crypto/vmac.c
4793 +@@ -713,3 +713,4 @@ module_exit(vmac_module_exit);
4794 +
4795 + MODULE_LICENSE("GPL");
4796 + MODULE_DESCRIPTION("VMAC hash algorithm");
4797 ++MODULE_ALIAS_CRYPTO("vmac");
4798 +diff --git a/crypto/wp512.c b/crypto/wp512.c
4799 +index 180f1d6e03f4..253db94b5479 100644
4800 +--- a/crypto/wp512.c
4801 ++++ b/crypto/wp512.c
4802 +@@ -1167,8 +1167,9 @@ static void __exit wp512_mod_fini(void)
4803 + crypto_unregister_shashes(wp_algs, ARRAY_SIZE(wp_algs));
4804 + }
4805 +
4806 +-MODULE_ALIAS("wp384");
4807 +-MODULE_ALIAS("wp256");
4808 ++MODULE_ALIAS_CRYPTO("wp512");
4809 ++MODULE_ALIAS_CRYPTO("wp384");
4810 ++MODULE_ALIAS_CRYPTO("wp256");
4811 +
4812 + module_init(wp512_mod_init);
4813 + module_exit(wp512_mod_fini);
4814 +diff --git a/crypto/xcbc.c b/crypto/xcbc.c
4815 +index a5fbdf3738cf..df90b332554c 100644
4816 +--- a/crypto/xcbc.c
4817 ++++ b/crypto/xcbc.c
4818 +@@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
4819 +
4820 + MODULE_LICENSE("GPL");
4821 + MODULE_DESCRIPTION("XCBC keyed hash algorithm");
4822 ++MODULE_ALIAS_CRYPTO("xcbc");
4823 +diff --git a/crypto/xts.c b/crypto/xts.c
4824 +index ca1608f44cb5..f6fd43f100c8 100644
4825 +--- a/crypto/xts.c
4826 ++++ b/crypto/xts.c
4827 +@@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
4828 +
4829 + MODULE_LICENSE("GPL");
4830 + MODULE_DESCRIPTION("XTS block cipher mode");
4831 ++MODULE_ALIAS_CRYPTO("xts");
4832 +diff --git a/crypto/zlib.c b/crypto/zlib.c
4833 +index 06b62e5cdcc7..d98078835281 100644
4834 +--- a/crypto/zlib.c
4835 ++++ b/crypto/zlib.c
4836 +@@ -378,3 +378,4 @@ module_exit(zlib_mod_fini);
4837 + MODULE_LICENSE("GPL");
4838 + MODULE_DESCRIPTION("Zlib Compression Algorithm");
4839 + MODULE_AUTHOR("Sony Corporation");
4840 ++MODULE_ALIAS_CRYPTO("zlib");
4841 +diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
4842 +index e5f416c7f66e..d73f85247272 100644
4843 +--- a/drivers/acpi/osl.c
4844 ++++ b/drivers/acpi/osl.c
4845 +@@ -421,7 +421,7 @@ static void acpi_os_drop_map_ref(struct acpi_ioremap *map)
4846 + static void acpi_os_map_cleanup(struct acpi_ioremap *map)
4847 + {
4848 + if (!map->refcount) {
4849 +- synchronize_rcu();
4850 ++ synchronize_rcu_expedited();
4851 + acpi_unmap(map->phys, map->virt);
4852 + kfree(map);
4853 + }
4854 +diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
4855 +index 37acda6fa7e4..136803c47cdb 100644
4856 +--- a/drivers/ata/libata-sff.c
4857 ++++ b/drivers/ata/libata-sff.c
4858 +@@ -1333,7 +1333,19 @@ void ata_sff_flush_pio_task(struct ata_port *ap)
4859 + DPRINTK("ENTER\n");
4860 +
4861 + cancel_delayed_work_sync(&ap->sff_pio_task);
4862 ++
4863 ++ /*
4864 ++ * We wanna reset the HSM state to IDLE. If we do so without
4865 ++ * grabbing the port lock, critical sections protected by it which
4866 ++ * expect the HSM state to stay stable may get surprised. For
4867 ++ * example, we may set IDLE in between the time
4868 ++ * __ata_sff_port_intr() checks for HSM_ST_IDLE and before it calls
4869 ++ * ata_sff_hsm_move() causing ata_sff_hsm_move() to BUG().
4870 ++ */
4871 ++ spin_lock_irq(ap->lock);
4872 + ap->hsm_task_state = HSM_ST_IDLE;
4873 ++ spin_unlock_irq(ap->lock);
4874 ++
4875 + ap->sff_pio_task_link = NULL;
4876 +
4877 + if (ata_msg_ctl(ap))
4878 +diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
4879 +index 2e391730e8be..776b59fbe861 100644
4880 +--- a/drivers/ata/sata_dwc_460ex.c
4881 ++++ b/drivers/ata/sata_dwc_460ex.c
4882 +@@ -797,7 +797,7 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq)
4883 + if (err) {
4884 + dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns"
4885 + " %d\n", __func__, err);
4886 +- goto error_out;
4887 ++ return err;
4888 + }
4889 +
4890 + /* Enabe DMA */
4891 +@@ -808,11 +808,6 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq)
4892 + sata_dma_regs);
4893 +
4894 + return 0;
4895 +-
4896 +-error_out:
4897 +- dma_dwc_exit(hsdev);
4898 +-
4899 +- return err;
4900 + }
4901 +
4902 + static int sata_dwc_scr_read(struct ata_link *link, unsigned int scr, u32 *val)
4903 +@@ -1662,7 +1657,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
4904 + char *ver = (char *)&versionr;
4905 + u8 *base = NULL;
4906 + int err = 0;
4907 +- int irq, rc;
4908 ++ int irq;
4909 + struct ata_host *host;
4910 + struct ata_port_info pi = sata_dwc_port_info[0];
4911 + const struct ata_port_info *ppi[] = { &pi, NULL };
4912 +@@ -1725,7 +1720,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
4913 + if (irq == NO_IRQ) {
4914 + dev_err(&ofdev->dev, "no SATA DMA irq\n");
4915 + err = -ENODEV;
4916 +- goto error_out;
4917 ++ goto error_iomap;
4918 + }
4919 +
4920 + /* Get physical SATA DMA register base address */
4921 +@@ -1734,14 +1729,16 @@ static int sata_dwc_probe(struct platform_device *ofdev)
4922 + dev_err(&ofdev->dev, "ioremap failed for AHBDMA register"
4923 + " address\n");
4924 + err = -ENODEV;
4925 +- goto error_out;
4926 ++ goto error_iomap;
4927 + }
4928 +
4929 + /* Save dev for later use in dev_xxx() routines */
4930 + host_pvt.dwc_dev = &ofdev->dev;
4931 +
4932 + /* Initialize AHB DMAC */
4933 +- dma_dwc_init(hsdev, irq);
4934 ++ err = dma_dwc_init(hsdev, irq);
4935 ++ if (err)
4936 ++ goto error_dma_iomap;
4937 +
4938 + /* Enable SATA Interrupts */
4939 + sata_dwc_enable_interrupts(hsdev);
4940 +@@ -1759,9 +1756,8 @@ static int sata_dwc_probe(struct platform_device *ofdev)
4941 + * device discovery process, invoking our port_start() handler &
4942 + * error_handler() to execute a dummy Softreset EH session
4943 + */
4944 +- rc = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht);
4945 +-
4946 +- if (rc != 0)
4947 ++ err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht);
4948 ++ if (err)
4949 + dev_err(&ofdev->dev, "failed to activate host");
4950 +
4951 + dev_set_drvdata(&ofdev->dev, host);
4952 +@@ -1770,7 +1766,8 @@ static int sata_dwc_probe(struct platform_device *ofdev)
4953 + error_out:
4954 + /* Free SATA DMA resources */
4955 + dma_dwc_exit(hsdev);
4956 +-
4957 ++error_dma_iomap:
4958 ++ iounmap((void __iomem *)host_pvt.sata_dma_regs);
4959 + error_iomap:
4960 + iounmap(base);
4961 + error_kmalloc:
4962 +@@ -1791,6 +1788,7 @@ static int sata_dwc_remove(struct platform_device *ofdev)
4963 + /* Free SATA DMA resources */
4964 + dma_dwc_exit(hsdev);
4965 +
4966 ++ iounmap((void __iomem *)host_pvt.sata_dma_regs);
4967 + iounmap(hsdev->reg_base);
4968 + kfree(hsdev);
4969 + kfree(host);
4970 +diff --git a/drivers/base/bus.c b/drivers/base/bus.c
4971 +index 4c289ab91357..aed92e41f291 100644
4972 +--- a/drivers/base/bus.c
4973 ++++ b/drivers/base/bus.c
4974 +@@ -243,13 +243,15 @@ static ssize_t store_drivers_probe(struct bus_type *bus,
4975 + const char *buf, size_t count)
4976 + {
4977 + struct device *dev;
4978 ++ int err = -EINVAL;
4979 +
4980 + dev = bus_find_device_by_name(bus, NULL, buf);
4981 + if (!dev)
4982 + return -ENODEV;
4983 +- if (bus_rescan_devices_helper(dev, NULL) != 0)
4984 +- return -EINVAL;
4985 +- return count;
4986 ++ if (bus_rescan_devices_helper(dev, NULL) == 0)
4987 ++ err = count;
4988 ++ put_device(dev);
4989 ++ return err;
4990 + }
4991 +
4992 + static struct device *next_device(struct klist_iter *i)
4993 +diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
4994 +index c24379ffd4e3..b2ae184a637c 100644
4995 +--- a/drivers/block/drbd/drbd_req.c
4996 ++++ b/drivers/block/drbd/drbd_req.c
4997 +@@ -1309,6 +1309,7 @@ int drbd_merge_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct
4998 + struct request_queue * const b =
4999 + mdev->ldev->backing_bdev->bd_disk->queue;
5000 + if (b->merge_bvec_fn) {
5001 ++ bvm->bi_bdev = mdev->ldev->backing_bdev;
5002 + backing_limit = b->merge_bvec_fn(b, bvm, bvec);
5003 + limit = min(limit, backing_limit);
5004 + }
5005 +diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
5006 +index b4bd72b6fdc8..b50c5e32ca35 100644
5007 +--- a/drivers/bus/mvebu-mbus.c
5008 ++++ b/drivers/bus/mvebu-mbus.c
5009 +@@ -181,12 +181,25 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus,
5010 + }
5011 +
5012 + /* Checks whether the given window number is available */
5013 ++
5014 ++/* On Armada XP, 375 and 38x the MBus window 13 has the remap
5015 ++ * capability, like windows 0 to 7. However, the mvebu-mbus driver
5016 ++ * isn't currently taking into account this special case, which means
5017 ++ * that when window 13 is actually used, the remap registers are left
5018 ++ * to 0, making the device using this MBus window unavailable. The
5019 ++ * quick fix for stable is to not use window 13. A follow up patch
5020 ++ * will correctly handle this window.
5021 ++*/
5022 + static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus,
5023 + const int win)
5024 + {
5025 + void __iomem *addr = mbus->mbuswins_base +
5026 + mbus->soc->win_cfg_offset(win);
5027 + u32 ctrl = readl(addr + WIN_CTRL_OFF);
5028 ++
5029 ++ if (win == 13)
5030 ++ return false;
5031 ++
5032 + return !(ctrl & WIN_CTRL_ENABLE);
5033 + }
5034 +
5035 +diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
5036 +index 70f3a597ec57..12fbec743fac 100644
5037 +--- a/drivers/clocksource/exynos_mct.c
5038 ++++ b/drivers/clocksource/exynos_mct.c
5039 +@@ -94,8 +94,8 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset)
5040 + __raw_writel(value, reg_base + offset);
5041 +
5042 + if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) {
5043 +- stat_addr = (offset & ~EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET;
5044 +- switch (offset & EXYNOS4_MCT_L_MASK) {
5045 ++ stat_addr = (offset & EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET;
5046 ++ switch (offset & ~EXYNOS4_MCT_L_MASK) {
5047 + case MCT_L_TCON_OFFSET:
5048 + mask = 1 << 3; /* L_TCON write status */
5049 + break;
5050 +diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
5051 +index 633ba945e153..c178ed8c3908 100644
5052 +--- a/drivers/crypto/padlock-aes.c
5053 ++++ b/drivers/crypto/padlock-aes.c
5054 +@@ -563,4 +563,4 @@ MODULE_DESCRIPTION("VIA PadLock AES algorithm support");
5055 + MODULE_LICENSE("GPL");
5056 + MODULE_AUTHOR("Michal Ludvig");
5057 +
5058 +-MODULE_ALIAS("aes");
5059 ++MODULE_ALIAS_CRYPTO("aes");
5060 +diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
5061 +index 9266c0e25492..93d7753ab38a 100644
5062 +--- a/drivers/crypto/padlock-sha.c
5063 ++++ b/drivers/crypto/padlock-sha.c
5064 +@@ -593,7 +593,7 @@ MODULE_DESCRIPTION("VIA PadLock SHA1/SHA256 algorithms support.");
5065 + MODULE_LICENSE("GPL");
5066 + MODULE_AUTHOR("Michal Ludvig");
5067 +
5068 +-MODULE_ALIAS("sha1-all");
5069 +-MODULE_ALIAS("sha256-all");
5070 +-MODULE_ALIAS("sha1-padlock");
5071 +-MODULE_ALIAS("sha256-padlock");
5072 ++MODULE_ALIAS_CRYPTO("sha1-all");
5073 ++MODULE_ALIAS_CRYPTO("sha256-all");
5074 ++MODULE_ALIAS_CRYPTO("sha1-padlock");
5075 ++MODULE_ALIAS_CRYPTO("sha256-padlock");
5076 +diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c
5077 +index 92105f3dc8e0..e4cea7c45142 100644
5078 +--- a/drivers/crypto/ux500/cryp/cryp_core.c
5079 ++++ b/drivers/crypto/ux500/cryp/cryp_core.c
5080 +@@ -1810,7 +1810,7 @@ module_exit(ux500_cryp_mod_fini);
5081 + module_param(cryp_mode, int, 0);
5082 +
5083 + MODULE_DESCRIPTION("Driver for ST-Ericsson UX500 CRYP crypto engine.");
5084 +-MODULE_ALIAS("aes-all");
5085 +-MODULE_ALIAS("des-all");
5086 ++MODULE_ALIAS_CRYPTO("aes-all");
5087 ++MODULE_ALIAS_CRYPTO("des-all");
5088 +
5089 + MODULE_LICENSE("GPL");
5090 +diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
5091 +index 1c73f4fbc252..8e5e0187506f 100644
5092 +--- a/drivers/crypto/ux500/hash/hash_core.c
5093 ++++ b/drivers/crypto/ux500/hash/hash_core.c
5094 +@@ -1995,7 +1995,7 @@ module_exit(ux500_hash_mod_fini);
5095 + MODULE_DESCRIPTION("Driver for ST-Ericsson UX500 HASH engine.");
5096 + MODULE_LICENSE("GPL");
5097 +
5098 +-MODULE_ALIAS("sha1-all");
5099 +-MODULE_ALIAS("sha256-all");
5100 +-MODULE_ALIAS("hmac-sha1-all");
5101 +-MODULE_ALIAS("hmac-sha256-all");
5102 ++MODULE_ALIAS_CRYPTO("sha1-all");
5103 ++MODULE_ALIAS_CRYPTO("sha256-all");
5104 ++MODULE_ALIAS_CRYPTO("hmac-sha1-all");
5105 ++MODULE_ALIAS_CRYPTO("hmac-sha256-all");
5106 +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
5107 +index 0dfaf20e4dad..63e7fad69ced 100644
5108 +--- a/drivers/gpio/gpiolib-of.c
5109 ++++ b/drivers/gpio/gpiolib-of.c
5110 +@@ -12,6 +12,7 @@
5111 + */
5112 +
5113 + #include <linux/device.h>
5114 ++#include <linux/err.h>
5115 + #include <linux/errno.h>
5116 + #include <linux/module.h>
5117 + #include <linux/io.h>
5118 +@@ -42,8 +43,14 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)
5119 + return false;
5120 +
5121 + ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags);
5122 +- if (ret < 0)
5123 +- return false;
5124 ++ if (ret < 0) {
5125 ++ /* We've found the gpio chip, but the translation failed.
5126 ++ * Return true to stop looking and return the translation
5127 ++ * error via out_gpio
5128 ++ */
5129 ++ gg_data->out_gpio = ERR_PTR(ret);
5130 ++ return true;
5131 ++ }
5132 +
5133 + gg_data->out_gpio = ret + gc->base;
5134 + return true;
5135 +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
5136 +index 0dee0e0c247a..e66d1cdb637d 100644
5137 +--- a/drivers/gpio/gpiolib.c
5138 ++++ b/drivers/gpio/gpiolib.c
5139 +@@ -362,7 +362,7 @@ static ssize_t gpio_value_store(struct device *dev,
5140 + return status;
5141 + }
5142 +
5143 +-static const DEVICE_ATTR(value, 0644,
5144 ++static DEVICE_ATTR(value, 0644,
5145 + gpio_value_show, gpio_value_store);
5146 +
5147 + static irqreturn_t gpio_sysfs_irq(int irq, void *priv)
5148 +@@ -580,18 +580,16 @@ static ssize_t gpio_active_low_store(struct device *dev,
5149 + return status ? : size;
5150 + }
5151 +
5152 +-static const DEVICE_ATTR(active_low, 0644,
5153 ++static DEVICE_ATTR(active_low, 0644,
5154 + gpio_active_low_show, gpio_active_low_store);
5155 +
5156 +-static const struct attribute *gpio_attrs[] = {
5157 ++static struct attribute *gpio_attrs[] = {
5158 + &dev_attr_value.attr,
5159 + &dev_attr_active_low.attr,
5160 + NULL,
5161 + };
5162 +
5163 +-static const struct attribute_group gpio_attr_group = {
5164 +- .attrs = (struct attribute **) gpio_attrs,
5165 +-};
5166 ++ATTRIBUTE_GROUPS(gpio);
5167 +
5168 + /*
5169 + * /sys/class/gpio/gpiochipN/
5170 +@@ -627,16 +625,13 @@ static ssize_t chip_ngpio_show(struct device *dev,
5171 + }
5172 + static DEVICE_ATTR(ngpio, 0444, chip_ngpio_show, NULL);
5173 +
5174 +-static const struct attribute *gpiochip_attrs[] = {
5175 ++static struct attribute *gpiochip_attrs[] = {
5176 + &dev_attr_base.attr,
5177 + &dev_attr_label.attr,
5178 + &dev_attr_ngpio.attr,
5179 + NULL,
5180 + };
5181 +-
5182 +-static const struct attribute_group gpiochip_attr_group = {
5183 +- .attrs = (struct attribute **) gpiochip_attrs,
5184 +-};
5185 ++ATTRIBUTE_GROUPS(gpiochip);
5186 +
5187 + /*
5188 + * /sys/class/gpio/export ... write-only
5189 +@@ -791,18 +786,15 @@ static int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
5190 + if (desc->chip->names && desc->chip->names[offset])
5191 + ioname = desc->chip->names[offset];
5192 +
5193 +- dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
5194 +- desc, ioname ? ioname : "gpio%u",
5195 +- desc_to_gpio(desc));
5196 ++ dev = device_create_with_groups(&gpio_class, desc->chip->dev,
5197 ++ MKDEV(0, 0), desc, gpio_groups,
5198 ++ ioname ? ioname : "gpio%u",
5199 ++ desc_to_gpio(desc));
5200 + if (IS_ERR(dev)) {
5201 + status = PTR_ERR(dev);
5202 + goto fail_unlock;
5203 + }
5204 +
5205 +- status = sysfs_create_group(&dev->kobj, &gpio_attr_group);
5206 +- if (status)
5207 +- goto fail_unregister_device;
5208 +-
5209 + if (direction_may_change) {
5210 + status = device_create_file(dev, &dev_attr_direction);
5211 + if (status)
5212 +@@ -813,13 +805,15 @@ static int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
5213 + !test_bit(FLAG_IS_OUT, &desc->flags))) {
5214 + status = device_create_file(dev, &dev_attr_edge);
5215 + if (status)
5216 +- goto fail_unregister_device;
5217 ++ goto fail_remove_attr_direction;
5218 + }
5219 +
5220 + set_bit(FLAG_EXPORT, &desc->flags);
5221 + mutex_unlock(&sysfs_lock);
5222 + return 0;
5223 +
5224 ++fail_remove_attr_direction:
5225 ++ device_remove_file(dev, &dev_attr_direction);
5226 + fail_unregister_device:
5227 + device_unregister(dev);
5228 + fail_unlock:
5229 +@@ -971,6 +965,8 @@ static void gpiod_unexport(struct gpio_desc *desc)
5230 + mutex_unlock(&sysfs_lock);
5231 +
5232 + if (dev) {
5233 ++ device_remove_file(dev, &dev_attr_edge);
5234 ++ device_remove_file(dev, &dev_attr_direction);
5235 + device_unregister(dev);
5236 + put_device(dev);
5237 + }
5238 +@@ -1001,13 +997,13 @@ static int gpiochip_export(struct gpio_chip *chip)
5239 +
5240 + /* use chip->base for the ID; it's already known to be unique */
5241 + mutex_lock(&sysfs_lock);
5242 +- dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0), chip,
5243 +- "gpiochip%d", chip->base);
5244 +- if (!IS_ERR(dev)) {
5245 +- status = sysfs_create_group(&dev->kobj,
5246 +- &gpiochip_attr_group);
5247 +- } else
5248 ++ dev = device_create_with_groups(&gpio_class, chip->dev, MKDEV(0, 0),
5249 ++ chip, gpiochip_groups,
5250 ++ "gpiochip%d", chip->base);
5251 ++ if (IS_ERR(dev))
5252 + status = PTR_ERR(dev);
5253 ++ else
5254 ++ status = 0;
5255 + chip->exported = (status == 0);
5256 + mutex_unlock(&sysfs_lock);
5257 +
5258 +@@ -1216,18 +1212,20 @@ int gpiochip_add(struct gpio_chip *chip)
5259 +
5260 + spin_unlock_irqrestore(&gpio_lock, flags);
5261 +
5262 ++ if (status)
5263 ++ goto fail;
5264 ++
5265 + #ifdef CONFIG_PINCTRL
5266 + INIT_LIST_HEAD(&chip->pin_ranges);
5267 + #endif
5268 +
5269 + of_gpiochip_add(chip);
5270 +
5271 +- if (status)
5272 +- goto fail;
5273 +-
5274 + status = gpiochip_export(chip);
5275 +- if (status)
5276 ++ if (status) {
5277 ++ of_gpiochip_remove(chip);
5278 + goto fail;
5279 ++ }
5280 +
5281 + pr_debug("gpiochip_add: registered GPIOs %d to %d on device: %s\n",
5282 + chip->base, chip->base + chip->ngpio - 1,
5283 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
5284 +index ef5fe7e9d86c..7e4e6896fa81 100644
5285 +--- a/drivers/gpu/drm/i915/i915_gem.c
5286 ++++ b/drivers/gpu/drm/i915/i915_gem.c
5287 +@@ -4795,7 +4795,7 @@ static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task)
5288 + if (!mutex_is_locked(mutex))
5289 + return false;
5290 +
5291 +-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)
5292 ++#if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES)
5293 + return mutex->owner == task;
5294 + #else
5295 + /* Since UP may be pre-empted, we cannot assume that we own the lock */
5296 +diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
5297 +index 5cd69a7cc241..c052e1e49d75 100644
5298 +--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
5299 ++++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
5300 +@@ -126,9 +126,26 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
5301 + r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
5302 + "Graphics Stolen Memory");
5303 + if (r == NULL) {
5304 +- DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
5305 +- base, base + (uint32_t)dev_priv->gtt.stolen_size);
5306 +- base = 0;
5307 ++ /*
5308 ++ * One more attempt but this time requesting region from
5309 ++ * base + 1, as we have seen that this resolves the region
5310 ++ * conflict with the PCI Bus.
5311 ++ * This is a BIOS w/a: Some BIOS wrap stolen in the root
5312 ++ * PCI bus, but have an off-by-one error. Hence retry the
5313 ++ * reservation starting from 1 instead of 0.
5314 ++ */
5315 ++ r = devm_request_mem_region(dev->dev, base + 1,
5316 ++ dev_priv->gtt.stolen_size - 1,
5317 ++ "Graphics Stolen Memory");
5318 ++ /*
5319 ++ * GEN3 firmware likes to smash pci bridges into the stolen
5320 ++ * range. Apparently this works.
5321 ++ */
5322 ++ if (r == NULL && !IS_GEN3(dev)) {
5323 ++ DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
5324 ++ base, base + (uint32_t)dev_priv->gtt.stolen_size);
5325 ++ base = 0;
5326 ++ }
5327 + }
5328 +
5329 + return base;
5330 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
5331 +index 998f774b5fff..9d344da55056 100644
5332 +--- a/drivers/gpu/drm/i915/i915_reg.h
5333 ++++ b/drivers/gpu/drm/i915/i915_reg.h
5334 +@@ -309,6 +309,7 @@
5335 + #define PIPE_CONTROL_GLOBAL_GTT_IVB (1<<24) /* gen7+ */
5336 + #define PIPE_CONTROL_CS_STALL (1<<20)
5337 + #define PIPE_CONTROL_TLB_INVALIDATE (1<<18)
5338 ++#define PIPE_CONTROL_MEDIA_STATE_CLEAR (1<<16)
5339 + #define PIPE_CONTROL_QW_WRITE (1<<14)
5340 + #define PIPE_CONTROL_DEPTH_STALL (1<<13)
5341 + #define PIPE_CONTROL_WRITE_FLUSH (1<<12)
5342 +diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
5343 +index 1ceb95a3bbe0..776ed3f7ef66 100644
5344 +--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
5345 ++++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
5346 +@@ -322,12 +322,15 @@ gen7_render_ring_flush(struct intel_ring_buffer *ring,
5347 + flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE;
5348 + flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE;
5349 + flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE;
5350 ++ flags |= PIPE_CONTROL_MEDIA_STATE_CLEAR;
5351 + /*
5352 + * TLB invalidate requires a post-sync write.
5353 + */
5354 + flags |= PIPE_CONTROL_QW_WRITE;
5355 + flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
5356 +
5357 ++ flags |= PIPE_CONTROL_STALL_AT_SCOREBOARD;
5358 ++
5359 + /* Workaround: we must issue a pipe_control with CS-stall bit
5360 + * set before a pipe_control command that has the state cache
5361 + * invalidate bit set. */
5362 +diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
5363 +index 4601969be373..26059ec8bafc 100644
5364 +--- a/drivers/gpu/drm/radeon/atombios_dp.c
5365 ++++ b/drivers/gpu/drm/radeon/atombios_dp.c
5366 +@@ -574,6 +574,10 @@ int radeon_dp_mode_valid_helper(struct drm_connector *connector,
5367 + struct radeon_connector_atom_dig *dig_connector;
5368 + int dp_clock;
5369 +
5370 ++ if ((mode->clock > 340000) &&
5371 ++ (!radeon_connector_is_dp12_capable(connector)))
5372 ++ return MODE_CLOCK_HIGH;
5373 ++
5374 + if (!radeon_connector->con_priv)
5375 + return MODE_CLOCK_HIGH;
5376 + dig_connector = radeon_connector->con_priv;
5377 +diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
5378 +index 95f4ab99c44b..0a8fc92f6eab 100644
5379 +--- a/drivers/gpu/drm/radeon/ci_dpm.c
5380 ++++ b/drivers/gpu/drm/radeon/ci_dpm.c
5381 +@@ -4698,7 +4698,7 @@ void ci_dpm_disable(struct radeon_device *rdev)
5382 + ci_enable_spread_spectrum(rdev, false);
5383 + ci_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, false);
5384 + ci_stop_dpm(rdev);
5385 +- ci_enable_ds_master_switch(rdev, true);
5386 ++ ci_enable_ds_master_switch(rdev, false);
5387 + ci_enable_ulv(rdev, false);
5388 + ci_clear_vc(rdev);
5389 + ci_reset_to_default(rdev);
5390 +diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
5391 +index 0fc5fd6b3b41..cdc7f408bd18 100644
5392 +--- a/drivers/gpu/drm/radeon/cik.c
5393 ++++ b/drivers/gpu/drm/radeon/cik.c
5394 +@@ -5167,6 +5167,7 @@ static void cik_enable_mgcg(struct radeon_device *rdev, bool enable)
5395 + }
5396 +
5397 + orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE);
5398 ++ data |= 0x00000001;
5399 + data &= 0xfffffffd;
5400 + if (orig != data)
5401 + WREG32(RLC_CGTT_MGCG_OVERRIDE, data);
5402 +@@ -5198,7 +5199,7 @@ static void cik_enable_mgcg(struct radeon_device *rdev, bool enable)
5403 + }
5404 + } else {
5405 + orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE);
5406 +- data |= 0x00000002;
5407 ++ data |= 0x00000003;
5408 + if (orig != data)
5409 + WREG32(RLC_CGTT_MGCG_OVERRIDE, data);
5410 +
5411 +diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
5412 +index 84323c943bfc..02d3c3820803 100644
5413 +--- a/drivers/gpu/drm/radeon/radeon_ttm.c
5414 ++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
5415 +@@ -189,7 +189,7 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo,
5416 + rbo = container_of(bo, struct radeon_bo, tbo);
5417 + switch (bo->mem.mem_type) {
5418 + case TTM_PL_VRAM:
5419 +- if (rbo->rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready == false)
5420 ++ if (rbo->rdev->ring[radeon_copy_ring_index(rbo->rdev)].ready == false)
5421 + radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_CPU);
5422 + else
5423 + radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT);
5424 +diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
5425 +index f5cdc865752a..51588d30d675 100644
5426 +--- a/drivers/gpu/drm/radeon/si_dpm.c
5427 ++++ b/drivers/gpu/drm/radeon/si_dpm.c
5428 +@@ -2901,6 +2901,22 @@ static int si_init_smc_spll_table(struct radeon_device *rdev)
5429 + return ret;
5430 + }
5431 +
5432 ++struct si_dpm_quirk {
5433 ++ u32 chip_vendor;
5434 ++ u32 chip_device;
5435 ++ u32 subsys_vendor;
5436 ++ u32 subsys_device;
5437 ++ u32 max_sclk;
5438 ++ u32 max_mclk;
5439 ++};
5440 ++
5441 ++/* cards with dpm stability problems */
5442 ++static struct si_dpm_quirk si_dpm_quirk_list[] = {
5443 ++ /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */
5444 ++ { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
5445 ++ { 0, 0, 0, 0 },
5446 ++};
5447 ++
5448 + static void si_apply_state_adjust_rules(struct radeon_device *rdev,
5449 + struct radeon_ps *rps)
5450 + {
5451 +@@ -2911,7 +2927,22 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
5452 + u32 mclk, sclk;
5453 + u16 vddc, vddci;
5454 + u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc;
5455 ++ u32 max_sclk = 0, max_mclk = 0;
5456 + int i;
5457 ++ struct si_dpm_quirk *p = si_dpm_quirk_list;
5458 ++
5459 ++ /* Apply dpm quirks */
5460 ++ while (p && p->chip_device != 0) {
5461 ++ if (rdev->pdev->vendor == p->chip_vendor &&
5462 ++ rdev->pdev->device == p->chip_device &&
5463 ++ rdev->pdev->subsystem_vendor == p->subsys_vendor &&
5464 ++ rdev->pdev->subsystem_device == p->subsys_device) {
5465 ++ max_sclk = p->max_sclk;
5466 ++ max_mclk = p->max_mclk;
5467 ++ break;
5468 ++ }
5469 ++ ++p;
5470 ++ }
5471 +
5472 + if ((rdev->pm.dpm.new_active_crtc_count > 1) ||
5473 + ni_dpm_vblank_too_short(rdev))
5474 +@@ -2965,6 +2996,14 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
5475 + if (ps->performance_levels[i].mclk > max_mclk_vddc)
5476 + ps->performance_levels[i].mclk = max_mclk_vddc;
5477 + }
5478 ++ if (max_mclk) {
5479 ++ if (ps->performance_levels[i].mclk > max_mclk)
5480 ++ ps->performance_levels[i].mclk = max_mclk;
5481 ++ }
5482 ++ if (max_sclk) {
5483 ++ if (ps->performance_levels[i].sclk > max_sclk)
5484 ++ ps->performance_levels[i].sclk = max_sclk;
5485 ++ }
5486 + }
5487 +
5488 + /* XXX validate the min clocks required for display */
5489 +diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
5490 +index cf4bad2c1d59..76329d27385b 100644
5491 +--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
5492 ++++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
5493 +@@ -297,11 +297,12 @@ static void ttm_pool_update_free_locked(struct ttm_page_pool *pool,
5494 + *
5495 + * @pool: to free the pages from
5496 + * @free_all: If set to true will free all pages in pool
5497 +- * @gfp: GFP flags.
5498 ++ * @use_static: Safe to use static buffer
5499 + **/
5500 + static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free,
5501 +- gfp_t gfp)
5502 ++ bool use_static)
5503 + {
5504 ++ static struct page *static_buf[NUM_PAGES_TO_ALLOC];
5505 + unsigned long irq_flags;
5506 + struct page *p;
5507 + struct page **pages_to_free;
5508 +@@ -311,7 +312,11 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free,
5509 + if (NUM_PAGES_TO_ALLOC < nr_free)
5510 + npages_to_free = NUM_PAGES_TO_ALLOC;
5511 +
5512 +- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);
5513 ++ if (use_static)
5514 ++ pages_to_free = static_buf;
5515 ++ else
5516 ++ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *),
5517 ++ GFP_KERNEL);
5518 + if (!pages_to_free) {
5519 + pr_err("Failed to allocate memory for pool free operation\n");
5520 + return 0;
5521 +@@ -374,7 +379,8 @@ restart:
5522 + if (freed_pages)
5523 + ttm_pages_put(pages_to_free, freed_pages);
5524 + out:
5525 +- kfree(pages_to_free);
5526 ++ if (pages_to_free != static_buf)
5527 ++ kfree(pages_to_free);
5528 + return nr_free;
5529 + }
5530 +
5531 +@@ -383,8 +389,6 @@ out:
5532 + *
5533 + * XXX: (dchinner) Deadlock warning!
5534 + *
5535 +- * We need to pass sc->gfp_mask to ttm_page_pool_free().
5536 +- *
5537 + * This code is crying out for a shrinker per pool....
5538 + */
5539 + static unsigned long
5540 +@@ -407,8 +411,8 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
5541 + if (shrink_pages == 0)
5542 + break;
5543 + pool = &_manager->pools[(i + pool_offset)%NUM_POOLS];
5544 +- shrink_pages = ttm_page_pool_free(pool, nr_free,
5545 +- sc->gfp_mask);
5546 ++ /* OK to use static buffer since global mutex is held. */
5547 ++ shrink_pages = ttm_page_pool_free(pool, nr_free, true);
5548 + freed += nr_free - shrink_pages;
5549 + }
5550 + mutex_unlock(&lock);
5551 +@@ -710,7 +714,7 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags,
5552 + }
5553 + spin_unlock_irqrestore(&pool->lock, irq_flags);
5554 + if (npages)
5555 +- ttm_page_pool_free(pool, npages, GFP_KERNEL);
5556 ++ ttm_page_pool_free(pool, npages, false);
5557 + }
5558 +
5559 + /*
5560 +@@ -849,9 +853,9 @@ void ttm_page_alloc_fini(void)
5561 + pr_info("Finalizing pool allocator\n");
5562 + ttm_pool_mm_shrink_fini(_manager);
5563 +
5564 ++ /* OK to use static buffer since global mutex is no longer used. */
5565 + for (i = 0; i < NUM_POOLS; ++i)
5566 +- ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES,
5567 +- GFP_KERNEL);
5568 ++ ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES, true);
5569 +
5570 + kobject_put(&_manager->kobj);
5571 + _manager = NULL;
5572 +diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
5573 +index ae86e3513631..9082ca001ae2 100644
5574 +--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
5575 ++++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
5576 +@@ -410,11 +410,12 @@ static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page)
5577 + *
5578 + * @pool: to free the pages from
5579 + * @nr_free: If set to true will free all pages in pool
5580 +- * @gfp: GFP flags.
5581 ++ * @use_static: Safe to use static buffer
5582 + **/
5583 + static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free,
5584 +- gfp_t gfp)
5585 ++ bool use_static)
5586 + {
5587 ++ static struct page *static_buf[NUM_PAGES_TO_ALLOC];
5588 + unsigned long irq_flags;
5589 + struct dma_page *dma_p, *tmp;
5590 + struct page **pages_to_free;
5591 +@@ -431,7 +432,11 @@ static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free,
5592 + npages_to_free, nr_free);
5593 + }
5594 + #endif
5595 +- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp);
5596 ++ if (use_static)
5597 ++ pages_to_free = static_buf;
5598 ++ else
5599 ++ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *),
5600 ++ GFP_KERNEL);
5601 +
5602 + if (!pages_to_free) {
5603 + pr_err("%s: Failed to allocate memory for pool free operation\n",
5604 +@@ -501,7 +506,8 @@ restart:
5605 + if (freed_pages)
5606 + ttm_dma_pages_put(pool, &d_pages, pages_to_free, freed_pages);
5607 + out:
5608 +- kfree(pages_to_free);
5609 ++ if (pages_to_free != static_buf)
5610 ++ kfree(pages_to_free);
5611 + return nr_free;
5612 + }
5613 +
5614 +@@ -530,7 +536,8 @@ static void ttm_dma_free_pool(struct device *dev, enum pool_type type)
5615 + if (pool->type != type)
5616 + continue;
5617 + /* Takes a spinlock.. */
5618 +- ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, GFP_KERNEL);
5619 ++ /* OK to use static buffer since global mutex is held. */
5620 ++ ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, true);
5621 + WARN_ON(((pool->npages_in_use + pool->npages_free) != 0));
5622 + /* This code path is called after _all_ references to the
5623 + * struct device has been dropped - so nobody should be
5624 +@@ -983,7 +990,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
5625 +
5626 + /* shrink pool if necessary (only on !is_cached pools)*/
5627 + if (npages)
5628 +- ttm_dma_page_pool_free(pool, npages, GFP_KERNEL);
5629 ++ ttm_dma_page_pool_free(pool, npages, false);
5630 + ttm->state = tt_unpopulated;
5631 + }
5632 + EXPORT_SYMBOL_GPL(ttm_dma_unpopulate);
5633 +@@ -993,8 +1000,6 @@ EXPORT_SYMBOL_GPL(ttm_dma_unpopulate);
5634 + *
5635 + * XXX: (dchinner) Deadlock warning!
5636 + *
5637 +- * We need to pass sc->gfp_mask to ttm_dma_page_pool_free().
5638 +- *
5639 + * I'm getting sadder as I hear more pathetical whimpers about needing per-pool
5640 + * shrinkers
5641 + */
5642 +@@ -1027,8 +1032,8 @@ ttm_dma_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
5643 + if (++idx < pool_offset)
5644 + continue;
5645 + nr_free = shrink_pages;
5646 +- shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free,
5647 +- sc->gfp_mask);
5648 ++ /* OK to use static buffer since global mutex is held. */
5649 ++ shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free, true);
5650 + freed += nr_free - shrink_pages;
5651 +
5652 + pr_debug("%s: (%s:%d) Asked to shrink %d, have %d more to go\n",
5653 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
5654 +index c62d20e8a6f1..ee742f14ddc2 100644
5655 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
5656 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
5657 +@@ -1049,6 +1049,8 @@ int vmw_event_fence_action_create(struct drm_file *file_priv,
5658 + if (ret != 0)
5659 + goto out_no_queue;
5660 +
5661 ++ return 0;
5662 ++
5663 + out_no_queue:
5664 + event->base.destroy(&event->base);
5665 + out_no_event:
5666 +@@ -1123,17 +1125,10 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
5667 +
5668 + BUG_ON(fence == NULL);
5669 +
5670 +- if (arg->flags & DRM_VMW_FE_FLAG_REQ_TIME)
5671 +- ret = vmw_event_fence_action_create(file_priv, fence,
5672 +- arg->flags,
5673 +- arg->user_data,
5674 +- true);
5675 +- else
5676 +- ret = vmw_event_fence_action_create(file_priv, fence,
5677 +- arg->flags,
5678 +- arg->user_data,
5679 +- true);
5680 +-
5681 ++ ret = vmw_event_fence_action_create(file_priv, fence,
5682 ++ arg->flags,
5683 ++ arg->user_data,
5684 ++ true);
5685 + if (unlikely(ret != 0)) {
5686 + if (ret != -ERESTARTSYS)
5687 + DRM_ERROR("Failed to attach event to fence.\n");
5688 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
5689 +index 245f8922f813..62d73264b3e2 100644
5690 +--- a/drivers/hid/hid-core.c
5691 ++++ b/drivers/hid/hid-core.c
5692 +@@ -1743,6 +1743,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
5693 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
5694 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) },
5695 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) },
5696 ++ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) },
5697 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) },
5698 + { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
5699 + { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) },
5700 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
5701 +index 28f6cdc5aaf9..60348ec399fc 100644
5702 +--- a/drivers/hid/hid-ids.h
5703 ++++ b/drivers/hid/hid-ids.h
5704 +@@ -501,6 +501,7 @@
5705 + #define USB_DEVICE_ID_KYE_GPEN_560 0x5003
5706 + #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010
5707 + #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011
5708 ++#define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a
5709 + #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013
5710 +
5711 + #define USB_VENDOR_ID_LABTEC 0x1020
5712 +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
5713 +index d97f2323af57..6f568b64784b 100644
5714 +--- a/drivers/hid/hid-input.c
5715 ++++ b/drivers/hid/hid-input.c
5716 +@@ -312,6 +312,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
5717 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
5718 + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
5719 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
5720 ++ USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
5721 ++ HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
5722 ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
5723 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
5724 + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
5725 + {}
5726 +diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
5727 +index 8a3552cf3904..a4beb9917b52 100644
5728 +--- a/drivers/hid/hid-kye.c
5729 ++++ b/drivers/hid/hid-kye.c
5730 +@@ -323,6 +323,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
5731 + }
5732 + break;
5733 + case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
5734 ++ case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2:
5735 + if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) {
5736 + rdesc = mousepen_i608x_rdesc_fixed;
5737 + *rsize = sizeof(mousepen_i608x_rdesc_fixed);
5738 +@@ -415,6 +416,7 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id)
5739 + switch (id->product) {
5740 + case USB_DEVICE_ID_KYE_EASYPEN_I405X:
5741 + case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
5742 ++ case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2:
5743 + case USB_DEVICE_ID_KYE_EASYPEN_M610X:
5744 + ret = kye_tablet_enable(hdev);
5745 + if (ret) {
5746 +@@ -438,6 +440,8 @@ static const struct hid_device_id kye_devices[] = {
5747 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
5748 + USB_DEVICE_ID_KYE_MOUSEPEN_I608X) },
5749 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
5750 ++ USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) },
5751 ++ { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
5752 + USB_DEVICE_ID_KYE_EASYPEN_M610X) },
5753 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
5754 + USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
5755 +diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
5756 +index 1a07e07d99a0..47d7e74231e5 100644
5757 +--- a/drivers/hid/hid-roccat-pyra.c
5758 ++++ b/drivers/hid/hid-roccat-pyra.c
5759 +@@ -35,6 +35,8 @@ static struct class *pyra_class;
5760 + static void profile_activated(struct pyra_device *pyra,
5761 + unsigned int new_profile)
5762 + {
5763 ++ if (new_profile >= ARRAY_SIZE(pyra->profile_settings))
5764 ++ return;
5765 + pyra->actual_profile = new_profile;
5766 + pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi;
5767 + }
5768 +@@ -257,9 +259,11 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp,
5769 + if (off != 0 || count != PYRA_SIZE_SETTINGS)
5770 + return -EINVAL;
5771 +
5772 +- mutex_lock(&pyra->pyra_lock);
5773 +-
5774 + settings = (struct pyra_settings const *)buf;
5775 ++ if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings))
5776 ++ return -EINVAL;
5777 ++
5778 ++ mutex_lock(&pyra->pyra_lock);
5779 +
5780 + retval = pyra_set_settings(usb_dev, settings);
5781 + if (retval) {
5782 +diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
5783 +index c1336193b04b..e29d8a0feb5f 100644
5784 +--- a/drivers/hid/i2c-hid/i2c-hid.c
5785 ++++ b/drivers/hid/i2c-hid/i2c-hid.c
5786 +@@ -136,6 +136,7 @@ struct i2c_hid {
5787 + * descriptor. */
5788 + unsigned int bufsize; /* i2c buffer size */
5789 + char *inbuf; /* Input buffer */
5790 ++ char *rawbuf; /* Raw Input buffer */
5791 + char *cmdbuf; /* Command buffer */
5792 + char *argsbuf; /* Command arguments buffer */
5793 +
5794 +@@ -355,7 +356,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
5795 + static void i2c_hid_get_input(struct i2c_hid *ihid)
5796 + {
5797 + int ret, ret_size;
5798 +- int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
5799 ++ int size = ihid->bufsize;
5800 +
5801 + ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
5802 + if (ret != size) {
5803 +@@ -486,9 +487,11 @@ static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type,
5804 + static void i2c_hid_free_buffers(struct i2c_hid *ihid)
5805 + {
5806 + kfree(ihid->inbuf);
5807 ++ kfree(ihid->rawbuf);
5808 + kfree(ihid->argsbuf);
5809 + kfree(ihid->cmdbuf);
5810 + ihid->inbuf = NULL;
5811 ++ ihid->rawbuf = NULL;
5812 + ihid->cmdbuf = NULL;
5813 + ihid->argsbuf = NULL;
5814 + ihid->bufsize = 0;
5815 +@@ -504,10 +507,11 @@ static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size)
5816 + report_size; /* report */
5817 +
5818 + ihid->inbuf = kzalloc(report_size, GFP_KERNEL);
5819 ++ ihid->rawbuf = kzalloc(report_size, GFP_KERNEL);
5820 + ihid->argsbuf = kzalloc(args_len, GFP_KERNEL);
5821 + ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL);
5822 +
5823 +- if (!ihid->inbuf || !ihid->argsbuf || !ihid->cmdbuf) {
5824 ++ if (!ihid->inbuf || !ihid->rawbuf || !ihid->argsbuf || !ihid->cmdbuf) {
5825 + i2c_hid_free_buffers(ihid);
5826 + return -ENOMEM;
5827 + }
5828 +@@ -534,12 +538,12 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,
5829 +
5830 + ret = i2c_hid_get_report(client,
5831 + report_type == HID_FEATURE_REPORT ? 0x03 : 0x01,
5832 +- report_number, ihid->inbuf, ask_count);
5833 ++ report_number, ihid->rawbuf, ask_count);
5834 +
5835 + if (ret < 0)
5836 + return ret;
5837 +
5838 +- ret_count = ihid->inbuf[0] | (ihid->inbuf[1] << 8);
5839 ++ ret_count = ihid->rawbuf[0] | (ihid->rawbuf[1] << 8);
5840 +
5841 + if (ret_count <= 2)
5842 + return 0;
5843 +@@ -548,7 +552,7 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,
5844 +
5845 + /* The query buffer contains the size, dropping it in the reply */
5846 + count = min(count, ret_count - 2);
5847 +- memcpy(buf, ihid->inbuf + 2, count);
5848 ++ memcpy(buf, ihid->rawbuf + 2, count);
5849 +
5850 + return count;
5851 + }
5852 +diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
5853 +index 19b5fc350354..3554496bacf8 100644
5854 +--- a/drivers/hid/usbhid/hid-quirks.c
5855 ++++ b/drivers/hid/usbhid/hid-quirks.c
5856 +@@ -119,6 +119,7 @@ static const struct hid_blacklist {
5857 + { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT },
5858 + { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS },
5859 + { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT },
5860 ++ { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT },
5861 + { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT },
5862 + { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
5863 + { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS },
5864 +diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
5865 +index fa920469bf10..505fe29c75b0 100644
5866 +--- a/drivers/hv/channel_mgmt.c
5867 ++++ b/drivers/hv/channel_mgmt.c
5868 +@@ -202,9 +202,16 @@ static void vmbus_process_rescind_offer(struct work_struct *work)
5869 + unsigned long flags;
5870 + struct vmbus_channel *primary_channel;
5871 + struct vmbus_channel_relid_released msg;
5872 ++ struct device *dev;
5873 ++
5874 ++ if (channel->device_obj) {
5875 ++ dev = get_device(&channel->device_obj->device);
5876 ++ if (dev) {
5877 ++ vmbus_device_unregister(channel->device_obj);
5878 ++ put_device(dev);
5879 ++ }
5880 ++ }
5881 +
5882 +- if (channel->device_obj)
5883 +- vmbus_device_unregister(channel->device_obj);
5884 + memset(&msg, 0, sizeof(struct vmbus_channel_relid_released));
5885 + msg.child_relid = channel->offermsg.child_relid;
5886 + msg.header.msgtype = CHANNELMSG_RELID_RELEASED;
5887 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
5888 +index 7fb89a46d864..60a3ed9f0624 100644
5889 +--- a/drivers/infiniband/ulp/isert/ib_isert.c
5890 ++++ b/drivers/infiniband/ulp/isert/ib_isert.c
5891 +@@ -40,6 +40,7 @@ static DEFINE_MUTEX(device_list_mutex);
5892 + static LIST_HEAD(device_list);
5893 + static struct workqueue_struct *isert_rx_wq;
5894 + static struct workqueue_struct *isert_comp_wq;
5895 ++static struct workqueue_struct *isert_release_wq;
5896 +
5897 + static void
5898 + isert_unmap_cmd(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn);
5899 +@@ -51,6 +52,11 @@ isert_unreg_rdma_frwr(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn
5900 + static int
5901 + isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
5902 + struct isert_rdma_wr *wr);
5903 ++static int
5904 ++isert_rdma_post_recvl(struct isert_conn *isert_conn);
5905 ++static int
5906 ++isert_rdma_accept(struct isert_conn *isert_conn);
5907 ++struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
5908 +
5909 + static void
5910 + isert_qp_event_callback(struct ib_event *e, void *context)
5911 +@@ -131,12 +137,18 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id)
5912 + ret = rdma_create_qp(cma_id, isert_conn->conn_pd, &attr);
5913 + if (ret) {
5914 + pr_err("rdma_create_qp failed for cma_id %d\n", ret);
5915 +- return ret;
5916 ++ goto err;
5917 + }
5918 + isert_conn->conn_qp = cma_id->qp;
5919 + pr_debug("rdma_create_qp() returned success >>>>>>>>>>>>>>>>>>>>>>>>>.\n");
5920 +
5921 + return 0;
5922 ++err:
5923 ++ mutex_lock(&device_list_mutex);
5924 ++ device->cq_active_qps[min_index]--;
5925 ++ mutex_unlock(&device_list_mutex);
5926 ++
5927 ++ return ret;
5928 + }
5929 +
5930 + static void
5931 +@@ -493,8 +505,8 @@ err:
5932 + static int
5933 + isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
5934 + {
5935 +- struct iscsi_np *np = cma_id->context;
5936 +- struct isert_np *isert_np = np->np_context;
5937 ++ struct isert_np *isert_np = cma_id->context;
5938 ++ struct iscsi_np *np = isert_np->np;
5939 + struct isert_conn *isert_conn;
5940 + struct isert_device *device;
5941 + struct ib_device *ib_dev = cma_id->device;
5942 +@@ -519,6 +531,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
5943 + isert_conn->state = ISER_CONN_INIT;
5944 + INIT_LIST_HEAD(&isert_conn->conn_accept_node);
5945 + init_completion(&isert_conn->conn_login_comp);
5946 ++ init_completion(&isert_conn->login_req_comp);
5947 + init_completion(&isert_conn->conn_wait);
5948 + init_completion(&isert_conn->conn_wait_comp_err);
5949 + kref_init(&isert_conn->conn_kref);
5950 +@@ -526,7 +539,6 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
5951 + spin_lock_init(&isert_conn->conn_lock);
5952 + INIT_LIST_HEAD(&isert_conn->conn_frwr_pool);
5953 +
5954 +- cma_id->context = isert_conn;
5955 + isert_conn->conn_cm_id = cma_id;
5956 + isert_conn->responder_resources = event->param.conn.responder_resources;
5957 + isert_conn->initiator_depth = event->param.conn.initiator_depth;
5958 +@@ -586,6 +598,14 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
5959 + if (ret)
5960 + goto out_conn_dev;
5961 +
5962 ++ ret = isert_rdma_post_recvl(isert_conn);
5963 ++ if (ret)
5964 ++ goto out_conn_dev;
5965 ++
5966 ++ ret = isert_rdma_accept(isert_conn);
5967 ++ if (ret)
5968 ++ goto out_conn_dev;
5969 ++
5970 + mutex_lock(&isert_np->np_accept_mutex);
5971 + list_add_tail(&isert_conn->conn_accept_node, &isert_np->np_accept_list);
5972 + mutex_unlock(&isert_np->np_accept_mutex);
5973 +@@ -606,6 +626,7 @@ out_login_buf:
5974 + kfree(isert_conn->login_buf);
5975 + out:
5976 + kfree(isert_conn);
5977 ++ rdma_reject(cma_id, NULL, 0);
5978 + return ret;
5979 + }
5980 +
5981 +@@ -621,18 +642,20 @@ isert_connect_release(struct isert_conn *isert_conn)
5982 + if (device && device->use_frwr)
5983 + isert_conn_free_frwr_pool(isert_conn);
5984 +
5985 ++ isert_free_rx_descriptors(isert_conn);
5986 ++ rdma_destroy_id(isert_conn->conn_cm_id);
5987 ++
5988 + if (isert_conn->conn_qp) {
5989 + cq_index = ((struct isert_cq_desc *)
5990 + isert_conn->conn_qp->recv_cq->cq_context)->cq_index;
5991 + pr_debug("isert_connect_release: cq_index: %d\n", cq_index);
5992 ++ mutex_lock(&device_list_mutex);
5993 + isert_conn->conn_device->cq_active_qps[cq_index]--;
5994 ++ mutex_unlock(&device_list_mutex);
5995 +
5996 +- rdma_destroy_qp(isert_conn->conn_cm_id);
5997 ++ ib_destroy_qp(isert_conn->conn_qp);
5998 + }
5999 +
6000 +- isert_free_rx_descriptors(isert_conn);
6001 +- rdma_destroy_id(isert_conn->conn_cm_id);
6002 +-
6003 + if (isert_conn->login_buf) {
6004 + ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma,
6005 + ISER_RX_LOGIN_SIZE, DMA_TO_DEVICE);
6006 +@@ -652,9 +675,19 @@ isert_connect_release(struct isert_conn *isert_conn)
6007 + static void
6008 + isert_connected_handler(struct rdma_cm_id *cma_id)
6009 + {
6010 +- struct isert_conn *isert_conn = cma_id->context;
6011 ++ struct isert_conn *isert_conn = cma_id->qp->qp_context;
6012 ++
6013 ++ pr_info("conn %p\n", isert_conn);
6014 +
6015 +- kref_get(&isert_conn->conn_kref);
6016 ++ if (!kref_get_unless_zero(&isert_conn->conn_kref)) {
6017 ++ pr_warn("conn %p connect_release is running\n", isert_conn);
6018 ++ return;
6019 ++ }
6020 ++
6021 ++ mutex_lock(&isert_conn->conn_mutex);
6022 ++ if (isert_conn->state != ISER_CONN_FULL_FEATURE)
6023 ++ isert_conn->state = ISER_CONN_UP;
6024 ++ mutex_unlock(&isert_conn->conn_mutex);
6025 + }
6026 +
6027 + static void
6028 +@@ -675,65 +708,108 @@ isert_put_conn(struct isert_conn *isert_conn)
6029 + kref_put(&isert_conn->conn_kref, isert_release_conn_kref);
6030 + }
6031 +
6032 ++/**
6033 ++ * isert_conn_terminate() - Initiate connection termination
6034 ++ * @isert_conn: isert connection struct
6035 ++ *
6036 ++ * Notes:
6037 ++ * In case the connection state is FULL_FEATURE, move state
6038 ++ * to TEMINATING and start teardown sequence (rdma_disconnect).
6039 ++ * In case the connection state is UP, complete flush as well.
6040 ++ *
6041 ++ * This routine must be called with conn_mutex held. Thus it is
6042 ++ * safe to call multiple times.
6043 ++ */
6044 + static void
6045 +-isert_disconnect_work(struct work_struct *work)
6046 ++isert_conn_terminate(struct isert_conn *isert_conn)
6047 + {
6048 +- struct isert_conn *isert_conn = container_of(work,
6049 +- struct isert_conn, conn_logout_work);
6050 ++ int err;
6051 +
6052 +- pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
6053 +- mutex_lock(&isert_conn->conn_mutex);
6054 +- if (isert_conn->state == ISER_CONN_UP)
6055 ++ switch (isert_conn->state) {
6056 ++ case ISER_CONN_TERMINATING:
6057 ++ break;
6058 ++ case ISER_CONN_UP:
6059 ++ /*
6060 ++ * No flush completions will occur as we didn't
6061 ++ * get to ISER_CONN_FULL_FEATURE yet, complete
6062 ++ * to allow teardown progress.
6063 ++ */
6064 ++ complete(&isert_conn->conn_wait_comp_err);
6065 ++ case ISER_CONN_FULL_FEATURE: /* FALLTHRU */
6066 ++ pr_info("Terminating conn %p state %d\n",
6067 ++ isert_conn, isert_conn->state);
6068 + isert_conn->state = ISER_CONN_TERMINATING;
6069 +-
6070 +- if (isert_conn->post_recv_buf_count == 0 &&
6071 +- atomic_read(&isert_conn->post_send_buf_count) == 0) {
6072 +- mutex_unlock(&isert_conn->conn_mutex);
6073 +- goto wake_up;
6074 +- }
6075 +- if (!isert_conn->conn_cm_id) {
6076 +- mutex_unlock(&isert_conn->conn_mutex);
6077 +- isert_put_conn(isert_conn);
6078 +- return;
6079 ++ err = rdma_disconnect(isert_conn->conn_cm_id);
6080 ++ if (err)
6081 ++ pr_warn("Failed rdma_disconnect isert_conn %p\n",
6082 ++ isert_conn);
6083 ++ break;
6084 ++ default:
6085 ++ pr_warn("conn %p teminating in state %d\n",
6086 ++ isert_conn, isert_conn->state);
6087 + }
6088 ++}
6089 +
6090 +- if (isert_conn->disconnect) {
6091 +- /* Send DREQ/DREP towards our initiator */
6092 +- rdma_disconnect(isert_conn->conn_cm_id);
6093 +- }
6094 ++static int
6095 ++isert_np_cma_handler(struct isert_np *isert_np,
6096 ++ enum rdma_cm_event_type event)
6097 ++{
6098 ++ pr_debug("isert np %p, handling event %d\n", isert_np, event);
6099 +
6100 +- mutex_unlock(&isert_conn->conn_mutex);
6101 ++ switch (event) {
6102 ++ case RDMA_CM_EVENT_DEVICE_REMOVAL:
6103 ++ isert_np->np_cm_id = NULL;
6104 ++ break;
6105 ++ case RDMA_CM_EVENT_ADDR_CHANGE:
6106 ++ isert_np->np_cm_id = isert_setup_id(isert_np);
6107 ++ if (IS_ERR(isert_np->np_cm_id)) {
6108 ++ pr_err("isert np %p setup id failed: %ld\n",
6109 ++ isert_np, PTR_ERR(isert_np->np_cm_id));
6110 ++ isert_np->np_cm_id = NULL;
6111 ++ }
6112 ++ break;
6113 ++ default:
6114 ++ pr_err("isert np %p Unexpected event %d\n",
6115 ++ isert_np, event);
6116 ++ }
6117 +
6118 +-wake_up:
6119 +- complete(&isert_conn->conn_wait);
6120 ++ return -1;
6121 + }
6122 +
6123 + static int
6124 +-isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect)
6125 ++isert_disconnected_handler(struct rdma_cm_id *cma_id,
6126 ++ enum rdma_cm_event_type event)
6127 + {
6128 ++ struct isert_np *isert_np = cma_id->context;
6129 + struct isert_conn *isert_conn;
6130 +
6131 +- if (!cma_id->qp) {
6132 +- struct isert_np *isert_np = cma_id->context;
6133 ++ if (isert_np->np_cm_id == cma_id)
6134 ++ return isert_np_cma_handler(cma_id->context, event);
6135 +
6136 +- isert_np->np_cm_id = NULL;
6137 +- return -1;
6138 +- }
6139 ++ isert_conn = cma_id->qp->qp_context;
6140 +
6141 +- isert_conn = (struct isert_conn *)cma_id->context;
6142 ++ mutex_lock(&isert_conn->conn_mutex);
6143 ++ isert_conn_terminate(isert_conn);
6144 ++ mutex_unlock(&isert_conn->conn_mutex);
6145 +
6146 +- isert_conn->disconnect = disconnect;
6147 +- INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work);
6148 +- schedule_work(&isert_conn->conn_logout_work);
6149 ++ pr_info("conn %p completing conn_wait\n", isert_conn);
6150 ++ complete(&isert_conn->conn_wait);
6151 +
6152 + return 0;
6153 + }
6154 +
6155 ++static void
6156 ++isert_connect_error(struct rdma_cm_id *cma_id)
6157 ++{
6158 ++ struct isert_conn *isert_conn = cma_id->qp->qp_context;
6159 ++
6160 ++ isert_put_conn(isert_conn);
6161 ++}
6162 ++
6163 + static int
6164 + isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
6165 + {
6166 + int ret = 0;
6167 +- bool disconnect = false;
6168 +
6169 + pr_debug("isert_cma_handler: event %d status %d conn %p id %p\n",
6170 + event->event, event->status, cma_id->context, cma_id);
6171 +@@ -751,11 +827,14 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
6172 + case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */
6173 + case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */
6174 + case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
6175 +- disconnect = true;
6176 + case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */
6177 +- ret = isert_disconnected_handler(cma_id, disconnect);
6178 ++ ret = isert_disconnected_handler(cma_id, event->event);
6179 + break;
6180 ++ case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */
6181 ++ case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */
6182 + case RDMA_CM_EVENT_CONNECT_ERROR:
6183 ++ isert_connect_error(cma_id);
6184 ++ break;
6185 + default:
6186 + pr_err("Unhandled RDMA CMA event: %d\n", event->event);
6187 + break;
6188 +@@ -966,7 +1045,10 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login,
6189 + if (ret)
6190 + return ret;
6191 +
6192 +- isert_conn->state = ISER_CONN_UP;
6193 ++ /* Now we are in FULL_FEATURE phase */
6194 ++ mutex_lock(&isert_conn->conn_mutex);
6195 ++ isert_conn->state = ISER_CONN_FULL_FEATURE;
6196 ++ mutex_unlock(&isert_conn->conn_mutex);
6197 + goto post_send;
6198 + }
6199 +
6200 +@@ -983,18 +1065,17 @@ post_send:
6201 + }
6202 +
6203 + static void
6204 +-isert_rx_login_req(struct iser_rx_desc *rx_desc, int rx_buflen,
6205 +- struct isert_conn *isert_conn)
6206 ++isert_rx_login_req(struct isert_conn *isert_conn)
6207 + {
6208 ++ struct iser_rx_desc *rx_desc = (void *)isert_conn->login_req_buf;
6209 ++ int rx_buflen = isert_conn->login_req_len;
6210 + struct iscsi_conn *conn = isert_conn->conn;
6211 + struct iscsi_login *login = conn->conn_login;
6212 + int size;
6213 +
6214 +- if (!login) {
6215 +- pr_err("conn->conn_login is NULL\n");
6216 +- dump_stack();
6217 +- return;
6218 +- }
6219 ++ pr_info("conn %p\n", isert_conn);
6220 ++
6221 ++ WARN_ON_ONCE(!login);
6222 +
6223 + if (login->first_request) {
6224 + struct iscsi_login_req *login_req =
6225 +@@ -1357,11 +1438,20 @@ isert_rx_completion(struct iser_rx_desc *desc, struct isert_conn *isert_conn,
6226 + hdr->opcode, hdr->itt, hdr->flags,
6227 + (int)(xfer_len - ISER_HEADERS_LEN));
6228 +
6229 +- if ((char *)desc == isert_conn->login_req_buf)
6230 +- isert_rx_login_req(desc, xfer_len - ISER_HEADERS_LEN,
6231 +- isert_conn);
6232 +- else
6233 ++ if ((char *)desc == isert_conn->login_req_buf) {
6234 ++ isert_conn->login_req_len = xfer_len - ISER_HEADERS_LEN;
6235 ++ if (isert_conn->conn) {
6236 ++ struct iscsi_login *login = isert_conn->conn->conn_login;
6237 ++
6238 ++ if (login && !login->first_request)
6239 ++ isert_rx_login_req(isert_conn);
6240 ++ }
6241 ++ mutex_lock(&isert_conn->conn_mutex);
6242 ++ complete(&isert_conn->login_req_comp);
6243 ++ mutex_unlock(&isert_conn->conn_mutex);
6244 ++ } else {
6245 + isert_rx_do_work(desc, isert_conn);
6246 ++ }
6247 +
6248 + ib_dma_sync_single_for_device(ib_dev, rx_dma, rx_buflen,
6249 + DMA_FROM_DEVICE);
6250 +@@ -1706,7 +1796,7 @@ isert_cq_rx_comp_err(struct isert_conn *isert_conn)
6251 + msleep(3000);
6252 +
6253 + mutex_lock(&isert_conn->conn_mutex);
6254 +- isert_conn->state = ISER_CONN_DOWN;
6255 ++ isert_conn_terminate(isert_conn);
6256 + mutex_unlock(&isert_conn->conn_mutex);
6257 +
6258 + iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
6259 +@@ -2486,13 +2576,51 @@ isert_response_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state)
6260 + return ret;
6261 + }
6262 +
6263 ++struct rdma_cm_id *
6264 ++isert_setup_id(struct isert_np *isert_np)
6265 ++{
6266 ++ struct iscsi_np *np = isert_np->np;
6267 ++ struct rdma_cm_id *id;
6268 ++ struct sockaddr *sa;
6269 ++ int ret;
6270 ++
6271 ++ sa = (struct sockaddr *)&np->np_sockaddr;
6272 ++ pr_debug("ksockaddr: %p, sa: %p\n", &np->np_sockaddr, sa);
6273 ++
6274 ++ id = rdma_create_id(isert_cma_handler, isert_np,
6275 ++ RDMA_PS_TCP, IB_QPT_RC);
6276 ++ if (IS_ERR(id)) {
6277 ++ pr_err("rdma_create_id() failed: %ld\n", PTR_ERR(id));
6278 ++ ret = PTR_ERR(id);
6279 ++ goto out;
6280 ++ }
6281 ++ pr_debug("id %p context %p\n", id, id->context);
6282 ++
6283 ++ ret = rdma_bind_addr(id, sa);
6284 ++ if (ret) {
6285 ++ pr_err("rdma_bind_addr() failed: %d\n", ret);
6286 ++ goto out_id;
6287 ++ }
6288 ++
6289 ++ ret = rdma_listen(id, ISERT_RDMA_LISTEN_BACKLOG);
6290 ++ if (ret) {
6291 ++ pr_err("rdma_listen() failed: %d\n", ret);
6292 ++ goto out_id;
6293 ++ }
6294 ++
6295 ++ return id;
6296 ++out_id:
6297 ++ rdma_destroy_id(id);
6298 ++out:
6299 ++ return ERR_PTR(ret);
6300 ++}
6301 ++
6302 + static int
6303 + isert_setup_np(struct iscsi_np *np,
6304 + struct __kernel_sockaddr_storage *ksockaddr)
6305 + {
6306 + struct isert_np *isert_np;
6307 + struct rdma_cm_id *isert_lid;
6308 +- struct sockaddr *sa;
6309 + int ret;
6310 +
6311 + isert_np = kzalloc(sizeof(struct isert_np), GFP_KERNEL);
6312 +@@ -2504,9 +2632,8 @@ isert_setup_np(struct iscsi_np *np,
6313 + mutex_init(&isert_np->np_accept_mutex);
6314 + INIT_LIST_HEAD(&isert_np->np_accept_list);
6315 + init_completion(&isert_np->np_login_comp);
6316 ++ isert_np->np = np;
6317 +
6318 +- sa = (struct sockaddr *)ksockaddr;
6319 +- pr_debug("ksockaddr: %p, sa: %p\n", ksockaddr, sa);
6320 + /*
6321 + * Setup the np->np_sockaddr from the passed sockaddr setup
6322 + * in iscsi_target_configfs.c code..
6323 +@@ -2514,37 +2641,20 @@ isert_setup_np(struct iscsi_np *np,
6324 + memcpy(&np->np_sockaddr, ksockaddr,
6325 + sizeof(struct __kernel_sockaddr_storage));
6326 +
6327 +- isert_lid = rdma_create_id(isert_cma_handler, np, RDMA_PS_TCP,
6328 +- IB_QPT_RC);
6329 ++ isert_lid = isert_setup_id(isert_np);
6330 + if (IS_ERR(isert_lid)) {
6331 +- pr_err("rdma_create_id() for isert_listen_handler failed: %ld\n",
6332 +- PTR_ERR(isert_lid));
6333 + ret = PTR_ERR(isert_lid);
6334 + goto out;
6335 + }
6336 +
6337 +- ret = rdma_bind_addr(isert_lid, sa);
6338 +- if (ret) {
6339 +- pr_err("rdma_bind_addr() for isert_lid failed: %d\n", ret);
6340 +- goto out_lid;
6341 +- }
6342 +-
6343 +- ret = rdma_listen(isert_lid, ISERT_RDMA_LISTEN_BACKLOG);
6344 +- if (ret) {
6345 +- pr_err("rdma_listen() for isert_lid failed: %d\n", ret);
6346 +- goto out_lid;
6347 +- }
6348 +-
6349 + isert_np->np_cm_id = isert_lid;
6350 + np->np_context = isert_np;
6351 +- pr_debug("Setup isert_lid->context: %p\n", isert_lid->context);
6352 +
6353 + return 0;
6354 +
6355 +-out_lid:
6356 +- rdma_destroy_id(isert_lid);
6357 + out:
6358 + kfree(isert_np);
6359 ++
6360 + return ret;
6361 + }
6362 +
6363 +@@ -2580,7 +2690,15 @@ isert_get_login_rx(struct iscsi_conn *conn, struct iscsi_login *login)
6364 + struct isert_conn *isert_conn = (struct isert_conn *)conn->context;
6365 + int ret;
6366 +
6367 +- pr_debug("isert_get_login_rx before conn_login_comp conn: %p\n", conn);
6368 ++ pr_info("before login_req comp conn: %p\n", isert_conn);
6369 ++ ret = wait_for_completion_interruptible(&isert_conn->login_req_comp);
6370 ++ if (ret) {
6371 ++ pr_err("isert_conn %p interrupted before got login req\n",
6372 ++ isert_conn);
6373 ++ return ret;
6374 ++ }
6375 ++ INIT_COMPLETION(isert_conn->login_req_comp);
6376 ++
6377 + /*
6378 + * For login requests after the first PDU, isert_rx_login_req() will
6379 + * kick schedule_delayed_work(&conn->login_work) as the packet is
6380 +@@ -2590,11 +2708,15 @@ isert_get_login_rx(struct iscsi_conn *conn, struct iscsi_login *login)
6381 + if (!login->first_request)
6382 + return 0;
6383 +
6384 ++ isert_rx_login_req(isert_conn);
6385 ++
6386 ++ pr_info("before conn_login_comp conn: %p\n", conn);
6387 + ret = wait_for_completion_interruptible(&isert_conn->conn_login_comp);
6388 + if (ret)
6389 + return ret;
6390 +
6391 +- pr_debug("isert_get_login_rx processing login->req: %p\n", login->req);
6392 ++ pr_info("processing login->req: %p\n", login->req);
6393 ++
6394 + return 0;
6395 + }
6396 +
6397 +@@ -2672,17 +2794,10 @@ accept_wait:
6398 + isert_conn->conn = conn;
6399 + max_accept = 0;
6400 +
6401 +- ret = isert_rdma_post_recvl(isert_conn);
6402 +- if (ret)
6403 +- return ret;
6404 +-
6405 +- ret = isert_rdma_accept(isert_conn);
6406 +- if (ret)
6407 +- return ret;
6408 +-
6409 + isert_set_conn_info(np, conn, isert_conn);
6410 +
6411 +- pr_debug("Processing isert_accept_np: isert_conn: %p\n", isert_conn);
6412 ++ pr_debug("Processing isert_conn: %p\n", isert_conn);
6413 ++
6414 + return 0;
6415 + }
6416 +
6417 +@@ -2698,6 +2813,24 @@ isert_free_np(struct iscsi_np *np)
6418 + kfree(isert_np);
6419 + }
6420 +
6421 ++static void isert_release_work(struct work_struct *work)
6422 ++{
6423 ++ struct isert_conn *isert_conn = container_of(work,
6424 ++ struct isert_conn,
6425 ++ release_work);
6426 ++
6427 ++ pr_info("Starting release conn %p\n", isert_conn);
6428 ++
6429 ++ wait_for_completion(&isert_conn->conn_wait);
6430 ++
6431 ++ mutex_lock(&isert_conn->conn_mutex);
6432 ++ isert_conn->state = ISER_CONN_DOWN;
6433 ++ mutex_unlock(&isert_conn->conn_mutex);
6434 ++
6435 ++ pr_info("Destroying conn %p\n", isert_conn);
6436 ++ isert_put_conn(isert_conn);
6437 ++}
6438 ++
6439 + static void isert_wait_conn(struct iscsi_conn *conn)
6440 + {
6441 + struct isert_conn *isert_conn = conn->context;
6442 +@@ -2705,10 +2838,6 @@ static void isert_wait_conn(struct iscsi_conn *conn)
6443 + pr_debug("isert_wait_conn: Starting \n");
6444 +
6445 + mutex_lock(&isert_conn->conn_mutex);
6446 +- if (isert_conn->conn_cm_id) {
6447 +- pr_debug("Calling rdma_disconnect from isert_wait_conn\n");
6448 +- rdma_disconnect(isert_conn->conn_cm_id);
6449 +- }
6450 + /*
6451 + * Only wait for conn_wait_comp_err if the isert_conn made it
6452 + * into full feature phase..
6453 +@@ -2717,14 +2846,13 @@ static void isert_wait_conn(struct iscsi_conn *conn)
6454 + mutex_unlock(&isert_conn->conn_mutex);
6455 + return;
6456 + }
6457 +- if (isert_conn->state == ISER_CONN_UP)
6458 +- isert_conn->state = ISER_CONN_TERMINATING;
6459 ++ isert_conn_terminate(isert_conn);
6460 + mutex_unlock(&isert_conn->conn_mutex);
6461 +
6462 + wait_for_completion(&isert_conn->conn_wait_comp_err);
6463 +
6464 +- wait_for_completion(&isert_conn->conn_wait);
6465 +- isert_put_conn(isert_conn);
6466 ++ INIT_WORK(&isert_conn->release_work, isert_release_work);
6467 ++ queue_work(isert_release_wq, &isert_conn->release_work);
6468 + }
6469 +
6470 + static void isert_free_conn(struct iscsi_conn *conn)
6471 +@@ -2770,10 +2898,21 @@ static int __init isert_init(void)
6472 + goto destroy_rx_wq;
6473 + }
6474 +
6475 ++ isert_release_wq = alloc_workqueue("isert_release_wq", WQ_UNBOUND,
6476 ++ WQ_UNBOUND_MAX_ACTIVE);
6477 ++ if (!isert_release_wq) {
6478 ++ pr_err("Unable to allocate isert_release_wq\n");
6479 ++ ret = -ENOMEM;
6480 ++ goto destroy_comp_wq;
6481 ++ }
6482 ++
6483 + iscsit_register_transport(&iser_target_transport);
6484 +- pr_debug("iSER_TARGET[0] - Loaded iser_target_transport\n");
6485 ++ pr_info("iSER_TARGET[0] - Loaded iser_target_transport\n");
6486 ++
6487 + return 0;
6488 +
6489 ++destroy_comp_wq:
6490 ++ destroy_workqueue(isert_comp_wq);
6491 + destroy_rx_wq:
6492 + destroy_workqueue(isert_rx_wq);
6493 + return ret;
6494 +@@ -2782,6 +2921,7 @@ destroy_rx_wq:
6495 + static void __exit isert_exit(void)
6496 + {
6497 + flush_scheduled_work();
6498 ++ destroy_workqueue(isert_release_wq);
6499 + destroy_workqueue(isert_comp_wq);
6500 + destroy_workqueue(isert_rx_wq);
6501 + iscsit_unregister_transport(&iser_target_transport);
6502 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
6503 +index 90e6aa3c25d2..1ea527974beb 100644
6504 +--- a/drivers/infiniband/ulp/isert/ib_isert.h
6505 ++++ b/drivers/infiniband/ulp/isert/ib_isert.h
6506 +@@ -23,6 +23,7 @@ enum iser_ib_op_code {
6507 + enum iser_conn_state {
6508 + ISER_CONN_INIT,
6509 + ISER_CONN_UP,
6510 ++ ISER_CONN_FULL_FEATURE,
6511 + ISER_CONN_TERMINATING,
6512 + ISER_CONN_DOWN,
6513 + };
6514 +@@ -99,6 +100,7 @@ struct isert_conn {
6515 + char *login_req_buf;
6516 + char *login_rsp_buf;
6517 + u64 login_req_dma;
6518 ++ int login_req_len;
6519 + u64 login_rsp_dma;
6520 + unsigned int conn_rx_desc_head;
6521 + struct iser_rx_desc *conn_rx_descs;
6522 +@@ -106,13 +108,13 @@ struct isert_conn {
6523 + struct iscsi_conn *conn;
6524 + struct list_head conn_accept_node;
6525 + struct completion conn_login_comp;
6526 ++ struct completion login_req_comp;
6527 + struct iser_tx_desc conn_login_tx_desc;
6528 + struct rdma_cm_id *conn_cm_id;
6529 + struct ib_pd *conn_pd;
6530 + struct ib_mr *conn_mr;
6531 + struct ib_qp *conn_qp;
6532 + struct isert_device *conn_device;
6533 +- struct work_struct conn_logout_work;
6534 + struct mutex conn_mutex;
6535 + struct completion conn_wait;
6536 + struct completion conn_wait_comp_err;
6537 +@@ -121,7 +123,7 @@ struct isert_conn {
6538 + int conn_frwr_pool_size;
6539 + /* lock to protect frwr_pool */
6540 + spinlock_t conn_lock;
6541 +- bool disconnect;
6542 ++ struct work_struct release_work;
6543 + };
6544 +
6545 + #define ISERT_MAX_CQ 64
6546 +@@ -154,6 +156,7 @@ struct isert_device {
6547 + };
6548 +
6549 + struct isert_np {
6550 ++ struct iscsi_np *np;
6551 + struct semaphore np_sem;
6552 + struct rdma_cm_id *np_cm_id;
6553 + struct mutex np_accept_mutex;
6554 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
6555 +index a4ac027637b9..c1d156aad8fc 100644
6556 +--- a/drivers/input/serio/i8042-x86ia64io.h
6557 ++++ b/drivers/input/serio/i8042-x86ia64io.h
6558 +@@ -415,6 +415,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
6559 + },
6560 + },
6561 + {
6562 ++ /* Acer Aspire 7738 */
6563 ++ .matches = {
6564 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
6565 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"),
6566 ++ },
6567 ++ },
6568 ++ {
6569 + /* Gericom Bellagio */
6570 + .matches = {
6571 + DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
6572 +@@ -728,6 +735,35 @@ static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
6573 + { }
6574 + };
6575 +
6576 ++/*
6577 ++ * Some laptops need keyboard reset before probing for the trackpad to get
6578 ++ * it detected, initialised & finally work.
6579 ++ */
6580 ++static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
6581 ++ {
6582 ++ /* Gigabyte P35 v2 - Elantech touchpad */
6583 ++ .matches = {
6584 ++ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
6585 ++ DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
6586 ++ },
6587 ++ },
6588 ++ {
6589 ++ /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */
6590 ++ .matches = {
6591 ++ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
6592 ++ DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
6593 ++ },
6594 ++ },
6595 ++ {
6596 ++ /* Gigabyte P34 - Elantech touchpad */
6597 ++ .matches = {
6598 ++ DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
6599 ++ DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
6600 ++ },
6601 ++ },
6602 ++ { }
6603 ++};
6604 ++
6605 + #endif /* CONFIG_X86 */
6606 +
6607 + #ifdef CONFIG_PNP
6608 +@@ -1023,6 +1059,9 @@ static int __init i8042_platform_init(void)
6609 + if (dmi_check_system(i8042_dmi_dritek_table))
6610 + i8042_dritek = true;
6611 +
6612 ++ if (dmi_check_system(i8042_dmi_kbdreset_table))
6613 ++ i8042_kbdreset = true;
6614 ++
6615 + /*
6616 + * A20 was already enabled during early kernel init. But some buggy
6617 + * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
6618 +diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
6619 +index 03ab163857dd..e38024cf0227 100644
6620 +--- a/drivers/input/serio/i8042.c
6621 ++++ b/drivers/input/serio/i8042.c
6622 +@@ -67,6 +67,10 @@ static bool i8042_notimeout;
6623 + module_param_named(notimeout, i8042_notimeout, bool, 0);
6624 + MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042");
6625 +
6626 ++static bool i8042_kbdreset;
6627 ++module_param_named(kbdreset, i8042_kbdreset, bool, 0);
6628 ++MODULE_PARM_DESC(kbdreset, "Reset device connected to KBD port");
6629 ++
6630 + #ifdef CONFIG_X86
6631 + static bool i8042_dritek;
6632 + module_param_named(dritek, i8042_dritek, bool, 0);
6633 +@@ -790,6 +794,16 @@ static int __init i8042_check_aux(void)
6634 + return -1;
6635 +
6636 + /*
6637 ++ * Reset keyboard (needed on some laptops to successfully detect
6638 ++ * touchpad, e.g., some Gigabyte laptop models with Elantech
6639 ++ * touchpads).
6640 ++ */
6641 ++ if (i8042_kbdreset) {
6642 ++ pr_warn("Attempting to reset device connected to KBD port\n");
6643 ++ i8042_kbd_write(NULL, (unsigned char) 0xff);
6644 ++ }
6645 ++
6646 ++/*
6647 + * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and
6648 + * used it for a PCI card or somethig else.
6649 + */
6650 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
6651 +index 911ecb230b5a..fd0516c9fbfe 100644
6652 +--- a/drivers/iommu/intel-iommu.c
6653 ++++ b/drivers/iommu/intel-iommu.c
6654 +@@ -1796,7 +1796,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
6655 + struct dma_pte *first_pte = NULL, *pte = NULL;
6656 + phys_addr_t uninitialized_var(pteval);
6657 + int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
6658 +- unsigned long sg_res;
6659 ++ unsigned long sg_res = 0;
6660 + unsigned int largepage_lvl = 0;
6661 + unsigned long lvl_pages = 0;
6662 +
6663 +@@ -1807,10 +1807,8 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
6664 +
6665 + prot &= DMA_PTE_READ | DMA_PTE_WRITE | DMA_PTE_SNP;
6666 +
6667 +- if (sg)
6668 +- sg_res = 0;
6669 +- else {
6670 +- sg_res = nr_pages + 1;
6671 ++ if (!sg) {
6672 ++ sg_res = nr_pages;
6673 + pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot;
6674 + }
6675 +
6676 +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
6677 +index d1734d9d9c79..26ca4db908b9 100644
6678 +--- a/drivers/md/bcache/btree.c
6679 ++++ b/drivers/md/bcache/btree.c
6680 +@@ -141,7 +141,7 @@ static void bch_btree_node_read_done(struct btree *b)
6681 + struct bset *i = b->sets[0].data;
6682 + struct btree_iter *iter;
6683 +
6684 +- iter = mempool_alloc(b->c->fill_iter, GFP_NOWAIT);
6685 ++ iter = mempool_alloc(b->c->fill_iter, GFP_NOIO);
6686 + iter->size = b->c->sb.bucket_size / b->c->sb.block_size;
6687 + iter->used = 0;
6688 +
6689 +diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
6690 +index b564c0610259..0bfd9c0611a0 100644
6691 +--- a/drivers/md/dm-cache-metadata.c
6692 ++++ b/drivers/md/dm-cache-metadata.c
6693 +@@ -88,6 +88,9 @@ struct cache_disk_superblock {
6694 + } __packed;
6695 +
6696 + struct dm_cache_metadata {
6697 ++ atomic_t ref_count;
6698 ++ struct list_head list;
6699 ++
6700 + struct block_device *bdev;
6701 + struct dm_block_manager *bm;
6702 + struct dm_space_map *metadata_sm;
6703 +@@ -650,10 +653,10 @@ static void unpack_value(__le64 value_le, dm_oblock_t *block, unsigned *flags)
6704 +
6705 + /*----------------------------------------------------------------*/
6706 +
6707 +-struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
6708 +- sector_t data_block_size,
6709 +- bool may_format_device,
6710 +- size_t policy_hint_size)
6711 ++static struct dm_cache_metadata *metadata_open(struct block_device *bdev,
6712 ++ sector_t data_block_size,
6713 ++ bool may_format_device,
6714 ++ size_t policy_hint_size)
6715 + {
6716 + int r;
6717 + struct dm_cache_metadata *cmd;
6718 +@@ -664,6 +667,7 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
6719 + return NULL;
6720 + }
6721 +
6722 ++ atomic_set(&cmd->ref_count, 1);
6723 + init_rwsem(&cmd->root_lock);
6724 + cmd->bdev = bdev;
6725 + cmd->data_block_size = data_block_size;
6726 +@@ -686,10 +690,95 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
6727 + return cmd;
6728 + }
6729 +
6730 ++/*
6731 ++ * We keep a little list of ref counted metadata objects to prevent two
6732 ++ * different target instances creating separate bufio instances. This is
6733 ++ * an issue if a table is reloaded before the suspend.
6734 ++ */
6735 ++static DEFINE_MUTEX(table_lock);
6736 ++static LIST_HEAD(table);
6737 ++
6738 ++static struct dm_cache_metadata *lookup(struct block_device *bdev)
6739 ++{
6740 ++ struct dm_cache_metadata *cmd;
6741 ++
6742 ++ list_for_each_entry(cmd, &table, list)
6743 ++ if (cmd->bdev == bdev) {
6744 ++ atomic_inc(&cmd->ref_count);
6745 ++ return cmd;
6746 ++ }
6747 ++
6748 ++ return NULL;
6749 ++}
6750 ++
6751 ++static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev,
6752 ++ sector_t data_block_size,
6753 ++ bool may_format_device,
6754 ++ size_t policy_hint_size)
6755 ++{
6756 ++ struct dm_cache_metadata *cmd, *cmd2;
6757 ++
6758 ++ mutex_lock(&table_lock);
6759 ++ cmd = lookup(bdev);
6760 ++ mutex_unlock(&table_lock);
6761 ++
6762 ++ if (cmd)
6763 ++ return cmd;
6764 ++
6765 ++ cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size);
6766 ++ if (cmd) {
6767 ++ mutex_lock(&table_lock);
6768 ++ cmd2 = lookup(bdev);
6769 ++ if (cmd2) {
6770 ++ mutex_unlock(&table_lock);
6771 ++ __destroy_persistent_data_objects(cmd);
6772 ++ kfree(cmd);
6773 ++ return cmd2;
6774 ++ }
6775 ++ list_add(&cmd->list, &table);
6776 ++ mutex_unlock(&table_lock);
6777 ++ }
6778 ++
6779 ++ return cmd;
6780 ++}
6781 ++
6782 ++static bool same_params(struct dm_cache_metadata *cmd, sector_t data_block_size)
6783 ++{
6784 ++ if (cmd->data_block_size != data_block_size) {
6785 ++ DMERR("data_block_size (%llu) different from that in metadata (%llu)\n",
6786 ++ (unsigned long long) data_block_size,
6787 ++ (unsigned long long) cmd->data_block_size);
6788 ++ return false;
6789 ++ }
6790 ++
6791 ++ return true;
6792 ++}
6793 ++
6794 ++struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
6795 ++ sector_t data_block_size,
6796 ++ bool may_format_device,
6797 ++ size_t policy_hint_size)
6798 ++{
6799 ++ struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size,
6800 ++ may_format_device, policy_hint_size);
6801 ++ if (cmd && !same_params(cmd, data_block_size)) {
6802 ++ dm_cache_metadata_close(cmd);
6803 ++ return NULL;
6804 ++ }
6805 ++
6806 ++ return cmd;
6807 ++}
6808 ++
6809 + void dm_cache_metadata_close(struct dm_cache_metadata *cmd)
6810 + {
6811 +- __destroy_persistent_data_objects(cmd);
6812 +- kfree(cmd);
6813 ++ if (atomic_dec_and_test(&cmd->ref_count)) {
6814 ++ mutex_lock(&table_lock);
6815 ++ list_del(&cmd->list);
6816 ++ mutex_unlock(&table_lock);
6817 ++
6818 ++ __destroy_persistent_data_objects(cmd);
6819 ++ kfree(cmd);
6820 ++ }
6821 + }
6822 +
6823 + int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size)
6824 +diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
6825 +index 843af26e9050..17718456587c 100644
6826 +--- a/drivers/md/dm-cache-target.c
6827 ++++ b/drivers/md/dm-cache-target.c
6828 +@@ -146,7 +146,13 @@ struct cache {
6829 + struct list_head need_commit_migrations;
6830 + sector_t migration_threshold;
6831 + wait_queue_head_t migration_wait;
6832 +- atomic_t nr_migrations;
6833 ++ atomic_t nr_allocated_migrations;
6834 ++
6835 ++ /*
6836 ++ * The number of in flight migrations that are performing
6837 ++ * background io. eg, promotion, writeback.
6838 ++ */
6839 ++ atomic_t nr_io_migrations;
6840 +
6841 + wait_queue_head_t quiescing_wait;
6842 + atomic_t quiescing_ack;
6843 +@@ -182,7 +188,6 @@ struct cache {
6844 + struct dm_deferred_set *all_io_ds;
6845 +
6846 + mempool_t *migration_pool;
6847 +- struct dm_cache_migration *next_migration;
6848 +
6849 + struct dm_cache_policy *policy;
6850 + unsigned policy_nr_args;
6851 +@@ -265,10 +270,31 @@ static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell *cel
6852 + dm_bio_prison_free_cell(cache->prison, cell);
6853 + }
6854 +
6855 ++static struct dm_cache_migration *alloc_migration(struct cache *cache)
6856 ++{
6857 ++ struct dm_cache_migration *mg;
6858 ++
6859 ++ mg = mempool_alloc(cache->migration_pool, GFP_NOWAIT);
6860 ++ if (mg) {
6861 ++ mg->cache = cache;
6862 ++ atomic_inc(&mg->cache->nr_allocated_migrations);
6863 ++ }
6864 ++
6865 ++ return mg;
6866 ++}
6867 ++
6868 ++static void free_migration(struct dm_cache_migration *mg)
6869 ++{
6870 ++ if (atomic_dec_and_test(&mg->cache->nr_allocated_migrations))
6871 ++ wake_up(&mg->cache->migration_wait);
6872 ++
6873 ++ mempool_free(mg, mg->cache->migration_pool);
6874 ++}
6875 ++
6876 + static int prealloc_data_structs(struct cache *cache, struct prealloc *p)
6877 + {
6878 + if (!p->mg) {
6879 +- p->mg = mempool_alloc(cache->migration_pool, GFP_NOWAIT);
6880 ++ p->mg = alloc_migration(cache);
6881 + if (!p->mg)
6882 + return -ENOMEM;
6883 + }
6884 +@@ -297,7 +323,7 @@ static void prealloc_free_structs(struct cache *cache, struct prealloc *p)
6885 + free_prison_cell(cache, p->cell1);
6886 +
6887 + if (p->mg)
6888 +- mempool_free(p->mg, cache->migration_pool);
6889 ++ free_migration(p->mg);
6890 + }
6891 +
6892 + static struct dm_cache_migration *prealloc_get_migration(struct prealloc *p)
6893 +@@ -708,24 +734,14 @@ static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio,
6894 + * Migration covers moving data from the origin device to the cache, or
6895 + * vice versa.
6896 + *--------------------------------------------------------------*/
6897 +-static void free_migration(struct dm_cache_migration *mg)
6898 +-{
6899 +- mempool_free(mg, mg->cache->migration_pool);
6900 +-}
6901 +-
6902 +-static void inc_nr_migrations(struct cache *cache)
6903 ++static void inc_io_migrations(struct cache *cache)
6904 + {
6905 +- atomic_inc(&cache->nr_migrations);
6906 ++ atomic_inc(&cache->nr_io_migrations);
6907 + }
6908 +
6909 +-static void dec_nr_migrations(struct cache *cache)
6910 ++static void dec_io_migrations(struct cache *cache)
6911 + {
6912 +- atomic_dec(&cache->nr_migrations);
6913 +-
6914 +- /*
6915 +- * Wake the worker in case we're suspending the target.
6916 +- */
6917 +- wake_up(&cache->migration_wait);
6918 ++ atomic_dec(&cache->nr_io_migrations);
6919 + }
6920 +
6921 + static void __cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell,
6922 +@@ -748,11 +764,10 @@ static void cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell,
6923 + wake_worker(cache);
6924 + }
6925 +
6926 +-static void cleanup_migration(struct dm_cache_migration *mg)
6927 ++static void free_io_migration(struct dm_cache_migration *mg)
6928 + {
6929 +- struct cache *cache = mg->cache;
6930 ++ dec_io_migrations(mg->cache);
6931 + free_migration(mg);
6932 +- dec_nr_migrations(cache);
6933 + }
6934 +
6935 + static void migration_failure(struct dm_cache_migration *mg)
6936 +@@ -777,7 +792,7 @@ static void migration_failure(struct dm_cache_migration *mg)
6937 + cell_defer(cache, mg->new_ocell, 1);
6938 + }
6939 +
6940 +- cleanup_migration(mg);
6941 ++ free_io_migration(mg);
6942 + }
6943 +
6944 + static void migration_success_pre_commit(struct dm_cache_migration *mg)
6945 +@@ -788,7 +803,7 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg)
6946 + if (mg->writeback) {
6947 + clear_dirty(cache, mg->old_oblock, mg->cblock);
6948 + cell_defer(cache, mg->old_ocell, false);
6949 +- cleanup_migration(mg);
6950 ++ free_io_migration(mg);
6951 + return;
6952 +
6953 + } else if (mg->demote) {
6954 +@@ -798,14 +813,14 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg)
6955 + mg->old_oblock);
6956 + if (mg->promote)
6957 + cell_defer(cache, mg->new_ocell, true);
6958 +- cleanup_migration(mg);
6959 ++ free_io_migration(mg);
6960 + return;
6961 + }
6962 + } else {
6963 + if (dm_cache_insert_mapping(cache->cmd, mg->cblock, mg->new_oblock)) {
6964 + DMWARN_LIMIT("promotion failed; couldn't update on disk metadata");
6965 + policy_remove_mapping(cache->policy, mg->new_oblock);
6966 +- cleanup_migration(mg);
6967 ++ free_io_migration(mg);
6968 + return;
6969 + }
6970 + }
6971 +@@ -836,12 +851,12 @@ static void migration_success_post_commit(struct dm_cache_migration *mg)
6972 + spin_unlock_irqrestore(&cache->lock, flags);
6973 +
6974 + } else
6975 +- cleanup_migration(mg);
6976 ++ free_io_migration(mg);
6977 +
6978 + } else {
6979 + clear_dirty(cache, mg->new_oblock, mg->cblock);
6980 + cell_defer(cache, mg->new_ocell, true);
6981 +- cleanup_migration(mg);
6982 ++ free_io_migration(mg);
6983 + }
6984 + }
6985 +
6986 +@@ -1002,7 +1017,7 @@ static void promote(struct cache *cache, struct prealloc *structs,
6987 + mg->new_ocell = cell;
6988 + mg->start_jiffies = jiffies;
6989 +
6990 +- inc_nr_migrations(cache);
6991 ++ inc_io_migrations(cache);
6992 + quiesce_migration(mg);
6993 + }
6994 +
6995 +@@ -1023,7 +1038,7 @@ static void writeback(struct cache *cache, struct prealloc *structs,
6996 + mg->new_ocell = NULL;
6997 + mg->start_jiffies = jiffies;
6998 +
6999 +- inc_nr_migrations(cache);
7000 ++ inc_io_migrations(cache);
7001 + quiesce_migration(mg);
7002 + }
7003 +
7004 +@@ -1047,7 +1062,7 @@ static void demote_then_promote(struct cache *cache, struct prealloc *structs,
7005 + mg->new_ocell = new_ocell;
7006 + mg->start_jiffies = jiffies;
7007 +
7008 +- inc_nr_migrations(cache);
7009 ++ inc_io_migrations(cache);
7010 + quiesce_migration(mg);
7011 + }
7012 +
7013 +@@ -1108,7 +1123,7 @@ static void process_discard_bio(struct cache *cache, struct bio *bio)
7014 +
7015 + static bool spare_migration_bandwidth(struct cache *cache)
7016 + {
7017 +- sector_t current_volume = (atomic_read(&cache->nr_migrations) + 1) *
7018 ++ sector_t current_volume = (atomic_read(&cache->nr_io_migrations) + 1) *
7019 + cache->sectors_per_block;
7020 + return current_volume < cache->migration_threshold;
7021 + }
7022 +@@ -1399,7 +1414,7 @@ static void stop_quiescing(struct cache *cache)
7023 +
7024 + static void wait_for_migrations(struct cache *cache)
7025 + {
7026 +- wait_event(cache->migration_wait, !atomic_read(&cache->nr_migrations));
7027 ++ wait_event(cache->migration_wait, !atomic_read(&cache->nr_allocated_migrations));
7028 + }
7029 +
7030 + static void stop_worker(struct cache *cache)
7031 +@@ -1508,9 +1523,6 @@ static void destroy(struct cache *cache)
7032 + {
7033 + unsigned i;
7034 +
7035 +- if (cache->next_migration)
7036 +- mempool_free(cache->next_migration, cache->migration_pool);
7037 +-
7038 + if (cache->migration_pool)
7039 + mempool_destroy(cache->migration_pool);
7040 +
7041 +@@ -1998,7 +2010,8 @@ static int cache_create(struct cache_args *ca, struct cache **result)
7042 + INIT_LIST_HEAD(&cache->quiesced_migrations);
7043 + INIT_LIST_HEAD(&cache->completed_migrations);
7044 + INIT_LIST_HEAD(&cache->need_commit_migrations);
7045 +- atomic_set(&cache->nr_migrations, 0);
7046 ++ atomic_set(&cache->nr_allocated_migrations, 0);
7047 ++ atomic_set(&cache->nr_io_migrations, 0);
7048 + init_waitqueue_head(&cache->migration_wait);
7049 +
7050 + init_waitqueue_head(&cache->quiescing_wait);
7051 +@@ -2057,8 +2070,6 @@ static int cache_create(struct cache_args *ca, struct cache **result)
7052 + goto bad;
7053 + }
7054 +
7055 +- cache->next_migration = NULL;
7056 +-
7057 + cache->need_tick_bio = true;
7058 + cache->sized = false;
7059 + cache->quiescing = false;
7060 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
7061 +index 582bc3f69a43..7b54c3bf9f8f 100644
7062 +--- a/drivers/md/raid5.c
7063 ++++ b/drivers/md/raid5.c
7064 +@@ -2789,7 +2789,8 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s,
7065 + (s->failed >= 2 && fdev[1]->toread) ||
7066 + (sh->raid_conf->level <= 5 && s->failed && fdev[0]->towrite &&
7067 + !test_bit(R5_OVERWRITE, &fdev[0]->flags)) ||
7068 +- (sh->raid_conf->level == 6 && s->failed && s->to_write))) {
7069 ++ ((sh->raid_conf->level == 6 || sh->sector >= sh->raid_conf->mddev->recovery_cp)
7070 ++ && s->failed && s->to_write))) {
7071 + /* we would like to get this block, possibly by computing it,
7072 + * otherwise read it if the backing disk is insync
7073 + */
7074 +diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c
7075 +index 2335529b195c..ab5d9a3adebf 100644
7076 +--- a/drivers/media/i2c/smiapp-pll.c
7077 ++++ b/drivers/media/i2c/smiapp-pll.c
7078 +@@ -67,7 +67,7 @@ static void print_pll(struct device *dev, struct smiapp_pll *pll)
7079 + {
7080 + dev_dbg(dev, "pre_pll_clk_div\t%d\n", pll->pre_pll_clk_div);
7081 + dev_dbg(dev, "pll_multiplier \t%d\n", pll->pll_multiplier);
7082 +- if (pll->flags != SMIAPP_PLL_FLAG_NO_OP_CLOCKS) {
7083 ++ if (!(pll->flags & SMIAPP_PLL_FLAG_NO_OP_CLOCKS)) {
7084 + dev_dbg(dev, "op_sys_clk_div \t%d\n", pll->op_sys_clk_div);
7085 + dev_dbg(dev, "op_pix_clk_div \t%d\n", pll->op_pix_clk_div);
7086 + }
7087 +@@ -77,7 +77,7 @@ static void print_pll(struct device *dev, struct smiapp_pll *pll)
7088 + dev_dbg(dev, "ext_clk_freq_hz \t%d\n", pll->ext_clk_freq_hz);
7089 + dev_dbg(dev, "pll_ip_clk_freq_hz \t%d\n", pll->pll_ip_clk_freq_hz);
7090 + dev_dbg(dev, "pll_op_clk_freq_hz \t%d\n", pll->pll_op_clk_freq_hz);
7091 +- if (pll->flags & SMIAPP_PLL_FLAG_NO_OP_CLOCKS) {
7092 ++ if (!(pll->flags & SMIAPP_PLL_FLAG_NO_OP_CLOCKS)) {
7093 + dev_dbg(dev, "op_sys_clk_freq_hz \t%d\n",
7094 + pll->op_sys_clk_freq_hz);
7095 + dev_dbg(dev, "op_pix_clk_freq_hz \t%d\n",
7096 +diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
7097 +index 371ca22843ee..4bfe83ffd577 100644
7098 +--- a/drivers/media/i2c/smiapp/smiapp-core.c
7099 ++++ b/drivers/media/i2c/smiapp/smiapp-core.c
7100 +@@ -2625,7 +2625,9 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
7101 + pll->flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE;
7102 + pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN];
7103 +
7104 ++ mutex_lock(&sensor->mutex);
7105 + rval = smiapp_update_mode(sensor);
7106 ++ mutex_unlock(&sensor->mutex);
7107 + if (rval) {
7108 + dev_err(&client->dev, "update mode failed\n");
7109 + goto out_nvm_release;
7110 +diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c
7111 +index dd32decb237d..1d4b11038958 100644
7112 +--- a/drivers/media/usb/au0828/au0828-cards.c
7113 ++++ b/drivers/media/usb/au0828/au0828-cards.c
7114 +@@ -36,6 +36,11 @@ static void hvr950q_cs5340_audio(void *priv, int enable)
7115 + au0828_clear(dev, REG_000, 0x10);
7116 + }
7117 +
7118 ++/*
7119 ++ * WARNING: There's a quirks table at sound/usb/quirks-table.h
7120 ++ * that should also be updated every time a new device with V4L2 support
7121 ++ * is added here.
7122 ++ */
7123 + struct au0828_board au0828_boards[] = {
7124 + [AU0828_BOARD_UNKNOWN] = {
7125 + .name = "Unknown board",
7126 +diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
7127 +index af176b6ce738..e6d3561eea47 100644
7128 +--- a/drivers/media/usb/dvb-usb/af9005.c
7129 ++++ b/drivers/media/usb/dvb-usb/af9005.c
7130 +@@ -1081,9 +1081,12 @@ static int __init af9005_usb_module_init(void)
7131 + err("usb_register failed. (%d)", result);
7132 + return result;
7133 + }
7134 ++#if IS_MODULE(CONFIG_DVB_USB_AF9005) || defined(CONFIG_DVB_USB_AF9005_REMOTE)
7135 ++ /* FIXME: convert to todays kernel IR infrastructure */
7136 + rc_decode = symbol_request(af9005_rc_decode);
7137 + rc_keys = symbol_request(rc_map_af9005_table);
7138 + rc_keys_size = symbol_request(rc_map_af9005_table_size);
7139 ++#endif
7140 + if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) {
7141 + err("af9005_rc_decode function not found, disabling remote");
7142 + af9005_properties.rc.legacy.rc_query = NULL;
7143 +diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
7144 +index 753ad4cfc118..45314412b4a3 100644
7145 +--- a/drivers/media/usb/uvc/uvc_driver.c
7146 ++++ b/drivers/media/usb/uvc/uvc_driver.c
7147 +@@ -1603,12 +1603,12 @@ static void uvc_delete(struct uvc_device *dev)
7148 + {
7149 + struct list_head *p, *n;
7150 +
7151 +- usb_put_intf(dev->intf);
7152 +- usb_put_dev(dev->udev);
7153 +-
7154 + uvc_status_cleanup(dev);
7155 + uvc_ctrl_cleanup_device(dev);
7156 +
7157 ++ usb_put_intf(dev->intf);
7158 ++ usb_put_dev(dev->udev);
7159 ++
7160 + if (dev->vdev.dev)
7161 + v4l2_device_unregister(&dev->vdev);
7162 + #ifdef CONFIG_MEDIA_CONTROLLER
7163 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
7164 +index 7a7fb4f0d5a4..ff6e822d2b78 100644
7165 +--- a/drivers/mmc/host/sdhci.c
7166 ++++ b/drivers/mmc/host/sdhci.c
7167 +@@ -1333,6 +1333,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
7168 +
7169 + sdhci_runtime_pm_get(host);
7170 +
7171 ++ present = mmc_gpio_get_cd(host->mmc);
7172 ++
7173 + spin_lock_irqsave(&host->lock, flags);
7174 +
7175 + WARN_ON(host->mrq != NULL);
7176 +@@ -1361,7 +1363,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
7177 + * zero: cd-gpio is used, and card is removed
7178 + * one: cd-gpio is used, and card is present
7179 + */
7180 +- present = mmc_gpio_get_cd(host->mmc);
7181 + if (present < 0) {
7182 + /* If polling, assume that the card is always present. */
7183 + if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
7184 +@@ -2061,15 +2062,18 @@ static void sdhci_card_event(struct mmc_host *mmc)
7185 + {
7186 + struct sdhci_host *host = mmc_priv(mmc);
7187 + unsigned long flags;
7188 ++ int present;
7189 +
7190 + /* First check if client has provided their own card event */
7191 + if (host->ops->card_event)
7192 + host->ops->card_event(host);
7193 +
7194 ++ present = sdhci_do_get_cd(host);
7195 ++
7196 + spin_lock_irqsave(&host->lock, flags);
7197 +
7198 + /* Check host->mrq first in case we are runtime suspended */
7199 +- if (host->mrq && !sdhci_do_get_cd(host)) {
7200 ++ if (host->mrq && !present) {
7201 + pr_err("%s: Card removed during transfer!\n",
7202 + mmc_hostname(host->mmc));
7203 + pr_err("%s: Resetting controller.\n",
7204 +@@ -2504,7 +2508,7 @@ out:
7205 + /*
7206 + * We have to delay this as it calls back into the driver.
7207 + */
7208 +- if (cardint)
7209 ++ if (cardint && host->mmc->sdio_irqs)
7210 + mmc_signal_sdio_irq(host->mmc);
7211 +
7212 + return result;
7213 +diff --git a/drivers/mtd/tests/torturetest.c b/drivers/mtd/tests/torturetest.c
7214 +index eeab96973cf0..b55bc52a1340 100644
7215 +--- a/drivers/mtd/tests/torturetest.c
7216 ++++ b/drivers/mtd/tests/torturetest.c
7217 +@@ -264,7 +264,9 @@ static int __init tort_init(void)
7218 + int i;
7219 + void *patt;
7220 +
7221 +- mtdtest_erase_good_eraseblocks(mtd, bad_ebs, eb, ebcnt);
7222 ++ err = mtdtest_erase_good_eraseblocks(mtd, bad_ebs, eb, ebcnt);
7223 ++ if (err)
7224 ++ goto out;
7225 +
7226 + /* Check if the eraseblocks contain only 0xFF bytes */
7227 + if (check) {
7228 +diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
7229 +index ec2c2dc1c1ca..2a1b6e037e1a 100644
7230 +--- a/drivers/mtd/ubi/upd.c
7231 ++++ b/drivers/mtd/ubi/upd.c
7232 +@@ -133,6 +133,10 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
7233 + ubi_assert(!vol->updating && !vol->changing_leb);
7234 + vol->updating = 1;
7235 +
7236 ++ vol->upd_buf = vmalloc(ubi->leb_size);
7237 ++ if (!vol->upd_buf)
7238 ++ return -ENOMEM;
7239 ++
7240 + err = set_update_marker(ubi, vol);
7241 + if (err)
7242 + return err;
7243 +@@ -152,14 +156,12 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
7244 + err = clear_update_marker(ubi, vol, 0);
7245 + if (err)
7246 + return err;
7247 ++
7248 ++ vfree(vol->upd_buf);
7249 + vol->updating = 0;
7250 + return 0;
7251 + }
7252 +
7253 +- vol->upd_buf = vmalloc(ubi->leb_size);
7254 +- if (!vol->upd_buf)
7255 +- return -ENOMEM;
7256 +-
7257 + vol->upd_ebs = div_u64(bytes + vol->usable_leb_size - 1,
7258 + vol->usable_leb_size);
7259 + vol->upd_bytes = bytes;
7260 +diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
7261 +index c95bfb183c62..49e570abe58b 100644
7262 +--- a/drivers/mtd/ubi/wl.c
7263 ++++ b/drivers/mtd/ubi/wl.c
7264 +@@ -1209,7 +1209,6 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
7265 +
7266 + err = do_sync_erase(ubi, e1, vol_id, lnum, 0);
7267 + if (err) {
7268 +- kmem_cache_free(ubi_wl_entry_slab, e1);
7269 + if (e2)
7270 + kmem_cache_free(ubi_wl_entry_slab, e2);
7271 + goto out_ro;
7272 +@@ -1223,10 +1222,8 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
7273 + dbg_wl("PEB %d (LEB %d:%d) was put meanwhile, erase",
7274 + e2->pnum, vol_id, lnum);
7275 + err = do_sync_erase(ubi, e2, vol_id, lnum, 0);
7276 +- if (err) {
7277 +- kmem_cache_free(ubi_wl_entry_slab, e2);
7278 ++ if (err)
7279 + goto out_ro;
7280 +- }
7281 + }
7282 +
7283 + dbg_wl("done");
7284 +@@ -1262,10 +1259,9 @@ out_not_moved:
7285 +
7286 + ubi_free_vid_hdr(ubi, vid_hdr);
7287 + err = do_sync_erase(ubi, e2, vol_id, lnum, torture);
7288 +- if (err) {
7289 +- kmem_cache_free(ubi_wl_entry_slab, e2);
7290 ++ if (err)
7291 + goto out_ro;
7292 +- }
7293 ++
7294 + mutex_unlock(&ubi->move_mutex);
7295 + return 0;
7296 +
7297 +diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
7298 +index 9bf47a064cdf..a4694aa20a3e 100644
7299 +--- a/drivers/net/can/dev.c
7300 ++++ b/drivers/net/can/dev.c
7301 +@@ -643,10 +643,14 @@ static int can_changelink(struct net_device *dev,
7302 + if (dev->flags & IFF_UP)
7303 + return -EBUSY;
7304 + cm = nla_data(data[IFLA_CAN_CTRLMODE]);
7305 +- if (cm->flags & ~priv->ctrlmode_supported)
7306 ++
7307 ++ /* check whether changed bits are allowed to be modified */
7308 ++ if (cm->mask & ~priv->ctrlmode_supported)
7309 + return -EOPNOTSUPP;
7310 ++
7311 ++ /* clear bits to be modified and copy the flag values */
7312 + priv->ctrlmode &= ~cm->mask;
7313 +- priv->ctrlmode |= cm->flags;
7314 ++ priv->ctrlmode |= (cm->flags & cm->mask);
7315 + }
7316 +
7317 + if (data[IFLA_CAN_BITTIMING]) {
7318 +diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
7319 +index cc3df8aebb87..63fb90b006ba 100644
7320 +--- a/drivers/net/can/usb/kvaser_usb.c
7321 ++++ b/drivers/net/can/usb/kvaser_usb.c
7322 +@@ -1238,6 +1238,9 @@ static int kvaser_usb_close(struct net_device *netdev)
7323 + if (err)
7324 + netdev_warn(netdev, "Cannot stop device, error %d\n", err);
7325 +
7326 ++ /* reset tx contexts */
7327 ++ kvaser_usb_unlink_tx_urbs(priv);
7328 ++
7329 + priv->can.state = CAN_STATE_STOPPED;
7330 + close_candev(priv->netdev);
7331 +
7332 +@@ -1286,12 +1289,14 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
7333 + if (!urb) {
7334 + netdev_err(netdev, "No memory left for URBs\n");
7335 + stats->tx_dropped++;
7336 +- goto nourbmem;
7337 ++ dev_kfree_skb(skb);
7338 ++ return NETDEV_TX_OK;
7339 + }
7340 +
7341 + buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC);
7342 + if (!buf) {
7343 + stats->tx_dropped++;
7344 ++ dev_kfree_skb(skb);
7345 + goto nobufmem;
7346 + }
7347 +
7348 +@@ -1326,6 +1331,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
7349 + }
7350 + }
7351 +
7352 ++ /* This should never happen; it implies a flow control bug */
7353 + if (!context) {
7354 + netdev_warn(netdev, "cannot find free context\n");
7355 + ret = NETDEV_TX_BUSY;
7356 +@@ -1356,9 +1362,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
7357 + if (unlikely(err)) {
7358 + can_free_echo_skb(netdev, context->echo_index);
7359 +
7360 +- skb = NULL; /* set to NULL to avoid double free in
7361 +- * dev_kfree_skb(skb) */
7362 +-
7363 + atomic_dec(&priv->active_tx_urbs);
7364 + usb_unanchor_urb(urb);
7365 +
7366 +@@ -1380,8 +1383,6 @@ releasebuf:
7367 + kfree(buf);
7368 + nobufmem:
7369 + usb_free_urb(urb);
7370 +-nourbmem:
7371 +- dev_kfree_skb(skb);
7372 + return ret;
7373 + }
7374 +
7375 +@@ -1493,6 +1494,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
7376 + struct kvaser_usb_net_priv *priv;
7377 + int i, err;
7378 +
7379 ++ err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel);
7380 ++ if (err)
7381 ++ return err;
7382 ++
7383 + netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS);
7384 + if (!netdev) {
7385 + dev_err(&intf->dev, "Cannot alloc candev\n");
7386 +@@ -1596,9 +1601,6 @@ static int kvaser_usb_probe(struct usb_interface *intf,
7387 +
7388 + usb_set_intfdata(intf, dev);
7389 +
7390 +- for (i = 0; i < MAX_NET_DEVICES; i++)
7391 +- kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i);
7392 +-
7393 + err = kvaser_usb_get_software_info(dev);
7394 + if (err) {
7395 + dev_err(&intf->dev,
7396 +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
7397 +index 0b7a4c3b01a2..03e7f0cbda8c 100644
7398 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
7399 ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
7400 +@@ -734,7 +734,7 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
7401 + dev->cmd_buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL);
7402 + if (!dev->cmd_buf) {
7403 + err = -ENOMEM;
7404 +- goto lbl_set_intf_data;
7405 ++ goto lbl_free_candev;
7406 + }
7407 +
7408 + dev->udev = usb_dev;
7409 +@@ -773,7 +773,7 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
7410 + err = register_candev(netdev);
7411 + if (err) {
7412 + dev_err(&intf->dev, "couldn't register CAN device: %d\n", err);
7413 +- goto lbl_free_cmd_buf;
7414 ++ goto lbl_restore_intf_data;
7415 + }
7416 +
7417 + if (dev->prev_siblings)
7418 +@@ -786,14 +786,14 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
7419 + if (dev->adapter->dev_init) {
7420 + err = dev->adapter->dev_init(dev);
7421 + if (err)
7422 +- goto lbl_free_cmd_buf;
7423 ++ goto lbl_unregister_candev;
7424 + }
7425 +
7426 + /* set bus off */
7427 + if (dev->adapter->dev_set_bus) {
7428 + err = dev->adapter->dev_set_bus(dev, 0);
7429 + if (err)
7430 +- goto lbl_free_cmd_buf;
7431 ++ goto lbl_unregister_candev;
7432 + }
7433 +
7434 + /* get device number early */
7435 +@@ -805,11 +805,14 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
7436 +
7437 + return 0;
7438 +
7439 +-lbl_free_cmd_buf:
7440 +- kfree(dev->cmd_buf);
7441 ++lbl_unregister_candev:
7442 ++ unregister_candev(netdev);
7443 +
7444 +-lbl_set_intf_data:
7445 ++lbl_restore_intf_data:
7446 + usb_set_intfdata(intf, dev->prev_siblings);
7447 ++ kfree(dev->cmd_buf);
7448 ++
7449 ++lbl_free_candev:
7450 + free_candev(netdev);
7451 +
7452 + return err;
7453 +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
7454 +index 263dd921edc4..f7f796a2c50b 100644
7455 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
7456 ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
7457 +@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
7458 + if (!(dev->state & PCAN_USB_STATE_CONNECTED))
7459 + return 0;
7460 +
7461 +- memset(req_addr, '\0', req_size);
7462 +-
7463 + req_type = USB_TYPE_VENDOR | USB_RECIP_OTHER;
7464 +
7465 + switch (req_id) {
7466 +@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
7467 + default:
7468 + p = usb_rcvctrlpipe(dev->udev, 0);
7469 + req_type |= USB_DIR_IN;
7470 ++ memset(req_addr, '\0', req_size);
7471 + break;
7472 + }
7473 +
7474 +diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
7475 +index 6305a5d29db2..754ac8ef2484 100644
7476 +--- a/drivers/net/ethernet/atheros/alx/main.c
7477 ++++ b/drivers/net/ethernet/atheros/alx/main.c
7478 +@@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alx_priv *alx)
7479 + schedule_work(&alx->reset_wk);
7480 + }
7481 +
7482 +-static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
7483 ++static int alx_clean_rx_irq(struct alx_priv *alx, int budget)
7484 + {
7485 + struct alx_rx_queue *rxq = &alx->rxq;
7486 + struct alx_rrd *rrd;
7487 + struct alx_buffer *rxb;
7488 + struct sk_buff *skb;
7489 + u16 length, rfd_cleaned = 0;
7490 ++ int work = 0;
7491 +
7492 +- while (budget > 0) {
7493 ++ while (work < budget) {
7494 + rrd = &rxq->rrd[rxq->rrd_read_idx];
7495 + if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT)))
7496 + break;
7497 +@@ -203,7 +204,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
7498 + ALX_GET_FIELD(le32_to_cpu(rrd->word0),
7499 + RRD_NOR) != 1) {
7500 + alx_schedule_reset(alx);
7501 +- return 0;
7502 ++ return work;
7503 + }
7504 +
7505 + rxb = &rxq->bufs[rxq->read_idx];
7506 +@@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget)
7507 + }
7508 +
7509 + napi_gro_receive(&alx->napi, skb);
7510 +- budget--;
7511 ++ work++;
7512 +
7513 + next_pkt:
7514 + if (++rxq->read_idx == alx->rx_ringsz)
7515 +@@ -258,21 +259,22 @@ next_pkt:
7516 + if (rfd_cleaned)
7517 + alx_refill_rx_ring(alx, GFP_ATOMIC);
7518 +
7519 +- return budget > 0;
7520 ++ return work;
7521 + }
7522 +
7523 + static int alx_poll(struct napi_struct *napi, int budget)
7524 + {
7525 + struct alx_priv *alx = container_of(napi, struct alx_priv, napi);
7526 + struct alx_hw *hw = &alx->hw;
7527 +- bool complete = true;
7528 + unsigned long flags;
7529 ++ bool tx_complete;
7530 ++ int work;
7531 +
7532 +- complete = alx_clean_tx_irq(alx) &&
7533 +- alx_clean_rx_irq(alx, budget);
7534 ++ tx_complete = alx_clean_tx_irq(alx);
7535 ++ work = alx_clean_rx_irq(alx, budget);
7536 +
7537 +- if (!complete)
7538 +- return 1;
7539 ++ if (!tx_complete || work == budget)
7540 ++ return budget;
7541 +
7542 + napi_complete(&alx->napi);
7543 +
7544 +@@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *napi, int budget)
7545 +
7546 + alx_post_write(hw);
7547 +
7548 +- return 0;
7549 ++ return work;
7550 + }
7551 +
7552 + static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr)
7553 +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
7554 +index 8d45dce7cfdb..98ded21c37b2 100644
7555 +--- a/drivers/net/ethernet/broadcom/tg3.c
7556 ++++ b/drivers/net/ethernet/broadcom/tg3.c
7557 +@@ -17572,23 +17572,6 @@ static int tg3_init_one(struct pci_dev *pdev,
7558 + goto err_out_apeunmap;
7559 + }
7560 +
7561 +- /*
7562 +- * Reset chip in case UNDI or EFI driver did not shutdown
7563 +- * DMA self test will enable WDMAC and we'll see (spurious)
7564 +- * pending DMA on the PCI bus at that point.
7565 +- */
7566 +- if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) ||
7567 +- (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
7568 +- tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
7569 +- tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
7570 +- }
7571 +-
7572 +- err = tg3_test_dma(tp);
7573 +- if (err) {
7574 +- dev_err(&pdev->dev, "DMA engine test failed, aborting\n");
7575 +- goto err_out_apeunmap;
7576 +- }
7577 +-
7578 + intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW;
7579 + rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW;
7580 + sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW;
7581 +@@ -17633,6 +17616,23 @@ static int tg3_init_one(struct pci_dev *pdev,
7582 + sndmbx += 0xc;
7583 + }
7584 +
7585 ++ /*
7586 ++ * Reset chip in case UNDI or EFI driver did not shutdown
7587 ++ * DMA self test will enable WDMAC and we'll see (spurious)
7588 ++ * pending DMA on the PCI bus at that point.
7589 ++ */
7590 ++ if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) ||
7591 ++ (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
7592 ++ tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
7593 ++ tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
7594 ++ }
7595 ++
7596 ++ err = tg3_test_dma(tp);
7597 ++ if (err) {
7598 ++ dev_err(&pdev->dev, "DMA engine test failed, aborting\n");
7599 ++ goto err_out_apeunmap;
7600 ++ }
7601 ++
7602 + tg3_init_coal(tp);
7603 +
7604 + pci_set_drvdata(pdev, dev);
7605 +diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
7606 +index 7b756cf9474a..c298239cb960 100644
7607 +--- a/drivers/net/ethernet/cisco/enic/enic_main.c
7608 ++++ b/drivers/net/ethernet/cisco/enic/enic_main.c
7609 +@@ -1043,10 +1043,14 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
7610 + skb->l4_rxhash = true;
7611 + }
7612 +
7613 +- if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc) {
7614 +- skb->csum = htons(checksum);
7615 +- skb->ip_summed = CHECKSUM_COMPLETE;
7616 +- }
7617 ++ /* Hardware does not provide whole packet checksum. It only
7618 ++ * provides pseudo checksum. Since hw validates the packet
7619 ++ * checksum but not provide us the checksum value. use
7620 ++ * CHECSUM_UNNECESSARY.
7621 ++ */
7622 ++ if ((netdev->features & NETIF_F_RXCSUM) && tcp_udp_csum_ok &&
7623 ++ ipv4_csum_ok)
7624 ++ skb->ip_summed = CHECKSUM_UNNECESSARY;
7625 +
7626 + if (vlan_stripped)
7627 + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
7628 +diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
7629 +index 498e808391a9..07cd14d586dc 100644
7630 +--- a/drivers/net/ethernet/ti/cpsw.c
7631 ++++ b/drivers/net/ethernet/ti/cpsw.c
7632 +@@ -546,6 +546,12 @@ static inline int cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
7633 + static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
7634 + {
7635 + struct cpsw_priv *priv = netdev_priv(ndev);
7636 ++ int vid;
7637 ++
7638 ++ if (priv->data.dual_emac)
7639 ++ vid = priv->slaves[priv->emac_port].port_vlan;
7640 ++ else
7641 ++ vid = priv->data.default_vlan;
7642 +
7643 + if (ndev->flags & IFF_PROMISC) {
7644 + /* Enable promiscuous mode */
7645 +@@ -554,7 +560,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
7646 + }
7647 +
7648 + /* Clear all mcast from ALE */
7649 +- cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port);
7650 ++ cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port,
7651 ++ vid);
7652 +
7653 + if (!netdev_mc_empty(ndev)) {
7654 + struct netdev_hw_addr *ha;
7655 +@@ -639,6 +646,14 @@ void cpsw_rx_handler(void *token, int len, int status)
7656 + static irqreturn_t cpsw_interrupt(int irq, void *dev_id)
7657 + {
7658 + struct cpsw_priv *priv = dev_id;
7659 ++ int value = irq - priv->irqs_table[0];
7660 ++
7661 ++ /* NOTICE: Ending IRQ here. The trick with the 'value' variable above
7662 ++ * is to make sure we will always write the correct value to the EOI
7663 ++ * register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2
7664 ++ * for TX Interrupt and 3 for MISC Interrupt.
7665 ++ */
7666 ++ cpdma_ctlr_eoi(priv->dma, value);
7667 +
7668 + cpsw_intr_disable(priv);
7669 + if (priv->irq_enabled == true) {
7670 +@@ -668,8 +683,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget)
7671 + int num_tx, num_rx;
7672 +
7673 + num_tx = cpdma_chan_process(priv->txch, 128);
7674 +- if (num_tx)
7675 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
7676 +
7677 + num_rx = cpdma_chan_process(priv->rxch, budget);
7678 + if (num_rx < budget) {
7679 +@@ -677,7 +690,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget)
7680 +
7681 + napi_complete(napi);
7682 + cpsw_intr_enable(priv);
7683 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
7684 + prim_cpsw = cpsw_get_slave_priv(priv, 0);
7685 + if (prim_cpsw->irq_enabled == false) {
7686 + prim_cpsw->irq_enabled = true;
7687 +@@ -1165,8 +1177,6 @@ static int cpsw_ndo_open(struct net_device *ndev)
7688 + napi_enable(&priv->napi);
7689 + cpdma_ctlr_start(priv->dma);
7690 + cpsw_intr_enable(priv);
7691 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
7692 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
7693 +
7694 + if (priv->data.dual_emac)
7695 + priv->slaves[priv->emac_port].open_stat = true;
7696 +@@ -1416,9 +1426,6 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev)
7697 + cpdma_chan_start(priv->txch);
7698 + cpdma_ctlr_int_ctrl(priv->dma, true);
7699 + cpsw_intr_enable(priv);
7700 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
7701 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
7702 +-
7703 + }
7704 +
7705 + static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
7706 +@@ -1464,9 +1471,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev)
7707 + cpsw_interrupt(ndev->irq, priv);
7708 + cpdma_ctlr_int_ctrl(priv->dma, true);
7709 + cpsw_intr_enable(priv);
7710 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
7711 +- cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
7712 +-
7713 + }
7714 + #endif
7715 +
7716 +diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
7717 +index 7fa60d6092ed..f7acf76b223c 100644
7718 +--- a/drivers/net/ethernet/ti/cpsw_ale.c
7719 ++++ b/drivers/net/ethernet/ti/cpsw_ale.c
7720 +@@ -236,7 +236,7 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry,
7721 + cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
7722 + }
7723 +
7724 +-int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask)
7725 ++int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
7726 + {
7727 + u32 ale_entry[ALE_ENTRY_WORDS];
7728 + int ret, idx;
7729 +@@ -247,6 +247,14 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask)
7730 + if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR)
7731 + continue;
7732 +
7733 ++ /* if vid passed is -1 then remove all multicast entry from
7734 ++ * the table irrespective of vlan id, if a valid vlan id is
7735 ++ * passed then remove only multicast added to that vlan id.
7736 ++ * if vlan id doesn't match then move on to next entry.
7737 ++ */
7738 ++ if (vid != -1 && cpsw_ale_get_vlan_id(ale_entry) != vid)
7739 ++ continue;
7740 ++
7741 + if (cpsw_ale_get_mcast(ale_entry)) {
7742 + u8 addr[6];
7743 +
7744 +diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h
7745 +index 30daa1265f0c..20c7976819e7 100644
7746 +--- a/drivers/net/ethernet/ti/cpsw_ale.h
7747 ++++ b/drivers/net/ethernet/ti/cpsw_ale.h
7748 +@@ -86,7 +86,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale);
7749 +
7750 + int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout);
7751 + int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask);
7752 +-int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask);
7753 ++int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid);
7754 + int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
7755 + int flags, u16 vid);
7756 + int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port,
7757 +diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
7758 +index 75864dfaa1c2..258f65ba733f 100644
7759 +--- a/drivers/net/team/team.c
7760 ++++ b/drivers/net/team/team.c
7761 +@@ -629,6 +629,7 @@ static int team_change_mode(struct team *team, const char *kind)
7762 + static void team_notify_peers_work(struct work_struct *work)
7763 + {
7764 + struct team *team;
7765 ++ int val;
7766 +
7767 + team = container_of(work, struct team, notify_peers.dw.work);
7768 +
7769 +@@ -636,9 +637,14 @@ static void team_notify_peers_work(struct work_struct *work)
7770 + schedule_delayed_work(&team->notify_peers.dw, 0);
7771 + return;
7772 + }
7773 ++ val = atomic_dec_if_positive(&team->notify_peers.count_pending);
7774 ++ if (val < 0) {
7775 ++ rtnl_unlock();
7776 ++ return;
7777 ++ }
7778 + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev);
7779 + rtnl_unlock();
7780 +- if (!atomic_dec_and_test(&team->notify_peers.count_pending))
7781 ++ if (val)
7782 + schedule_delayed_work(&team->notify_peers.dw,
7783 + msecs_to_jiffies(team->notify_peers.interval));
7784 + }
7785 +@@ -669,6 +675,7 @@ static void team_notify_peers_fini(struct team *team)
7786 + static void team_mcast_rejoin_work(struct work_struct *work)
7787 + {
7788 + struct team *team;
7789 ++ int val;
7790 +
7791 + team = container_of(work, struct team, mcast_rejoin.dw.work);
7792 +
7793 +@@ -676,9 +683,14 @@ static void team_mcast_rejoin_work(struct work_struct *work)
7794 + schedule_delayed_work(&team->mcast_rejoin.dw, 0);
7795 + return;
7796 + }
7797 ++ val = atomic_dec_if_positive(&team->mcast_rejoin.count_pending);
7798 ++ if (val < 0) {
7799 ++ rtnl_unlock();
7800 ++ return;
7801 ++ }
7802 + call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev);
7803 + rtnl_unlock();
7804 +- if (!atomic_dec_and_test(&team->mcast_rejoin.count_pending))
7805 ++ if (val)
7806 + schedule_delayed_work(&team->mcast_rejoin.dw,
7807 + msecs_to_jiffies(team->mcast_rejoin.interval));
7808 + }
7809 +diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
7810 +index 0583c69d26db..ddaad712c59a 100644
7811 +--- a/drivers/net/wireless/ath/ath5k/qcu.c
7812 ++++ b/drivers/net/wireless/ath/ath5k/qcu.c
7813 +@@ -225,13 +225,7 @@ ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,
7814 + } else {
7815 + switch (queue_type) {
7816 + case AR5K_TX_QUEUE_DATA:
7817 +- for (queue = AR5K_TX_QUEUE_ID_DATA_MIN;
7818 +- ah->ah_txq[queue].tqi_type !=
7819 +- AR5K_TX_QUEUE_INACTIVE; queue++) {
7820 +-
7821 +- if (queue > AR5K_TX_QUEUE_ID_DATA_MAX)
7822 +- return -EINVAL;
7823 +- }
7824 ++ queue = queue_info->tqi_subtype;
7825 + break;
7826 + case AR5K_TX_QUEUE_UAPSD:
7827 + queue = AR5K_TX_QUEUE_ID_UAPSD;
7828 +diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
7829 +index 69a907b55a73..5bf775e59ee9 100644
7830 +--- a/drivers/net/wireless/ath/ath9k/hw.h
7831 ++++ b/drivers/net/wireless/ath/ath9k/hw.h
7832 +@@ -215,8 +215,8 @@
7833 + #define AH_WOW_BEACON_MISS BIT(3)
7834 +
7835 + enum ath_hw_txq_subtype {
7836 +- ATH_TXQ_AC_BE = 0,
7837 +- ATH_TXQ_AC_BK = 1,
7838 ++ ATH_TXQ_AC_BK = 0,
7839 ++ ATH_TXQ_AC_BE = 1,
7840 + ATH_TXQ_AC_VI = 2,
7841 + ATH_TXQ_AC_VO = 3,
7842 + };
7843 +diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
7844 +index a3eff0986a3f..02446801cb3a 100644
7845 +--- a/drivers/net/wireless/ath/ath9k/mac.c
7846 ++++ b/drivers/net/wireless/ath/ath9k/mac.c
7847 +@@ -311,14 +311,7 @@ int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type,
7848 + q = ATH9K_NUM_TX_QUEUES - 3;
7849 + break;
7850 + case ATH9K_TX_QUEUE_DATA:
7851 +- for (q = 0; q < ATH9K_NUM_TX_QUEUES; q++)
7852 +- if (ah->txq[q].tqi_type ==
7853 +- ATH9K_TX_QUEUE_INACTIVE)
7854 +- break;
7855 +- if (q == ATH9K_NUM_TX_QUEUES) {
7856 +- ath_err(common, "No available TX queue\n");
7857 +- return -1;
7858 +- }
7859 ++ q = qinfo->tqi_subtype;
7860 + break;
7861 + default:
7862 + ath_err(common, "Invalid TX queue type: %u\n", type);
7863 +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
7864 +index 7ef0f868b3e0..16b3bd684942 100644
7865 +--- a/drivers/pci/probe.c
7866 ++++ b/drivers/pci/probe.c
7867 +@@ -214,14 +214,17 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
7868 + res->flags |= IORESOURCE_SIZEALIGN;
7869 + if (res->flags & IORESOURCE_IO) {
7870 + l &= PCI_BASE_ADDRESS_IO_MASK;
7871 ++ sz &= PCI_BASE_ADDRESS_IO_MASK;
7872 + mask = PCI_BASE_ADDRESS_IO_MASK & (u32) IO_SPACE_LIMIT;
7873 + } else {
7874 + l &= PCI_BASE_ADDRESS_MEM_MASK;
7875 ++ sz &= PCI_BASE_ADDRESS_MEM_MASK;
7876 + mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
7877 + }
7878 + } else {
7879 + res->flags |= (l & IORESOURCE_ROM_ENABLE);
7880 + l &= PCI_ROM_ADDRESS_MASK;
7881 ++ sz &= PCI_ROM_ADDRESS_MASK;
7882 + mask = (u32)PCI_ROM_ADDRESS_MASK;
7883 + }
7884 +
7885 +diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
7886 +index a1ffae4c3770..260a2551d612 100644
7887 +--- a/drivers/pinctrl/core.c
7888 ++++ b/drivers/pinctrl/core.c
7889 +@@ -1796,14 +1796,15 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
7890 + if (pctldev == NULL)
7891 + return;
7892 +
7893 +- mutex_lock(&pinctrldev_list_mutex);
7894 + mutex_lock(&pctldev->mutex);
7895 +-
7896 + pinctrl_remove_device_debugfs(pctldev);
7897 ++ mutex_unlock(&pctldev->mutex);
7898 +
7899 + if (!IS_ERR(pctldev->p))
7900 + pinctrl_put(pctldev->p);
7901 +
7902 ++ mutex_lock(&pinctrldev_list_mutex);
7903 ++ mutex_lock(&pctldev->mutex);
7904 + /* TODO: check that no pinmuxes are still active? */
7905 + list_del(&pctldev->node);
7906 + /* Destroy descriptor tree */
7907 +diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
7908 +index 0ed96df20162..3458eb6fd491 100644
7909 +--- a/drivers/platform/x86/hp_accel.c
7910 ++++ b/drivers/platform/x86/hp_accel.c
7911 +@@ -237,6 +237,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
7912 + AXIS_DMI_MATCH("HPB64xx", "HP ProBook 64", xy_swap),
7913 + AXIS_DMI_MATCH("HPB64xx", "HP EliteBook 84", xy_swap),
7914 + AXIS_DMI_MATCH("HPB65xx", "HP ProBook 65", x_inverted),
7915 ++ AXIS_DMI_MATCH("HPZBook15", "HP ZBook 15", x_inverted),
7916 + { NULL, }
7917 + /* Laptop models without axis info (yet):
7918 + * "NC6910" "HP Compaq 6910"
7919 +diff --git a/drivers/rtc/rtc-sirfsoc.c b/drivers/rtc/rtc-sirfsoc.c
7920 +index 63460cf80f1b..3b13401b3682 100644
7921 +--- a/drivers/rtc/rtc-sirfsoc.c
7922 ++++ b/drivers/rtc/rtc-sirfsoc.c
7923 +@@ -290,14 +290,6 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev)
7924 + rtc_div = ((32768 / RTC_HZ) / 2) - 1;
7925 + sirfsoc_rtc_iobrg_writel(rtc_div, rtcdrv->rtc_base + RTC_DIV);
7926 +
7927 +- rtcdrv->rtc = rtc_device_register(pdev->name, &(pdev->dev),
7928 +- &sirfsoc_rtc_ops, THIS_MODULE);
7929 +- if (IS_ERR(rtcdrv->rtc)) {
7930 +- err = PTR_ERR(rtcdrv->rtc);
7931 +- dev_err(&pdev->dev, "can't register RTC device\n");
7932 +- return err;
7933 +- }
7934 +-
7935 + /* 0x3 -> RTC_CLK */
7936 + sirfsoc_rtc_iobrg_writel(SIRFSOC_RTC_CLK,
7937 + rtcdrv->rtc_base + RTC_CLOCK_SWITCH);
7938 +@@ -312,6 +304,14 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev)
7939 + rtcdrv->overflow_rtc =
7940 + sirfsoc_rtc_iobrg_readl(rtcdrv->rtc_base + RTC_SW_VALUE);
7941 +
7942 ++ rtcdrv->rtc = rtc_device_register(pdev->name, &(pdev->dev),
7943 ++ &sirfsoc_rtc_ops, THIS_MODULE);
7944 ++ if (IS_ERR(rtcdrv->rtc)) {
7945 ++ err = PTR_ERR(rtcdrv->rtc);
7946 ++ dev_err(&pdev->dev, "can't register RTC device\n");
7947 ++ return err;
7948 ++ }
7949 ++
7950 + rtcdrv->irq = platform_get_irq(pdev, 0);
7951 + err = devm_request_irq(
7952 + &pdev->dev,
7953 +diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
7954 +index 02300dcfac91..2efa66c6914e 100644
7955 +--- a/drivers/s390/crypto/ap_bus.c
7956 ++++ b/drivers/s390/crypto/ap_bus.c
7957 +@@ -44,6 +44,7 @@
7958 + #include <linux/hrtimer.h>
7959 + #include <linux/ktime.h>
7960 + #include <asm/facility.h>
7961 ++#include <linux/crypto.h>
7962 +
7963 + #include "ap_bus.h"
7964 +
7965 +@@ -71,7 +72,7 @@ MODULE_AUTHOR("IBM Corporation");
7966 + MODULE_DESCRIPTION("Adjunct Processor Bus driver, " \
7967 + "Copyright IBM Corp. 2006, 2012");
7968 + MODULE_LICENSE("GPL");
7969 +-MODULE_ALIAS("z90crypt");
7970 ++MODULE_ALIAS_CRYPTO("z90crypt");
7971 +
7972 + /*
7973 + * Module parameter
7974 +diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
7975 +index 074f278f7dab..5f841652886e 100644
7976 +--- a/drivers/scsi/ipr.c
7977 ++++ b/drivers/scsi/ipr.c
7978 +@@ -683,6 +683,7 @@ static void ipr_init_ipr_cmnd(struct ipr_cmnd *ipr_cmd,
7979 + ipr_reinit_ipr_cmnd(ipr_cmd);
7980 + ipr_cmd->u.scratch = 0;
7981 + ipr_cmd->sibling = NULL;
7982 ++ ipr_cmd->eh_comp = NULL;
7983 + ipr_cmd->fast_done = fast_done;
7984 + init_timer(&ipr_cmd->timer);
7985 + }
7986 +@@ -848,6 +849,8 @@ static void ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd)
7987 +
7988 + scsi_dma_unmap(ipr_cmd->scsi_cmd);
7989 + scsi_cmd->scsi_done(scsi_cmd);
7990 ++ if (ipr_cmd->eh_comp)
7991 ++ complete(ipr_cmd->eh_comp);
7992 + list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
7993 + }
7994 +
7995 +@@ -4805,6 +4808,84 @@ static int ipr_slave_alloc(struct scsi_device *sdev)
7996 + return rc;
7997 + }
7998 +
7999 ++/**
8000 ++ * ipr_match_lun - Match function for specified LUN
8001 ++ * @ipr_cmd: ipr command struct
8002 ++ * @device: device to match (sdev)
8003 ++ *
8004 ++ * Returns:
8005 ++ * 1 if command matches sdev / 0 if command does not match sdev
8006 ++ **/
8007 ++static int ipr_match_lun(struct ipr_cmnd *ipr_cmd, void *device)
8008 ++{
8009 ++ if (ipr_cmd->scsi_cmd && ipr_cmd->scsi_cmd->device == device)
8010 ++ return 1;
8011 ++ return 0;
8012 ++}
8013 ++
8014 ++/**
8015 ++ * ipr_wait_for_ops - Wait for matching commands to complete
8016 ++ * @ipr_cmd: ipr command struct
8017 ++ * @device: device to match (sdev)
8018 ++ * @match: match function to use
8019 ++ *
8020 ++ * Returns:
8021 ++ * SUCCESS / FAILED
8022 ++ **/
8023 ++static int ipr_wait_for_ops(struct ipr_ioa_cfg *ioa_cfg, void *device,
8024 ++ int (*match)(struct ipr_cmnd *, void *))
8025 ++{
8026 ++ struct ipr_cmnd *ipr_cmd;
8027 ++ int wait;
8028 ++ unsigned long flags;
8029 ++ struct ipr_hrr_queue *hrrq;
8030 ++ signed long timeout = IPR_ABORT_TASK_TIMEOUT;
8031 ++ DECLARE_COMPLETION_ONSTACK(comp);
8032 ++
8033 ++ ENTER;
8034 ++ do {
8035 ++ wait = 0;
8036 ++
8037 ++ for_each_hrrq(hrrq, ioa_cfg) {
8038 ++ spin_lock_irqsave(hrrq->lock, flags);
8039 ++ list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) {
8040 ++ if (match(ipr_cmd, device)) {
8041 ++ ipr_cmd->eh_comp = &comp;
8042 ++ wait++;
8043 ++ }
8044 ++ }
8045 ++ spin_unlock_irqrestore(hrrq->lock, flags);
8046 ++ }
8047 ++
8048 ++ if (wait) {
8049 ++ timeout = wait_for_completion_timeout(&comp, timeout);
8050 ++
8051 ++ if (!timeout) {
8052 ++ wait = 0;
8053 ++
8054 ++ for_each_hrrq(hrrq, ioa_cfg) {
8055 ++ spin_lock_irqsave(hrrq->lock, flags);
8056 ++ list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) {
8057 ++ if (match(ipr_cmd, device)) {
8058 ++ ipr_cmd->eh_comp = NULL;
8059 ++ wait++;
8060 ++ }
8061 ++ }
8062 ++ spin_unlock_irqrestore(hrrq->lock, flags);
8063 ++ }
8064 ++
8065 ++ if (wait)
8066 ++ dev_err(&ioa_cfg->pdev->dev, "Timed out waiting for aborted commands\n");
8067 ++ LEAVE;
8068 ++ return wait ? FAILED : SUCCESS;
8069 ++ }
8070 ++ }
8071 ++ } while (wait);
8072 ++
8073 ++ LEAVE;
8074 ++ return SUCCESS;
8075 ++}
8076 ++
8077 + static int ipr_eh_host_reset(struct scsi_cmnd *cmd)
8078 + {
8079 + struct ipr_ioa_cfg *ioa_cfg;
8080 +@@ -5023,11 +5104,17 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd)
8081 + static int ipr_eh_dev_reset(struct scsi_cmnd *cmd)
8082 + {
8083 + int rc;
8084 ++ struct ipr_ioa_cfg *ioa_cfg;
8085 ++
8086 ++ ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata;
8087 +
8088 + spin_lock_irq(cmd->device->host->host_lock);
8089 + rc = __ipr_eh_dev_reset(cmd);
8090 + spin_unlock_irq(cmd->device->host->host_lock);
8091 +
8092 ++ if (rc == SUCCESS)
8093 ++ rc = ipr_wait_for_ops(ioa_cfg, cmd->device, ipr_match_lun);
8094 ++
8095 + return rc;
8096 + }
8097 +
8098 +@@ -5205,13 +5292,18 @@ static int ipr_eh_abort(struct scsi_cmnd *scsi_cmd)
8099 + {
8100 + unsigned long flags;
8101 + int rc;
8102 ++ struct ipr_ioa_cfg *ioa_cfg;
8103 +
8104 + ENTER;
8105 +
8106 ++ ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
8107 ++
8108 + spin_lock_irqsave(scsi_cmd->device->host->host_lock, flags);
8109 + rc = ipr_cancel_op(scsi_cmd);
8110 + spin_unlock_irqrestore(scsi_cmd->device->host->host_lock, flags);
8111 +
8112 ++ if (rc == SUCCESS)
8113 ++ rc = ipr_wait_for_ops(ioa_cfg, scsi_cmd->device, ipr_match_lun);
8114 + LEAVE;
8115 + return rc;
8116 + }
8117 +diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
8118 +index 58c6630fe3e2..c5f2e9a0a4a4 100644
8119 +--- a/drivers/scsi/ipr.h
8120 ++++ b/drivers/scsi/ipr.h
8121 +@@ -1588,6 +1588,7 @@ struct ipr_cmnd {
8122 + struct scsi_device *sdev;
8123 + } u;
8124 +
8125 ++ struct completion *eh_comp;
8126 + struct ipr_hrr_queue *hrrq;
8127 + struct ipr_ioa_cfg *ioa_cfg;
8128 + };
8129 +diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c
8130 +index 9d26637308be..396d78ef59e7 100644
8131 +--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
8132 ++++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
8133 +@@ -1006,12 +1006,9 @@ mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
8134 + &mpt2sas_phy->remote_identify);
8135 + _transport_add_phy_to_an_existing_port(ioc, sas_node,
8136 + mpt2sas_phy, mpt2sas_phy->remote_identify.sas_address);
8137 +- } else {
8138 ++ } else
8139 + memset(&mpt2sas_phy->remote_identify, 0 , sizeof(struct
8140 + sas_identify));
8141 +- _transport_del_phy_from_an_existing_port(ioc, sas_node,
8142 +- mpt2sas_phy);
8143 +- }
8144 +
8145 + if (mpt2sas_phy->phy)
8146 + mpt2sas_phy->phy->negotiated_linkrate =
8147 +diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
8148 +index e771a88c6a74..dcadd56860ff 100644
8149 +--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
8150 ++++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
8151 +@@ -1003,12 +1003,9 @@ mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER *ioc,
8152 + &mpt3sas_phy->remote_identify);
8153 + _transport_add_phy_to_an_existing_port(ioc, sas_node,
8154 + mpt3sas_phy, mpt3sas_phy->remote_identify.sas_address);
8155 +- } else {
8156 ++ } else
8157 + memset(&mpt3sas_phy->remote_identify, 0 , sizeof(struct
8158 + sas_identify));
8159 +- _transport_del_phy_from_an_existing_port(ioc, sas_node,
8160 +- mpt3sas_phy);
8161 +- }
8162 +
8163 + if (mpt3sas_phy->phy)
8164 + mpt3sas_phy->phy->negotiated_linkrate =
8165 +diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
8166 +index c1d04d4d3c6c..262ab837a704 100644
8167 +--- a/drivers/scsi/scsi_devinfo.c
8168 ++++ b/drivers/scsi/scsi_devinfo.c
8169 +@@ -211,6 +211,7 @@ static struct {
8170 + {"Medion", "Flash XL MMC/SD", "2.6D", BLIST_FORCELUN},
8171 + {"MegaRAID", "LD", NULL, BLIST_FORCELUN},
8172 + {"MICROP", "4110", NULL, BLIST_NOTQ},
8173 ++ {"MSFT", "Virtual HD", NULL, BLIST_NO_RSOC},
8174 + {"MYLEX", "DACARMRB", "*", BLIST_REPORTLUN2},
8175 + {"nCipher", "Fastness Crypto", NULL, BLIST_FORCELUN},
8176 + {"NAKAMICH", "MJ-4.8S", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
8177 +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
8178 +index ed0f899e8aa5..86b05151fdab 100644
8179 +--- a/drivers/scsi/storvsc_drv.c
8180 ++++ b/drivers/scsi/storvsc_drv.c
8181 +@@ -1690,13 +1690,12 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
8182 + if (ret == -EAGAIN) {
8183 + /* no more space */
8184 +
8185 +- if (cmd_request->bounce_sgl_count) {
8186 ++ if (cmd_request->bounce_sgl_count)
8187 + destroy_bounce_buffer(cmd_request->bounce_sgl,
8188 + cmd_request->bounce_sgl_count);
8189 +
8190 +- ret = SCSI_MLQUEUE_DEVICE_BUSY;
8191 +- goto queue_error;
8192 +- }
8193 ++ ret = SCSI_MLQUEUE_DEVICE_BUSY;
8194 ++ goto queue_error;
8195 + }
8196 +
8197 + return 0;
8198 +diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
8199 +index 2129fcd1c31b..6ee3dc4dbb2e 100644
8200 +--- a/drivers/spi/spi-fsl-spi.c
8201 ++++ b/drivers/spi/spi-fsl-spi.c
8202 +@@ -362,18 +362,28 @@ static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t,
8203 + static void fsl_spi_do_one_msg(struct spi_message *m)
8204 + {
8205 + struct spi_device *spi = m->spi;
8206 +- struct spi_transfer *t;
8207 ++ struct spi_transfer *t, *first;
8208 + unsigned int cs_change;
8209 + const int nsecs = 50;
8210 + int status;
8211 +
8212 +- cs_change = 1;
8213 +- status = 0;
8214 ++ /* Don't allow changes if CS is active */
8215 ++ first = list_first_entry(&m->transfers, struct spi_transfer,
8216 ++ transfer_list);
8217 + list_for_each_entry(t, &m->transfers, transfer_list) {
8218 +- if (t->bits_per_word || t->speed_hz) {
8219 +- /* Don't allow changes if CS is active */
8220 ++ if ((first->bits_per_word != t->bits_per_word) ||
8221 ++ (first->speed_hz != t->speed_hz)) {
8222 + status = -EINVAL;
8223 ++ dev_err(&spi->dev,
8224 ++ "bits_per_word/speed_hz should be same for the same SPI transfer\n");
8225 ++ return;
8226 ++ }
8227 ++ }
8228 +
8229 ++ cs_change = 1;
8230 ++ status = -EINVAL;
8231 ++ list_for_each_entry(t, &m->transfers, transfer_list) {
8232 ++ if (t->bits_per_word || t->speed_hz) {
8233 + if (cs_change)
8234 + status = fsl_spi_setup_transfer(spi, t);
8235 + if (status < 0)
8236 +diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
8237 +index e7629be39739..c6ca9ca8eab4 100644
8238 +--- a/drivers/staging/lustre/lustre/llite/dcache.c
8239 ++++ b/drivers/staging/lustre/lustre/llite/dcache.c
8240 +@@ -278,7 +278,7 @@ void ll_invalidate_aliases(struct inode *inode)
8241 + inode->i_ino, inode->i_generation, inode);
8242 +
8243 + ll_lock_dcache(inode);
8244 +- ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
8245 ++ ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) {
8246 + CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p "
8247 + "inode %p flags %d\n", dentry->d_name.len,
8248 + dentry->d_name.name, dentry, dentry->d_parent,
8249 +diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
8250 +index b868c2bd58d2..04313298df4a 100644
8251 +--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
8252 ++++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
8253 +@@ -665,7 +665,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
8254 + return;
8255 +
8256 + list_for_each(tmp, &dentry->d_subdirs) {
8257 +- struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child);
8258 ++ struct dentry *d = list_entry(tmp, struct dentry, d_child);
8259 + lustre_dump_dentry(d, recur - 1);
8260 + }
8261 + }
8262 +diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
8263 +index 34815b550e71..cd90a6539555 100644
8264 +--- a/drivers/staging/lustre/lustre/llite/namei.c
8265 ++++ b/drivers/staging/lustre/lustre/llite/namei.c
8266 +@@ -175,14 +175,14 @@ static void ll_invalidate_negative_children(struct inode *dir)
8267 + struct ll_d_hlist_node *p;
8268 +
8269 + ll_lock_dcache(dir);
8270 +- ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_alias) {
8271 ++ ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) {
8272 + spin_lock(&dentry->d_lock);
8273 + if (!list_empty(&dentry->d_subdirs)) {
8274 + struct dentry *child;
8275 +
8276 + list_for_each_entry_safe(child, tmp_subdir,
8277 + &dentry->d_subdirs,
8278 +- d_u.d_child) {
8279 ++ d_child) {
8280 + if (child->d_inode == NULL)
8281 + d_lustre_invalidate(child, 1);
8282 + }
8283 +@@ -363,7 +363,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
8284 + discon_alias = invalid_alias = NULL;
8285 +
8286 + ll_lock_dcache(inode);
8287 +- ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_alias) {
8288 ++ ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) {
8289 + LASSERT(alias != dentry);
8290 +
8291 + spin_lock(&alias->d_lock);
8292 +@@ -953,7 +953,7 @@ static void ll_get_child_fid(struct inode * dir, struct qstr *name,
8293 + {
8294 + struct dentry *parent, *child;
8295 +
8296 +- parent = ll_d_hlist_entry(dir->i_dentry, struct dentry, d_alias);
8297 ++ parent = ll_d_hlist_entry(dir->i_dentry, struct dentry, d_u.d_alias);
8298 + child = d_lookup(parent, name);
8299 + if (child) {
8300 + if (child->d_inode)
8301 +diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
8302 +index 8d44bec42e95..0c15772c5035 100644
8303 +--- a/drivers/target/iscsi/iscsi_target_login.c
8304 ++++ b/drivers/target/iscsi/iscsi_target_login.c
8305 +@@ -1188,6 +1188,9 @@ old_sess_out:
8306 + conn->sock = NULL;
8307 + }
8308 +
8309 ++ if (conn->conn_transport->iscsit_wait_conn)
8310 ++ conn->conn_transport->iscsit_wait_conn(conn);
8311 ++
8312 + if (conn->conn_transport->iscsit_free_conn)
8313 + conn->conn_transport->iscsit_free_conn(conn);
8314 +
8315 +diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
8316 +index 658c9c77ec04..c5c98559f7f6 100644
8317 +--- a/drivers/target/iscsi/iscsi_target_util.c
8318 ++++ b/drivers/target/iscsi/iscsi_target_util.c
8319 +@@ -1355,15 +1355,15 @@ static int iscsit_do_tx_data(
8320 + struct iscsi_conn *conn,
8321 + struct iscsi_data_count *count)
8322 + {
8323 +- int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len;
8324 ++ int ret, iov_len;
8325 + struct kvec *iov_p;
8326 + struct msghdr msg;
8327 +
8328 + if (!conn || !conn->sock || !conn->conn_ops)
8329 + return -1;
8330 +
8331 +- if (data <= 0) {
8332 +- pr_err("Data length is: %d\n", data);
8333 ++ if (count->data_length <= 0) {
8334 ++ pr_err("Data length is: %d\n", count->data_length);
8335 + return -1;
8336 + }
8337 +
8338 +@@ -1372,20 +1372,16 @@ static int iscsit_do_tx_data(
8339 + iov_p = count->iov;
8340 + iov_len = count->iov_count;
8341 +
8342 +- while (total_tx < data) {
8343 +- tx_loop = kernel_sendmsg(conn->sock, &msg, iov_p, iov_len,
8344 +- (data - total_tx));
8345 +- if (tx_loop <= 0) {
8346 +- pr_debug("tx_loop: %d total_tx %d\n",
8347 +- tx_loop, total_tx);
8348 +- return tx_loop;
8349 +- }
8350 +- total_tx += tx_loop;
8351 +- pr_debug("tx_loop: %d, total_tx: %d, data: %d\n",
8352 +- tx_loop, total_tx, data);
8353 ++ ret = kernel_sendmsg(conn->sock, &msg, iov_p, iov_len,
8354 ++ count->data_length);
8355 ++ if (ret != count->data_length) {
8356 ++ pr_err("Unexpected ret: %d send data %d\n",
8357 ++ ret, count->data_length);
8358 ++ return -EPIPE;
8359 + }
8360 ++ pr_debug("ret: %d, sent data: %d\n", ret, count->data_length);
8361 +
8362 +- return total_tx;
8363 ++ return ret;
8364 + }
8365 +
8366 + int rx_data(
8367 +diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
8368 +index b40b37cd25e0..d54388a53637 100644
8369 +--- a/drivers/thermal/intel_powerclamp.c
8370 ++++ b/drivers/thermal/intel_powerclamp.c
8371 +@@ -426,7 +426,6 @@ static int clamp_thread(void *arg)
8372 + * allowed. thus jiffies are updated properly.
8373 + */
8374 + preempt_disable();
8375 +- tick_nohz_idle_enter();
8376 + /* mwait until target jiffies is reached */
8377 + while (time_before(jiffies, target_jiffies)) {
8378 + unsigned long ecx = 1;
8379 +@@ -444,7 +443,6 @@ static int clamp_thread(void *arg)
8380 + start_critical_timings();
8381 + atomic_inc(&idle_wakeup_counter);
8382 + }
8383 +- tick_nohz_idle_exit();
8384 + preempt_enable_no_resched();
8385 + }
8386 + del_timer_sync(&wakeup_timer);
8387 +diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
8388 +index 1197767b3019..d711dbb6d9fb 100644
8389 +--- a/drivers/tty/n_tty.c
8390 ++++ b/drivers/tty/n_tty.c
8391 +@@ -319,7 +319,8 @@ static void n_tty_check_unthrottle(struct tty_struct *tty)
8392 +
8393 + static inline void put_tty_queue(unsigned char c, struct n_tty_data *ldata)
8394 + {
8395 +- *read_buf_addr(ldata, ldata->read_head++) = c;
8396 ++ *read_buf_addr(ldata, ldata->read_head) = c;
8397 ++ ldata->read_head++;
8398 + }
8399 +
8400 + /**
8401 +diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
8402 +index f3dfa19a1cb8..6b0adfbfacaf 100644
8403 +--- a/drivers/tty/serial/samsung.c
8404 ++++ b/drivers/tty/serial/samsung.c
8405 +@@ -537,11 +537,15 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
8406 + unsigned int old)
8407 + {
8408 + struct s3c24xx_uart_port *ourport = to_ourport(port);
8409 ++ int timeout = 10000;
8410 +
8411 + ourport->pm_level = level;
8412 +
8413 + switch (level) {
8414 + case 3:
8415 ++ while (--timeout && !s3c24xx_serial_txempty_nofifo(port))
8416 ++ udelay(100);
8417 ++
8418 + if (!IS_ERR(ourport->baudclk))
8419 + clk_disable_unprepare(ourport->baudclk);
8420 +
8421 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
8422 +index 99fd026161d5..2574b24d70c0 100644
8423 +--- a/drivers/usb/class/cdc-acm.c
8424 ++++ b/drivers/usb/class/cdc-acm.c
8425 +@@ -1079,10 +1079,11 @@ next_desc:
8426 + } else {
8427 + control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0);
8428 + data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0));
8429 +- if (!control_interface || !data_interface) {
8430 +- dev_dbg(&intf->dev, "no interfaces\n");
8431 +- return -ENODEV;
8432 +- }
8433 ++ }
8434 ++
8435 ++ if (!control_interface || !data_interface) {
8436 ++ dev_dbg(&intf->dev, "no interfaces\n");
8437 ++ return -ENODEV;
8438 + }
8439 +
8440 + if (data_interface_num != call_interface_num)
8441 +@@ -1357,6 +1358,7 @@ alloc_fail8:
8442 + &dev_attr_wCountryCodes);
8443 + device_remove_file(&acm->control->dev,
8444 + &dev_attr_iCountryCodeRelDate);
8445 ++ kfree(acm->country_codes);
8446 + }
8447 + device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
8448 + alloc_fail7:
8449 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
8450 +index be149b82564f..d19564d0f79a 100644
8451 +--- a/drivers/usb/dwc3/gadget.c
8452 ++++ b/drivers/usb/dwc3/gadget.c
8453 +@@ -887,8 +887,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
8454 +
8455 + if (i == (request->num_mapped_sgs - 1) ||
8456 + sg_is_last(s)) {
8457 +- if (list_is_last(&req->list,
8458 +- &dep->request_list))
8459 ++ if (list_empty(&dep->request_list))
8460 + last_one = true;
8461 + chain = false;
8462 + }
8463 +@@ -906,6 +905,9 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
8464 + if (last_one)
8465 + break;
8466 + }
8467 ++
8468 ++ if (last_one)
8469 ++ break;
8470 + } else {
8471 + dma = req->request.dma;
8472 + length = req->request.length;
8473 +diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
8474 +index 85dd24ed97a6..8ecf164f0318 100644
8475 +--- a/drivers/usb/host/ehci-sched.c
8476 ++++ b/drivers/usb/host/ehci-sched.c
8477 +@@ -1384,6 +1384,10 @@ iso_stream_schedule (
8478 +
8479 + now = ehci_read_frame_index(ehci) & (mod - 1);
8480 +
8481 ++ /* If needed, initialize last_iso_frame so that this URB will be seen */
8482 ++ if (ehci->isoc_count == 0)
8483 ++ ehci->last_iso_frame = now >> 3;
8484 ++
8485 + /* Typical case: reuse current schedule, stream is still active.
8486 + * Hopefully there are no gaps from the host falling behind
8487 + * (irq delays etc). If there are, the behavior depends on
8488 +@@ -1493,10 +1497,6 @@ iso_stream_schedule (
8489 + urb->start_frame = stream->next_uframe;
8490 + if (!stream->highspeed)
8491 + urb->start_frame >>= 3;
8492 +-
8493 +- /* Make sure scan_isoc() sees these */
8494 +- if (ehci->isoc_count == 0)
8495 +- ehci->last_iso_frame = now >> 3;
8496 + return 0;
8497 +
8498 + fail:
8499 +diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
8500 +index 877f87f9513b..5a45437da097 100644
8501 +--- a/drivers/usb/host/pci-quirks.c
8502 ++++ b/drivers/usb/host/pci-quirks.c
8503 +@@ -560,7 +560,8 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev)
8504 + {
8505 + void __iomem *base;
8506 + u32 control;
8507 +- u32 fminterval;
8508 ++ u32 fminterval = 0;
8509 ++ bool no_fminterval = false;
8510 + int cnt;
8511 +
8512 + if (!mmio_resource_enabled(pdev, 0))
8513 +@@ -570,6 +571,13 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev)
8514 + if (base == NULL)
8515 + return;
8516 +
8517 ++ /*
8518 ++ * ULi M5237 OHCI controller locks the whole system when accessing
8519 ++ * the OHCI_FMINTERVAL offset.
8520 ++ */
8521 ++ if (pdev->vendor == PCI_VENDOR_ID_AL && pdev->device == 0x5237)
8522 ++ no_fminterval = true;
8523 ++
8524 + control = readl(base + OHCI_CONTROL);
8525 +
8526 + /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
8527 +@@ -608,7 +616,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev)
8528 + }
8529 +
8530 + /* software reset of the controller, preserving HcFmInterval */
8531 +- fminterval = readl(base + OHCI_FMINTERVAL);
8532 ++ if (!no_fminterval)
8533 ++ fminterval = readl(base + OHCI_FMINTERVAL);
8534 ++
8535 + writel(OHCI_HCR, base + OHCI_CMDSTATUS);
8536 +
8537 + /* reset requires max 10 us delay */
8538 +@@ -617,7 +627,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev)
8539 + break;
8540 + udelay(1);
8541 + }
8542 +- writel(fminterval, base + OHCI_FMINTERVAL);
8543 ++
8544 ++ if (!no_fminterval)
8545 ++ writel(fminterval, base + OHCI_FMINTERVAL);
8546 +
8547 + /* Now the controller is safely in SUSPEND and nothing can wake it up */
8548 + iounmap(base);
8549 +diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
8550 +index 3eaa83f05086..e2373f179522 100644
8551 +--- a/drivers/usb/misc/adutux.c
8552 ++++ b/drivers/usb/misc/adutux.c
8553 +@@ -815,15 +815,10 @@ static void adu_disconnect(struct usb_interface *interface)
8554 + usb_set_intfdata(interface, NULL);
8555 +
8556 + /* if the device is not opened, then we clean up right now */
8557 +- dev_dbg(&dev->udev->dev, "%s : open count %d\n",
8558 +- __func__, dev->open_count);
8559 + if (!dev->open_count)
8560 + adu_delete(dev);
8561 +
8562 + mutex_unlock(&adutux_mutex);
8563 +-
8564 +- dev_info(&interface->dev, "ADU device adutux%d now disconnected\n",
8565 +- (minor - ADU_MINOR_BASE));
8566 + }
8567 +
8568 + /* usb specific object needed to register this driver with the usb subsystem */
8569 +diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
8570 +index 5c91ff379345..77b475a43dad 100644
8571 +--- a/drivers/usb/musb/musb_cppi41.c
8572 ++++ b/drivers/usb/musb/musb_cppi41.c
8573 +@@ -586,9 +586,9 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller)
8574 + ret = of_property_read_string_index(np, "dma-names", i, &str);
8575 + if (ret)
8576 + goto err;
8577 +- if (!strncmp(str, "tx", 2))
8578 ++ if (strstarts(str, "tx"))
8579 + is_tx = 1;
8580 +- else if (!strncmp(str, "rx", 2))
8581 ++ else if (strstarts(str, "rx"))
8582 + is_tx = 0;
8583 + else {
8584 + dev_err(dev, "Wrong dmatype %s\n", str);
8585 +diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
8586 +index 4c216790e86b..05d1b203f0d0 100644
8587 +--- a/drivers/usb/musb/musb_debugfs.c
8588 ++++ b/drivers/usb/musb/musb_debugfs.c
8589 +@@ -194,30 +194,30 @@ static ssize_t musb_test_mode_write(struct file *file,
8590 + if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
8591 + return -EFAULT;
8592 +
8593 +- if (!strncmp(buf, "force host", 9))
8594 ++ if (strstarts(buf, "force host"))
8595 + test = MUSB_TEST_FORCE_HOST;
8596 +
8597 +- if (!strncmp(buf, "fifo access", 11))
8598 ++ if (strstarts(buf, "fifo access"))
8599 + test = MUSB_TEST_FIFO_ACCESS;
8600 +
8601 +- if (!strncmp(buf, "force full-speed", 15))
8602 ++ if (strstarts(buf, "force full-speed"))
8603 + test = MUSB_TEST_FORCE_FS;
8604 +
8605 +- if (!strncmp(buf, "force high-speed", 15))
8606 ++ if (strstarts(buf, "force high-speed"))
8607 + test = MUSB_TEST_FORCE_HS;
8608 +
8609 +- if (!strncmp(buf, "test packet", 10)) {
8610 ++ if (strstarts(buf, "test packet")) {
8611 + test = MUSB_TEST_PACKET;
8612 + musb_load_testpacket(musb);
8613 + }
8614 +
8615 +- if (!strncmp(buf, "test K", 6))
8616 ++ if (strstarts(buf, "test K"))
8617 + test = MUSB_TEST_K;
8618 +
8619 +- if (!strncmp(buf, "test J", 6))
8620 ++ if (strstarts(buf, "test J"))
8621 + test = MUSB_TEST_J;
8622 +
8623 +- if (!strncmp(buf, "test SE0 NAK", 12))
8624 ++ if (strstarts(buf, "test SE0 NAK"))
8625 + test = MUSB_TEST_SE0_NAK;
8626 +
8627 + musb_writeb(musb->mregs, MUSB_TESTMODE, test);
8628 +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
8629 +index 9a2b8c85f19a..d73cda3591aa 100644
8630 +--- a/drivers/usb/musb/musb_host.c
8631 ++++ b/drivers/usb/musb/musb_host.c
8632 +@@ -2631,7 +2631,6 @@ void musb_host_cleanup(struct musb *musb)
8633 + if (musb->port_mode == MUSB_PORT_MODE_GADGET)
8634 + return;
8635 + usb_remove_hcd(musb->hcd);
8636 +- musb->hcd = NULL;
8637 + }
8638 +
8639 + void musb_host_free(struct musb *musb)
8640 +diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
8641 +index c69bb50d4663..e4ce48cf7a64 100644
8642 +--- a/drivers/usb/serial/console.c
8643 ++++ b/drivers/usb/serial/console.c
8644 +@@ -47,6 +47,8 @@ static struct console usbcons;
8645 + * ------------------------------------------------------------
8646 + */
8647 +
8648 ++static const struct tty_operations usb_console_fake_tty_ops = {
8649 ++};
8650 +
8651 + /*
8652 + * The parsing of the command line works exactly like the
8653 +@@ -139,14 +141,18 @@ static int usb_console_setup(struct console *co, char *options)
8654 + goto reset_open_count;
8655 + }
8656 + kref_init(&tty->kref);
8657 +- tty_port_tty_set(&port->port, tty);
8658 + tty->driver = usb_serial_tty_driver;
8659 + tty->index = co->index;
8660 ++ init_ldsem(&tty->ldisc_sem);
8661 ++ INIT_LIST_HEAD(&tty->tty_files);
8662 ++ kref_get(&tty->driver->kref);
8663 ++ tty->ops = &usb_console_fake_tty_ops;
8664 + if (tty_init_termios(tty)) {
8665 + retval = -ENOMEM;
8666 + dev_err(&port->dev, "no more memory\n");
8667 +- goto free_tty;
8668 ++ goto put_tty;
8669 + }
8670 ++ tty_port_tty_set(&port->port, tty);
8671 + }
8672 +
8673 + /* only call the device specific open if this
8674 +@@ -164,7 +170,7 @@ static int usb_console_setup(struct console *co, char *options)
8675 + serial->type->set_termios(tty, port, &dummy);
8676 +
8677 + tty_port_tty_set(&port->port, NULL);
8678 +- kfree(tty);
8679 ++ tty_kref_put(tty);
8680 + }
8681 + set_bit(ASYNCB_INITIALIZED, &port->port.flags);
8682 + }
8683 +@@ -180,8 +186,8 @@ static int usb_console_setup(struct console *co, char *options)
8684 +
8685 + fail:
8686 + tty_port_tty_set(&port->port, NULL);
8687 +- free_tty:
8688 +- kfree(tty);
8689 ++ put_tty:
8690 ++ tty_kref_put(tty);
8691 + reset_open_count:
8692 + port->port.count = 0;
8693 + usb_autopm_put_interface(serial->interface);
8694 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
8695 +index 59fd7187daff..b5fa609def53 100644
8696 +--- a/drivers/usb/serial/cp210x.c
8697 ++++ b/drivers/usb/serial/cp210x.c
8698 +@@ -120,10 +120,12 @@ static const struct usb_device_id id_table[] = {
8699 + { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
8700 + { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
8701 + { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
8702 +- { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */
8703 ++ { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */
8704 ++ { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */
8705 + { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
8706 + { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
8707 + { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
8708 ++ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
8709 + { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
8710 + { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
8711 + { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
8712 +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
8713 +index dc3a77c8cd83..e58e21b46ef0 100644
8714 +--- a/drivers/usb/serial/keyspan.c
8715 ++++ b/drivers/usb/serial/keyspan.c
8716 +@@ -422,6 +422,8 @@ static void usa26_instat_callback(struct urb *urb)
8717 + }
8718 + port = serial->port[msg->port];
8719 + p_priv = usb_get_serial_port_data(port);
8720 ++ if (!p_priv)
8721 ++ goto resubmit;
8722 +
8723 + /* Update handshaking pin state information */
8724 + old_dcd_state = p_priv->dcd_state;
8725 +@@ -432,7 +434,7 @@ static void usa26_instat_callback(struct urb *urb)
8726 +
8727 + if (old_dcd_state != p_priv->dcd_state)
8728 + tty_port_tty_hangup(&port->port, true);
8729 +-
8730 ++resubmit:
8731 + /* Resubmit urb so we continue receiving */
8732 + err = usb_submit_urb(urb, GFP_ATOMIC);
8733 + if (err != 0)
8734 +@@ -542,6 +544,8 @@ static void usa28_instat_callback(struct urb *urb)
8735 + }
8736 + port = serial->port[msg->port];
8737 + p_priv = usb_get_serial_port_data(port);
8738 ++ if (!p_priv)
8739 ++ goto resubmit;
8740 +
8741 + /* Update handshaking pin state information */
8742 + old_dcd_state = p_priv->dcd_state;
8743 +@@ -552,7 +556,7 @@ static void usa28_instat_callback(struct urb *urb)
8744 +
8745 + if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
8746 + tty_port_tty_hangup(&port->port, true);
8747 +-
8748 ++resubmit:
8749 + /* Resubmit urb so we continue receiving */
8750 + err = usb_submit_urb(urb, GFP_ATOMIC);
8751 + if (err != 0)
8752 +@@ -625,6 +629,8 @@ static void usa49_instat_callback(struct urb *urb)
8753 + }
8754 + port = serial->port[msg->portNumber];
8755 + p_priv = usb_get_serial_port_data(port);
8756 ++ if (!p_priv)
8757 ++ goto resubmit;
8758 +
8759 + /* Update handshaking pin state information */
8760 + old_dcd_state = p_priv->dcd_state;
8761 +@@ -635,7 +641,7 @@ static void usa49_instat_callback(struct urb *urb)
8762 +
8763 + if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
8764 + tty_port_tty_hangup(&port->port, true);
8765 +-
8766 ++resubmit:
8767 + /* Resubmit urb so we continue receiving */
8768 + err = usb_submit_urb(urb, GFP_ATOMIC);
8769 + if (err != 0)
8770 +@@ -873,6 +879,8 @@ static void usa90_instat_callback(struct urb *urb)
8771 +
8772 + port = serial->port[0];
8773 + p_priv = usb_get_serial_port_data(port);
8774 ++ if (!p_priv)
8775 ++ goto resubmit;
8776 +
8777 + /* Update handshaking pin state information */
8778 + old_dcd_state = p_priv->dcd_state;
8779 +@@ -883,7 +891,7 @@ static void usa90_instat_callback(struct urb *urb)
8780 +
8781 + if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
8782 + tty_port_tty_hangup(&port->port, true);
8783 +-
8784 ++resubmit:
8785 + /* Resubmit urb so we continue receiving */
8786 + err = usb_submit_urb(urb, GFP_ATOMIC);
8787 + if (err != 0)
8788 +@@ -944,6 +952,8 @@ static void usa67_instat_callback(struct urb *urb)
8789 +
8790 + port = serial->port[msg->port];
8791 + p_priv = usb_get_serial_port_data(port);
8792 ++ if (!p_priv)
8793 ++ goto resubmit;
8794 +
8795 + /* Update handshaking pin state information */
8796 + old_dcd_state = p_priv->dcd_state;
8797 +@@ -952,7 +962,7 @@ static void usa67_instat_callback(struct urb *urb)
8798 +
8799 + if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
8800 + tty_port_tty_hangup(&port->port, true);
8801 +-
8802 ++resubmit:
8803 + /* Resubmit urb so we continue receiving */
8804 + err = usb_submit_urb(urb, GFP_ATOMIC);
8805 + if (err != 0)
8806 +diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
8807 +index 6ab71b9fcf8d..275aa3fc4087 100644
8808 +--- a/drivers/vfio/pci/vfio_pci.c
8809 ++++ b/drivers/vfio/pci/vfio_pci.c
8810 +@@ -821,13 +821,11 @@ static const struct vfio_device_ops vfio_pci_ops = {
8811 +
8812 + static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
8813 + {
8814 +- u8 type;
8815 + struct vfio_pci_device *vdev;
8816 + struct iommu_group *group;
8817 + int ret;
8818 +
8819 +- pci_read_config_byte(pdev, PCI_HEADER_TYPE, &type);
8820 +- if ((type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL)
8821 ++ if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL)
8822 + return -EINVAL;
8823 +
8824 + group = iommu_group_get(&pdev->dev);
8825 +diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
8826 +index c5b631cceb4c..d7fddc7d10d5 100644
8827 +--- a/drivers/vhost/scsi.c
8828 ++++ b/drivers/vhost/scsi.c
8829 +@@ -861,6 +861,23 @@ vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *cmd,
8830 + return 0;
8831 + }
8832 +
8833 ++static int vhost_scsi_to_tcm_attr(int attr)
8834 ++{
8835 ++ switch (attr) {
8836 ++ case VIRTIO_SCSI_S_SIMPLE:
8837 ++ return MSG_SIMPLE_TAG;
8838 ++ case VIRTIO_SCSI_S_ORDERED:
8839 ++ return MSG_ORDERED_TAG;
8840 ++ case VIRTIO_SCSI_S_HEAD:
8841 ++ return MSG_HEAD_TAG;
8842 ++ case VIRTIO_SCSI_S_ACA:
8843 ++ return MSG_ACA_TAG;
8844 ++ default:
8845 ++ break;
8846 ++ }
8847 ++ return MSG_SIMPLE_TAG;
8848 ++}
8849 ++
8850 + static void tcm_vhost_submission_work(struct work_struct *work)
8851 + {
8852 + struct tcm_vhost_cmd *cmd =
8853 +@@ -887,9 +904,9 @@ static void tcm_vhost_submission_work(struct work_struct *work)
8854 + rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess,
8855 + cmd->tvc_cdb, &cmd->tvc_sense_buf[0],
8856 + cmd->tvc_lun, cmd->tvc_exp_data_len,
8857 +- cmd->tvc_task_attr, cmd->tvc_data_direction,
8858 +- TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count,
8859 +- sg_bidi_ptr, sg_no_bidi);
8860 ++ vhost_scsi_to_tcm_attr(cmd->tvc_task_attr),
8861 ++ cmd->tvc_data_direction, TARGET_SCF_ACK_KREF,
8862 ++ sg_ptr, cmd->tvc_sgl_count, sg_bidi_ptr, sg_no_bidi);
8863 + if (rc < 0) {
8864 + transport_send_check_condition_and_sense(se_cmd,
8865 + TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
8866 +diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
8867 +index 080c35b34bbb..cc5dbb5b2f71 100644
8868 +--- a/drivers/video/logo/logo.c
8869 ++++ b/drivers/video/logo/logo.c
8870 +@@ -25,6 +25,21 @@ static bool nologo;
8871 + module_param(nologo, bool, 0);
8872 + MODULE_PARM_DESC(nologo, "Disables startup logo");
8873 +
8874 ++/*
8875 ++ * Logos are located in the initdata, and will be freed in kernel_init.
8876 ++ * Use late_init to mark the logos as freed to prevent any further use.
8877 ++ */
8878 ++
8879 ++static bool logos_freed;
8880 ++
8881 ++static int __init fb_logo_late_init(void)
8882 ++{
8883 ++ logos_freed = true;
8884 ++ return 0;
8885 ++}
8886 ++
8887 ++late_initcall(fb_logo_late_init);
8888 ++
8889 + /* logo's are marked __initdata. Use __init_refok to tell
8890 + * modpost that it is intended that this function uses data
8891 + * marked __initdata.
8892 +@@ -33,7 +48,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
8893 + {
8894 + const struct linux_logo *logo = NULL;
8895 +
8896 +- if (nologo)
8897 ++ if (nologo || logos_freed)
8898 + return NULL;
8899 +
8900 + if (depth >= 1) {
8901 +diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
8902 +index d9a43674cb94..9cca0ea4e479 100644
8903 +--- a/fs/affs/amigaffs.c
8904 ++++ b/fs/affs/amigaffs.c
8905 +@@ -126,7 +126,7 @@ affs_fix_dcache(struct inode *inode, u32 entry_ino)
8906 + {
8907 + struct dentry *dentry;
8908 + spin_lock(&inode->i_lock);
8909 +- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
8910 ++ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
8911 + if (entry_ino == (u32)(long)dentry->d_fsdata) {
8912 + dentry->d_fsdata = (void *)inode->i_ino;
8913 + break;
8914 +diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
8915 +index 3d9d3f5d5dda..d096316533da 100644
8916 +--- a/fs/autofs4/expire.c
8917 ++++ b/fs/autofs4/expire.c
8918 +@@ -91,7 +91,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,
8919 + spin_lock(&root->d_lock);
8920 +
8921 + if (prev)
8922 +- next = prev->d_u.d_child.next;
8923 ++ next = prev->d_child.next;
8924 + else {
8925 + prev = dget_dlock(root);
8926 + next = prev->d_subdirs.next;
8927 +@@ -105,13 +105,13 @@ cont:
8928 + return NULL;
8929 + }
8930 +
8931 +- q = list_entry(next, struct dentry, d_u.d_child);
8932 ++ q = list_entry(next, struct dentry, d_child);
8933 +
8934 + spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
8935 + /* Already gone or negative dentry (under construction) - try next */
8936 + if (!d_count(q) || !simple_positive(q)) {
8937 + spin_unlock(&q->d_lock);
8938 +- next = q->d_u.d_child.next;
8939 ++ next = q->d_child.next;
8940 + goto cont;
8941 + }
8942 + dget_dlock(q);
8943 +@@ -161,13 +161,13 @@ again:
8944 + goto relock;
8945 + }
8946 + spin_unlock(&p->d_lock);
8947 +- next = p->d_u.d_child.next;
8948 ++ next = p->d_child.next;
8949 + p = parent;
8950 + if (next != &parent->d_subdirs)
8951 + break;
8952 + }
8953 + }
8954 +- ret = list_entry(next, struct dentry, d_u.d_child);
8955 ++ ret = list_entry(next, struct dentry, d_child);
8956 +
8957 + spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED);
8958 + /* Negative dentry - try next */
8959 +@@ -447,7 +447,7 @@ found:
8960 + spin_lock(&sbi->lookup_lock);
8961 + spin_lock(&expired->d_parent->d_lock);
8962 + spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED);
8963 +- list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child);
8964 ++ list_move(&expired->d_parent->d_subdirs, &expired->d_child);
8965 + spin_unlock(&expired->d_lock);
8966 + spin_unlock(&expired->d_parent->d_lock);
8967 + spin_unlock(&sbi->lookup_lock);
8968 +diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
8969 +index 2a69bde8c61d..b3f4794c9f6d 100644
8970 +--- a/fs/autofs4/root.c
8971 ++++ b/fs/autofs4/root.c
8972 +@@ -655,7 +655,7 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
8973 + /* only consider parents below dentrys in the root */
8974 + if (IS_ROOT(parent->d_parent))
8975 + return;
8976 +- d_child = &dentry->d_u.d_child;
8977 ++ d_child = &dentry->d_child;
8978 + /* Set parent managed if it's becoming empty */
8979 + if (d_child->next == &parent->d_subdirs &&
8980 + d_child->prev == &parent->d_subdirs)
8981 +diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
8982 +index ec3ba43b9faa..f757dffb715e 100644
8983 +--- a/fs/ceph/addr.c
8984 ++++ b/fs/ceph/addr.c
8985 +@@ -672,7 +672,7 @@ static int ceph_writepages_start(struct address_space *mapping,
8986 + int rc = 0;
8987 + unsigned wsize = 1 << inode->i_blkbits;
8988 + struct ceph_osd_request *req = NULL;
8989 +- int do_sync;
8990 ++ int do_sync = 0;
8991 + u64 truncate_size, snap_size;
8992 + u32 truncate_seq;
8993 +
8994 +diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
8995 +index 868b61d56cac..ea3de8b719ab 100644
8996 +--- a/fs/ceph/dir.c
8997 ++++ b/fs/ceph/dir.c
8998 +@@ -103,7 +103,7 @@ static unsigned fpos_off(loff_t p)
8999 + /*
9000 + * When possible, we try to satisfy a readdir by peeking at the
9001 + * dcache. We make this work by carefully ordering dentries on
9002 +- * d_u.d_child when we initially get results back from the MDS, and
9003 ++ * d_child when we initially get results back from the MDS, and
9004 + * falling back to a "normal" sync readdir if any dentries in the dir
9005 + * are dropped.
9006 + *
9007 +@@ -138,11 +138,11 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx)
9008 + p = parent->d_subdirs.prev;
9009 + dout(" initial p %p/%p\n", p->prev, p->next);
9010 + } else {
9011 +- p = last->d_u.d_child.prev;
9012 ++ p = last->d_child.prev;
9013 + }
9014 +
9015 + more:
9016 +- dentry = list_entry(p, struct dentry, d_u.d_child);
9017 ++ dentry = list_entry(p, struct dentry, d_child);
9018 + di = ceph_dentry(dentry);
9019 + while (1) {
9020 + dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next,
9021 +@@ -164,7 +164,7 @@ more:
9022 + !dentry->d_inode ? " null" : "");
9023 + spin_unlock(&dentry->d_lock);
9024 + p = p->prev;
9025 +- dentry = list_entry(p, struct dentry, d_u.d_child);
9026 ++ dentry = list_entry(p, struct dentry, d_child);
9027 + di = ceph_dentry(dentry);
9028 + }
9029 +
9030 +diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
9031 +index 8549a48115f7..74a479e518d4 100644
9032 +--- a/fs/ceph/inode.c
9033 ++++ b/fs/ceph/inode.c
9034 +@@ -880,9 +880,9 @@ static void ceph_set_dentry_offset(struct dentry *dn)
9035 +
9036 + spin_lock(&dir->d_lock);
9037 + spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
9038 +- list_move(&dn->d_u.d_child, &dir->d_subdirs);
9039 ++ list_move(&dn->d_child, &dir->d_subdirs);
9040 + dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset,
9041 +- dn->d_u.d_child.prev, dn->d_u.d_child.next);
9042 ++ dn->d_child.prev, dn->d_child.next);
9043 + spin_unlock(&dn->d_lock);
9044 + spin_unlock(&dir->d_lock);
9045 + }
9046 +@@ -1309,7 +1309,7 @@ retry_lookup:
9047 + /* reorder parent's d_subdirs */
9048 + spin_lock(&parent->d_lock);
9049 + spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
9050 +- list_move(&dn->d_u.d_child, &parent->d_subdirs);
9051 ++ list_move(&dn->d_child, &parent->d_subdirs);
9052 + spin_unlock(&dn->d_lock);
9053 + spin_unlock(&parent->d_lock);
9054 + }
9055 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
9056 +index 2a93255c0150..ab9f992ca479 100644
9057 +--- a/fs/cifs/inode.c
9058 ++++ b/fs/cifs/inode.c
9059 +@@ -874,7 +874,7 @@ inode_has_hashed_dentries(struct inode *inode)
9060 + struct dentry *dentry;
9061 +
9062 + spin_lock(&inode->i_lock);
9063 +- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
9064 ++ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
9065 + if (!d_unhashed(dentry) || IS_ROOT(dentry)) {
9066 + spin_unlock(&inode->i_lock);
9067 + return true;
9068 +diff --git a/fs/coda/cache.c b/fs/coda/cache.c
9069 +index 1da168c61d35..9bc1147a6c5d 100644
9070 +--- a/fs/coda/cache.c
9071 ++++ b/fs/coda/cache.c
9072 +@@ -92,7 +92,7 @@ static void coda_flag_children(struct dentry *parent, int flag)
9073 + struct dentry *de;
9074 +
9075 + spin_lock(&parent->d_lock);
9076 +- list_for_each_entry(de, &parent->d_subdirs, d_u.d_child) {
9077 ++ list_for_each_entry(de, &parent->d_subdirs, d_child) {
9078 + /* don't know what to do with negative dentries */
9079 + if (de->d_inode )
9080 + coda_flag_inode(de->d_inode, flag);
9081 +diff --git a/fs/dcache.c b/fs/dcache.c
9082 +index d449b1aed5ad..eb540b00d027 100644
9083 +--- a/fs/dcache.c
9084 ++++ b/fs/dcache.c
9085 +@@ -44,7 +44,7 @@
9086 + /*
9087 + * Usage:
9088 + * dcache->d_inode->i_lock protects:
9089 +- * - i_dentry, d_alias, d_inode of aliases
9090 ++ * - i_dentry, d_u.d_alias, d_inode of aliases
9091 + * dcache_hash_bucket lock protects:
9092 + * - the dcache hash table
9093 + * s_anon bl list spinlock protects:
9094 +@@ -59,7 +59,7 @@
9095 + * - d_unhashed()
9096 + * - d_parent and d_subdirs
9097 + * - childrens' d_child and d_parent
9098 +- * - d_alias, d_inode
9099 ++ * - d_u.d_alias, d_inode
9100 + *
9101 + * Ordering:
9102 + * dentry->d_inode->i_lock
9103 +@@ -268,7 +268,6 @@ static void __d_free(struct rcu_head *head)
9104 + {
9105 + struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
9106 +
9107 +- WARN_ON(!hlist_unhashed(&dentry->d_alias));
9108 + if (dname_external(dentry))
9109 + kfree(dentry->d_name.name);
9110 + kmem_cache_free(dentry_cache, dentry);
9111 +@@ -276,6 +275,7 @@ static void __d_free(struct rcu_head *head)
9112 +
9113 + static void dentry_free(struct dentry *dentry)
9114 + {
9115 ++ WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias));
9116 + /* if dentry was never visible to RCU, immediate free is OK */
9117 + if (!(dentry->d_flags & DCACHE_RCUACCESS))
9118 + __d_free(&dentry->d_u.d_rcu);
9119 +@@ -309,7 +309,7 @@ static void dentry_iput(struct dentry * dentry)
9120 + struct inode *inode = dentry->d_inode;
9121 + if (inode) {
9122 + dentry->d_inode = NULL;
9123 +- hlist_del_init(&dentry->d_alias);
9124 ++ hlist_del_init(&dentry->d_u.d_alias);
9125 + spin_unlock(&dentry->d_lock);
9126 + spin_unlock(&inode->i_lock);
9127 + if (!inode->i_nlink)
9128 +@@ -333,7 +333,7 @@ static void dentry_unlink_inode(struct dentry * dentry)
9129 + {
9130 + struct inode *inode = dentry->d_inode;
9131 + dentry->d_inode = NULL;
9132 +- hlist_del_init(&dentry->d_alias);
9133 ++ hlist_del_init(&dentry->d_u.d_alias);
9134 + dentry_rcuwalk_barrier(dentry);
9135 + spin_unlock(&dentry->d_lock);
9136 + spin_unlock(&inode->i_lock);
9137 +@@ -488,7 +488,7 @@ static void __dentry_kill(struct dentry *dentry)
9138 + }
9139 + /* if it was on the hash then remove it */
9140 + __d_drop(dentry);
9141 +- list_del(&dentry->d_u.d_child);
9142 ++ __list_del_entry(&dentry->d_child);
9143 + /*
9144 + * Inform d_walk() that we are no longer attached to the
9145 + * dentry tree
9146 +@@ -772,7 +772,7 @@ static struct dentry *__d_find_alias(struct inode *inode, int want_discon)
9147 +
9148 + again:
9149 + discon_alias = NULL;
9150 +- hlist_for_each_entry(alias, &inode->i_dentry, d_alias) {
9151 ++ hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
9152 + spin_lock(&alias->d_lock);
9153 + if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) {
9154 + if (IS_ROOT(alias) &&
9155 +@@ -825,7 +825,7 @@ void d_prune_aliases(struct inode *inode)
9156 + struct dentry *dentry;
9157 + restart:
9158 + spin_lock(&inode->i_lock);
9159 +- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
9160 ++ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
9161 + spin_lock(&dentry->d_lock);
9162 + if (!dentry->d_lockref.count) {
9163 + /*
9164 +@@ -1110,7 +1110,7 @@ repeat:
9165 + resume:
9166 + while (next != &this_parent->d_subdirs) {
9167 + struct list_head *tmp = next;
9168 +- struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
9169 ++ struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
9170 + next = tmp->next;
9171 +
9172 + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
9173 +@@ -1142,33 +1142,31 @@ resume:
9174 + /*
9175 + * All done at this level ... ascend and resume the search.
9176 + */
9177 ++ rcu_read_lock();
9178 ++ascend:
9179 + if (this_parent != parent) {
9180 + struct dentry *child = this_parent;
9181 + this_parent = child->d_parent;
9182 +
9183 +- rcu_read_lock();
9184 + spin_unlock(&child->d_lock);
9185 + spin_lock(&this_parent->d_lock);
9186 +
9187 +- /*
9188 +- * might go back up the wrong parent if we have had a rename
9189 +- * or deletion
9190 +- */
9191 +- if (this_parent != child->d_parent ||
9192 +- (child->d_flags & DCACHE_DENTRY_KILLED) ||
9193 +- need_seqretry(&rename_lock, seq)) {
9194 +- spin_unlock(&this_parent->d_lock);
9195 +- rcu_read_unlock();
9196 ++ /* might go back up the wrong parent if we have had a rename. */
9197 ++ if (need_seqretry(&rename_lock, seq))
9198 + goto rename_retry;
9199 ++ next = child->d_child.next;
9200 ++ while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
9201 ++ if (next == &this_parent->d_subdirs)
9202 ++ goto ascend;
9203 ++ child = list_entry(next, struct dentry, d_child);
9204 ++ next = next->next;
9205 + }
9206 + rcu_read_unlock();
9207 +- next = child->d_u.d_child.next;
9208 + goto resume;
9209 + }
9210 +- if (need_seqretry(&rename_lock, seq)) {
9211 +- spin_unlock(&this_parent->d_lock);
9212 ++ if (need_seqretry(&rename_lock, seq))
9213 + goto rename_retry;
9214 +- }
9215 ++ rcu_read_unlock();
9216 + if (finish)
9217 + finish(data);
9218 +
9219 +@@ -1178,6 +1176,9 @@ out_unlock:
9220 + return;
9221 +
9222 + rename_retry:
9223 ++ spin_unlock(&this_parent->d_lock);
9224 ++ rcu_read_unlock();
9225 ++ BUG_ON(seq & 1);
9226 + if (!retry)
9227 + return;
9228 + seq = 1;
9229 +@@ -1497,8 +1498,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
9230 + INIT_HLIST_BL_NODE(&dentry->d_hash);
9231 + INIT_LIST_HEAD(&dentry->d_lru);
9232 + INIT_LIST_HEAD(&dentry->d_subdirs);
9233 +- INIT_HLIST_NODE(&dentry->d_alias);
9234 +- INIT_LIST_HEAD(&dentry->d_u.d_child);
9235 ++ INIT_HLIST_NODE(&dentry->d_u.d_alias);
9236 ++ INIT_LIST_HEAD(&dentry->d_child);
9237 + d_set_d_op(dentry, dentry->d_sb->s_d_op);
9238 +
9239 + this_cpu_inc(nr_dentry);
9240 +@@ -1528,7 +1529,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
9241 + */
9242 + __dget_dlock(parent);
9243 + dentry->d_parent = parent;
9244 +- list_add(&dentry->d_u.d_child, &parent->d_subdirs);
9245 ++ list_add(&dentry->d_child, &parent->d_subdirs);
9246 + spin_unlock(&parent->d_lock);
9247 +
9248 + return dentry;
9249 +@@ -1588,7 +1589,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
9250 + if (inode) {
9251 + if (unlikely(IS_AUTOMOUNT(inode)))
9252 + dentry->d_flags |= DCACHE_NEED_AUTOMOUNT;
9253 +- hlist_add_head(&dentry->d_alias, &inode->i_dentry);
9254 ++ hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
9255 + }
9256 + dentry->d_inode = inode;
9257 + dentry_rcuwalk_barrier(dentry);
9258 +@@ -1613,7 +1614,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
9259 +
9260 + void d_instantiate(struct dentry *entry, struct inode * inode)
9261 + {
9262 +- BUG_ON(!hlist_unhashed(&entry->d_alias));
9263 ++ BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
9264 + if (inode)
9265 + spin_lock(&inode->i_lock);
9266 + __d_instantiate(entry, inode);
9267 +@@ -1652,7 +1653,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
9268 + return NULL;
9269 + }
9270 +
9271 +- hlist_for_each_entry(alias, &inode->i_dentry, d_alias) {
9272 ++ hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
9273 + /*
9274 + * Don't need alias->d_lock here, because aliases with
9275 + * d_parent == entry->d_parent are not subject to name or
9276 +@@ -1678,7 +1679,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)
9277 + {
9278 + struct dentry *result;
9279 +
9280 +- BUG_ON(!hlist_unhashed(&entry->d_alias));
9281 ++ BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
9282 +
9283 + if (inode)
9284 + spin_lock(&inode->i_lock);
9285 +@@ -1721,7 +1722,7 @@ static struct dentry * __d_find_any_alias(struct inode *inode)
9286 +
9287 + if (hlist_empty(&inode->i_dentry))
9288 + return NULL;
9289 +- alias = hlist_entry(inode->i_dentry.first, struct dentry, d_alias);
9290 ++ alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
9291 + __dget(alias);
9292 + return alias;
9293 + }
9294 +@@ -1795,7 +1796,7 @@ struct dentry *d_obtain_alias(struct inode *inode)
9295 + spin_lock(&tmp->d_lock);
9296 + tmp->d_inode = inode;
9297 + tmp->d_flags |= DCACHE_DISCONNECTED;
9298 +- hlist_add_head(&tmp->d_alias, &inode->i_dentry);
9299 ++ hlist_add_head(&tmp->d_u.d_alias, &inode->i_dentry);
9300 + hlist_bl_lock(&tmp->d_sb->s_anon);
9301 + hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon);
9302 + hlist_bl_unlock(&tmp->d_sb->s_anon);
9303 +@@ -2238,7 +2239,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent)
9304 + struct dentry *child;
9305 +
9306 + spin_lock(&dparent->d_lock);
9307 +- list_for_each_entry(child, &dparent->d_subdirs, d_u.d_child) {
9308 ++ list_for_each_entry(child, &dparent->d_subdirs, d_child) {
9309 + if (dentry == child) {
9310 + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
9311 + __dget_dlock(dentry);
9312 +@@ -2485,8 +2486,8 @@ static void __d_move(struct dentry * dentry, struct dentry * target)
9313 + /* Unhash the target: dput() will then get rid of it */
9314 + __d_drop(target);
9315 +
9316 +- list_del(&dentry->d_u.d_child);
9317 +- list_del(&target->d_u.d_child);
9318 ++ list_del(&dentry->d_child);
9319 ++ list_del(&target->d_child);
9320 +
9321 + /* Switch the names.. */
9322 + switch_names(dentry, target);
9323 +@@ -2496,15 +2497,15 @@ static void __d_move(struct dentry * dentry, struct dentry * target)
9324 + if (IS_ROOT(dentry)) {
9325 + dentry->d_parent = target->d_parent;
9326 + target->d_parent = target;
9327 +- INIT_LIST_HEAD(&target->d_u.d_child);
9328 ++ INIT_LIST_HEAD(&target->d_child);
9329 + } else {
9330 + swap(dentry->d_parent, target->d_parent);
9331 +
9332 + /* And add them back to the (new) parent lists */
9333 +- list_add(&target->d_u.d_child, &target->d_parent->d_subdirs);
9334 ++ list_add(&target->d_child, &target->d_parent->d_subdirs);
9335 + }
9336 +
9337 +- list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
9338 ++ list_add(&dentry->d_child, &dentry->d_parent->d_subdirs);
9339 +
9340 + write_seqcount_end(&target->d_seq);
9341 + write_seqcount_end(&dentry->d_seq);
9342 +@@ -2611,9 +2612,9 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
9343 + swap(dentry->d_name.hash, anon->d_name.hash);
9344 +
9345 + dentry->d_parent = dentry;
9346 +- list_del_init(&dentry->d_u.d_child);
9347 ++ list_del_init(&dentry->d_child);
9348 + anon->d_parent = dparent;
9349 +- list_move(&anon->d_u.d_child, &dparent->d_subdirs);
9350 ++ list_move(&anon->d_child, &dparent->d_subdirs);
9351 +
9352 + write_seqcount_end(&dentry->d_seq);
9353 + write_seqcount_end(&anon->d_seq);
9354 +@@ -3241,7 +3242,7 @@ void d_tmpfile(struct dentry *dentry, struct inode *inode)
9355 + {
9356 + inode_dec_link_count(inode);
9357 + BUG_ON(dentry->d_name.name != dentry->d_iname ||
9358 +- !hlist_unhashed(&dentry->d_alias) ||
9359 ++ !hlist_unhashed(&dentry->d_u.d_alias) ||
9360 + !d_unlinked(dentry));
9361 + spin_lock(&dentry->d_parent->d_lock);
9362 + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
9363 +diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
9364 +index 15761957cc3f..f3784dd57353 100644
9365 +--- a/fs/debugfs/inode.c
9366 ++++ b/fs/debugfs/inode.c
9367 +@@ -549,10 +549,10 @@ void debugfs_remove_recursive(struct dentry *dentry)
9368 + /*
9369 + * The parent->d_subdirs is protected by the d_lock. Outside that
9370 + * lock, the child can be unlinked and set to be freed which can
9371 +- * use the d_u.d_child as the rcu head and corrupt this list.
9372 ++ * use the d_child as the rcu head and corrupt this list.
9373 + */
9374 + spin_lock(&parent->d_lock);
9375 +- list_for_each_entry(child, &parent->d_subdirs, d_u.d_child) {
9376 ++ list_for_each_entry(child, &parent->d_subdirs, d_child) {
9377 + if (!debugfs_positive(child))
9378 + continue;
9379 +
9380 +diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
9381 +index c43fe9b39ff2..b75f1742ddf9 100644
9382 +--- a/fs/exportfs/expfs.c
9383 ++++ b/fs/exportfs/expfs.c
9384 +@@ -50,7 +50,7 @@ find_acceptable_alias(struct dentry *result,
9385 +
9386 + inode = result->d_inode;
9387 + spin_lock(&inode->i_lock);
9388 +- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
9389 ++ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
9390 + dget(dentry);
9391 + spin_unlock(&inode->i_lock);
9392 + if (toput)
9393 +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
9394 +index 5bbec31440a4..a1b20625b4e9 100644
9395 +--- a/fs/fs-writeback.c
9396 ++++ b/fs/fs-writeback.c
9397 +@@ -475,12 +475,28 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
9398 + * write_inode()
9399 + */
9400 + spin_lock(&inode->i_lock);
9401 +- /* Clear I_DIRTY_PAGES if we've written out all dirty pages */
9402 +- if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
9403 +- inode->i_state &= ~I_DIRTY_PAGES;
9404 ++
9405 + dirty = inode->i_state & I_DIRTY;
9406 +- inode->i_state &= ~(I_DIRTY_SYNC | I_DIRTY_DATASYNC);
9407 ++ inode->i_state &= ~I_DIRTY;
9408 ++
9409 ++ /*
9410 ++ * Paired with smp_mb() in __mark_inode_dirty(). This allows
9411 ++ * __mark_inode_dirty() to test i_state without grabbing i_lock -
9412 ++ * either they see the I_DIRTY bits cleared or we see the dirtied
9413 ++ * inode.
9414 ++ *
9415 ++ * I_DIRTY_PAGES is always cleared together above even if @mapping
9416 ++ * still has dirty pages. The flag is reinstated after smp_mb() if
9417 ++ * necessary. This guarantees that either __mark_inode_dirty()
9418 ++ * sees clear I_DIRTY_PAGES or we see PAGECACHE_TAG_DIRTY.
9419 ++ */
9420 ++ smp_mb();
9421 ++
9422 ++ if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
9423 ++ inode->i_state |= I_DIRTY_PAGES;
9424 ++
9425 + spin_unlock(&inode->i_lock);
9426 ++
9427 + /* Don't write the inode if only I_DIRTY_PAGES was set */
9428 + if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
9429 + int err = write_inode(inode, wbc);
9430 +@@ -1144,12 +1160,11 @@ void __mark_inode_dirty(struct inode *inode, int flags)
9431 + }
9432 +
9433 + /*
9434 +- * make sure that changes are seen by all cpus before we test i_state
9435 +- * -- mikulas
9436 ++ * Paired with smp_mb() in __writeback_single_inode() for the
9437 ++ * following lockless i_state test. See there for details.
9438 + */
9439 + smp_mb();
9440 +
9441 +- /* avoid the locking if we can */
9442 + if ((inode->i_state & flags) == flags)
9443 + return;
9444 +
9445 +diff --git a/fs/libfs.c b/fs/libfs.c
9446 +index 193e0c29fb94..80d18955c322 100644
9447 +--- a/fs/libfs.c
9448 ++++ b/fs/libfs.c
9449 +@@ -105,18 +105,18 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
9450 +
9451 + spin_lock(&dentry->d_lock);
9452 + /* d_lock not required for cursor */
9453 +- list_del(&cursor->d_u.d_child);
9454 ++ list_del(&cursor->d_child);
9455 + p = dentry->d_subdirs.next;
9456 + while (n && p != &dentry->d_subdirs) {
9457 + struct dentry *next;
9458 +- next = list_entry(p, struct dentry, d_u.d_child);
9459 ++ next = list_entry(p, struct dentry, d_child);
9460 + spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
9461 + if (simple_positive(next))
9462 + n--;
9463 + spin_unlock(&next->d_lock);
9464 + p = p->next;
9465 + }
9466 +- list_add_tail(&cursor->d_u.d_child, p);
9467 ++ list_add_tail(&cursor->d_child, p);
9468 + spin_unlock(&dentry->d_lock);
9469 + }
9470 + }
9471 +@@ -140,7 +140,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
9472 + {
9473 + struct dentry *dentry = file->f_path.dentry;
9474 + struct dentry *cursor = file->private_data;
9475 +- struct list_head *p, *q = &cursor->d_u.d_child;
9476 ++ struct list_head *p, *q = &cursor->d_child;
9477 +
9478 + if (!dir_emit_dots(file, ctx))
9479 + return 0;
9480 +@@ -149,7 +149,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
9481 + list_move(q, &dentry->d_subdirs);
9482 +
9483 + for (p = q->next; p != &dentry->d_subdirs; p = p->next) {
9484 +- struct dentry *next = list_entry(p, struct dentry, d_u.d_child);
9485 ++ struct dentry *next = list_entry(p, struct dentry, d_child);
9486 + spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
9487 + if (!simple_positive(next)) {
9488 + spin_unlock(&next->d_lock);
9489 +@@ -270,7 +270,7 @@ int simple_empty(struct dentry *dentry)
9490 + int ret = 0;
9491 +
9492 + spin_lock(&dentry->d_lock);
9493 +- list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) {
9494 ++ list_for_each_entry(child, &dentry->d_subdirs, d_child) {
9495 + spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
9496 + if (simple_positive(child)) {
9497 + spin_unlock(&child->d_lock);
9498 +diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
9499 +index 223e1cb14345..59a53f664005 100644
9500 +--- a/fs/lockd/svc.c
9501 ++++ b/fs/lockd/svc.c
9502 +@@ -137,10 +137,6 @@ lockd(void *vrqstp)
9503 +
9504 + dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
9505 +
9506 +- if (!nlm_timeout)
9507 +- nlm_timeout = LOCKD_DFLT_TIMEO;
9508 +- nlmsvc_timeout = nlm_timeout * HZ;
9509 +-
9510 + /*
9511 + * The main request loop. We don't terminate until the last
9512 + * NFS mount or NFS daemon has gone away.
9513 +@@ -346,6 +342,10 @@ static struct svc_serv *lockd_create_svc(void)
9514 + printk(KERN_WARNING
9515 + "lockd_up: no pid, %d users??\n", nlmsvc_users);
9516 +
9517 ++ if (!nlm_timeout)
9518 ++ nlm_timeout = LOCKD_DFLT_TIMEO;
9519 ++ nlmsvc_timeout = nlm_timeout * HZ;
9520 ++
9521 + serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL);
9522 + if (!serv) {
9523 + printk(KERN_WARNING "lockd_up: create service failed\n");
9524 +diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
9525 +index 3be047474bfc..0686002ccd1c 100644
9526 +--- a/fs/ncpfs/dir.c
9527 ++++ b/fs/ncpfs/dir.c
9528 +@@ -407,7 +407,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
9529 + spin_lock(&parent->d_lock);
9530 + next = parent->d_subdirs.next;
9531 + while (next != &parent->d_subdirs) {
9532 +- dent = list_entry(next, struct dentry, d_u.d_child);
9533 ++ dent = list_entry(next, struct dentry, d_child);
9534 + if ((unsigned long)dent->d_fsdata == fpos) {
9535 + if (dent->d_inode)
9536 + dget(dent);
9537 +diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h
9538 +index 32c06587351a..6d5e7c56c79d 100644
9539 +--- a/fs/ncpfs/ncplib_kernel.h
9540 ++++ b/fs/ncpfs/ncplib_kernel.h
9541 +@@ -194,7 +194,7 @@ ncp_renew_dentries(struct dentry *parent)
9542 + spin_lock(&parent->d_lock);
9543 + next = parent->d_subdirs.next;
9544 + while (next != &parent->d_subdirs) {
9545 +- dentry = list_entry(next, struct dentry, d_u.d_child);
9546 ++ dentry = list_entry(next, struct dentry, d_child);
9547 +
9548 + if (dentry->d_fsdata == NULL)
9549 + ncp_age_dentry(server, dentry);
9550 +@@ -216,7 +216,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent)
9551 + spin_lock(&parent->d_lock);
9552 + next = parent->d_subdirs.next;
9553 + while (next != &parent->d_subdirs) {
9554 +- dentry = list_entry(next, struct dentry, d_u.d_child);
9555 ++ dentry = list_entry(next, struct dentry, d_child);
9556 + dentry->d_fsdata = NULL;
9557 + ncp_age_dentry(server, dentry);
9558 + next = next->next;
9559 +diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
9560 +index 66984a9aafaa..5b8ab0e444f9 100644
9561 +--- a/fs/nfs/getroot.c
9562 ++++ b/fs/nfs/getroot.c
9563 +@@ -58,7 +58,7 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
9564 + */
9565 + spin_lock(&sb->s_root->d_inode->i_lock);
9566 + spin_lock(&sb->s_root->d_lock);
9567 +- hlist_del_init(&sb->s_root->d_alias);
9568 ++ hlist_del_init(&sb->s_root->d_u.d_alias);
9569 + spin_unlock(&sb->s_root->d_lock);
9570 + spin_unlock(&sb->s_root->d_inode->i_lock);
9571 + }
9572 +diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
9573 +index 531f1b48b46b..ce036f071302 100644
9574 +--- a/fs/nfs/nfs4client.c
9575 ++++ b/fs/nfs/nfs4client.c
9576 +@@ -561,20 +561,14 @@ static bool nfs4_match_clientids(struct nfs_client *a, struct nfs_client *b)
9577 + }
9578 +
9579 + /*
9580 +- * Returns true if the server owners match
9581 ++ * Returns true if the server major ids match
9582 + */
9583 + static bool
9584 +-nfs4_match_serverowners(struct nfs_client *a, struct nfs_client *b)
9585 ++nfs4_check_clientid_trunking(struct nfs_client *a, struct nfs_client *b)
9586 + {
9587 + struct nfs41_server_owner *o1 = a->cl_serverowner;
9588 + struct nfs41_server_owner *o2 = b->cl_serverowner;
9589 +
9590 +- if (o1->minor_id != o2->minor_id) {
9591 +- dprintk("NFS: --> %s server owner minor IDs do not match\n",
9592 +- __func__);
9593 +- return false;
9594 +- }
9595 +-
9596 + if (o1->major_id_sz != o2->major_id_sz)
9597 + goto out_major_mismatch;
9598 + if (memcmp(o1->major_id, o2->major_id, o1->major_id_sz) != 0)
9599 +@@ -650,7 +644,12 @@ int nfs41_walk_client_list(struct nfs_client *new,
9600 + if (!nfs4_match_clientids(pos, new))
9601 + continue;
9602 +
9603 +- if (!nfs4_match_serverowners(pos, new))
9604 ++ /*
9605 ++ * Note that session trunking is just a special subcase of
9606 ++ * client id trunking. In either case, we want to fall back
9607 ++ * to using the existing nfs_client.
9608 ++ */
9609 ++ if (!nfs4_check_clientid_trunking(pos, new))
9610 + continue;
9611 +
9612 + atomic_inc(&pos->cl_count);
9613 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
9614 +index 5ae1dd340073..0a138e4fc2e0 100644
9615 +--- a/fs/nfsd/nfs4state.c
9616 ++++ b/fs/nfsd/nfs4state.c
9617 +@@ -1197,15 +1197,14 @@ static int copy_cred(struct svc_cred *target, struct svc_cred *source)
9618 + return 0;
9619 + }
9620 +
9621 +-static long long
9622 ++static int
9623 + compare_blob(const struct xdr_netobj *o1, const struct xdr_netobj *o2)
9624 + {
9625 +- long long res;
9626 +-
9627 +- res = o1->len - o2->len;
9628 +- if (res)
9629 +- return res;
9630 +- return (long long)memcmp(o1->data, o2->data, o1->len);
9631 ++ if (o1->len < o2->len)
9632 ++ return -1;
9633 ++ if (o1->len > o2->len)
9634 ++ return 1;
9635 ++ return memcmp(o1->data, o2->data, o1->len);
9636 + }
9637 +
9638 + static int same_name(const char *n1, const char *n2)
9639 +@@ -1389,7 +1388,7 @@ add_clp_to_name_tree(struct nfs4_client *new_clp, struct rb_root *root)
9640 + static struct nfs4_client *
9641 + find_clp_in_name_tree(struct xdr_netobj *name, struct rb_root *root)
9642 + {
9643 +- long long cmp;
9644 ++ int cmp;
9645 + struct rb_node *node = root->rb_node;
9646 + struct nfs4_client *clp;
9647 +
9648 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
9649 +index 42c8c8aeb465..1c825aee736d 100644
9650 +--- a/fs/nfsd/nfs4xdr.c
9651 ++++ b/fs/nfsd/nfs4xdr.c
9652 +@@ -1786,6 +1786,9 @@ static __be32 nfsd4_encode_components_esc(char sep, char *components,
9653 + }
9654 + else
9655 + end++;
9656 ++ if (found_esc)
9657 ++ end = next;
9658 ++
9659 + str = end;
9660 + }
9661 + *pp = p;
9662 +diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
9663 +index 1e0bbae06ee7..09480c53fd74 100644
9664 +--- a/fs/nilfs2/inode.c
9665 ++++ b/fs/nilfs2/inode.c
9666 +@@ -49,6 +49,8 @@ struct nilfs_iget_args {
9667 + int for_gc;
9668 + };
9669 +
9670 ++static int nilfs_iget_test(struct inode *inode, void *opaque);
9671 ++
9672 + void nilfs_inode_add_blocks(struct inode *inode, int n)
9673 + {
9674 + struct nilfs_root *root = NILFS_I(inode)->i_root;
9675 +@@ -347,6 +349,17 @@ const struct address_space_operations nilfs_aops = {
9676 + .is_partially_uptodate = block_is_partially_uptodate,
9677 + };
9678 +
9679 ++static int nilfs_insert_inode_locked(struct inode *inode,
9680 ++ struct nilfs_root *root,
9681 ++ unsigned long ino)
9682 ++{
9683 ++ struct nilfs_iget_args args = {
9684 ++ .ino = ino, .root = root, .cno = 0, .for_gc = 0
9685 ++ };
9686 ++
9687 ++ return insert_inode_locked4(inode, ino, nilfs_iget_test, &args);
9688 ++}
9689 ++
9690 + struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
9691 + {
9692 + struct super_block *sb = dir->i_sb;
9693 +@@ -382,7 +395,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
9694 + if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
9695 + err = nilfs_bmap_read(ii->i_bmap, NULL);
9696 + if (err < 0)
9697 +- goto failed_bmap;
9698 ++ goto failed_after_creation;
9699 +
9700 + set_bit(NILFS_I_BMAP, &ii->i_state);
9701 + /* No lock is needed; iget() ensures it. */
9702 +@@ -398,21 +411,24 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
9703 + spin_lock(&nilfs->ns_next_gen_lock);
9704 + inode->i_generation = nilfs->ns_next_generation++;
9705 + spin_unlock(&nilfs->ns_next_gen_lock);
9706 +- insert_inode_hash(inode);
9707 ++ if (nilfs_insert_inode_locked(inode, root, ino) < 0) {
9708 ++ err = -EIO;
9709 ++ goto failed_after_creation;
9710 ++ }
9711 +
9712 + err = nilfs_init_acl(inode, dir);
9713 + if (unlikely(err))
9714 +- goto failed_acl; /* never occur. When supporting
9715 ++ goto failed_after_creation; /* never occur. When supporting
9716 + nilfs_init_acl(), proper cancellation of
9717 + above jobs should be considered */
9718 +
9719 + return inode;
9720 +
9721 +- failed_acl:
9722 +- failed_bmap:
9723 ++ failed_after_creation:
9724 + clear_nlink(inode);
9725 ++ unlock_new_inode(inode);
9726 + iput(inode); /* raw_inode will be deleted through
9727 +- generic_delete_inode() */
9728 ++ nilfs_evict_inode() */
9729 + goto failed;
9730 +
9731 + failed_ifile_create_inode:
9732 +@@ -460,8 +476,8 @@ int nilfs_read_inode_common(struct inode *inode,
9733 + inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
9734 + inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec);
9735 + inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
9736 +- if (inode->i_nlink == 0 && inode->i_mode == 0)
9737 +- return -EINVAL; /* this inode is deleted */
9738 ++ if (inode->i_nlink == 0)
9739 ++ return -ESTALE; /* this inode is deleted */
9740 +
9741 + inode->i_blocks = le64_to_cpu(raw_inode->i_blocks);
9742 + ii->i_flags = le32_to_cpu(raw_inode->i_flags);
9743 +diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
9744 +index 9de78f08989e..0f84b257932c 100644
9745 +--- a/fs/nilfs2/namei.c
9746 ++++ b/fs/nilfs2/namei.c
9747 +@@ -51,9 +51,11 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode)
9748 + int err = nilfs_add_link(dentry, inode);
9749 + if (!err) {
9750 + d_instantiate(dentry, inode);
9751 ++ unlock_new_inode(inode);
9752 + return 0;
9753 + }
9754 + inode_dec_link_count(inode);
9755 ++ unlock_new_inode(inode);
9756 + iput(inode);
9757 + return err;
9758 + }
9759 +@@ -182,6 +184,7 @@ out:
9760 + out_fail:
9761 + drop_nlink(inode);
9762 + nilfs_mark_inode_dirty(inode);
9763 ++ unlock_new_inode(inode);
9764 + iput(inode);
9765 + goto out;
9766 + }
9767 +@@ -201,11 +204,15 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
9768 + inode_inc_link_count(inode);
9769 + ihold(inode);
9770 +
9771 +- err = nilfs_add_nondir(dentry, inode);
9772 +- if (!err)
9773 ++ err = nilfs_add_link(dentry, inode);
9774 ++ if (!err) {
9775 ++ d_instantiate(dentry, inode);
9776 + err = nilfs_transaction_commit(dir->i_sb);
9777 +- else
9778 ++ } else {
9779 ++ inode_dec_link_count(inode);
9780 ++ iput(inode);
9781 + nilfs_transaction_abort(dir->i_sb);
9782 ++ }
9783 +
9784 + return err;
9785 + }
9786 +@@ -243,6 +250,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
9787 +
9788 + nilfs_mark_inode_dirty(inode);
9789 + d_instantiate(dentry, inode);
9790 ++ unlock_new_inode(inode);
9791 + out:
9792 + if (!err)
9793 + err = nilfs_transaction_commit(dir->i_sb);
9794 +@@ -255,6 +263,7 @@ out_fail:
9795 + drop_nlink(inode);
9796 + drop_nlink(inode);
9797 + nilfs_mark_inode_dirty(inode);
9798 ++ unlock_new_inode(inode);
9799 + iput(inode);
9800 + out_dir:
9801 + drop_nlink(dir);
9802 +diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
9803 +index 4bb21d67d9b1..a3153e2d0f1f 100644
9804 +--- a/fs/notify/fsnotify.c
9805 ++++ b/fs/notify/fsnotify.c
9806 +@@ -63,14 +63,14 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
9807 + spin_lock(&inode->i_lock);
9808 + /* run all of the dentries associated with this inode. Since this is a
9809 + * directory, there damn well better only be one item on this list */
9810 +- hlist_for_each_entry(alias, &inode->i_dentry, d_alias) {
9811 ++ hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
9812 + struct dentry *child;
9813 +
9814 + /* run all of the children of the original inode and fix their
9815 + * d_flags to indicate parental interest (their parent is the
9816 + * original inode) */
9817 + spin_lock(&alias->d_lock);
9818 +- list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) {
9819 ++ list_for_each_entry(child, &alias->d_subdirs, d_child) {
9820 + if (!child->d_inode)
9821 + continue;
9822 +
9823 +diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
9824 +index 74825be65b7b..fbb9dfb7b1d2 100644
9825 +--- a/fs/notify/inode_mark.c
9826 ++++ b/fs/notify/inode_mark.c
9827 +@@ -288,20 +288,25 @@ void fsnotify_unmount_inodes(struct list_head *list)
9828 + spin_unlock(&inode->i_lock);
9829 +
9830 + /* In case the dropping of a reference would nuke next_i. */
9831 +- if ((&next_i->i_sb_list != list) &&
9832 +- atomic_read(&next_i->i_count)) {
9833 ++ while (&next_i->i_sb_list != list) {
9834 + spin_lock(&next_i->i_lock);
9835 +- if (!(next_i->i_state & (I_FREEING | I_WILL_FREE))) {
9836 ++ if (!(next_i->i_state & (I_FREEING | I_WILL_FREE)) &&
9837 ++ atomic_read(&next_i->i_count)) {
9838 + __iget(next_i);
9839 + need_iput = next_i;
9840 ++ spin_unlock(&next_i->i_lock);
9841 ++ break;
9842 + }
9843 + spin_unlock(&next_i->i_lock);
9844 ++ next_i = list_entry(next_i->i_sb_list.next,
9845 ++ struct inode, i_sb_list);
9846 + }
9847 +
9848 + /*
9849 +- * We can safely drop inode_sb_list_lock here because we hold
9850 +- * references on both inode and next_i. Also no new inodes
9851 +- * will be added since the umount has begun.
9852 ++ * We can safely drop inode_sb_list_lock here because either
9853 ++ * we actually hold references on both inode and next_i or
9854 ++ * end of list. Also no new inodes will be added since the
9855 ++ * umount has begun.
9856 + */
9857 + spin_unlock(&inode_sb_list_lock);
9858 +
9859 +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
9860 +index f37d3c0e2053..dd2c4e4ec691 100644
9861 +--- a/fs/ocfs2/aops.c
9862 ++++ b/fs/ocfs2/aops.c
9863 +@@ -912,7 +912,7 @@ void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
9864 + }
9865 + }
9866 +
9867 +-static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
9868 ++static void ocfs2_unlock_pages(struct ocfs2_write_ctxt *wc)
9869 + {
9870 + int i;
9871 +
9872 +@@ -933,7 +933,11 @@ static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
9873 + page_cache_release(wc->w_target_page);
9874 + }
9875 + ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages);
9876 ++}
9877 +
9878 ++static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
9879 ++{
9880 ++ ocfs2_unlock_pages(wc);
9881 + brelse(wc->w_di_bh);
9882 + kfree(wc);
9883 + }
9884 +@@ -2055,11 +2059,19 @@ out_write_size:
9885 + di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
9886 + ocfs2_journal_dirty(handle, wc->w_di_bh);
9887 +
9888 ++ /* unlock pages before dealloc since it needs acquiring j_trans_barrier
9889 ++ * lock, or it will cause a deadlock since journal commit threads holds
9890 ++ * this lock and will ask for the page lock when flushing the data.
9891 ++ * put it here to preserve the unlock order.
9892 ++ */
9893 ++ ocfs2_unlock_pages(wc);
9894 ++
9895 + ocfs2_commit_trans(osb, handle);
9896 +
9897 + ocfs2_run_deallocs(osb, &wc->w_dealloc);
9898 +
9899 +- ocfs2_free_write_ctxt(wc);
9900 ++ brelse(wc->w_di_bh);
9901 ++ kfree(wc);
9902 +
9903 + return copied;
9904 + }
9905 +diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
9906 +index e2e05a106beb..92edcfc23c1c 100644
9907 +--- a/fs/ocfs2/dcache.c
9908 ++++ b/fs/ocfs2/dcache.c
9909 +@@ -172,7 +172,7 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode,
9910 + struct dentry *dentry;
9911 +
9912 + spin_lock(&inode->i_lock);
9913 +- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
9914 ++ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
9915 + spin_lock(&dentry->d_lock);
9916 + if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
9917 + trace_ocfs2_find_local_alias(dentry->d_name.len,
9918 +diff --git a/fs/proc/stat.c b/fs/proc/stat.c
9919 +index 1cf86c0e8689..b5c72a3be359 100644
9920 +--- a/fs/proc/stat.c
9921 ++++ b/fs/proc/stat.c
9922 +@@ -159,7 +159,7 @@ static int show_stat(struct seq_file *p, void *v)
9923 +
9924 + /* sum again ? it could be updated? */
9925 + for_each_irq_nr(j)
9926 +- seq_put_decimal_ull(p, ' ', kstat_irqs(j));
9927 ++ seq_put_decimal_ull(p, ' ', kstat_irqs_usr(j));
9928 +
9929 + seq_printf(p,
9930 + "\nctxt %llu\n"
9931 +diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
9932 +index fa8cef2cca3a..e7d95f959333 100644
9933 +--- a/fs/pstore/ram.c
9934 ++++ b/fs/pstore/ram.c
9935 +@@ -61,6 +61,11 @@ module_param(mem_size, ulong, 0400);
9936 + MODULE_PARM_DESC(mem_size,
9937 + "size of reserved RAM used to store oops/panic logs");
9938 +
9939 ++static unsigned int mem_type;
9940 ++module_param(mem_type, uint, 0600);
9941 ++MODULE_PARM_DESC(mem_type,
9942 ++ "set to 1 to try to use unbuffered memory (default 0)");
9943 ++
9944 + static int dump_oops = 1;
9945 + module_param(dump_oops, int, 0600);
9946 + MODULE_PARM_DESC(dump_oops,
9947 +@@ -79,6 +84,7 @@ struct ramoops_context {
9948 + struct persistent_ram_zone *fprz;
9949 + phys_addr_t phys_addr;
9950 + unsigned long size;
9951 ++ unsigned int memtype;
9952 + size_t record_size;
9953 + size_t console_size;
9954 + size_t ftrace_size;
9955 +@@ -353,7 +359,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
9956 + size_t sz = cxt->record_size;
9957 +
9958 + cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
9959 +- &cxt->ecc_info);
9960 ++ &cxt->ecc_info,
9961 ++ cxt->memtype);
9962 + if (IS_ERR(cxt->przs[i])) {
9963 + err = PTR_ERR(cxt->przs[i]);
9964 + dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
9965 +@@ -383,7 +390,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
9966 + return -ENOMEM;
9967 + }
9968 +
9969 +- *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info);
9970 ++ *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, cxt->memtype);
9971 + if (IS_ERR(*prz)) {
9972 + int err = PTR_ERR(*prz);
9973 +
9974 +@@ -431,6 +438,7 @@ static int ramoops_probe(struct platform_device *pdev)
9975 + cxt->dump_read_cnt = 0;
9976 + cxt->size = pdata->mem_size;
9977 + cxt->phys_addr = pdata->mem_address;
9978 ++ cxt->memtype = pdata->mem_type;
9979 + cxt->record_size = pdata->record_size;
9980 + cxt->console_size = pdata->console_size;
9981 + cxt->ftrace_size = pdata->ftrace_size;
9982 +@@ -561,6 +569,7 @@ static void ramoops_register_dummy(void)
9983 +
9984 + dummy_data->mem_size = mem_size;
9985 + dummy_data->mem_address = mem_address;
9986 ++ dummy_data->mem_type = 0;
9987 + dummy_data->record_size = record_size;
9988 + dummy_data->console_size = ramoops_console_size;
9989 + dummy_data->ftrace_size = ramoops_ftrace_size;
9990 +diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
9991 +index de272d426763..bda61a759b68 100644
9992 +--- a/fs/pstore/ram_core.c
9993 ++++ b/fs/pstore/ram_core.c
9994 +@@ -380,7 +380,8 @@ void persistent_ram_zap(struct persistent_ram_zone *prz)
9995 + persistent_ram_update_header_ecc(prz);
9996 + }
9997 +
9998 +-static void *persistent_ram_vmap(phys_addr_t start, size_t size)
9999 ++static void *persistent_ram_vmap(phys_addr_t start, size_t size,
10000 ++ unsigned int memtype)
10001 + {
10002 + struct page **pages;
10003 + phys_addr_t page_start;
10004 +@@ -392,7 +393,10 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size)
10005 + page_start = start - offset_in_page(start);
10006 + page_count = DIV_ROUND_UP(size + offset_in_page(start), PAGE_SIZE);
10007 +
10008 +- prot = pgprot_noncached(PAGE_KERNEL);
10009 ++ if (memtype)
10010 ++ prot = pgprot_noncached(PAGE_KERNEL);
10011 ++ else
10012 ++ prot = pgprot_writecombine(PAGE_KERNEL);
10013 +
10014 + pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL);
10015 + if (!pages) {
10016 +@@ -411,8 +415,11 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size)
10017 + return vaddr;
10018 + }
10019 +
10020 +-static void *persistent_ram_iomap(phys_addr_t start, size_t size)
10021 ++static void *persistent_ram_iomap(phys_addr_t start, size_t size,
10022 ++ unsigned int memtype)
10023 + {
10024 ++ void *va;
10025 ++
10026 + if (!request_mem_region(start, size, "persistent_ram")) {
10027 + pr_err("request mem region (0x%llx@0x%llx) failed\n",
10028 + (unsigned long long)size, (unsigned long long)start);
10029 +@@ -422,19 +429,24 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size)
10030 + buffer_start_add = buffer_start_add_locked;
10031 + buffer_size_add = buffer_size_add_locked;
10032 +
10033 +- return ioremap(start, size);
10034 ++ if (memtype)
10035 ++ va = ioremap(start, size);
10036 ++ else
10037 ++ va = ioremap_wc(start, size);
10038 ++
10039 ++ return va;
10040 + }
10041 +
10042 + static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
10043 +- struct persistent_ram_zone *prz)
10044 ++ struct persistent_ram_zone *prz, int memtype)
10045 + {
10046 + prz->paddr = start;
10047 + prz->size = size;
10048 +
10049 + if (pfn_valid(start >> PAGE_SHIFT))
10050 +- prz->vaddr = persistent_ram_vmap(start, size);
10051 ++ prz->vaddr = persistent_ram_vmap(start, size, memtype);
10052 + else
10053 +- prz->vaddr = persistent_ram_iomap(start, size);
10054 ++ prz->vaddr = persistent_ram_iomap(start, size, memtype);
10055 +
10056 + if (!prz->vaddr) {
10057 + pr_err("%s: Failed to map 0x%llx pages at 0x%llx\n", __func__,
10058 +@@ -502,7 +514,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
10059 + }
10060 +
10061 + struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
10062 +- u32 sig, struct persistent_ram_ecc_info *ecc_info)
10063 ++ u32 sig, struct persistent_ram_ecc_info *ecc_info,
10064 ++ unsigned int memtype)
10065 + {
10066 + struct persistent_ram_zone *prz;
10067 + int ret = -ENOMEM;
10068 +@@ -513,7 +526,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
10069 + goto err;
10070 + }
10071 +
10072 +- ret = persistent_ram_buffer_map(start, size, prz);
10073 ++ ret = persistent_ram_buffer_map(start, size, prz, memtype);
10074 + if (ret)
10075 + goto err;
10076 +
10077 +diff --git a/include/linux/crypto.h b/include/linux/crypto.h
10078 +index b92eadf92d72..2b00d92a6e6f 100644
10079 +--- a/include/linux/crypto.h
10080 ++++ b/include/linux/crypto.h
10081 +@@ -26,6 +26,19 @@
10082 + #include <linux/uaccess.h>
10083 +
10084 + /*
10085 ++ * Autoloaded crypto modules should only use a prefixed name to avoid allowing
10086 ++ * arbitrary modules to be loaded. Loading from userspace may still need the
10087 ++ * unprefixed names, so retains those aliases as well.
10088 ++ * This uses __MODULE_INFO directly instead of MODULE_ALIAS because pre-4.3
10089 ++ * gcc (e.g. avr32 toolchain) uses __LINE__ for uniqueness, and this macro
10090 ++ * expands twice on the same line. Instead, use a separate base name for the
10091 ++ * alias.
10092 ++ */
10093 ++#define MODULE_ALIAS_CRYPTO(name) \
10094 ++ __MODULE_INFO(alias, alias_userspace, name); \
10095 ++ __MODULE_INFO(alias, alias_crypto, "crypto-" name)
10096 ++
10097 ++/*
10098 + * Algorithm masks and types.
10099 + */
10100 + #define CRYPTO_ALG_TYPE_MASK 0x0000000f
10101 +diff --git a/include/linux/dcache.h b/include/linux/dcache.h
10102 +index cbde0540d4dd..53c1b60a29a0 100644
10103 +--- a/include/linux/dcache.h
10104 ++++ b/include/linux/dcache.h
10105 +@@ -122,15 +122,15 @@ struct dentry {
10106 + void *d_fsdata; /* fs-specific data */
10107 +
10108 + struct list_head d_lru; /* LRU list */
10109 ++ struct list_head d_child; /* child of parent list */
10110 ++ struct list_head d_subdirs; /* our children */
10111 + /*
10112 +- * d_child and d_rcu can share memory
10113 ++ * d_alias and d_rcu can share memory
10114 + */
10115 + union {
10116 +- struct list_head d_child; /* child of parent list */
10117 ++ struct hlist_node d_alias; /* inode alias list */
10118 + struct rcu_head d_rcu;
10119 + } d_u;
10120 +- struct list_head d_subdirs; /* our children */
10121 +- struct hlist_node d_alias; /* inode alias list */
10122 + };
10123 +
10124 + /*
10125 +diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
10126 +index 51c72be4a7c3..4b2053a232c9 100644
10127 +--- a/include/linux/kernel_stat.h
10128 ++++ b/include/linux/kernel_stat.h
10129 +@@ -74,6 +74,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
10130 + * Number of interrupts per specific IRQ source, since bootup
10131 + */
10132 + extern unsigned int kstat_irqs(unsigned int irq);
10133 ++extern unsigned int kstat_irqs_usr(unsigned int irq);
10134 +
10135 + /*
10136 + * Number of interrupts per cpu, since bootup
10137 +diff --git a/include/linux/mm.h b/include/linux/mm.h
10138 +index 36556b2e07f8..306f0d4ce7e3 100644
10139 +--- a/include/linux/mm.h
10140 ++++ b/include/linux/mm.h
10141 +@@ -1642,7 +1642,7 @@ extern int expand_downwards(struct vm_area_struct *vma,
10142 + #if VM_GROWSUP
10143 + extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
10144 + #else
10145 +- #define expand_upwards(vma, address) do { } while (0)
10146 ++ #define expand_upwards(vma, address) (0)
10147 + #endif
10148 +
10149 + /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
10150 +diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
10151 +index d57a02a9747b..bf944e86895b 100644
10152 +--- a/include/linux/pagemap.h
10153 ++++ b/include/linux/pagemap.h
10154 +@@ -256,7 +256,7 @@ pgoff_t page_cache_prev_hole(struct address_space *mapping,
10155 + #define FGP_NOWAIT 0x00000020
10156 +
10157 + struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
10158 +- int fgp_flags, gfp_t cache_gfp_mask, gfp_t radix_gfp_mask);
10159 ++ int fgp_flags, gfp_t cache_gfp_mask);
10160 +
10161 + /**
10162 + * find_get_page - find and get a page reference
10163 +@@ -271,13 +271,13 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
10164 + static inline struct page *find_get_page(struct address_space *mapping,
10165 + pgoff_t offset)
10166 + {
10167 +- return pagecache_get_page(mapping, offset, 0, 0, 0);
10168 ++ return pagecache_get_page(mapping, offset, 0, 0);
10169 + }
10170 +
10171 + static inline struct page *find_get_page_flags(struct address_space *mapping,
10172 + pgoff_t offset, int fgp_flags)
10173 + {
10174 +- return pagecache_get_page(mapping, offset, fgp_flags, 0, 0);
10175 ++ return pagecache_get_page(mapping, offset, fgp_flags, 0);
10176 + }
10177 +
10178 + /**
10179 +@@ -297,7 +297,7 @@ static inline struct page *find_get_page_flags(struct address_space *mapping,
10180 + static inline struct page *find_lock_page(struct address_space *mapping,
10181 + pgoff_t offset)
10182 + {
10183 +- return pagecache_get_page(mapping, offset, FGP_LOCK, 0, 0);
10184 ++ return pagecache_get_page(mapping, offset, FGP_LOCK, 0);
10185 + }
10186 +
10187 + /**
10188 +@@ -324,7 +324,7 @@ static inline struct page *find_or_create_page(struct address_space *mapping,
10189 + {
10190 + return pagecache_get_page(mapping, offset,
10191 + FGP_LOCK|FGP_ACCESSED|FGP_CREAT,
10192 +- gfp_mask, gfp_mask & GFP_RECLAIM_MASK);
10193 ++ gfp_mask);
10194 + }
10195 +
10196 + /**
10197 +@@ -345,8 +345,7 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping,
10198 + {
10199 + return pagecache_get_page(mapping, index,
10200 + FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT,
10201 +- mapping_gfp_mask(mapping),
10202 +- GFP_NOFS);
10203 ++ mapping_gfp_mask(mapping));
10204 + }
10205 +
10206 + struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
10207 +diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
10208 +index 9974975d40db..4af3fdc85b01 100644
10209 +--- a/include/linux/pstore_ram.h
10210 ++++ b/include/linux/pstore_ram.h
10211 +@@ -53,7 +53,8 @@ struct persistent_ram_zone {
10212 + };
10213 +
10214 + struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
10215 +- u32 sig, struct persistent_ram_ecc_info *ecc_info);
10216 ++ u32 sig, struct persistent_ram_ecc_info *ecc_info,
10217 ++ unsigned int memtype);
10218 + void persistent_ram_free(struct persistent_ram_zone *prz);
10219 + void persistent_ram_zap(struct persistent_ram_zone *prz);
10220 +
10221 +@@ -76,6 +77,7 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
10222 + struct ramoops_platform_data {
10223 + unsigned long mem_size;
10224 + unsigned long mem_address;
10225 ++ unsigned int mem_type;
10226 + unsigned long record_size;
10227 + unsigned long console_size;
10228 + unsigned long ftrace_size;
10229 +diff --git a/include/linux/time.h b/include/linux/time.h
10230 +index d5d229b2e5af..7d532a32ff3a 100644
10231 +--- a/include/linux/time.h
10232 ++++ b/include/linux/time.h
10233 +@@ -173,6 +173,19 @@ extern void getboottime(struct timespec *ts);
10234 + extern void monotonic_to_bootbased(struct timespec *ts);
10235 + extern void get_monotonic_boottime(struct timespec *ts);
10236 +
10237 ++static inline bool timeval_valid(const struct timeval *tv)
10238 ++{
10239 ++ /* Dates before 1970 are bogus */
10240 ++ if (tv->tv_sec < 0)
10241 ++ return false;
10242 ++
10243 ++ /* Can't have more microseconds then a second */
10244 ++ if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
10245 ++ return false;
10246 ++
10247 ++ return true;
10248 ++}
10249 ++
10250 + extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
10251 + extern int timekeeping_valid_for_hres(void);
10252 + extern u64 timekeeping_max_deferment(void);
10253 +diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
10254 +index 440d5c479145..599b0d4c2d1c 100644
10255 +--- a/include/uapi/linux/in6.h
10256 ++++ b/include/uapi/linux/in6.h
10257 +@@ -156,7 +156,7 @@ enum {
10258 + /*
10259 + * IPV6 socket options
10260 + */
10261 +-
10262 ++#if __UAPI_DEF_IPV6_OPTIONS
10263 + #define IPV6_ADDRFORM 1
10264 + #define IPV6_2292PKTINFO 2
10265 + #define IPV6_2292HOPOPTS 3
10266 +@@ -195,6 +195,7 @@ enum {
10267 +
10268 + #define IPV6_IPSEC_POLICY 34
10269 + #define IPV6_XFRM_POLICY 35
10270 ++#endif
10271 +
10272 + /*
10273 + * Multicast:
10274 +diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
10275 +index c140620dad92..e28807ad17fa 100644
10276 +--- a/include/uapi/linux/libc-compat.h
10277 ++++ b/include/uapi/linux/libc-compat.h
10278 +@@ -69,6 +69,7 @@
10279 + #define __UAPI_DEF_SOCKADDR_IN6 0
10280 + #define __UAPI_DEF_IPV6_MREQ 0
10281 + #define __UAPI_DEF_IPPROTO_V6 0
10282 ++#define __UAPI_DEF_IPV6_OPTIONS 0
10283 +
10284 + #else
10285 +
10286 +@@ -82,6 +83,7 @@
10287 + #define __UAPI_DEF_SOCKADDR_IN6 1
10288 + #define __UAPI_DEF_IPV6_MREQ 1
10289 + #define __UAPI_DEF_IPPROTO_V6 1
10290 ++#define __UAPI_DEF_IPV6_OPTIONS 1
10291 +
10292 + #endif /* _NETINET_IN_H */
10293 +
10294 +@@ -103,6 +105,7 @@
10295 + #define __UAPI_DEF_SOCKADDR_IN6 1
10296 + #define __UAPI_DEF_IPV6_MREQ 1
10297 + #define __UAPI_DEF_IPPROTO_V6 1
10298 ++#define __UAPI_DEF_IPV6_OPTIONS 1
10299 +
10300 + /* Definitions for xattr.h */
10301 + #define __UAPI_DEF_XATTR 1
10302 +diff --git a/kernel/cgroup.c b/kernel/cgroup.c
10303 +index 1c204fdb85d8..5d9d542c0bb5 100644
10304 +--- a/kernel/cgroup.c
10305 ++++ b/kernel/cgroup.c
10306 +@@ -1012,7 +1012,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry)
10307 + parent = dentry->d_parent;
10308 + spin_lock(&parent->d_lock);
10309 + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
10310 +- list_del_init(&dentry->d_u.d_child);
10311 ++ list_del_init(&dentry->d_child);
10312 + spin_unlock(&dentry->d_lock);
10313 + spin_unlock(&parent->d_lock);
10314 + remove_dir(dentry);
10315 +diff --git a/kernel/events/core.c b/kernel/events/core.c
10316 +index 63bd27c861fe..452b2b0d7af1 100644
10317 +--- a/kernel/events/core.c
10318 ++++ b/kernel/events/core.c
10319 +@@ -7167,11 +7167,11 @@ SYSCALL_DEFINE5(perf_event_open,
10320 +
10321 + if (move_group) {
10322 + synchronize_rcu();
10323 +- perf_install_in_context(ctx, group_leader, event->cpu);
10324 ++ perf_install_in_context(ctx, group_leader, group_leader->cpu);
10325 + get_ctx(ctx);
10326 + list_for_each_entry(sibling, &group_leader->sibling_list,
10327 + group_entry) {
10328 +- perf_install_in_context(ctx, sibling, event->cpu);
10329 ++ perf_install_in_context(ctx, sibling, sibling->cpu);
10330 + get_ctx(ctx);
10331 + }
10332 + }
10333 +diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
10334 +index 001fa5bab490..8a160e8a44e8 100644
10335 +--- a/kernel/irq/internals.h
10336 ++++ b/kernel/irq/internals.h
10337 +@@ -74,6 +74,14 @@ extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
10338 + extern void mask_irq(struct irq_desc *desc);
10339 + extern void unmask_irq(struct irq_desc *desc);
10340 +
10341 ++#ifdef CONFIG_SPARSE_IRQ
10342 ++extern void irq_lock_sparse(void);
10343 ++extern void irq_unlock_sparse(void);
10344 ++#else
10345 ++static inline void irq_lock_sparse(void) { }
10346 ++static inline void irq_unlock_sparse(void) { }
10347 ++#endif
10348 ++
10349 + extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
10350 +
10351 + irqreturn_t handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action);
10352 +diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
10353 +index 8ab8e9390297..07d45516b540 100644
10354 +--- a/kernel/irq/irqdesc.c
10355 ++++ b/kernel/irq/irqdesc.c
10356 +@@ -131,6 +131,16 @@ static void free_masks(struct irq_desc *desc)
10357 + static inline void free_masks(struct irq_desc *desc) { }
10358 + #endif
10359 +
10360 ++void irq_lock_sparse(void)
10361 ++{
10362 ++ mutex_lock(&sparse_irq_lock);
10363 ++}
10364 ++
10365 ++void irq_unlock_sparse(void)
10366 ++{
10367 ++ mutex_unlock(&sparse_irq_lock);
10368 ++}
10369 ++
10370 + static struct irq_desc *alloc_desc(int irq, int node, struct module *owner)
10371 + {
10372 + struct irq_desc *desc;
10373 +@@ -167,6 +177,12 @@ static void free_desc(unsigned int irq)
10374 +
10375 + unregister_irq_proc(irq, desc);
10376 +
10377 ++ /*
10378 ++ * sparse_irq_lock protects also show_interrupts() and
10379 ++ * kstat_irq_usr(). Once we deleted the descriptor from the
10380 ++ * sparse tree we can free it. Access in proc will fail to
10381 ++ * lookup the descriptor.
10382 ++ */
10383 + mutex_lock(&sparse_irq_lock);
10384 + delete_irq_desc(irq);
10385 + mutex_unlock(&sparse_irq_lock);
10386 +@@ -489,6 +505,15 @@ void dynamic_irq_cleanup(unsigned int irq)
10387 + raw_spin_unlock_irqrestore(&desc->lock, flags);
10388 + }
10389 +
10390 ++/**
10391 ++ * kstat_irqs_cpu - Get the statistics for an interrupt on a cpu
10392 ++ * @irq: The interrupt number
10393 ++ * @cpu: The cpu number
10394 ++ *
10395 ++ * Returns the sum of interrupt counts on @cpu since boot for
10396 ++ * @irq. The caller must ensure that the interrupt is not removed
10397 ++ * concurrently.
10398 ++ */
10399 + unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
10400 + {
10401 + struct irq_desc *desc = irq_to_desc(irq);
10402 +@@ -497,6 +522,14 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
10403 + *per_cpu_ptr(desc->kstat_irqs, cpu) : 0;
10404 + }
10405 +
10406 ++/**
10407 ++ * kstat_irqs - Get the statistics for an interrupt
10408 ++ * @irq: The interrupt number
10409 ++ *
10410 ++ * Returns the sum of interrupt counts on all cpus since boot for
10411 ++ * @irq. The caller must ensure that the interrupt is not removed
10412 ++ * concurrently.
10413 ++ */
10414 + unsigned int kstat_irqs(unsigned int irq)
10415 + {
10416 + struct irq_desc *desc = irq_to_desc(irq);
10417 +@@ -509,3 +542,22 @@ unsigned int kstat_irqs(unsigned int irq)
10418 + sum += *per_cpu_ptr(desc->kstat_irqs, cpu);
10419 + return sum;
10420 + }
10421 ++
10422 ++/**
10423 ++ * kstat_irqs_usr - Get the statistics for an interrupt
10424 ++ * @irq: The interrupt number
10425 ++ *
10426 ++ * Returns the sum of interrupt counts on all cpus since boot for
10427 ++ * @irq. Contrary to kstat_irqs() this can be called from any
10428 ++ * preemptible context. It's protected against concurrent removal of
10429 ++ * an interrupt descriptor when sparse irqs are enabled.
10430 ++ */
10431 ++unsigned int kstat_irqs_usr(unsigned int irq)
10432 ++{
10433 ++ int sum;
10434 ++
10435 ++ irq_lock_sparse();
10436 ++ sum = kstat_irqs(irq);
10437 ++ irq_unlock_sparse();
10438 ++ return sum;
10439 ++}
10440 +diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
10441 +index 36f6ee181b0c..095cd7230aef 100644
10442 +--- a/kernel/irq/proc.c
10443 ++++ b/kernel/irq/proc.c
10444 +@@ -15,6 +15,23 @@
10445 +
10446 + #include "internals.h"
10447 +
10448 ++/*
10449 ++ * Access rules:
10450 ++ *
10451 ++ * procfs protects read/write of /proc/irq/N/ files against a
10452 ++ * concurrent free of the interrupt descriptor. remove_proc_entry()
10453 ++ * immediately prevents new read/writes to happen and waits for
10454 ++ * already running read/write functions to complete.
10455 ++ *
10456 ++ * We remove the proc entries first and then delete the interrupt
10457 ++ * descriptor from the radix tree and free it. So it is guaranteed
10458 ++ * that irq_to_desc(N) is valid as long as the read/writes are
10459 ++ * permitted by procfs.
10460 ++ *
10461 ++ * The read from /proc/interrupts is a different problem because there
10462 ++ * is no protection. So the lookup and the access to irqdesc
10463 ++ * information must be protected by sparse_irq_lock.
10464 ++ */
10465 + static struct proc_dir_entry *root_irq_dir;
10466 +
10467 + #ifdef CONFIG_SMP
10468 +@@ -437,9 +454,10 @@ int show_interrupts(struct seq_file *p, void *v)
10469 + seq_putc(p, '\n');
10470 + }
10471 +
10472 ++ irq_lock_sparse();
10473 + desc = irq_to_desc(i);
10474 + if (!desc)
10475 +- return 0;
10476 ++ goto outsparse;
10477 +
10478 + raw_spin_lock_irqsave(&desc->lock, flags);
10479 + for_each_online_cpu(j)
10480 +@@ -479,6 +497,8 @@ int show_interrupts(struct seq_file *p, void *v)
10481 + seq_putc(p, '\n');
10482 + out:
10483 + raw_spin_unlock_irqrestore(&desc->lock, flags);
10484 ++outsparse:
10485 ++ irq_unlock_sparse();
10486 + return 0;
10487 + }
10488 + #endif
10489 +diff --git a/kernel/time.c b/kernel/time.c
10490 +index 3c49ab45f822..3eb322e518a3 100644
10491 +--- a/kernel/time.c
10492 ++++ b/kernel/time.c
10493 +@@ -195,6 +195,10 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
10494 + if (tv) {
10495 + if (copy_from_user(&user_tv, tv, sizeof(*tv)))
10496 + return -EFAULT;
10497 ++
10498 ++ if (!timeval_valid(&user_tv))
10499 ++ return -EINVAL;
10500 ++
10501 + new_ts.tv_sec = user_tv.tv_sec;
10502 + new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC;
10503 + }
10504 +diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
10505 +index af8d1d4f3d55..28db9bedc857 100644
10506 +--- a/kernel/time/ntp.c
10507 ++++ b/kernel/time/ntp.c
10508 +@@ -631,6 +631,13 @@ int ntp_validate_timex(struct timex *txc)
10509 + if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME)))
10510 + return -EPERM;
10511 +
10512 ++ if (txc->modes & ADJ_FREQUENCY) {
10513 ++ if (LONG_MIN / PPM_SCALE > txc->freq)
10514 ++ return -EINVAL;
10515 ++ if (LONG_MAX / PPM_SCALE < txc->freq)
10516 ++ return -EINVAL;
10517 ++ }
10518 ++
10519 + return 0;
10520 + }
10521 +
10522 +diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
10523 +index 29b063b32ff0..67673ca12a19 100644
10524 +--- a/kernel/time/tick-sched.c
10525 ++++ b/kernel/time/tick-sched.c
10526 +@@ -806,7 +806,6 @@ void tick_nohz_idle_enter(void)
10527 +
10528 + local_irq_enable();
10529 + }
10530 +-EXPORT_SYMBOL_GPL(tick_nohz_idle_enter);
10531 +
10532 + /**
10533 + * tick_nohz_irq_exit - update next tick event from interrupt exit
10534 +@@ -934,7 +933,6 @@ void tick_nohz_idle_exit(void)
10535 +
10536 + local_irq_enable();
10537 + }
10538 +-EXPORT_SYMBOL_GPL(tick_nohz_idle_exit);
10539 +
10540 + static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now)
10541 + {
10542 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
10543 +index dcdf4e682dd4..691a8ea6f472 100644
10544 +--- a/kernel/trace/trace.c
10545 ++++ b/kernel/trace/trace.c
10546 +@@ -6063,7 +6063,7 @@ static int instance_mkdir (struct inode *inode, struct dentry *dentry, umode_t m
10547 + int ret;
10548 +
10549 + /* Paranoid: Make sure the parent is the "instances" directory */
10550 +- parent = hlist_entry(inode->i_dentry.first, struct dentry, d_alias);
10551 ++ parent = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
10552 + if (WARN_ON_ONCE(parent != trace_instance_dir))
10553 + return -ENOENT;
10554 +
10555 +@@ -6090,7 +6090,7 @@ static int instance_rmdir(struct inode *inode, struct dentry *dentry)
10556 + int ret;
10557 +
10558 + /* Paranoid: Make sure the parent is the "instances" directory */
10559 +- parent = hlist_entry(inode->i_dentry.first, struct dentry, d_alias);
10560 ++ parent = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
10561 + if (WARN_ON_ONCE(parent != trace_instance_dir))
10562 + return -ENOENT;
10563 +
10564 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
10565 +index bc1bd20f7942..be15da87b390 100644
10566 +--- a/kernel/trace/trace_events.c
10567 ++++ b/kernel/trace/trace_events.c
10568 +@@ -427,7 +427,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file)
10569 +
10570 + if (dir) {
10571 + spin_lock(&dir->d_lock); /* probably unneeded */
10572 +- list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) {
10573 ++ list_for_each_entry(child, &dir->d_subdirs, d_child) {
10574 + if (child->d_inode) /* probably unneeded */
10575 + child->d_inode->i_private = NULL;
10576 + }
10577 +diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
10578 +index 31c5f7675fbf..f504027d66a8 100644
10579 +--- a/lib/decompress_bunzip2.c
10580 ++++ b/lib/decompress_bunzip2.c
10581 +@@ -184,7 +184,7 @@ static int INIT get_next_block(struct bunzip_data *bd)
10582 + if (get_bits(bd, 1))
10583 + return RETVAL_OBSOLETE_INPUT;
10584 + origPtr = get_bits(bd, 24);
10585 +- if (origPtr > dbufSize)
10586 ++ if (origPtr >= dbufSize)
10587 + return RETVAL_DATA_ERROR;
10588 + /* mapping table: if some byte values are never used (encoding things
10589 + like ascii text), the compression code removes the gaps to have fewer
10590 +diff --git a/mm/filemap.c b/mm/filemap.c
10591 +index e94c70380deb..bd08e9bbf347 100644
10592 +--- a/mm/filemap.c
10593 ++++ b/mm/filemap.c
10594 +@@ -897,7 +897,7 @@ EXPORT_SYMBOL(find_lock_entry);
10595 + * @mapping: the address_space to search
10596 + * @offset: the page index
10597 + * @fgp_flags: PCG flags
10598 +- * @gfp_mask: gfp mask to use if a page is to be allocated
10599 ++ * @gfp_mask: gfp mask to use for the page cache data page allocation
10600 + *
10601 + * Looks up the page cache slot at @mapping & @offset.
10602 + *
10603 +@@ -916,7 +916,7 @@ EXPORT_SYMBOL(find_lock_entry);
10604 + * If there is a page cache page, it is returned with an increased refcount.
10605 + */
10606 + struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
10607 +- int fgp_flags, gfp_t cache_gfp_mask, gfp_t radix_gfp_mask)
10608 ++ int fgp_flags, gfp_t gfp_mask)
10609 + {
10610 + struct page *page;
10611 +
10612 +@@ -953,13 +953,11 @@ no_page:
10613 + if (!page && (fgp_flags & FGP_CREAT)) {
10614 + int err;
10615 + if ((fgp_flags & FGP_WRITE) && mapping_cap_account_dirty(mapping))
10616 +- cache_gfp_mask |= __GFP_WRITE;
10617 +- if (fgp_flags & FGP_NOFS) {
10618 +- cache_gfp_mask &= ~__GFP_FS;
10619 +- radix_gfp_mask &= ~__GFP_FS;
10620 +- }
10621 ++ gfp_mask |= __GFP_WRITE;
10622 ++ if (fgp_flags & FGP_NOFS)
10623 ++ gfp_mask &= ~__GFP_FS;
10624 +
10625 +- page = __page_cache_alloc(cache_gfp_mask);
10626 ++ page = __page_cache_alloc(gfp_mask);
10627 + if (!page)
10628 + return NULL;
10629 +
10630 +@@ -970,7 +968,8 @@ no_page:
10631 + if (fgp_flags & FGP_ACCESSED)
10632 + init_page_accessed(page);
10633 +
10634 +- err = add_to_page_cache_lru(page, mapping, offset, radix_gfp_mask);
10635 ++ err = add_to_page_cache_lru(page, mapping, offset,
10636 ++ gfp_mask & GFP_RECLAIM_MASK);
10637 + if (unlikely(err)) {
10638 + page_cache_release(page);
10639 + page = NULL;
10640 +@@ -2462,8 +2461,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping,
10641 + fgp_flags |= FGP_NOFS;
10642 +
10643 + page = pagecache_get_page(mapping, index, fgp_flags,
10644 +- mapping_gfp_mask(mapping),
10645 +- GFP_KERNEL);
10646 ++ mapping_gfp_mask(mapping));
10647 + if (page)
10648 + wait_for_stable_page(page);
10649 +
10650 +diff --git a/mm/memory.c b/mm/memory.c
10651 +index 827a7ed7f5a2..db2916f5f378 100644
10652 +--- a/mm/memory.c
10653 ++++ b/mm/memory.c
10654 +@@ -3194,7 +3194,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo
10655 + if (prev && prev->vm_end == address)
10656 + return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
10657 +
10658 +- expand_downwards(vma, address - PAGE_SIZE);
10659 ++ return expand_downwards(vma, address - PAGE_SIZE);
10660 + }
10661 + if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) {
10662 + struct vm_area_struct *next = vma->vm_next;
10663 +@@ -3203,7 +3203,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo
10664 + if (next && next->vm_start == address + PAGE_SIZE)
10665 + return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM;
10666 +
10667 +- expand_upwards(vma, address + PAGE_SIZE);
10668 ++ return expand_upwards(vma, address + PAGE_SIZE);
10669 + }
10670 + return 0;
10671 + }
10672 +diff --git a/mm/mmap.c b/mm/mmap.c
10673 +index 15e07d5a75cb..441602d7259a 100644
10674 +--- a/mm/mmap.c
10675 ++++ b/mm/mmap.c
10676 +@@ -2049,14 +2049,17 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
10677 + {
10678 + struct mm_struct *mm = vma->vm_mm;
10679 + struct rlimit *rlim = current->signal->rlim;
10680 +- unsigned long new_start;
10681 ++ unsigned long new_start, actual_size;
10682 +
10683 + /* address space limit tests */
10684 + if (!may_expand_vm(mm, grow))
10685 + return -ENOMEM;
10686 +
10687 + /* Stack limit test */
10688 +- if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur))
10689 ++ actual_size = size;
10690 ++ if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN)))
10691 ++ actual_size -= PAGE_SIZE;
10692 ++ if (actual_size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur))
10693 + return -ENOMEM;
10694 +
10695 + /* mlock limit tests */
10696 +diff --git a/mm/vmscan.c b/mm/vmscan.c
10697 +index 5461d02ea718..ee8363f73cab 100644
10698 +--- a/mm/vmscan.c
10699 ++++ b/mm/vmscan.c
10700 +@@ -2868,18 +2868,20 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,
10701 + return false;
10702 +
10703 + /*
10704 +- * There is a potential race between when kswapd checks its watermarks
10705 +- * and a process gets throttled. There is also a potential race if
10706 +- * processes get throttled, kswapd wakes, a large process exits therby
10707 +- * balancing the zones that causes kswapd to miss a wakeup. If kswapd
10708 +- * is going to sleep, no process should be sleeping on pfmemalloc_wait
10709 +- * so wake them now if necessary. If necessary, processes will wake
10710 +- * kswapd and get throttled again
10711 ++ * The throttled processes are normally woken up in balance_pgdat() as
10712 ++ * soon as pfmemalloc_watermark_ok() is true. But there is a potential
10713 ++ * race between when kswapd checks the watermarks and a process gets
10714 ++ * throttled. There is also a potential race if processes get
10715 ++ * throttled, kswapd wakes, a large process exits thereby balancing the
10716 ++ * zones, which causes kswapd to exit balance_pgdat() before reaching
10717 ++ * the wake up checks. If kswapd is going to sleep, no process should
10718 ++ * be sleeping on pfmemalloc_wait, so wake them now if necessary. If
10719 ++ * the wake up is premature, processes will wake kswapd and get
10720 ++ * throttled again. The difference from wake ups in balance_pgdat() is
10721 ++ * that here we are under prepare_to_wait().
10722 + */
10723 +- if (waitqueue_active(&pgdat->pfmemalloc_wait)) {
10724 +- wake_up(&pgdat->pfmemalloc_wait);
10725 +- return false;
10726 +- }
10727 ++ if (waitqueue_active(&pgdat->pfmemalloc_wait))
10728 ++ wake_up_all(&pgdat->pfmemalloc_wait);
10729 +
10730 + return pgdat_balanced(pgdat, order, classzone_idx);
10731 + }
10732 +diff --git a/net/core/dev.c b/net/core/dev.c
10733 +index 70876db1ade2..ece49db4f265 100644
10734 +--- a/net/core/dev.c
10735 ++++ b/net/core/dev.c
10736 +@@ -1698,6 +1698,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
10737 +
10738 + skb_scrub_packet(skb, true);
10739 + skb->protocol = eth_type_trans(skb, dev);
10740 ++ skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
10741 +
10742 + return netif_rx(skb);
10743 + }
10744 +@@ -2504,11 +2505,14 @@ netdev_features_t netif_skb_dev_features(struct sk_buff *skb,
10745 + if (skb_shinfo(skb)->gso_segs > dev->gso_max_segs)
10746 + features &= ~NETIF_F_GSO_MASK;
10747 +
10748 +- if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {
10749 +- struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
10750 +- protocol = veh->h_vlan_encapsulated_proto;
10751 +- } else if (!vlan_tx_tag_present(skb)) {
10752 +- return harmonize_features(skb, dev, features);
10753 ++ if (!vlan_tx_tag_present(skb)) {
10754 ++ if (unlikely(protocol == htons(ETH_P_8021Q) ||
10755 ++ protocol == htons(ETH_P_8021AD))) {
10756 ++ struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
10757 ++ protocol = veh->h_vlan_encapsulated_proto;
10758 ++ } else {
10759 ++ return harmonize_features(skb, dev, features);
10760 ++ }
10761 + }
10762 +
10763 + features = netdev_intersect_features(features,
10764 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
10765 +index a8cf33868f9c..17313d17a923 100644
10766 +--- a/net/core/skbuff.c
10767 ++++ b/net/core/skbuff.c
10768 +@@ -3523,6 +3523,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet)
10769 + skb->local_df = 0;
10770 + skb_dst_drop(skb);
10771 + skb->mark = 0;
10772 ++ skb_init_secmark(skb);
10773 + secpath_reset(skb);
10774 + nf_reset(skb);
10775 + nf_reset_trace(skb);
10776 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
10777 +index 4c0e55f14f2e..b4435ae4c485 100644
10778 +--- a/net/ipv4/tcp_output.c
10779 ++++ b/net/ipv4/tcp_output.c
10780 +@@ -1871,7 +1871,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
10781 + if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
10782 + break;
10783 +
10784 +- if (tso_segs == 1) {
10785 ++ if (tso_segs == 1 || !sk->sk_gso_max_segs) {
10786 + if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
10787 + (tcp_skb_is_last(sk, skb) ?
10788 + nonagle : TCP_NAGLE_PUSH))))
10789 +@@ -1908,7 +1908,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
10790 + }
10791 +
10792 + limit = mss_now;
10793 +- if (tso_segs > 1 && !tcp_urg_mode(tp))
10794 ++ if (tso_segs > 1 && sk->sk_gso_max_segs && !tcp_urg_mode(tp))
10795 + limit = tcp_mss_split_point(sk, skb, mss_now,
10796 + min_t(unsigned int,
10797 + cwnd_quota,
10798 +diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
10799 +index f2e30fb31e78..4fb68dc73935 100644
10800 +--- a/net/netfilter/ipset/ip_set_core.c
10801 ++++ b/net/netfilter/ipset/ip_set_core.c
10802 +@@ -1753,6 +1753,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len)
10803 + if (*op < IP_SET_OP_VERSION) {
10804 + /* Check the version at the beginning of operations */
10805 + struct ip_set_req_version *req_version = data;
10806 ++
10807 ++ if (*len < sizeof(struct ip_set_req_version)) {
10808 ++ ret = -EINVAL;
10809 ++ goto done;
10810 ++ }
10811 ++
10812 + if (req_version->version != IPSET_PROTOCOL) {
10813 + ret = -EPROTO;
10814 + goto done;
10815 +diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
10816 +index 77c173282f38..4a662f15eaee 100644
10817 +--- a/net/netfilter/ipvs/ip_vs_ftp.c
10818 ++++ b/net/netfilter/ipvs/ip_vs_ftp.c
10819 +@@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
10820 + struct nf_conn *ct;
10821 + struct net *net;
10822 +
10823 ++ *diff = 0;
10824 ++
10825 + #ifdef CONFIG_IP_VS_IPV6
10826 + /* This application helper doesn't work with IPv6 yet,
10827 + * so turn this into a no-op for IPv6 packets
10828 +@@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
10829 + return 1;
10830 + #endif
10831 +
10832 +- *diff = 0;
10833 +-
10834 + /* Only useful for established sessions */
10835 + if (cp->state != IP_VS_TCP_S_ESTABLISHED)
10836 + return 1;
10837 +@@ -321,6 +321,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
10838 + struct ip_vs_conn *n_cp;
10839 + struct net *net;
10840 +
10841 ++ /* no diff required for incoming packets */
10842 ++ *diff = 0;
10843 ++
10844 + #ifdef CONFIG_IP_VS_IPV6
10845 + /* This application helper doesn't work with IPv6 yet,
10846 + * so turn this into a no-op for IPv6 packets
10847 +@@ -329,9 +332,6 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
10848 + return 1;
10849 + #endif
10850 +
10851 +- /* no diff required for incoming packets */
10852 +- *diff = 0;
10853 +-
10854 + /* Only useful for established sessions */
10855 + if (cp->state != IP_VS_TCP_S_ESTABLISHED)
10856 + return 1;
10857 +diff --git a/net/netfilter/ipvs/ip_vs_nfct.c b/net/netfilter/ipvs/ip_vs_nfct.c
10858 +index c8beafd401aa..5a355a46d1dc 100644
10859 +--- a/net/netfilter/ipvs/ip_vs_nfct.c
10860 ++++ b/net/netfilter/ipvs/ip_vs_nfct.c
10861 +@@ -63,6 +63,7 @@
10862 + #include <net/ip_vs.h>
10863 + #include <net/netfilter/nf_conntrack_core.h>
10864 + #include <net/netfilter/nf_conntrack_expect.h>
10865 ++#include <net/netfilter/nf_conntrack_seqadj.h>
10866 + #include <net/netfilter/nf_conntrack_helper.h>
10867 + #include <net/netfilter/nf_conntrack_zones.h>
10868 +
10869 +@@ -97,6 +98,11 @@ ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, int outin)
10870 + if (CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL)
10871 + return;
10872 +
10873 ++ /* Applications may adjust TCP seqs */
10874 ++ if (cp->app && nf_ct_protonum(ct) == IPPROTO_TCP &&
10875 ++ !nfct_seqadj(ct) && !nfct_seqadj_ext_add(ct))
10876 ++ return;
10877 ++
10878 + /*
10879 + * The connection is not yet in the hashtable, so we update it.
10880 + * CIP->VIP will remain the same, so leave the tuple in
10881 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
10882 +index 2735facbbf91..00590135dc30 100644
10883 +--- a/net/netlink/af_netlink.c
10884 ++++ b/net/netlink/af_netlink.c
10885 +@@ -502,14 +502,14 @@ out:
10886 + return err;
10887 + }
10888 +
10889 +-static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr)
10890 ++static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr, unsigned int nm_len)
10891 + {
10892 + #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
10893 + struct page *p_start, *p_end;
10894 +
10895 + /* First page is flushed through netlink_{get,set}_status */
10896 + p_start = pgvec_to_page(hdr + PAGE_SIZE);
10897 +- p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + hdr->nm_len - 1);
10898 ++ p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + nm_len - 1);
10899 + while (p_start <= p_end) {
10900 + flush_dcache_page(p_start);
10901 + p_start++;
10902 +@@ -527,9 +527,9 @@ static enum nl_mmap_status netlink_get_status(const struct nl_mmap_hdr *hdr)
10903 + static void netlink_set_status(struct nl_mmap_hdr *hdr,
10904 + enum nl_mmap_status status)
10905 + {
10906 ++ smp_mb();
10907 + hdr->nm_status = status;
10908 + flush_dcache_page(pgvec_to_page(hdr));
10909 +- smp_wmb();
10910 + }
10911 +
10912 + static struct nl_mmap_hdr *
10913 +@@ -691,24 +691,16 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg,
10914 + struct nl_mmap_hdr *hdr;
10915 + struct sk_buff *skb;
10916 + unsigned int maxlen;
10917 +- bool excl = true;
10918 + int err = 0, len = 0;
10919 +
10920 +- /* Netlink messages are validated by the receiver before processing.
10921 +- * In order to avoid userspace changing the contents of the message
10922 +- * after validation, the socket and the ring may only be used by a
10923 +- * single process, otherwise we fall back to copying.
10924 +- */
10925 +- if (atomic_long_read(&sk->sk_socket->file->f_count) > 1 ||
10926 +- atomic_read(&nlk->mapped) > 1)
10927 +- excl = false;
10928 +-
10929 + mutex_lock(&nlk->pg_vec_lock);
10930 +
10931 + ring = &nlk->tx_ring;
10932 + maxlen = ring->frame_size - NL_MMAP_HDRLEN;
10933 +
10934 + do {
10935 ++ unsigned int nm_len;
10936 ++
10937 + hdr = netlink_current_frame(ring, NL_MMAP_STATUS_VALID);
10938 + if (hdr == NULL) {
10939 + if (!(msg->msg_flags & MSG_DONTWAIT) &&
10940 +@@ -716,35 +708,23 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg,
10941 + schedule();
10942 + continue;
10943 + }
10944 +- if (hdr->nm_len > maxlen) {
10945 ++
10946 ++ nm_len = ACCESS_ONCE(hdr->nm_len);
10947 ++ if (nm_len > maxlen) {
10948 + err = -EINVAL;
10949 + goto out;
10950 + }
10951 +
10952 +- netlink_frame_flush_dcache(hdr);
10953 ++ netlink_frame_flush_dcache(hdr, nm_len);
10954 +
10955 +- if (likely(dst_portid == 0 && dst_group == 0 && excl)) {
10956 +- skb = alloc_skb_head(GFP_KERNEL);
10957 +- if (skb == NULL) {
10958 +- err = -ENOBUFS;
10959 +- goto out;
10960 +- }
10961 +- sock_hold(sk);
10962 +- netlink_ring_setup_skb(skb, sk, ring, hdr);
10963 +- NETLINK_CB(skb).flags |= NETLINK_SKB_TX;
10964 +- __skb_put(skb, hdr->nm_len);
10965 +- netlink_set_status(hdr, NL_MMAP_STATUS_RESERVED);
10966 +- atomic_inc(&ring->pending);
10967 +- } else {
10968 +- skb = alloc_skb(hdr->nm_len, GFP_KERNEL);
10969 +- if (skb == NULL) {
10970 +- err = -ENOBUFS;
10971 +- goto out;
10972 +- }
10973 +- __skb_put(skb, hdr->nm_len);
10974 +- memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len);
10975 +- netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
10976 ++ skb = alloc_skb(nm_len, GFP_KERNEL);
10977 ++ if (skb == NULL) {
10978 ++ err = -ENOBUFS;
10979 ++ goto out;
10980 + }
10981 ++ __skb_put(skb, nm_len);
10982 ++ memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, nm_len);
10983 ++ netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
10984 +
10985 + netlink_increment_head(ring);
10986 +
10987 +@@ -790,7 +770,7 @@ static void netlink_queue_mmaped_skb(struct sock *sk, struct sk_buff *skb)
10988 + hdr->nm_pid = NETLINK_CB(skb).creds.pid;
10989 + hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid);
10990 + hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid);
10991 +- netlink_frame_flush_dcache(hdr);
10992 ++ netlink_frame_flush_dcache(hdr, hdr->nm_len);
10993 + netlink_set_status(hdr, NL_MMAP_STATUS_VALID);
10994 +
10995 + NETLINK_CB(skb).flags |= NETLINK_SKB_DELIVERED;
10996 +diff --git a/net/wireless/reg.c b/net/wireless/reg.c
10997 +index de06d5d1287f..8eedb1507ccc 100644
10998 +--- a/net/wireless/reg.c
10999 ++++ b/net/wireless/reg.c
11000 +@@ -1432,7 +1432,7 @@ static enum reg_request_treatment
11001 + __regulatory_hint(struct wiphy *wiphy,
11002 + struct regulatory_request *pending_request)
11003 + {
11004 +- const struct ieee80211_regdomain *regd;
11005 ++ const struct ieee80211_regdomain *regd, *tmp;
11006 + bool intersect = false;
11007 + enum reg_request_treatment treatment;
11008 + struct regulatory_request *lr;
11009 +@@ -1448,7 +1448,9 @@ __regulatory_hint(struct wiphy *wiphy,
11010 + kfree(pending_request);
11011 + return PTR_ERR(regd);
11012 + }
11013 ++ tmp = get_wiphy_regdom(wiphy);
11014 + rcu_assign_pointer(wiphy->regd, regd);
11015 ++ rcu_free_regdom(tmp);
11016 + }
11017 + intersect = true;
11018 + break;
11019 +@@ -1468,7 +1470,9 @@ __regulatory_hint(struct wiphy *wiphy,
11020 + return REG_REQ_IGNORE;
11021 + }
11022 + treatment = REG_REQ_ALREADY_SET;
11023 ++ tmp = get_wiphy_regdom(wiphy);
11024 + rcu_assign_pointer(wiphy->regd, regd);
11025 ++ rcu_free_regdom(tmp);
11026 + goto new_request;
11027 + }
11028 + kfree(pending_request);
11029 +diff --git a/scripts/kernel-doc b/scripts/kernel-doc
11030 +index 4305b2f2ec5e..8c0e07b7a70b 100755
11031 +--- a/scripts/kernel-doc
11032 ++++ b/scripts/kernel-doc
11033 +@@ -1750,7 +1750,7 @@ sub dump_struct($$) {
11034 + # strip kmemcheck_bitfield_{begin,end}.*;
11035 + $members =~ s/kmemcheck_bitfield_.*?;//gos;
11036 + # strip attributes
11037 +- $members =~ s/__aligned\s*\(.+\)//gos;
11038 ++ $members =~ s/__aligned\s*\([^;]*\)//gos;
11039 +
11040 + create_parameterlist($members, ';', $file);
11041 + check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested);
11042 +diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
11043 +index a674fd5507c1..a27134fc3f76 100755
11044 +--- a/scripts/recordmcount.pl
11045 ++++ b/scripts/recordmcount.pl
11046 +@@ -262,7 +262,6 @@ if ($arch eq "x86_64") {
11047 + # force flags for this arch
11048 + $ld .= " -m shlelf_linux";
11049 + $objcopy .= " -O elf32-sh-linux";
11050 +- $cc .= " -m32";
11051 +
11052 + } elsif ($arch eq "powerpc") {
11053 + $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
11054 +diff --git a/security/keys/gc.c b/security/keys/gc.c
11055 +index d67c97bb1025..797818695c87 100644
11056 +--- a/security/keys/gc.c
11057 ++++ b/security/keys/gc.c
11058 +@@ -201,12 +201,12 @@ static noinline void key_gc_unused_keys(struct list_head *keys)
11059 + if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags))
11060 + atomic_dec(&key->user->nikeys);
11061 +
11062 +- key_user_put(key->user);
11063 +-
11064 + /* now throw away the key memory */
11065 + if (key->type->destroy)
11066 + key->type->destroy(key);
11067 +
11068 ++ key_user_put(key->user);
11069 ++
11070 + kfree(key->description);
11071 +
11072 + #ifdef KEY_DEBUGGING
11073 +diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
11074 +index ff427733c290..86f969437f5d 100644
11075 +--- a/security/selinux/selinuxfs.c
11076 ++++ b/security/selinux/selinuxfs.c
11077 +@@ -1190,7 +1190,7 @@ static void sel_remove_entries(struct dentry *de)
11078 + spin_lock(&de->d_lock);
11079 + node = de->d_subdirs.next;
11080 + while (node != &de->d_subdirs) {
11081 +- struct dentry *d = list_entry(node, struct dentry, d_u.d_child);
11082 ++ struct dentry *d = list_entry(node, struct dentry, d_child);
11083 +
11084 + spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED);
11085 + list_del_init(node);
11086 +@@ -1664,12 +1664,12 @@ static void sel_remove_classes(void)
11087 +
11088 + list_for_each(class_node, &class_dir->d_subdirs) {
11089 + struct dentry *class_subdir = list_entry(class_node,
11090 +- struct dentry, d_u.d_child);
11091 ++ struct dentry, d_child);
11092 + struct list_head *class_subdir_node;
11093 +
11094 + list_for_each(class_subdir_node, &class_subdir->d_subdirs) {
11095 + struct dentry *d = list_entry(class_subdir_node,
11096 +- struct dentry, d_u.d_child);
11097 ++ struct dentry, d_child);
11098 +
11099 + if (d->d_inode)
11100 + if (d->d_inode->i_mode & S_IFDIR)
11101 +diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
11102 +index e938a68625ea..fed93cb2ee2f 100644
11103 +--- a/sound/pci/hda/hda_codec.c
11104 ++++ b/sound/pci/hda/hda_codec.c
11105 +@@ -329,8 +329,10 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
11106 + unsigned int parm;
11107 +
11108 + parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT);
11109 +- if (parm == -1)
11110 ++ if (parm == -1) {
11111 ++ *start_id = 0;
11112 + return 0;
11113 ++ }
11114 + *start_id = (parm >> 16) & 0x7fff;
11115 + return (int)(parm & 0x7fff);
11116 + }
11117 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
11118 +index 38b47b7b9cb6..121336b0d3a8 100644
11119 +--- a/sound/pci/hda/patch_sigmatel.c
11120 ++++ b/sound/pci/hda/patch_sigmatel.c
11121 +@@ -582,9 +582,9 @@ static void stac_store_hints(struct hda_codec *codec)
11122 + spec->gpio_mask;
11123 + }
11124 + if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
11125 +- spec->gpio_mask &= spec->gpio_mask;
11126 +- if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
11127 + spec->gpio_dir &= spec->gpio_mask;
11128 ++ if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
11129 ++ spec->gpio_data &= spec->gpio_mask;
11130 + if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
11131 + spec->eapd_mask &= spec->gpio_mask;
11132 + if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
11133 +diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
11134 +index 764d0ea42e7c..9c20ef5f65d6 100644
11135 +--- a/sound/soc/codecs/max98090.c
11136 ++++ b/sound/soc/codecs/max98090.c
11137 +@@ -1378,8 +1378,8 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = {
11138 + {"STENL Mux", "Sidetone Left", "DMICL"},
11139 + {"STENR Mux", "Sidetone Right", "ADCR"},
11140 + {"STENR Mux", "Sidetone Right", "DMICR"},
11141 +- {"DACL", "NULL", "STENL Mux"},
11142 +- {"DACR", "NULL", "STENL Mux"},
11143 ++ {"DACL", NULL, "STENL Mux"},
11144 ++ {"DACR", NULL, "STENL Mux"},
11145 +
11146 + {"AIFINL", NULL, "SHDN"},
11147 + {"AIFINR", NULL, "SHDN"},
11148 +diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
11149 +index 4068f2491232..bb3878c9625f 100644
11150 +--- a/sound/soc/codecs/sigmadsp.c
11151 ++++ b/sound/soc/codecs/sigmadsp.c
11152 +@@ -176,6 +176,13 @@ static int _process_sigma_firmware(struct device *dev,
11153 + goto done;
11154 + }
11155 +
11156 ++ if (ssfw_head->version != 1) {
11157 ++ dev_err(dev,
11158 ++ "Failed to load firmware: Invalid version %d. Supported firmware versions: 1\n",
11159 ++ ssfw_head->version);
11160 ++ goto done;
11161 ++ }
11162 ++
11163 + crc = crc32(0, fw->data + sizeof(*ssfw_head),
11164 + fw->size - sizeof(*ssfw_head));
11165 + pr_debug("%s: crc=%x\n", __func__, crc);
11166 +diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
11167 +index 25c31f1655f6..2f6357578616 100644
11168 +--- a/sound/soc/dwc/designware_i2s.c
11169 ++++ b/sound/soc/dwc/designware_i2s.c
11170 +@@ -263,6 +263,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream,
11171 + snd_soc_dai_set_dma_data(dai, substream, NULL);
11172 + }
11173 +
11174 ++static int dw_i2s_prepare(struct snd_pcm_substream *substream,
11175 ++ struct snd_soc_dai *dai)
11176 ++{
11177 ++ struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
11178 ++
11179 ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
11180 ++ i2s_write_reg(dev->i2s_base, TXFFR, 1);
11181 ++ else
11182 ++ i2s_write_reg(dev->i2s_base, RXFFR, 1);
11183 ++
11184 ++ return 0;
11185 ++}
11186 ++
11187 + static int dw_i2s_trigger(struct snd_pcm_substream *substream,
11188 + int cmd, struct snd_soc_dai *dai)
11189 + {
11190 +@@ -294,6 +307,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = {
11191 + .startup = dw_i2s_startup,
11192 + .shutdown = dw_i2s_shutdown,
11193 + .hw_params = dw_i2s_hw_params,
11194 ++ .prepare = dw_i2s_prepare,
11195 + .trigger = dw_i2s_trigger,
11196 + };
11197 +
11198 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
11199 +index be4db47cb2d9..061be0e5fa5a 100644
11200 +--- a/sound/usb/mixer.c
11201 ++++ b/sound/usb/mixer.c
11202 +@@ -886,6 +886,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
11203 + case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */
11204 + case USB_ID(0x046d, 0x0808):
11205 + case USB_ID(0x046d, 0x0809):
11206 ++ case USB_ID(0x046d, 0x0819): /* Logitech Webcam C210 */
11207 + case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
11208 + case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */
11209 + case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */
11210 +diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
11211 +index 0339d464791a..4df31b0f94a3 100644
11212 +--- a/sound/usb/mixer_maps.c
11213 ++++ b/sound/usb/mixer_maps.c
11214 +@@ -322,8 +322,11 @@ static struct usbmix_name_map hercules_usb51_map[] = {
11215 + { 0 } /* terminator */
11216 + };
11217 +
11218 +-static const struct usbmix_name_map kef_x300a_map[] = {
11219 +- { 10, NULL }, /* firmware locks up (?) when we try to access this FU */
11220 ++/* some (all?) SCMS USB3318 devices are affected by a firmware lock up
11221 ++ * when anything attempts to access FU 10 (control)
11222 ++ */
11223 ++static const struct usbmix_name_map scms_usb3318_map[] = {
11224 ++ { 10, NULL },
11225 + { 0 }
11226 + };
11227 +
11228 +@@ -415,8 +418,14 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
11229 + .map = ebox44_map,
11230 + },
11231 + {
11232 ++ /* KEF X300A */
11233 + .id = USB_ID(0x27ac, 0x1000),
11234 +- .map = kef_x300a_map,
11235 ++ .map = scms_usb3318_map,
11236 ++ },
11237 ++ {
11238 ++ /* Arcam rPAC */
11239 ++ .id = USB_ID(0x25c4, 0x0003),
11240 ++ .map = scms_usb3318_map,
11241 + },
11242 + { 0 } /* terminator */
11243 + };
11244 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
11245 +index 01fac71992ba..83bddbdb90e9 100644
11246 +--- a/sound/usb/quirks-table.h
11247 ++++ b/sound/usb/quirks-table.h
11248 +@@ -72,22 +72,21 @@
11249 + }
11250 + },
11251 +
11252 +-/* Creative/Toshiba Multimedia Center SB-0500 */
11253 ++/* Creative/E-Mu devices */
11254 + {
11255 +- USB_DEVICE(0x041e, 0x3048),
11256 ++ USB_DEVICE(0x041e, 0x3010),
11257 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
11258 +- .vendor_name = "Toshiba",
11259 +- .product_name = "SB-0500",
11260 ++ .vendor_name = "Creative Labs",
11261 ++ .product_name = "Sound Blaster MP3+",
11262 + .ifnum = QUIRK_NO_INTERFACE
11263 + }
11264 + },
11265 +-
11266 +-/* Creative/E-Mu devices */
11267 ++/* Creative/Toshiba Multimedia Center SB-0500 */
11268 + {
11269 +- USB_DEVICE(0x041e, 0x3010),
11270 ++ USB_DEVICE(0x041e, 0x3048),
11271 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
11272 +- .vendor_name = "Creative Labs",
11273 +- .product_name = "Sound Blaster MP3+",
11274 ++ .vendor_name = "Toshiba",
11275 ++ .product_name = "SB-0500",
11276 + .ifnum = QUIRK_NO_INTERFACE
11277 + }
11278 + },
11279 +@@ -2580,6 +2579,46 @@ YAMAHA_DEVICE(0x7010, "UB99"),
11280 + }
11281 + },
11282 + {
11283 ++ USB_DEVICE(0x1235, 0x0010),
11284 ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11285 ++ .vendor_name = "Focusrite",
11286 ++ .product_name = "Saffire 6 USB",
11287 ++ .ifnum = QUIRK_ANY_INTERFACE,
11288 ++ .type = QUIRK_COMPOSITE,
11289 ++ .data = (const struct snd_usb_audio_quirk[]) {
11290 ++ {
11291 ++ .ifnum = 0,
11292 ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT,
11293 ++ .data = &(const struct audioformat) {
11294 ++ .formats = SNDRV_PCM_FMTBIT_S24_3LE,
11295 ++ .channels = 4,
11296 ++ .iface = 0,
11297 ++ .altsetting = 1,
11298 ++ .altset_idx = 1,
11299 ++ .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
11300 ++ .endpoint = 0x01,
11301 ++ .ep_attr = USB_ENDPOINT_XFER_ISOC,
11302 ++ .rates = SNDRV_PCM_RATE_44100 |
11303 ++ SNDRV_PCM_RATE_48000,
11304 ++ .rate_min = 44100,
11305 ++ .rate_max = 48000,
11306 ++ .nr_rates = 2,
11307 ++ .rate_table = (unsigned int[]) {
11308 ++ 44100, 48000
11309 ++ }
11310 ++ }
11311 ++ },
11312 ++ {
11313 ++ .ifnum = 1,
11314 ++ .type = QUIRK_MIDI_RAW_BYTES
11315 ++ },
11316 ++ {
11317 ++ .ifnum = -1
11318 ++ }
11319 ++ }
11320 ++ }
11321 ++},
11322 ++{
11323 + USB_DEVICE(0x1235, 0x0018),
11324 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
11325 + .vendor_name = "Novation",
11326 +@@ -2628,6 +2667,57 @@ YAMAHA_DEVICE(0x7010, "UB99"),
11327 + .type = QUIRK_MIDI_NOVATION
11328 + }
11329 + },
11330 ++{
11331 ++ /*
11332 ++ * Focusrite Scarlett 18i6
11333 ++ *
11334 ++ * Avoid mixer creation, which otherwise fails because some of
11335 ++ * the interface descriptor subtypes for interface 0 are
11336 ++ * unknown. That should be fixed or worked-around but this at
11337 ++ * least allows the device to be used successfully with a DAW
11338 ++ * and an external mixer. See comments below about other
11339 ++ * ignored interfaces.
11340 ++ */
11341 ++ USB_DEVICE(0x1235, 0x8004),
11342 ++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
11343 ++ .vendor_name = "Focusrite",
11344 ++ .product_name = "Scarlett 18i6",
11345 ++ .ifnum = QUIRK_ANY_INTERFACE,
11346 ++ .type = QUIRK_COMPOSITE,
11347 ++ .data = & (const struct snd_usb_audio_quirk[]) {
11348 ++ {
11349 ++ /* InterfaceSubClass 1 (Control Device) */
11350 ++ .ifnum = 0,
11351 ++ .type = QUIRK_IGNORE_INTERFACE
11352 ++ },
11353 ++ {
11354 ++ .ifnum = 1,
11355 ++ .type = QUIRK_AUDIO_STANDARD_INTERFACE
11356 ++ },
11357 ++ {
11358 ++ .ifnum = 2,
11359 ++ .type = QUIRK_AUDIO_STANDARD_INTERFACE
11360 ++ },
11361 ++ {
11362 ++ /* InterfaceSubClass 1 (Control Device) */
11363 ++ .ifnum = 3,
11364 ++ .type = QUIRK_IGNORE_INTERFACE
11365 ++ },
11366 ++ {
11367 ++ .ifnum = 4,
11368 ++ .type = QUIRK_MIDI_STANDARD_INTERFACE
11369 ++ },
11370 ++ {
11371 ++ /* InterfaceSubClass 1 (Device Firmware Update) */
11372 ++ .ifnum = 5,
11373 ++ .type = QUIRK_IGNORE_INTERFACE
11374 ++ },
11375 ++ {
11376 ++ .ifnum = -1
11377 ++ }
11378 ++ }
11379 ++ }
11380 ++},
11381 +
11382 + /* Access Music devices */
11383 + {
11384 +@@ -2714,133 +2804,45 @@ YAMAHA_DEVICE(0x7010, "UB99"),
11385 + }
11386 + },
11387 +
11388 +-/* Hauppauge HVR-950Q and HVR-850 */
11389 +-{
11390 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7200),
11391 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11392 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11393 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11394 +- .bInterfaceClass = USB_CLASS_AUDIO,
11395 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11396 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11397 +- .vendor_name = "Hauppauge",
11398 +- .product_name = "HVR-950Q",
11399 +- .ifnum = QUIRK_ANY_INTERFACE,
11400 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11401 +- }
11402 +-},
11403 +-{
11404 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7240),
11405 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11406 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11407 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11408 +- .bInterfaceClass = USB_CLASS_AUDIO,
11409 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11410 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11411 +- .vendor_name = "Hauppauge",
11412 +- .product_name = "HVR-850",
11413 +- .ifnum = QUIRK_ANY_INTERFACE,
11414 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11415 +- }
11416 +-},
11417 +-{
11418 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7210),
11419 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11420 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11421 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11422 +- .bInterfaceClass = USB_CLASS_AUDIO,
11423 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11424 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11425 +- .vendor_name = "Hauppauge",
11426 +- .product_name = "HVR-950Q",
11427 +- .ifnum = QUIRK_ANY_INTERFACE,
11428 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11429 +- }
11430 +-},
11431 +-{
11432 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7217),
11433 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11434 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11435 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11436 +- .bInterfaceClass = USB_CLASS_AUDIO,
11437 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11438 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11439 +- .vendor_name = "Hauppauge",
11440 +- .product_name = "HVR-950Q",
11441 +- .ifnum = QUIRK_ANY_INTERFACE,
11442 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11443 +- }
11444 +-},
11445 +-{
11446 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x721b),
11447 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11448 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11449 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11450 +- .bInterfaceClass = USB_CLASS_AUDIO,
11451 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11452 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11453 +- .vendor_name = "Hauppauge",
11454 +- .product_name = "HVR-950Q",
11455 +- .ifnum = QUIRK_ANY_INTERFACE,
11456 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11457 +- }
11458 +-},
11459 +-{
11460 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x721e),
11461 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11462 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11463 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11464 +- .bInterfaceClass = USB_CLASS_AUDIO,
11465 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11466 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11467 +- .vendor_name = "Hauppauge",
11468 +- .product_name = "HVR-950Q",
11469 +- .ifnum = QUIRK_ANY_INTERFACE,
11470 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11471 +- }
11472 +-},
11473 +-{
11474 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x721f),
11475 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11476 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11477 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11478 +- .bInterfaceClass = USB_CLASS_AUDIO,
11479 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11480 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11481 +- .vendor_name = "Hauppauge",
11482 +- .product_name = "HVR-950Q",
11483 +- .ifnum = QUIRK_ANY_INTERFACE,
11484 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11485 +- }
11486 +-},
11487 +-{
11488 +- USB_DEVICE_VENDOR_SPEC(0x2040, 0x7280),
11489 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11490 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11491 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11492 +- .bInterfaceClass = USB_CLASS_AUDIO,
11493 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11494 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11495 +- .vendor_name = "Hauppauge",
11496 +- .product_name = "HVR-950Q",
11497 +- .ifnum = QUIRK_ANY_INTERFACE,
11498 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11499 +- }
11500 +-},
11501 +-{
11502 +- USB_DEVICE_VENDOR_SPEC(0x0fd9, 0x0008),
11503 +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
11504 +- USB_DEVICE_ID_MATCH_INT_CLASS |
11505 +- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
11506 +- .bInterfaceClass = USB_CLASS_AUDIO,
11507 +- .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
11508 +- .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
11509 +- .vendor_name = "Hauppauge",
11510 +- .product_name = "HVR-950Q",
11511 +- .ifnum = QUIRK_ANY_INTERFACE,
11512 +- .type = QUIRK_AUDIO_ALIGN_TRANSFER,
11513 +- }
11514 +-},
11515 ++/*
11516 ++ * Auvitek au0828 devices with audio interface.
11517 ++ * This should be kept in sync with drivers/media/usb/au0828/au0828-cards.c
11518 ++ * Please notice that some drivers are DVB only, and don't need to be
11519 ++ * here. That's the case, for example, of DVICO_FUSIONHDTV7.
11520 ++ */
11521 ++
11522 ++#define AU0828_DEVICE(vid, pid, vname, pname) { \
11523 ++ USB_DEVICE_VENDOR_SPEC(vid, pid), \
11524 ++ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
11525 ++ USB_DEVICE_ID_MATCH_INT_CLASS | \
11526 ++ USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
11527 ++ .bInterfaceClass = USB_CLASS_AUDIO, \
11528 ++ .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, \
11529 ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { \
11530 ++ .vendor_name = vname, \
11531 ++ .product_name = pname, \
11532 ++ .ifnum = QUIRK_ANY_INTERFACE, \
11533 ++ .type = QUIRK_AUDIO_ALIGN_TRANSFER, \
11534 ++ } \
11535 ++}
11536 ++
11537 ++AU0828_DEVICE(0x2040, 0x7200, "Hauppauge", "HVR-950Q"),
11538 ++AU0828_DEVICE(0x2040, 0x7240, "Hauppauge", "HVR-850"),
11539 ++AU0828_DEVICE(0x2040, 0x7210, "Hauppauge", "HVR-950Q"),
11540 ++AU0828_DEVICE(0x2040, 0x7217, "Hauppauge", "HVR-950Q"),
11541 ++AU0828_DEVICE(0x2040, 0x721b, "Hauppauge", "HVR-950Q"),
11542 ++AU0828_DEVICE(0x2040, 0x721e, "Hauppauge", "HVR-950Q"),
11543 ++AU0828_DEVICE(0x2040, 0x721f, "Hauppauge", "HVR-950Q"),
11544 ++AU0828_DEVICE(0x2040, 0x7280, "Hauppauge", "HVR-950Q"),
11545 ++AU0828_DEVICE(0x0fd9, 0x0008, "Hauppauge", "HVR-950Q"),
11546 ++AU0828_DEVICE(0x2040, 0x7201, "Hauppauge", "HVR-950Q-MXL"),
11547 ++AU0828_DEVICE(0x2040, 0x7211, "Hauppauge", "HVR-950Q-MXL"),
11548 ++AU0828_DEVICE(0x2040, 0x7281, "Hauppauge", "HVR-950Q-MXL"),
11549 ++AU0828_DEVICE(0x05e1, 0x0480, "Hauppauge", "Woodbury"),
11550 ++AU0828_DEVICE(0x2040, 0x8200, "Hauppauge", "Woodbury"),
11551 ++AU0828_DEVICE(0x2040, 0x7260, "Hauppauge", "HVR-950Q"),
11552 ++AU0828_DEVICE(0x2040, 0x7213, "Hauppauge", "HVR-950Q"),
11553 ++AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
11554 +
11555 + /* Digidesign Mbox */
11556 + {
11557 +@@ -3113,58 +3115,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
11558 +
11559 + {
11560 + /*
11561 +- * Focusrite Scarlett 18i6
11562 +- *
11563 +- * Avoid mixer creation, which otherwise fails because some of
11564 +- * the interface descriptor subtypes for interface 0 are
11565 +- * unknown. That should be fixed or worked-around but this at
11566 +- * least allows the device to be used successfully with a DAW
11567 +- * and an external mixer. See comments below about other
11568 +- * ignored interfaces.
11569 +- */
11570 +- USB_DEVICE(0x1235, 0x8004),
11571 +- .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
11572 +- .vendor_name = "Focusrite",
11573 +- .product_name = "Scarlett 18i6",
11574 +- .ifnum = QUIRK_ANY_INTERFACE,
11575 +- .type = QUIRK_COMPOSITE,
11576 +- .data = & (const struct snd_usb_audio_quirk[]) {
11577 +- {
11578 +- /* InterfaceSubClass 1 (Control Device) */
11579 +- .ifnum = 0,
11580 +- .type = QUIRK_IGNORE_INTERFACE
11581 +- },
11582 +- {
11583 +- .ifnum = 1,
11584 +- .type = QUIRK_AUDIO_STANDARD_INTERFACE
11585 +- },
11586 +- {
11587 +- .ifnum = 2,
11588 +- .type = QUIRK_AUDIO_STANDARD_INTERFACE
11589 +- },
11590 +- {
11591 +- /* InterfaceSubClass 1 (Control Device) */
11592 +- .ifnum = 3,
11593 +- .type = QUIRK_IGNORE_INTERFACE
11594 +- },
11595 +- {
11596 +- .ifnum = 4,
11597 +- .type = QUIRK_MIDI_STANDARD_INTERFACE
11598 +- },
11599 +- {
11600 +- /* InterfaceSubClass 1 (Device Firmware Update) */
11601 +- .ifnum = 5,
11602 +- .type = QUIRK_IGNORE_INTERFACE
11603 +- },
11604 +- {
11605 +- .ifnum = -1
11606 +- }
11607 +- }
11608 +- }
11609 +-},
11610 +-
11611 +-{
11612 +- /*
11613 + * Some USB MIDI devices don't have an audio control interface,
11614 + * so we have to grab MIDI streaming interfaces here.
11615 + */
11616 +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
11617 +index 3fbb4553ba40..8bea68660061 100644
11618 +--- a/sound/usb/quirks.c
11619 ++++ b/sound/usb/quirks.c
11620 +@@ -662,8 +662,9 @@ static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
11621 +
11622 + /*
11623 + * Novation Twitch DJ controller
11624 ++ * Focusrite Novation Saffire 6 USB audio card
11625 + */
11626 +-static int snd_usb_twitch_boot_quirk(struct usb_device *dev)
11627 ++static int snd_usb_novation_boot_quirk(struct usb_device *dev)
11628 + {
11629 + /* preemptively set up the device because otherwise the
11630 + * raw MIDI endpoints are not active */
11631 +@@ -972,9 +973,9 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,
11632 + /* Digidesign Mbox 2 */
11633 + return snd_usb_mbox2_boot_quirk(dev);
11634 +
11635 +- case USB_ID(0x1235, 0x0018):
11636 +- /* Focusrite Novation Twitch */
11637 +- return snd_usb_twitch_boot_quirk(dev);
11638 ++ case USB_ID(0x1235, 0x0010): /* Focusrite Novation Saffire 6 USB */
11639 ++ case USB_ID(0x1235, 0x0018): /* Focusrite Novation Twitch */
11640 ++ return snd_usb_novation_boot_quirk(dev);
11641 +
11642 + case USB_ID(0x133e, 0x0815):
11643 + /* Access Music VirusTI Desktop */
11644 +diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
11645 +index ce8dc61ce2c3..d326fecdeb03 100644
11646 +--- a/tools/perf/util/hist.h
11647 ++++ b/tools/perf/util/hist.h
11648 +@@ -35,6 +35,7 @@ struct events_stats {
11649 + u32 nr_invalid_chains;
11650 + u32 nr_unknown_id;
11651 + u32 nr_unprocessable_samples;
11652 ++ u32 nr_unordered_events;
11653 + };
11654 +
11655 + enum hist_column {
11656 +diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
11657 +index 9d78c70be71e..532a6a38d330 100644
11658 +--- a/tools/perf/util/session.c
11659 ++++ b/tools/perf/util/session.c
11660 +@@ -681,8 +681,7 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event,
11661 + return -ETIME;
11662 +
11663 + if (timestamp < s->ordered_samples.last_flush) {
11664 +- printf("Warning: Timestamp below last timeslice flush\n");
11665 +- return -EINVAL;
11666 ++ s->stats.nr_unordered_events++;
11667 + }
11668 +
11669 + if (!list_empty(sc)) {
11670 +@@ -1168,6 +1167,8 @@ static void perf_session__warn_about_errors(const struct perf_session *session,
11671 + "Do you have a KVM guest running and not using 'perf kvm'?\n",
11672 + session->stats.nr_unprocessable_samples);
11673 + }
11674 ++ if (session->stats.nr_unordered_events != 0)
11675 ++ ui__warning("%u out of order events recorded.\n", session->stats.nr_unordered_events);
11676 + }
11677 +
11678 + volatile int session_done;