Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 21 Nov 2018 15:02:37
Message-Id: 1542812465.42a9f5b324bdb6c166764509da7f62df1ffc3bca.mpagano@gentoo
1 commit: 42a9f5b324bdb6c166764509da7f62df1ffc3bca
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 7 18:13:48 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 21 15:01:05 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=42a9f5b3
7
8 Linux patch 4.4.146
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1145_linux-4.4.146.patch | 2940 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2944 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 5149ed7..330fae0 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -623,6 +623,10 @@ Patch: 1144_linux-4.4.145.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.145
23
24 +Patch: 1145_linux-4.4.146.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.146
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1145_linux-4.4.146.patch b/1145_linux-4.4.146.patch
33 new file mode 100644
34 index 0000000..b2051f3
35 --- /dev/null
36 +++ b/1145_linux-4.4.146.patch
37 @@ -0,0 +1,2940 @@
38 +diff --git a/Makefile b/Makefile
39 +index be31491a2d67..030f5af05f4e 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 145
46 ++SUBLEVEL = 146
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
51 +index 91d2068da1b9..0f3fe6a151dc 100644
52 +--- a/arch/microblaze/boot/Makefile
53 ++++ b/arch/microblaze/boot/Makefile
54 +@@ -21,17 +21,19 @@ $(obj)/linux.bin.gz: $(obj)/linux.bin FORCE
55 + quiet_cmd_cp = CP $< $@$2
56 + cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
57 +
58 +-quiet_cmd_strip = STRIP $@
59 ++quiet_cmd_strip = STRIP $< $@$2
60 + cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
61 +- -K _fdt_start vmlinux -o $@
62 ++ -K _fdt_start $< -o $@$2
63 +
64 + UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
65 ++UIMAGE_IN = $@
66 ++UIMAGE_OUT = $@.ub
67 +
68 + $(obj)/simpleImage.%: vmlinux FORCE
69 + $(call if_changed,cp,.unstrip)
70 + $(call if_changed,objcopy)
71 + $(call if_changed,uimage)
72 +- $(call if_changed,strip)
73 +- @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
74 ++ $(call if_changed,strip,.strip)
75 ++ @echo 'Kernel: $(UIMAGE_OUT) is ready' ' (#'`cat .version`')'
76 +
77 + clean-files += simpleImage.*.unstrip linux.bin.ub dts/*.dtb
78 +diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
79 +index 98c31e5d9579..a7bc901819c8 100644
80 +--- a/arch/mips/include/asm/pci.h
81 ++++ b/arch/mips/include/asm/pci.h
82 +@@ -89,7 +89,7 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
83 + phys_addr_t size = resource_size(rsrc);
84 +
85 + *start = fixup_bigphys_addr(rsrc->start, size);
86 +- *end = rsrc->start + size;
87 ++ *end = rsrc->start + size - 1;
88 + }
89 +
90 + /*
91 +diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
92 +index 78c1eba4c04a..01e274e6907b 100644
93 +--- a/arch/powerpc/kernel/head_8xx.S
94 ++++ b/arch/powerpc/kernel/head_8xx.S
95 +@@ -720,7 +720,7 @@ start_here:
96 + tovirt(r6,r6)
97 + lis r5, abatron_pteptrs@h
98 + ori r5, r5, abatron_pteptrs@l
99 +- stw r5, 0xf0(r0) /* Must match your Abatron config file */
100 ++ stw r5, 0xf0(0) /* Must match your Abatron config file */
101 + tophys(r5,r5)
102 + stw r6, 0(r5)
103 +
104 +diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
105 +index 1f7930037cb7..d9e41b77dd13 100644
106 +--- a/arch/powerpc/kernel/pci_32.c
107 ++++ b/arch/powerpc/kernel/pci_32.c
108 +@@ -11,6 +11,7 @@
109 + #include <linux/sched.h>
110 + #include <linux/errno.h>
111 + #include <linux/bootmem.h>
112 ++#include <linux/syscalls.h>
113 + #include <linux/irq.h>
114 + #include <linux/list.h>
115 + #include <linux/of.h>
116 +diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
117 +index 515730e499fe..309027208f7c 100644
118 +--- a/arch/powerpc/mm/slb.c
119 ++++ b/arch/powerpc/mm/slb.c
120 +@@ -69,14 +69,14 @@ static inline void slb_shadow_update(unsigned long ea, int ssize,
121 + * updating it. No write barriers are needed here, provided
122 + * we only update the current CPU's SLB shadow buffer.
123 + */
124 +- p->save_area[index].esid = 0;
125 +- p->save_area[index].vsid = cpu_to_be64(mk_vsid_data(ea, ssize, flags));
126 +- p->save_area[index].esid = cpu_to_be64(mk_esid_data(ea, ssize, index));
127 ++ WRITE_ONCE(p->save_area[index].esid, 0);
128 ++ WRITE_ONCE(p->save_area[index].vsid, cpu_to_be64(mk_vsid_data(ea, ssize, flags)));
129 ++ WRITE_ONCE(p->save_area[index].esid, cpu_to_be64(mk_esid_data(ea, ssize, index)));
130 + }
131 +
132 + static inline void slb_shadow_clear(enum slb_index index)
133 + {
134 +- get_slb_shadow()->save_area[index].esid = 0;
135 ++ WRITE_ONCE(get_slb_shadow()->save_area[index].esid, 0);
136 + }
137 +
138 + static inline void create_shadowed_slbe(unsigned long ea, int ssize,
139 +diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
140 +index f803f4b8ab6f..8608e358217f 100644
141 +--- a/arch/powerpc/platforms/chrp/time.c
142 ++++ b/arch/powerpc/platforms/chrp/time.c
143 +@@ -27,6 +27,8 @@
144 + #include <asm/sections.h>
145 + #include <asm/time.h>
146 +
147 ++#include <platforms/chrp/chrp.h>
148 ++
149 + extern spinlock_t rtc_lock;
150 +
151 + #define NVRAM_AS0 0x74
152 +@@ -62,7 +64,7 @@ long __init chrp_time_init(void)
153 + return 0;
154 + }
155 +
156 +-int chrp_cmos_clock_read(int addr)
157 ++static int chrp_cmos_clock_read(int addr)
158 + {
159 + if (nvram_as1 != 0)
160 + outb(addr>>8, nvram_as1);
161 +@@ -70,7 +72,7 @@ int chrp_cmos_clock_read(int addr)
162 + return (inb(nvram_data));
163 + }
164 +
165 +-void chrp_cmos_clock_write(unsigned long val, int addr)
166 ++static void chrp_cmos_clock_write(unsigned long val, int addr)
167 + {
168 + if (nvram_as1 != 0)
169 + outb(addr>>8, nvram_as1);
170 +diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
171 +index 9b7975706bfc..9485f1024d46 100644
172 +--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
173 ++++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
174 +@@ -35,6 +35,8 @@
175 + */
176 + #define HW_BROADWAY_ICR 0x00
177 + #define HW_BROADWAY_IMR 0x04
178 ++#define HW_STARLET_ICR 0x08
179 ++#define HW_STARLET_IMR 0x0c
180 +
181 +
182 + /*
183 +@@ -74,6 +76,9 @@ static void hlwd_pic_unmask(struct irq_data *d)
184 + void __iomem *io_base = irq_data_get_irq_chip_data(d);
185 +
186 + setbits32(io_base + HW_BROADWAY_IMR, 1 << irq);
187 ++
188 ++ /* Make sure the ARM (aka. Starlet) doesn't handle this interrupt. */
189 ++ clrbits32(io_base + HW_STARLET_IMR, 1 << irq);
190 + }
191 +
192 +
193 +diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
194 +index 76f5013c35e5..89237b84b096 100644
195 +--- a/arch/powerpc/platforms/powermac/bootx_init.c
196 ++++ b/arch/powerpc/platforms/powermac/bootx_init.c
197 +@@ -467,7 +467,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
198 + boot_infos_t *bi = (boot_infos_t *) r4;
199 + unsigned long hdr;
200 + unsigned long space;
201 +- unsigned long ptr, x;
202 ++ unsigned long ptr;
203 + char *model;
204 + unsigned long offset = reloc_offset();
205 +
206 +@@ -561,6 +561,8 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
207 + * MMU switched OFF, so this should not be useful anymore.
208 + */
209 + if (bi->version < 4) {
210 ++ unsigned long x __maybe_unused;
211 ++
212 + bootx_printf("Touching pages...\n");
213 +
214 + /*
215 +diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
216 +index 8dd78f4e1af4..32fc56cf6261 100644
217 +--- a/arch/powerpc/platforms/powermac/setup.c
218 ++++ b/arch/powerpc/platforms/powermac/setup.c
219 +@@ -359,6 +359,7 @@ static int pmac_late_init(void)
220 + }
221 + machine_late_initcall(powermac, pmac_late_init);
222 +
223 ++void note_bootable_part(dev_t dev, int part, int goodness);
224 + /*
225 + * This is __init_refok because we check for "initializing" before
226 + * touching any of the __init sensitive things and "initializing"
227 +diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h
228 +index 9dd04b9e9782..b2f8c52b3840 100644
229 +--- a/arch/s390/include/asm/cpu_mf.h
230 ++++ b/arch/s390/include/asm/cpu_mf.h
231 +@@ -113,7 +113,7 @@ struct hws_basic_entry {
232 +
233 + struct hws_diag_entry {
234 + unsigned int def:16; /* 0-15 Data Entry Format */
235 +- unsigned int R:14; /* 16-19 and 20-30 reserved */
236 ++ unsigned int R:15; /* 16-19 and 20-30 reserved */
237 + unsigned int I:1; /* 31 entry valid or invalid */
238 + u8 data[]; /* Machine-dependent sample data */
239 + } __packed;
240 +@@ -129,7 +129,9 @@ struct hws_trailer_entry {
241 + unsigned int f:1; /* 0 - Block Full Indicator */
242 + unsigned int a:1; /* 1 - Alert request control */
243 + unsigned int t:1; /* 2 - Timestamp format */
244 +- unsigned long long:61; /* 3 - 63: Reserved */
245 ++ unsigned int :29; /* 3 - 31: Reserved */
246 ++ unsigned int bsdes:16; /* 32-47: size of basic SDE */
247 ++ unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */
248 + };
249 + unsigned long long flags; /* 0 - 63: All indicators */
250 + };
251 +diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
252 +index 61215a69b03d..b22e9c4dd111 100644
253 +--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
254 ++++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
255 +@@ -229,7 +229,7 @@ void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *e
256 + u64 prev_count, new_count, delta;
257 + int shift;
258 +
259 +- if (event->hw.idx >= UNCORE_PMC_IDX_FIXED)
260 ++ if (event->hw.idx == UNCORE_PMC_IDX_FIXED)
261 + shift = 64 - uncore_fixed_ctr_bits(box);
262 + else
263 + shift = 64 - uncore_perf_ctr_bits(box);
264 +diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_nhmex.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_nhmex.c
265 +index 2749965afed0..83cadc2605a7 100644
266 +--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_nhmex.c
267 ++++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_nhmex.c
268 +@@ -240,7 +240,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p
269 + {
270 + struct hw_perf_event *hwc = &event->hw;
271 +
272 +- if (hwc->idx >= UNCORE_PMC_IDX_FIXED)
273 ++ if (hwc->idx == UNCORE_PMC_IDX_FIXED)
274 + wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0);
275 + else if (box->pmu->type->event_mask & NHMEX_PMON_CTL_EN_BIT0)
276 + wrmsrl(hwc->config_base, hwc->config | NHMEX_PMON_CTL_EN_BIT22);
277 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
278 +index 18143886b186..c5a4b1978cbf 100644
279 +--- a/arch/x86/kvm/vmx.c
280 ++++ b/arch/x86/kvm/vmx.c
281 +@@ -6843,6 +6843,8 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
282 + HRTIMER_MODE_REL);
283 + vmx->nested.preemption_timer.function = vmx_preemption_timer_fn;
284 +
285 ++ vmx->nested.vpid02 = allocate_vpid();
286 ++
287 + vmx->nested.vmxon = true;
288 +
289 + skip_emulated_instruction(vcpu);
290 +@@ -8887,10 +8889,8 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
291 + goto free_vmcs;
292 + }
293 +
294 +- if (nested) {
295 ++ if (nested)
296 + nested_vmx_setup_ctls_msrs(vmx);
297 +- vmx->nested.vpid02 = allocate_vpid();
298 +- }
299 +
300 + vmx->nested.posted_intr_nv = -1;
301 + vmx->nested.current_vmptr = -1ull;
302 +@@ -8899,7 +8899,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
303 + return &vmx->vcpu;
304 +
305 + free_vmcs:
306 +- free_vpid(vmx->nested.vpid02);
307 + free_loaded_vmcs(vmx->loaded_vmcs);
308 + free_msrs:
309 + kfree(vmx->guest_msrs);
310 +diff --git a/crypto/authenc.c b/crypto/authenc.c
311 +index 55a354d57251..b7290c5b1eaa 100644
312 +--- a/crypto/authenc.c
313 ++++ b/crypto/authenc.c
314 +@@ -108,6 +108,7 @@ static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
315 + CRYPTO_TFM_RES_MASK);
316 +
317 + out:
318 ++ memzero_explicit(&keys, sizeof(keys));
319 + return err;
320 +
321 + badkey:
322 +diff --git a/crypto/authencesn.c b/crypto/authencesn.c
323 +index 52154ef21b5e..fa0c4567f697 100644
324 +--- a/crypto/authencesn.c
325 ++++ b/crypto/authencesn.c
326 +@@ -90,6 +90,7 @@ static int crypto_authenc_esn_setkey(struct crypto_aead *authenc_esn, const u8 *
327 + CRYPTO_TFM_RES_MASK);
328 +
329 + out:
330 ++ memzero_explicit(&keys, sizeof(keys));
331 + return err;
332 +
333 + badkey:
334 +diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
335 +index ae3fe4e64203..3b0b4bd67b71 100644
336 +--- a/drivers/acpi/pci_root.c
337 ++++ b/drivers/acpi/pci_root.c
338 +@@ -472,9 +472,11 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
339 + }
340 +
341 + control = OSC_PCI_EXPRESS_CAPABILITY_CONTROL
342 +- | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
343 + | OSC_PCI_EXPRESS_PME_CONTROL;
344 +
345 ++ if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
346 ++ control |= OSC_PCI_EXPRESS_NATIVE_HP_CONTROL;
347 ++
348 + if (pci_aer_available()) {
349 + if (aer_acpi_firmware_first())
350 + dev_info(&device->dev,
351 +diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
352 +index 75cced210b2a..7db76b5c7ada 100644
353 +--- a/drivers/ata/libata-eh.c
354 ++++ b/drivers/ata/libata-eh.c
355 +@@ -2198,12 +2198,16 @@ static void ata_eh_link_autopsy(struct ata_link *link)
356 + if (qc->err_mask & ~AC_ERR_OTHER)
357 + qc->err_mask &= ~AC_ERR_OTHER;
358 +
359 +- /* SENSE_VALID trumps dev/unknown error and revalidation */
360 ++ /*
361 ++ * SENSE_VALID trumps dev/unknown error and revalidation. Upper
362 ++ * layers will determine whether the command is worth retrying
363 ++ * based on the sense data and device class/type. Otherwise,
364 ++ * determine directly if the command is worth retrying using its
365 ++ * error mask and flags.
366 ++ */
367 + if (qc->flags & ATA_QCFLAG_SENSE_VALID)
368 + qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
369 +-
370 +- /* determine whether the command is worth retrying */
371 +- if (ata_eh_worth_retry(qc))
372 ++ else if (ata_eh_worth_retry(qc))
373 + qc->flags |= ATA_QCFLAG_RETRY;
374 +
375 + /* accumulate error info */
376 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
377 +index 91676535a1a3..4a899b41145e 100644
378 +--- a/drivers/bluetooth/btusb.c
379 ++++ b/drivers/bluetooth/btusb.c
380 +@@ -339,6 +339,9 @@ static const struct usb_device_id blacklist_table[] = {
381 + /* Additional Realtek 8723BU Bluetooth devices */
382 + { USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK },
383 +
384 ++ /* Additional Realtek 8723DE Bluetooth devices */
385 ++ { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK },
386 ++
387 + /* Additional Realtek 8821AE Bluetooth devices */
388 + { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK },
389 + { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
390 +diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
391 +index 476d39c7ba20..ecfb9ed2cff6 100644
392 +--- a/drivers/bluetooth/hci_qca.c
393 ++++ b/drivers/bluetooth/hci_qca.c
394 +@@ -884,7 +884,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
395 + */
396 + set_current_state(TASK_UNINTERRUPTIBLE);
397 + schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS));
398 +- set_current_state(TASK_INTERRUPTIBLE);
399 ++ set_current_state(TASK_RUNNING);
400 +
401 + return 0;
402 + }
403 +diff --git a/drivers/char/random.c b/drivers/char/random.c
404 +index dffd06a3bb76..2916d08ee30e 100644
405 +--- a/drivers/char/random.c
406 ++++ b/drivers/char/random.c
407 +@@ -1503,14 +1503,22 @@ static int
408 + write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
409 + {
410 + size_t bytes;
411 +- __u32 buf[16];
412 ++ __u32 t, buf[16];
413 + const char __user *p = buffer;
414 +
415 + while (count > 0) {
416 ++ int b, i = 0;
417 ++
418 + bytes = min(count, sizeof(buf));
419 + if (copy_from_user(&buf, p, bytes))
420 + return -EFAULT;
421 +
422 ++ for (b = bytes ; b > 0 ; b -= sizeof(__u32), i++) {
423 ++ if (!arch_get_random_int(&t))
424 ++ break;
425 ++ buf[i] ^= t;
426 ++ }
427 ++
428 + count -= bytes;
429 + p += bytes;
430 +
431 +diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
432 +index 97a364694bfc..047ef69b7e65 100644
433 +--- a/drivers/crypto/padlock-aes.c
434 ++++ b/drivers/crypto/padlock-aes.c
435 +@@ -266,6 +266,8 @@ static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
436 + return;
437 + }
438 +
439 ++ count -= initial;
440 ++
441 + if (initial)
442 + asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
443 + : "+S"(input), "+D"(output)
444 +@@ -273,7 +275,7 @@ static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
445 +
446 + asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
447 + : "+S"(input), "+D"(output)
448 +- : "d"(control_word), "b"(key), "c"(count - initial));
449 ++ : "d"(control_word), "b"(key), "c"(count));
450 + }
451 +
452 + static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
453 +@@ -284,6 +286,8 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
454 + if (count < cbc_fetch_blocks)
455 + return cbc_crypt(input, output, key, iv, control_word, count);
456 +
457 ++ count -= initial;
458 ++
459 + if (initial)
460 + asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
461 + : "+S" (input), "+D" (output), "+a" (iv)
462 +@@ -291,7 +295,7 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
463 +
464 + asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
465 + : "+S" (input), "+D" (output), "+a" (iv)
466 +- : "d" (control_word), "b" (key), "c" (count-initial));
467 ++ : "d" (control_word), "b" (key), "c" (count));
468 + return iv;
469 + }
470 +
471 +diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c
472 +index 55f5d33f6dc7..4251e9ac0373 100644
473 +--- a/drivers/dma/pxa_dma.c
474 ++++ b/drivers/dma/pxa_dma.c
475 +@@ -1321,7 +1321,7 @@ static int pxad_init_phys(struct platform_device *op,
476 + return 0;
477 + }
478 +
479 +-static const struct of_device_id const pxad_dt_ids[] = {
480 ++static const struct of_device_id pxad_dt_ids[] = {
481 + { .compatible = "marvell,pdma-1.0", },
482 + {}
483 + };
484 +diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
485 +index 50d74e5ce41b..355ad1b97df6 100644
486 +--- a/drivers/gpu/drm/drm_atomic.c
487 ++++ b/drivers/gpu/drm/drm_atomic.c
488 +@@ -960,7 +960,9 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
489 + {
490 + struct drm_plane *plane = plane_state->plane;
491 + struct drm_crtc_state *crtc_state;
492 +-
493 ++ /* Nothing to do for same crtc*/
494 ++ if (plane_state->crtc == crtc)
495 ++ return 0;
496 + if (plane_state->crtc) {
497 + crtc_state = drm_atomic_get_crtc_state(plane_state->state,
498 + plane_state->crtc);
499 +diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
500 +index 860dd2177ca1..283570080d47 100644
501 +--- a/drivers/gpu/drm/gma500/psb_intel_drv.h
502 ++++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
503 +@@ -252,7 +252,7 @@ extern int intelfb_remove(struct drm_device *dev,
504 + extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
505 + const struct drm_display_mode *mode,
506 + struct drm_display_mode *adjusted_mode);
507 +-extern int psb_intel_lvds_mode_valid(struct drm_connector *connector,
508 ++extern enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
509 + struct drm_display_mode *mode);
510 + extern int psb_intel_lvds_set_property(struct drm_connector *connector,
511 + struct drm_property *property,
512 +diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
513 +index 61e3a097a478..ccd1b8bf0fd5 100644
514 +--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
515 ++++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
516 +@@ -343,7 +343,7 @@ static void psb_intel_lvds_restore(struct drm_connector *connector)
517 + }
518 + }
519 +
520 +-int psb_intel_lvds_mode_valid(struct drm_connector *connector,
521 ++enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
522 + struct drm_display_mode *mode)
523 + {
524 + struct drm_psb_private *dev_priv = connector->dev->dev_private;
525 +diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
526 +index 1a2a7365d0b5..c6bf378534f8 100644
527 +--- a/drivers/gpu/drm/radeon/radeon_connectors.c
528 ++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
529 +@@ -844,7 +844,7 @@ static int radeon_lvds_get_modes(struct drm_connector *connector)
530 + return ret;
531 + }
532 +
533 +-static int radeon_lvds_mode_valid(struct drm_connector *connector,
534 ++static enum drm_mode_status radeon_lvds_mode_valid(struct drm_connector *connector,
535 + struct drm_display_mode *mode)
536 + {
537 + struct drm_encoder *encoder = radeon_best_single_encoder(connector);
538 +@@ -993,7 +993,7 @@ static int radeon_vga_get_modes(struct drm_connector *connector)
539 + return ret;
540 + }
541 +
542 +-static int radeon_vga_mode_valid(struct drm_connector *connector,
543 ++static enum drm_mode_status radeon_vga_mode_valid(struct drm_connector *connector,
544 + struct drm_display_mode *mode)
545 + {
546 + struct drm_device *dev = connector->dev;
547 +@@ -1136,7 +1136,7 @@ static int radeon_tv_get_modes(struct drm_connector *connector)
548 + return 1;
549 + }
550 +
551 +-static int radeon_tv_mode_valid(struct drm_connector *connector,
552 ++static enum drm_mode_status radeon_tv_mode_valid(struct drm_connector *connector,
553 + struct drm_display_mode *mode)
554 + {
555 + if ((mode->hdisplay > 1024) || (mode->vdisplay > 768))
556 +@@ -1477,7 +1477,7 @@ static void radeon_dvi_force(struct drm_connector *connector)
557 + radeon_connector->use_digital = true;
558 + }
559 +
560 +-static int radeon_dvi_mode_valid(struct drm_connector *connector,
561 ++static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connector,
562 + struct drm_display_mode *mode)
563 + {
564 + struct drm_device *dev = connector->dev;
565 +@@ -1778,7 +1778,7 @@ out:
566 + return ret;
567 + }
568 +
569 +-static int radeon_dp_mode_valid(struct drm_connector *connector,
570 ++static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connector,
571 + struct drm_display_mode *mode)
572 + {
573 + struct drm_device *dev = connector->dev;
574 +diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
575 +index febb21ee190e..584b10d3fc3d 100644
576 +--- a/drivers/hid/hid-plantronics.c
577 ++++ b/drivers/hid/hid-plantronics.c
578 +@@ -2,7 +2,7 @@
579 + * Plantronics USB HID Driver
580 + *
581 + * Copyright (c) 2014 JD Cole <jd.cole@×××××××××××.com>
582 +- * Copyright (c) 2015 Terry Junge <terry.junge@×××××××××××.com>
583 ++ * Copyright (c) 2015-2018 Terry Junge <terry.junge@×××××××××××.com>
584 + */
585 +
586 + /*
587 +@@ -48,6 +48,10 @@ static int plantronics_input_mapping(struct hid_device *hdev,
588 + unsigned short mapped_key;
589 + unsigned long plt_type = (unsigned long)hid_get_drvdata(hdev);
590 +
591 ++ /* special case for PTT products */
592 ++ if (field->application == HID_GD_JOYSTICK)
593 ++ goto defaulted;
594 ++
595 + /* handle volume up/down mapping */
596 + /* non-standard types or multi-HID interfaces - plt_type is PID */
597 + if (!(plt_type & HID_USAGE_PAGE)) {
598 +diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
599 +index a5fed668fde1..4248d253c32a 100644
600 +--- a/drivers/hid/i2c-hid/i2c-hid.c
601 ++++ b/drivers/hid/i2c-hid/i2c-hid.c
602 +@@ -1017,6 +1017,14 @@ static int i2c_hid_probe(struct i2c_client *client,
603 + pm_runtime_set_active(&client->dev);
604 + pm_runtime_enable(&client->dev);
605 +
606 ++ /* Make sure there is something at this address */
607 ++ ret = i2c_smbus_read_byte(client);
608 ++ if (ret < 0) {
609 ++ dev_dbg(&client->dev, "nothing at this address: %d\n", ret);
610 ++ ret = -ENXIO;
611 ++ goto err_pm;
612 ++ }
613 ++
614 + ret = i2c_hid_fetch_hid_descriptor(ihid);
615 + if (ret < 0)
616 + goto err_pm;
617 +diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
618 +index 8d84c563ba75..616173b7a5e8 100644
619 +--- a/drivers/infiniband/core/mad.c
620 ++++ b/drivers/infiniband/core/mad.c
621 +@@ -1548,7 +1548,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,
622 + mad_reg_req->oui, 3)) {
623 + method = &(*vendor_table)->vendor_class[
624 + vclass]->method_table[i];
625 +- BUG_ON(!*method);
626 ++ if (!*method)
627 ++ goto error3;
628 + goto check_in_use;
629 + }
630 + }
631 +@@ -1558,10 +1559,12 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,
632 + vclass]->oui[i])) {
633 + method = &(*vendor_table)->vendor_class[
634 + vclass]->method_table[i];
635 +- BUG_ON(*method);
636 + /* Allocate method table for this OUI */
637 +- if ((ret = allocate_method_table(method)))
638 +- goto error3;
639 ++ if (!*method) {
640 ++ ret = allocate_method_table(method);
641 ++ if (ret)
642 ++ goto error3;
643 ++ }
644 + memcpy((*vendor_table)->vendor_class[vclass]->oui[i],
645 + mad_reg_req->oui, 3);
646 + goto check_in_use;
647 +diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
648 +index 795938edce3f..55aa8d3d752f 100644
649 +--- a/drivers/infiniband/core/ucma.c
650 ++++ b/drivers/infiniband/core/ucma.c
651 +@@ -217,7 +217,7 @@ static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx)
652 + return NULL;
653 +
654 + mutex_lock(&mut);
655 +- mc->id = idr_alloc(&multicast_idr, mc, 0, 0, GFP_KERNEL);
656 ++ mc->id = idr_alloc(&multicast_idr, NULL, 0, 0, GFP_KERNEL);
657 + mutex_unlock(&mut);
658 + if (mc->id < 0)
659 + goto error;
660 +@@ -1375,6 +1375,10 @@ static ssize_t ucma_process_join(struct ucma_file *file,
661 + goto err3;
662 + }
663 +
664 ++ mutex_lock(&mut);
665 ++ idr_replace(&multicast_idr, mc, mc->id);
666 ++ mutex_unlock(&mut);
667 ++
668 + mutex_unlock(&file->mut);
669 + ucma_put_ctx(ctx);
670 + return 0;
671 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
672 +index 97f6e05cffce..a716482774db 100644
673 +--- a/drivers/input/mouse/elan_i2c_core.c
674 ++++ b/drivers/input/mouse/elan_i2c_core.c
675 +@@ -1251,6 +1251,8 @@ static const struct acpi_device_id elan_acpi_id[] = {
676 + { "ELAN0611", 0 },
677 + { "ELAN0612", 0 },
678 + { "ELAN0618", 0 },
679 ++ { "ELAN061D", 0 },
680 ++ { "ELAN0622", 0 },
681 + { "ELAN1000", 0 },
682 + { }
683 + };
684 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
685 +index e484ea2dc787..34be09651ee8 100644
686 +--- a/drivers/input/serio/i8042-x86ia64io.h
687 ++++ b/drivers/input/serio/i8042-x86ia64io.h
688 +@@ -527,6 +527,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
689 + DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
690 + },
691 + },
692 ++ {
693 ++ /* Lenovo LaVie Z */
694 ++ .matches = {
695 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
696 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"),
697 ++ },
698 ++ },
699 + { }
700 + };
701 +
702 +diff --git a/drivers/md/md.c b/drivers/md/md.c
703 +index 0663463df2f7..07f307402351 100644
704 +--- a/drivers/md/md.c
705 ++++ b/drivers/md/md.c
706 +@@ -6145,6 +6145,9 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev)
707 + struct md_rdev *rdev;
708 + int ret = -1;
709 +
710 ++ if (!mddev->pers)
711 ++ return -ENODEV;
712 ++
713 + rdev = find_rdev(mddev, dev);
714 + if (!rdev)
715 + return -ENXIO;
716 +diff --git a/drivers/media/common/siano/smsendian.c b/drivers/media/common/siano/smsendian.c
717 +index bfe831c10b1c..b95a631f23f9 100644
718 +--- a/drivers/media/common/siano/smsendian.c
719 ++++ b/drivers/media/common/siano/smsendian.c
720 +@@ -35,7 +35,7 @@ void smsendian_handle_tx_message(void *buffer)
721 + switch (msg->x_msg_header.msg_type) {
722 + case MSG_SMS_DATA_DOWNLOAD_REQ:
723 + {
724 +- msg->msg_data[0] = le32_to_cpu(msg->msg_data[0]);
725 ++ msg->msg_data[0] = le32_to_cpu((__force __le32)(msg->msg_data[0]));
726 + break;
727 + }
728 +
729 +@@ -44,7 +44,7 @@ void smsendian_handle_tx_message(void *buffer)
730 + sizeof(struct sms_msg_hdr))/4;
731 +
732 + for (i = 0; i < msg_words; i++)
733 +- msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]);
734 ++ msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
735 +
736 + break;
737 + }
738 +@@ -64,7 +64,7 @@ void smsendian_handle_rx_message(void *buffer)
739 + {
740 + struct sms_version_res *ver =
741 + (struct sms_version_res *) msg;
742 +- ver->chip_model = le16_to_cpu(ver->chip_model);
743 ++ ver->chip_model = le16_to_cpu((__force __le16)ver->chip_model);
744 + break;
745 + }
746 +
747 +@@ -81,7 +81,7 @@ void smsendian_handle_rx_message(void *buffer)
748 + sizeof(struct sms_msg_hdr))/4;
749 +
750 + for (i = 0; i < msg_words; i++)
751 +- msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]);
752 ++ msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
753 +
754 + break;
755 + }
756 +@@ -95,9 +95,9 @@ void smsendian_handle_message_header(void *msg)
757 + #ifdef __BIG_ENDIAN
758 + struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg;
759 +
760 +- phdr->msg_type = le16_to_cpu(phdr->msg_type);
761 +- phdr->msg_length = le16_to_cpu(phdr->msg_length);
762 +- phdr->msg_flags = le16_to_cpu(phdr->msg_flags);
763 ++ phdr->msg_type = le16_to_cpu((__force __le16)phdr->msg_type);
764 ++ phdr->msg_length = le16_to_cpu((__force __le16)phdr->msg_length);
765 ++ phdr->msg_flags = le16_to_cpu((__force __le16)phdr->msg_flags);
766 + #endif /* __BIG_ENDIAN */
767 + }
768 + EXPORT_SYMBOL_GPL(smsendian_handle_message_header);
769 +diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
770 +index fb39dfd55e75..46a052c5be2e 100644
771 +--- a/drivers/media/i2c/smiapp/smiapp-core.c
772 ++++ b/drivers/media/i2c/smiapp/smiapp-core.c
773 +@@ -981,7 +981,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
774 + if (rval)
775 + goto out;
776 +
777 +- for (i = 0; i < 1000; i++) {
778 ++ for (i = 1000; i > 0; i--) {
779 + rval = smiapp_read(
780 + sensor,
781 + SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS, &s);
782 +@@ -992,11 +992,10 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
783 + if (s & SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY)
784 + break;
785 +
786 +- if (--i == 0) {
787 +- rval = -ETIMEDOUT;
788 +- goto out;
789 +- }
790 +-
791 ++ }
792 ++ if (!i) {
793 ++ rval = -ETIMEDOUT;
794 ++ goto out;
795 + }
796 +
797 + for (i = 0; i < SMIAPP_NVM_PAGE_SIZE; i++) {
798 +diff --git a/drivers/media/pci/saa7164/saa7164-fw.c b/drivers/media/pci/saa7164/saa7164-fw.c
799 +index 269e0782c7b6..93d53195e8ca 100644
800 +--- a/drivers/media/pci/saa7164/saa7164-fw.c
801 ++++ b/drivers/media/pci/saa7164/saa7164-fw.c
802 +@@ -430,7 +430,8 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev)
803 + __func__, fw->size);
804 +
805 + if (fw->size != fwlength) {
806 +- printk(KERN_ERR "xc5000: firmware incorrect size\n");
807 ++ printk(KERN_ERR "saa7164: firmware incorrect size %zu != %u\n",
808 ++ fw->size, fwlength);
809 + ret = -ENOMEM;
810 + goto out;
811 + }
812 +diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
813 +index 56e683b19a73..91e02c1ff392 100644
814 +--- a/drivers/media/platform/omap3isp/isp.c
815 ++++ b/drivers/media/platform/omap3isp/isp.c
816 +@@ -2077,6 +2077,7 @@ error_csiphy:
817 +
818 + static void isp_detach_iommu(struct isp_device *isp)
819 + {
820 ++ arm_iommu_detach_device(isp->dev);
821 + arm_iommu_release_mapping(isp->mapping);
822 + isp->mapping = NULL;
823 + iommu_group_remove_device(isp->dev);
824 +@@ -2110,8 +2111,7 @@ static int isp_attach_iommu(struct isp_device *isp)
825 + mapping = arm_iommu_create_mapping(&platform_bus_type, SZ_1G, SZ_2G);
826 + if (IS_ERR(mapping)) {
827 + dev_err(isp->dev, "failed to create ARM IOMMU mapping\n");
828 +- ret = PTR_ERR(mapping);
829 +- goto error;
830 ++ return PTR_ERR(mapping);
831 + }
832 +
833 + isp->mapping = mapping;
834 +@@ -2126,7 +2126,8 @@ static int isp_attach_iommu(struct isp_device *isp)
835 + return 0;
836 +
837 + error:
838 +- isp_detach_iommu(isp);
839 ++ arm_iommu_release_mapping(isp->mapping);
840 ++ isp->mapping = NULL;
841 + return ret;
842 + }
843 +
844 +diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c
845 +index f8e3e83c52a2..20de5e9fc217 100644
846 +--- a/drivers/media/platform/rcar_jpu.c
847 ++++ b/drivers/media/platform/rcar_jpu.c
848 +@@ -1278,7 +1278,7 @@ static int jpu_open(struct file *file)
849 + /* ...issue software reset */
850 + ret = jpu_reset(jpu);
851 + if (ret)
852 +- goto device_prepare_rollback;
853 ++ goto jpu_reset_rollback;
854 + }
855 +
856 + jpu->ref_count++;
857 +@@ -1286,6 +1286,8 @@ static int jpu_open(struct file *file)
858 + mutex_unlock(&jpu->mutex);
859 + return 0;
860 +
861 ++jpu_reset_rollback:
862 ++ clk_disable_unprepare(jpu->clk);
863 + device_prepare_rollback:
864 + mutex_unlock(&jpu->mutex);
865 + v4l_prepare_rollback:
866 +diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
867 +index 471d6a8ae8a4..9326439bc49c 100644
868 +--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
869 ++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
870 +@@ -96,7 +96,7 @@ MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*");
871 + */
872 + int si470x_get_register(struct si470x_device *radio, int regnr)
873 + {
874 +- u16 buf[READ_REG_NUM];
875 ++ __be16 buf[READ_REG_NUM];
876 + struct i2c_msg msgs[1] = {
877 + {
878 + .addr = radio->client->addr,
879 +@@ -121,7 +121,7 @@ int si470x_get_register(struct si470x_device *radio, int regnr)
880 + int si470x_set_register(struct si470x_device *radio, int regnr)
881 + {
882 + int i;
883 +- u16 buf[WRITE_REG_NUM];
884 ++ __be16 buf[WRITE_REG_NUM];
885 + struct i2c_msg msgs[1] = {
886 + {
887 + .addr = radio->client->addr,
888 +@@ -151,7 +151,7 @@ int si470x_set_register(struct si470x_device *radio, int regnr)
889 + static int si470x_get_all_registers(struct si470x_device *radio)
890 + {
891 + int i;
892 +- u16 buf[READ_REG_NUM];
893 ++ __be16 buf[READ_REG_NUM];
894 + struct i2c_msg msgs[1] = {
895 + {
896 + .addr = radio->client->addr,
897 +diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
898 +index bb1e19f7ed5a..0c1a42bf27fd 100644
899 +--- a/drivers/media/v4l2-core/videobuf2-core.c
900 ++++ b/drivers/media/v4l2-core/videobuf2-core.c
901 +@@ -870,9 +870,12 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
902 + dprintk(4, "done processing on buffer %d, state: %d\n",
903 + vb->index, state);
904 +
905 +- /* sync buffers */
906 +- for (plane = 0; plane < vb->num_planes; ++plane)
907 +- call_void_memop(vb, finish, vb->planes[plane].mem_priv);
908 ++ if (state != VB2_BUF_STATE_QUEUED &&
909 ++ state != VB2_BUF_STATE_REQUEUEING) {
910 ++ /* sync buffers */
911 ++ for (plane = 0; plane < vb->num_planes; ++plane)
912 ++ call_void_memop(vb, finish, vb->planes[plane].mem_priv);
913 ++ }
914 +
915 + spin_lock_irqsave(&q->done_lock, flags);
916 + if (state == VB2_BUF_STATE_QUEUED ||
917 +diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
918 +index a1ae0cc2b86d..6ab481ee8ece 100644
919 +--- a/drivers/memory/tegra/mc.c
920 ++++ b/drivers/memory/tegra/mc.c
921 +@@ -20,14 +20,6 @@
922 + #include "mc.h"
923 +
924 + #define MC_INTSTATUS 0x000
925 +-#define MC_INT_DECERR_MTS (1 << 16)
926 +-#define MC_INT_SECERR_SEC (1 << 13)
927 +-#define MC_INT_DECERR_VPR (1 << 12)
928 +-#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11)
929 +-#define MC_INT_INVALID_SMMU_PAGE (1 << 10)
930 +-#define MC_INT_ARBITRATION_EMEM (1 << 9)
931 +-#define MC_INT_SECURITY_VIOLATION (1 << 8)
932 +-#define MC_INT_DECERR_EMEM (1 << 6)
933 +
934 + #define MC_INTMASK 0x004
935 +
936 +@@ -248,12 +240,13 @@ static const char *const error_names[8] = {
937 + static irqreturn_t tegra_mc_irq(int irq, void *data)
938 + {
939 + struct tegra_mc *mc = data;
940 +- unsigned long status, mask;
941 ++ unsigned long status;
942 + unsigned int bit;
943 +
944 + /* mask all interrupts to avoid flooding */
945 +- status = mc_readl(mc, MC_INTSTATUS);
946 +- mask = mc_readl(mc, MC_INTMASK);
947 ++ status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask;
948 ++ if (!status)
949 ++ return IRQ_NONE;
950 +
951 + for_each_set_bit(bit, &status, 32) {
952 + const char *error = status_names[bit] ?: "unknown";
953 +@@ -346,7 +339,6 @@ static int tegra_mc_probe(struct platform_device *pdev)
954 + const struct of_device_id *match;
955 + struct resource *res;
956 + struct tegra_mc *mc;
957 +- u32 value;
958 + int err;
959 +
960 + match = of_match_node(tegra_mc_of_match, pdev->dev.of_node);
961 +@@ -414,11 +406,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
962 +
963 + WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n");
964 +
965 +- value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
966 +- MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
967 +- MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM;
968 +-
969 +- mc_writel(mc, value, MC_INTMASK);
970 ++ mc_writel(mc, mc->soc->intmask, MC_INTMASK);
971 +
972 + return 0;
973 + }
974 +diff --git a/drivers/memory/tegra/mc.h b/drivers/memory/tegra/mc.h
975 +index ddb16676c3af..24e020b4609b 100644
976 +--- a/drivers/memory/tegra/mc.h
977 ++++ b/drivers/memory/tegra/mc.h
978 +@@ -14,6 +14,15 @@
979 +
980 + #include <soc/tegra/mc.h>
981 +
982 ++#define MC_INT_DECERR_MTS (1 << 16)
983 ++#define MC_INT_SECERR_SEC (1 << 13)
984 ++#define MC_INT_DECERR_VPR (1 << 12)
985 ++#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11)
986 ++#define MC_INT_INVALID_SMMU_PAGE (1 << 10)
987 ++#define MC_INT_ARBITRATION_EMEM (1 << 9)
988 ++#define MC_INT_SECURITY_VIOLATION (1 << 8)
989 ++#define MC_INT_DECERR_EMEM (1 << 6)
990 ++
991 + static inline u32 mc_readl(struct tegra_mc *mc, unsigned long offset)
992 + {
993 + return readl(mc->regs + offset);
994 +diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c
995 +index ba8fff3d66a6..6d2a5a849d92 100644
996 +--- a/drivers/memory/tegra/tegra114.c
997 ++++ b/drivers/memory/tegra/tegra114.c
998 +@@ -930,4 +930,6 @@ const struct tegra_mc_soc tegra114_mc_soc = {
999 + .atom_size = 32,
1000 + .client_id_mask = 0x7f,
1001 + .smmu = &tegra114_smmu_soc,
1002 ++ .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION |
1003 ++ MC_INT_DECERR_EMEM,
1004 + };
1005 +diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c
1006 +index 21e7255e3d96..234e74f97a4b 100644
1007 +--- a/drivers/memory/tegra/tegra124.c
1008 ++++ b/drivers/memory/tegra/tegra124.c
1009 +@@ -1019,6 +1019,9 @@ const struct tegra_mc_soc tegra124_mc_soc = {
1010 + .smmu = &tegra124_smmu_soc,
1011 + .emem_regs = tegra124_mc_emem_regs,
1012 + .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
1013 ++ .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1014 ++ MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1015 ++ MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1016 + };
1017 + #endif /* CONFIG_ARCH_TEGRA_124_SOC */
1018 +
1019 +@@ -1041,5 +1044,8 @@ const struct tegra_mc_soc tegra132_mc_soc = {
1020 + .atom_size = 32,
1021 + .client_id_mask = 0x7f,
1022 + .smmu = &tegra132_smmu_soc,
1023 ++ .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1024 ++ MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1025 ++ MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1026 + };
1027 + #endif /* CONFIG_ARCH_TEGRA_132_SOC */
1028 +diff --git a/drivers/memory/tegra/tegra210.c b/drivers/memory/tegra/tegra210.c
1029 +index 5e144abe4c18..47c78a6d8f00 100644
1030 +--- a/drivers/memory/tegra/tegra210.c
1031 ++++ b/drivers/memory/tegra/tegra210.c
1032 +@@ -1077,4 +1077,7 @@ const struct tegra_mc_soc tegra210_mc_soc = {
1033 + .atom_size = 64,
1034 + .client_id_mask = 0xff,
1035 + .smmu = &tegra210_smmu_soc,
1036 ++ .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
1037 ++ MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
1038 ++ MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
1039 + };
1040 +diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c
1041 +index b44737840e70..d0689428ea1a 100644
1042 +--- a/drivers/memory/tegra/tegra30.c
1043 ++++ b/drivers/memory/tegra/tegra30.c
1044 +@@ -952,4 +952,6 @@ const struct tegra_mc_soc tegra30_mc_soc = {
1045 + .atom_size = 16,
1046 + .client_id_mask = 0x7f,
1047 + .smmu = &tegra30_smmu_soc,
1048 ++ .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION |
1049 ++ MC_INT_DECERR_EMEM,
1050 + };
1051 +diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
1052 +index 0eee63542038..115a6f67ab51 100644
1053 +--- a/drivers/mfd/cros_ec.c
1054 ++++ b/drivers/mfd/cros_ec.c
1055 +@@ -68,7 +68,11 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
1056 +
1057 + mutex_init(&ec_dev->lock);
1058 +
1059 +- cros_ec_query_all(ec_dev);
1060 ++ err = cros_ec_query_all(ec_dev);
1061 ++ if (err) {
1062 ++ dev_err(dev, "Cannot identify the EC: error %d\n", err);
1063 ++ return err;
1064 ++ }
1065 +
1066 + err = mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO, &ec_cell, 1,
1067 + NULL, ec_dev->irq, NULL);
1068 +diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
1069 +index 5e3fa5861039..2c0bbaed3609 100644
1070 +--- a/drivers/mtd/nand/fsl_ifc_nand.c
1071 ++++ b/drivers/mtd/nand/fsl_ifc_nand.c
1072 +@@ -449,9 +449,16 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
1073 +
1074 + case NAND_CMD_READID:
1075 + case NAND_CMD_PARAM: {
1076 ++ /*
1077 ++ * For READID, read 8 bytes that are currently used.
1078 ++ * For PARAM, read all 3 copies of 256-bytes pages.
1079 ++ */
1080 ++ int len = 8;
1081 + int timing = IFC_FIR_OP_RB;
1082 +- if (command == NAND_CMD_PARAM)
1083 ++ if (command == NAND_CMD_PARAM) {
1084 + timing = IFC_FIR_OP_RBCD;
1085 ++ len = 256 * 3;
1086 ++ }
1087 +
1088 + ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
1089 + (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) |
1090 +@@ -461,12 +468,8 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
1091 + &ifc->ifc_nand.nand_fcr0);
1092 + ifc_out32(column, &ifc->ifc_nand.row3);
1093 +
1094 +- /*
1095 +- * although currently it's 8 bytes for READID, we always read
1096 +- * the maximum 256 bytes(for PARAM)
1097 +- */
1098 +- ifc_out32(256, &ifc->ifc_nand.nand_fbcr);
1099 +- ifc_nand_ctrl->read_bytes = 256;
1100 ++ ifc_out32(len, &ifc->ifc_nand.nand_fbcr);
1101 ++ ifc_nand_ctrl->read_bytes = len;
1102 +
1103 + set_addr(mtd, 0, 0, 0);
1104 + fsl_ifc_run_command(mtd);
1105 +diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
1106 +index 357c9e89fdf9..047348033e27 100644
1107 +--- a/drivers/net/can/usb/ems_usb.c
1108 ++++ b/drivers/net/can/usb/ems_usb.c
1109 +@@ -1078,6 +1078,7 @@ static void ems_usb_disconnect(struct usb_interface *intf)
1110 + usb_free_urb(dev->intr_urb);
1111 +
1112 + kfree(dev->intr_in_buffer);
1113 ++ kfree(dev->tx_msg_buffer);
1114 + }
1115 + }
1116 +
1117 +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
1118 +index 446058081866..7a0ab4c44ee4 100644
1119 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
1120 ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
1121 +@@ -872,14 +872,14 @@ static void xgbe_phy_adjust_link(struct xgbe_prv_data *pdata)
1122 +
1123 + if (pdata->tx_pause != pdata->phy.tx_pause) {
1124 + new_state = 1;
1125 +- pdata->hw_if.config_tx_flow_control(pdata);
1126 + pdata->tx_pause = pdata->phy.tx_pause;
1127 ++ pdata->hw_if.config_tx_flow_control(pdata);
1128 + }
1129 +
1130 + if (pdata->rx_pause != pdata->phy.rx_pause) {
1131 + new_state = 1;
1132 +- pdata->hw_if.config_rx_flow_control(pdata);
1133 + pdata->rx_pause = pdata->phy.rx_pause;
1134 ++ pdata->hw_if.config_rx_flow_control(pdata);
1135 + }
1136 +
1137 + /* Speed support */
1138 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1139 +index 5adaf537513b..7bba30f24135 100644
1140 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1141 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1142 +@@ -54,7 +54,7 @@
1143 + #include <linux/reset.h>
1144 + #include <linux/of_mdio.h>
1145 +
1146 +-#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x)
1147 ++#define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES)
1148 +
1149 + /* Module parameters */
1150 + #define TX_TIMEO 5000
1151 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
1152 +index a6d429950cb0..acec4b565511 100644
1153 +--- a/drivers/net/usb/lan78xx.c
1154 ++++ b/drivers/net/usb/lan78xx.c
1155 +@@ -1361,6 +1361,8 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
1156 + netif_dbg(dev, ifup, dev->net,
1157 + "MAC address set to random addr");
1158 + }
1159 ++
1160 ++ tasklet_schedule(&dev->bh);
1161 + }
1162 +
1163 + ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
1164 +diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h
1165 +index 37f53bd8fcb1..184b6810cde9 100644
1166 +--- a/drivers/net/wireless/ath/regd.h
1167 ++++ b/drivers/net/wireless/ath/regd.h
1168 +@@ -68,12 +68,14 @@ enum CountryCode {
1169 + CTRY_AUSTRALIA = 36,
1170 + CTRY_AUSTRIA = 40,
1171 + CTRY_AZERBAIJAN = 31,
1172 ++ CTRY_BAHAMAS = 44,
1173 + CTRY_BAHRAIN = 48,
1174 + CTRY_BANGLADESH = 50,
1175 + CTRY_BARBADOS = 52,
1176 + CTRY_BELARUS = 112,
1177 + CTRY_BELGIUM = 56,
1178 + CTRY_BELIZE = 84,
1179 ++ CTRY_BERMUDA = 60,
1180 + CTRY_BOLIVIA = 68,
1181 + CTRY_BOSNIA_HERZ = 70,
1182 + CTRY_BRAZIL = 76,
1183 +@@ -159,6 +161,7 @@ enum CountryCode {
1184 + CTRY_ROMANIA = 642,
1185 + CTRY_RUSSIA = 643,
1186 + CTRY_SAUDI_ARABIA = 682,
1187 ++ CTRY_SERBIA = 688,
1188 + CTRY_SERBIA_MONTENEGRO = 891,
1189 + CTRY_SINGAPORE = 702,
1190 + CTRY_SLOVAKIA = 703,
1191 +@@ -170,11 +173,13 @@ enum CountryCode {
1192 + CTRY_SWITZERLAND = 756,
1193 + CTRY_SYRIA = 760,
1194 + CTRY_TAIWAN = 158,
1195 ++ CTRY_TANZANIA = 834,
1196 + CTRY_THAILAND = 764,
1197 + CTRY_TRINIDAD_Y_TOBAGO = 780,
1198 + CTRY_TUNISIA = 788,
1199 + CTRY_TURKEY = 792,
1200 + CTRY_UAE = 784,
1201 ++ CTRY_UGANDA = 800,
1202 + CTRY_UKRAINE = 804,
1203 + CTRY_UNITED_KINGDOM = 826,
1204 + CTRY_UNITED_STATES = 840,
1205 +diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h
1206 +index bdd2b4d61f2f..15bbd1e0d912 100644
1207 +--- a/drivers/net/wireless/ath/regd_common.h
1208 ++++ b/drivers/net/wireless/ath/regd_common.h
1209 +@@ -35,6 +35,7 @@ enum EnumRd {
1210 + FRANCE_RES = 0x31,
1211 + FCC3_FCCA = 0x3A,
1212 + FCC3_WORLD = 0x3B,
1213 ++ FCC3_ETSIC = 0x3F,
1214 +
1215 + ETSI1_WORLD = 0x37,
1216 + ETSI3_ETSIA = 0x32,
1217 +@@ -44,6 +45,7 @@ enum EnumRd {
1218 + ETSI4_ETSIC = 0x38,
1219 + ETSI5_WORLD = 0x39,
1220 + ETSI6_WORLD = 0x34,
1221 ++ ETSI8_WORLD = 0x3D,
1222 + ETSI_RESERVED = 0x33,
1223 +
1224 + MKK1_MKKA = 0x40,
1225 +@@ -59,6 +61,7 @@ enum EnumRd {
1226 + MKK1_MKKA1 = 0x4A,
1227 + MKK1_MKKA2 = 0x4B,
1228 + MKK1_MKKC = 0x4C,
1229 ++ APL2_FCCA = 0x4D,
1230 +
1231 + APL3_FCCA = 0x50,
1232 + APL1_WORLD = 0x52,
1233 +@@ -67,6 +70,7 @@ enum EnumRd {
1234 + APL1_ETSIC = 0x55,
1235 + APL2_ETSIC = 0x56,
1236 + APL5_WORLD = 0x58,
1237 ++ APL13_WORLD = 0x5A,
1238 + APL6_WORLD = 0x5B,
1239 + APL7_FCCA = 0x5C,
1240 + APL8_WORLD = 0x5D,
1241 +@@ -168,6 +172,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = {
1242 + {FCC2_ETSIC, CTL_FCC, CTL_ETSI},
1243 + {FCC3_FCCA, CTL_FCC, CTL_FCC},
1244 + {FCC3_WORLD, CTL_FCC, CTL_ETSI},
1245 ++ {FCC3_ETSIC, CTL_FCC, CTL_ETSI},
1246 + {FCC4_FCCA, CTL_FCC, CTL_FCC},
1247 + {FCC5_FCCA, CTL_FCC, CTL_FCC},
1248 + {FCC6_FCCA, CTL_FCC, CTL_FCC},
1249 +@@ -179,6 +184,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = {
1250 + {ETSI4_WORLD, CTL_ETSI, CTL_ETSI},
1251 + {ETSI5_WORLD, CTL_ETSI, CTL_ETSI},
1252 + {ETSI6_WORLD, CTL_ETSI, CTL_ETSI},
1253 ++ {ETSI8_WORLD, CTL_ETSI, CTL_ETSI},
1254 +
1255 + /* XXX: For ETSI3_ETSIA, Was NO_CTL meant for the 2 GHz band ? */
1256 + {ETSI3_ETSIA, CTL_ETSI, CTL_ETSI},
1257 +@@ -188,9 +194,11 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = {
1258 + {FCC1_FCCA, CTL_FCC, CTL_FCC},
1259 + {APL1_WORLD, CTL_FCC, CTL_ETSI},
1260 + {APL2_WORLD, CTL_FCC, CTL_ETSI},
1261 ++ {APL2_FCCA, CTL_FCC, CTL_FCC},
1262 + {APL3_WORLD, CTL_FCC, CTL_ETSI},
1263 + {APL4_WORLD, CTL_FCC, CTL_ETSI},
1264 + {APL5_WORLD, CTL_FCC, CTL_ETSI},
1265 ++ {APL13_WORLD, CTL_ETSI, CTL_ETSI},
1266 + {APL6_WORLD, CTL_ETSI, CTL_ETSI},
1267 + {APL8_WORLD, CTL_ETSI, CTL_ETSI},
1268 + {APL9_WORLD, CTL_ETSI, CTL_ETSI},
1269 +@@ -298,6 +306,7 @@ static struct country_code_to_enum_rd allCountries[] = {
1270 + {CTRY_AUSTRALIA2, FCC6_WORLD, "AU"},
1271 + {CTRY_AUSTRIA, ETSI1_WORLD, "AT"},
1272 + {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ"},
1273 ++ {CTRY_BAHAMAS, FCC3_WORLD, "BS"},
1274 + {CTRY_BAHRAIN, APL6_WORLD, "BH"},
1275 + {CTRY_BANGLADESH, NULL1_WORLD, "BD"},
1276 + {CTRY_BARBADOS, FCC2_WORLD, "BB"},
1277 +@@ -305,6 +314,7 @@ static struct country_code_to_enum_rd allCountries[] = {
1278 + {CTRY_BELGIUM, ETSI1_WORLD, "BE"},
1279 + {CTRY_BELGIUM2, ETSI4_WORLD, "BL"},
1280 + {CTRY_BELIZE, APL1_ETSIC, "BZ"},
1281 ++ {CTRY_BERMUDA, FCC3_FCCA, "BM"},
1282 + {CTRY_BOLIVIA, APL1_ETSIC, "BO"},
1283 + {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA"},
1284 + {CTRY_BRAZIL, FCC3_WORLD, "BR"},
1285 +@@ -444,6 +454,7 @@ static struct country_code_to_enum_rd allCountries[] = {
1286 + {CTRY_ROMANIA, NULL1_WORLD, "RO"},
1287 + {CTRY_RUSSIA, NULL1_WORLD, "RU"},
1288 + {CTRY_SAUDI_ARABIA, NULL1_WORLD, "SA"},
1289 ++ {CTRY_SERBIA, ETSI1_WORLD, "RS"},
1290 + {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS"},
1291 + {CTRY_SINGAPORE, APL6_WORLD, "SG"},
1292 + {CTRY_SLOVAKIA, ETSI1_WORLD, "SK"},
1293 +@@ -455,10 +466,12 @@ static struct country_code_to_enum_rd allCountries[] = {
1294 + {CTRY_SWITZERLAND, ETSI1_WORLD, "CH"},
1295 + {CTRY_SYRIA, NULL1_WORLD, "SY"},
1296 + {CTRY_TAIWAN, APL3_FCCA, "TW"},
1297 ++ {CTRY_TANZANIA, APL1_WORLD, "TZ"},
1298 + {CTRY_THAILAND, FCC3_WORLD, "TH"},
1299 + {CTRY_TRINIDAD_Y_TOBAGO, FCC3_WORLD, "TT"},
1300 + {CTRY_TUNISIA, ETSI3_WORLD, "TN"},
1301 + {CTRY_TURKEY, ETSI3_WORLD, "TR"},
1302 ++ {CTRY_UGANDA, FCC3_WORLD, "UG"},
1303 + {CTRY_UKRAINE, NULL1_WORLD, "UA"},
1304 + {CTRY_UAE, NULL1_WORLD, "AE"},
1305 + {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
1306 +diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
1307 +index 59cef6c69fe8..91da67657f81 100644
1308 +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
1309 ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
1310 +@@ -1109,6 +1109,7 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = {
1311 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43340),
1312 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
1313 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
1314 ++ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43364),
1315 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
1316 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
1317 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
1318 +diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
1319 +index e06591f625c4..d6f9858ff2de 100644
1320 +--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
1321 ++++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
1322 +@@ -713,6 +713,8 @@ int iwl_pcie_rx_init(struct iwl_trans *trans)
1323 + WQ_HIGHPRI | WQ_UNBOUND, 1);
1324 + INIT_WORK(&rba->rx_alloc, iwl_pcie_rx_allocator_work);
1325 +
1326 ++ cancel_work_sync(&rba->rx_alloc);
1327 ++
1328 + spin_lock(&rba->lock);
1329 + atomic_set(&rba->req_pending, 0);
1330 + atomic_set(&rba->req_ready, 0);
1331 +diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
1332 +index e43aff932360..1a1b1de87583 100644
1333 +--- a/drivers/net/wireless/mwifiex/usb.c
1334 ++++ b/drivers/net/wireless/mwifiex/usb.c
1335 +@@ -624,6 +624,9 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf)
1336 + MWIFIEX_FUNC_SHUTDOWN);
1337 + }
1338 +
1339 ++ if (adapter->workqueue)
1340 ++ flush_workqueue(adapter->workqueue);
1341 ++
1342 + mwifiex_usb_free(card);
1343 +
1344 + mwifiex_dbg(adapter, FATAL,
1345 +diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
1346 +index 0cec8a64473e..eb5ffa5b1c6c 100644
1347 +--- a/drivers/net/wireless/mwifiex/util.c
1348 ++++ b/drivers/net/wireless/mwifiex/util.c
1349 +@@ -702,12 +702,14 @@ void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
1350 + s8 nflr)
1351 + {
1352 + struct mwifiex_histogram_data *phist_data = priv->hist_data;
1353 ++ s8 nf = -nflr;
1354 ++ s8 rssi = snr - nflr;
1355 +
1356 + atomic_inc(&phist_data->num_samples);
1357 + atomic_inc(&phist_data->rx_rate[rx_rate]);
1358 +- atomic_inc(&phist_data->snr[snr]);
1359 +- atomic_inc(&phist_data->noise_flr[128 + nflr]);
1360 +- atomic_inc(&phist_data->sig_str[nflr - snr]);
1361 ++ atomic_inc(&phist_data->snr[snr + 128]);
1362 ++ atomic_inc(&phist_data->noise_flr[nf + 128]);
1363 ++ atomic_inc(&phist_data->sig_str[rssi + 128]);
1364 + }
1365 +
1366 + /* function to reset histogram data during init/reset */
1367 +diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
1368 +index 8428858204a6..fc895b466ebb 100644
1369 +--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
1370 ++++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
1371 +@@ -155,7 +155,6 @@ static void rsi_reset_card(struct sdio_func *pfunction)
1372 + int err;
1373 + struct mmc_card *card = pfunction->card;
1374 + struct mmc_host *host = card->host;
1375 +- s32 bit = (fls(host->ocr_avail) - 1);
1376 + u8 cmd52_resp;
1377 + u32 clock, resp, i;
1378 + u16 rca;
1379 +@@ -175,7 +174,6 @@ static void rsi_reset_card(struct sdio_func *pfunction)
1380 + msleep(20);
1381 +
1382 + /* Initialize the SDIO card */
1383 +- host->ios.vdd = bit;
1384 + host->ios.chip_select = MMC_CS_DONTCARE;
1385 + host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
1386 + host->ios.power_mode = MMC_POWER_UP;
1387 +diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
1388 +index c172da56b550..e4a8280cea83 100644
1389 +--- a/drivers/net/wireless/ti/wlcore/sdio.c
1390 ++++ b/drivers/net/wireless/ti/wlcore/sdio.c
1391 +@@ -388,6 +388,11 @@ static int wl1271_suspend(struct device *dev)
1392 + mmc_pm_flag_t sdio_flags;
1393 + int ret = 0;
1394 +
1395 ++ if (!wl) {
1396 ++ dev_err(dev, "no wilink module was probed\n");
1397 ++ goto out;
1398 ++ }
1399 ++
1400 + dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n",
1401 + wl->wow_enabled);
1402 +
1403 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
1404 +index a0de2453fa09..bec9f099573b 100644
1405 +--- a/drivers/net/xen-netfront.c
1406 ++++ b/drivers/net/xen-netfront.c
1407 +@@ -86,6 +86,7 @@ struct netfront_cb {
1408 + /* IRQ name is queue name with "-tx" or "-rx" appended */
1409 + #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
1410 +
1411 ++static DECLARE_WAIT_QUEUE_HEAD(module_load_q);
1412 + static DECLARE_WAIT_QUEUE_HEAD(module_unload_q);
1413 +
1414 + struct netfront_stats {
1415 +@@ -238,7 +239,7 @@ static void rx_refill_timeout(unsigned long data)
1416 + static int netfront_tx_slot_available(struct netfront_queue *queue)
1417 + {
1418 + return (queue->tx.req_prod_pvt - queue->tx.rsp_cons) <
1419 +- (NET_TX_RING_SIZE - MAX_SKB_FRAGS - 2);
1420 ++ (NET_TX_RING_SIZE - XEN_NETIF_NR_SLOTS_MIN - 1);
1421 + }
1422 +
1423 + static void xennet_maybe_wake_tx(struct netfront_queue *queue)
1424 +@@ -775,7 +776,7 @@ static int xennet_get_responses(struct netfront_queue *queue,
1425 + RING_IDX cons = queue->rx.rsp_cons;
1426 + struct sk_buff *skb = xennet_get_rx_skb(queue, cons);
1427 + grant_ref_t ref = xennet_get_rx_ref(queue, cons);
1428 +- int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD);
1429 ++ int max = XEN_NETIF_NR_SLOTS_MIN + (rx->status <= RX_COPY_THRESHOLD);
1430 + int slots = 1;
1431 + int err = 0;
1432 + unsigned long ret;
1433 +@@ -1335,6 +1336,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1434 + netif_carrier_off(netdev);
1435 +
1436 + xenbus_switch_state(dev, XenbusStateInitialising);
1437 ++ wait_event(module_load_q,
1438 ++ xenbus_read_driver_state(dev->otherend) !=
1439 ++ XenbusStateClosed &&
1440 ++ xenbus_read_driver_state(dev->otherend) !=
1441 ++ XenbusStateUnknown);
1442 + return netdev;
1443 +
1444 + exit:
1445 +diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
1446 +index ec91cd17bf34..5fb4ed6ea322 100644
1447 +--- a/drivers/pci/pci-sysfs.c
1448 ++++ b/drivers/pci/pci-sysfs.c
1449 +@@ -180,13 +180,16 @@ static ssize_t enable_store(struct device *dev, struct device_attribute *attr,
1450 + if (!capable(CAP_SYS_ADMIN))
1451 + return -EPERM;
1452 +
1453 +- if (!val) {
1454 +- if (pci_is_enabled(pdev))
1455 +- pci_disable_device(pdev);
1456 +- else
1457 +- result = -EIO;
1458 +- } else
1459 ++ device_lock(dev);
1460 ++ if (dev->driver)
1461 ++ result = -EBUSY;
1462 ++ else if (val)
1463 + result = pci_enable_device(pdev);
1464 ++ else if (pci_is_enabled(pdev))
1465 ++ pci_disable_device(pdev);
1466 ++ else
1467 ++ result = -EIO;
1468 ++ device_unlock(dev);
1469 +
1470 + return result < 0 ? result : count;
1471 + }
1472 +diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
1473 +index 271cca63e9bd..9aa82a4e9e25 100644
1474 +--- a/drivers/pinctrl/pinctrl-at91-pio4.c
1475 ++++ b/drivers/pinctrl/pinctrl-at91-pio4.c
1476 +@@ -568,8 +568,10 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
1477 + for_each_child_of_node(np_config, np) {
1478 + ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map,
1479 + &reserved_maps, num_maps);
1480 +- if (ret < 0)
1481 ++ if (ret < 0) {
1482 ++ of_node_put(np);
1483 + break;
1484 ++ }
1485 + }
1486 + }
1487 +
1488 +diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
1489 +index 2a44e5dd9c2a..c68556bf6f39 100644
1490 +--- a/drivers/regulator/pfuze100-regulator.c
1491 ++++ b/drivers/regulator/pfuze100-regulator.c
1492 +@@ -152,6 +152,7 @@ static struct regulator_ops pfuze100_sw_regulator_ops = {
1493 + static struct regulator_ops pfuze100_swb_regulator_ops = {
1494 + .enable = regulator_enable_regmap,
1495 + .disable = regulator_disable_regmap,
1496 ++ .is_enabled = regulator_is_enabled_regmap,
1497 + .list_voltage = regulator_list_voltage_table,
1498 + .map_voltage = regulator_map_voltage_ascend,
1499 + .set_voltage_sel = regulator_set_voltage_sel_regmap,
1500 +diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
1501 +index c2cf9485fe32..8c10f3db6336 100644
1502 +--- a/drivers/rtc/interface.c
1503 ++++ b/drivers/rtc/interface.c
1504 +@@ -349,6 +349,11 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
1505 + {
1506 + int err;
1507 +
1508 ++ if (!rtc->ops)
1509 ++ return -ENODEV;
1510 ++ else if (!rtc->ops->set_alarm)
1511 ++ return -EINVAL;
1512 ++
1513 + err = rtc_valid_tm(&alarm->time);
1514 + if (err != 0)
1515 + return err;
1516 +diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
1517 +index a56a7b243e91..5466246c69b4 100644
1518 +--- a/drivers/scsi/3w-9xxx.c
1519 ++++ b/drivers/scsi/3w-9xxx.c
1520 +@@ -889,6 +889,11 @@ static int twa_chrdev_open(struct inode *inode, struct file *file)
1521 + unsigned int minor_number;
1522 + int retval = TW_IOCTL_ERROR_OS_ENODEV;
1523 +
1524 ++ if (!capable(CAP_SYS_ADMIN)) {
1525 ++ retval = -EACCES;
1526 ++ goto out;
1527 ++ }
1528 ++
1529 + minor_number = iminor(inode);
1530 + if (minor_number >= twa_device_extension_count)
1531 + goto out;
1532 +diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
1533 +index 2940bd769936..14af38036287 100644
1534 +--- a/drivers/scsi/3w-xxxx.c
1535 ++++ b/drivers/scsi/3w-xxxx.c
1536 +@@ -1034,6 +1034,9 @@ static int tw_chrdev_open(struct inode *inode, struct file *file)
1537 +
1538 + dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n");
1539 +
1540 ++ if (!capable(CAP_SYS_ADMIN))
1541 ++ return -EACCES;
1542 ++
1543 + minor_number = iminor(inode);
1544 + if (minor_number >= tw_device_extension_count)
1545 + return -ENODEV;
1546 +diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
1547 +index 9d05302a3bcd..19bffe0b2cc0 100644
1548 +--- a/drivers/scsi/megaraid.c
1549 ++++ b/drivers/scsi/megaraid.c
1550 +@@ -4197,6 +4197,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1551 + int irq, i, j;
1552 + int error = -ENODEV;
1553 +
1554 ++ if (hba_count >= MAX_CONTROLLERS)
1555 ++ goto out;
1556 ++
1557 + if (pci_enable_device(pdev))
1558 + goto out;
1559 + pci_set_master(pdev);
1560 +diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
1561 +index 96007633ad39..213944ed64d9 100644
1562 +--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
1563 ++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
1564 +@@ -1886,6 +1886,9 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
1565 + pRAID_Context->timeoutValue = cpu_to_le16(os_timeout_value);
1566 + pRAID_Context->VirtualDiskTgtId = cpu_to_le16(device_id);
1567 + } else {
1568 ++ if (os_timeout_value)
1569 ++ os_timeout_value++;
1570 ++
1571 + /* system pd Fast Path */
1572 + io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST;
1573 + timeout_limit = (scmd->device->type == TYPE_DISK) ?
1574 +diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
1575 +index 5711d58f9e81..a8ebaeace154 100644
1576 +--- a/drivers/scsi/scsi_dh.c
1577 ++++ b/drivers/scsi/scsi_dh.c
1578 +@@ -58,7 +58,10 @@ static const struct scsi_dh_blist scsi_dh_blist[] = {
1579 + {"IBM", "3526", "rdac", },
1580 + {"IBM", "3542", "rdac", },
1581 + {"IBM", "3552", "rdac", },
1582 +- {"SGI", "TP9", "rdac", },
1583 ++ {"SGI", "TP9300", "rdac", },
1584 ++ {"SGI", "TP9400", "rdac", },
1585 ++ {"SGI", "TP9500", "rdac", },
1586 ++ {"SGI", "TP9700", "rdac", },
1587 + {"SGI", "IS", "rdac", },
1588 + {"STK", "OPENstorage", "rdac", },
1589 + {"STK", "FLEXLINE 380", "rdac", },
1590 +diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
1591 +index 4302880a20b3..e1639e80db53 100644
1592 +--- a/drivers/scsi/sg.c
1593 ++++ b/drivers/scsi/sg.c
1594 +@@ -2195,6 +2195,7 @@ sg_add_sfp(Sg_device * sdp)
1595 + write_lock_irqsave(&sdp->sfd_lock, iflags);
1596 + if (atomic_read(&sdp->detaching)) {
1597 + write_unlock_irqrestore(&sdp->sfd_lock, iflags);
1598 ++ kfree(sfp);
1599 + return ERR_PTR(-ENODEV);
1600 + }
1601 + list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
1602 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
1603 +index 18f26cf1e24d..8c58adadb728 100644
1604 +--- a/drivers/scsi/ufs/ufshcd.c
1605 ++++ b/drivers/scsi/ufs/ufshcd.c
1606 +@@ -3447,6 +3447,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
1607 + hba = container_of(work, struct ufs_hba, eeh_work);
1608 +
1609 + pm_runtime_get_sync(hba->dev);
1610 ++ scsi_block_requests(hba->host);
1611 + err = ufshcd_get_ee_status(hba, &status);
1612 + if (err) {
1613 + dev_err(hba->dev, "%s: failed to get exception status %d\n",
1614 +@@ -3462,6 +3463,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
1615 + __func__, err);
1616 + }
1617 + out:
1618 ++ scsi_unblock_requests(hba->host);
1619 + pm_runtime_put_sync(hba->dev);
1620 + return;
1621 + }
1622 +diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
1623 +index fa61eff88496..16d45a25284f 100644
1624 +--- a/drivers/thermal/samsung/exynos_tmu.c
1625 ++++ b/drivers/thermal/samsung/exynos_tmu.c
1626 +@@ -585,6 +585,7 @@ static int exynos5433_tmu_initialize(struct platform_device *pdev)
1627 + threshold_code = temp_to_code(data, temp);
1628 +
1629 + rising_threshold = readl(data->base + rising_reg_offset);
1630 ++ rising_threshold &= ~(0xff << j * 8);
1631 + rising_threshold |= (threshold_code << j * 8);
1632 + writel(rising_threshold, data->base + rising_reg_offset);
1633 +
1634 +diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
1635 +index 47b54c6aefd2..9f660e55d1ba 100644
1636 +--- a/drivers/tty/hvc/hvc_opal.c
1637 ++++ b/drivers/tty/hvc/hvc_opal.c
1638 +@@ -323,7 +323,6 @@ static void udbg_init_opal_common(void)
1639 + udbg_putc = udbg_opal_putc;
1640 + udbg_getc = udbg_opal_getc;
1641 + udbg_getc_poll = udbg_opal_getc_poll;
1642 +- tb_ticks_per_usec = 0x200; /* Make udelay not suck */
1643 + }
1644 +
1645 + void __init hvc_opal_init_early(void)
1646 +diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
1647 +index 96aa0ad32497..c8a2e5b0eff7 100644
1648 +--- a/drivers/tty/pty.c
1649 ++++ b/drivers/tty/pty.c
1650 +@@ -106,16 +106,19 @@ static void pty_unthrottle(struct tty_struct *tty)
1651 + static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
1652 + {
1653 + struct tty_struct *to = tty->link;
1654 ++ unsigned long flags;
1655 +
1656 + if (tty->stopped)
1657 + return 0;
1658 +
1659 + if (c > 0) {
1660 ++ spin_lock_irqsave(&to->port->lock, flags);
1661 + /* Stuff the data into the input queue of the other end */
1662 + c = tty_insert_flip_string(to->port, buf, c);
1663 + /* And shovel */
1664 + if (c)
1665 + tty_flip_buffer_push(to->port);
1666 ++ spin_unlock_irqrestore(&to->port->lock, flags);
1667 + }
1668 + return c;
1669 + }
1670 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1671 +index 93756664592a..2facffea2ee0 100644
1672 +--- a/drivers/usb/core/hub.c
1673 ++++ b/drivers/usb/core/hub.c
1674 +@@ -3308,6 +3308,10 @@ static int wait_for_ss_port_enable(struct usb_device *udev,
1675 + while (delay_ms < 2000) {
1676 + if (status || *portstatus & USB_PORT_STAT_CONNECTION)
1677 + break;
1678 ++ if (!port_is_power_on(hub, *portstatus)) {
1679 ++ status = -ENODEV;
1680 ++ break;
1681 ++ }
1682 + msleep(20);
1683 + delay_ms += 20;
1684 + status = hub_port_status(hub, *port1, portstatus, portchange);
1685 +diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
1686 +index 7cf26768ea0b..cbe9e2295752 100644
1687 +--- a/drivers/virtio/virtio_balloon.c
1688 ++++ b/drivers/virtio/virtio_balloon.c
1689 +@@ -479,7 +479,9 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
1690 + tell_host(vb, vb->inflate_vq);
1691 +
1692 + /* balloon's page migration 2nd step -- deflate "page" */
1693 ++ spin_lock_irqsave(&vb_dev_info->pages_lock, flags);
1694 + balloon_page_delete(page);
1695 ++ spin_unlock_irqrestore(&vb_dev_info->pages_lock, flags);
1696 + vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE;
1697 + set_page_pfns(vb, vb->pfns, page);
1698 + tell_host(vb, vb->deflate_vq);
1699 +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
1700 +index 88d9b66e2207..a751937dded5 100644
1701 +--- a/fs/btrfs/qgroup.c
1702 ++++ b/fs/btrfs/qgroup.c
1703 +@@ -2185,6 +2185,21 @@ void assert_qgroups_uptodate(struct btrfs_trans_handle *trans)
1704 + BUG();
1705 + }
1706 +
1707 ++/*
1708 ++ * Check if the leaf is the last leaf. Which means all node pointers
1709 ++ * are at their last position.
1710 ++ */
1711 ++static bool is_last_leaf(struct btrfs_path *path)
1712 ++{
1713 ++ int i;
1714 ++
1715 ++ for (i = 1; i < BTRFS_MAX_LEVEL && path->nodes[i]; i++) {
1716 ++ if (path->slots[i] != btrfs_header_nritems(path->nodes[i]) - 1)
1717 ++ return false;
1718 ++ }
1719 ++ return true;
1720 ++}
1721 ++
1722 + /*
1723 + * returns < 0 on error, 0 when more leafs are to be scanned.
1724 + * returns 1 when done.
1725 +@@ -2198,6 +2213,7 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
1726 + struct ulist *roots = NULL;
1727 + struct seq_list tree_mod_seq_elem = SEQ_LIST_INIT(tree_mod_seq_elem);
1728 + u64 num_bytes;
1729 ++ bool done;
1730 + int slot;
1731 + int ret;
1732 +
1733 +@@ -2225,6 +2241,7 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
1734 + mutex_unlock(&fs_info->qgroup_rescan_lock);
1735 + return ret;
1736 + }
1737 ++ done = is_last_leaf(path);
1738 +
1739 + btrfs_item_key_to_cpu(path->nodes[0], &found,
1740 + btrfs_header_nritems(path->nodes[0]) - 1);
1741 +@@ -2271,6 +2288,8 @@ out:
1742 + }
1743 + btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
1744 +
1745 ++ if (done && !ret)
1746 ++ ret = 1;
1747 + return ret;
1748 + }
1749 +
1750 +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
1751 +index 738f5d6beb95..2c7f9a5f8717 100644
1752 +--- a/fs/btrfs/tree-log.c
1753 ++++ b/fs/btrfs/tree-log.c
1754 +@@ -2961,8 +2961,11 @@ out_wake_log_root:
1755 + mutex_unlock(&log_root_tree->log_mutex);
1756 +
1757 + /*
1758 +- * The barrier before waitqueue_active is implied by mutex_unlock
1759 ++ * The barrier before waitqueue_active is needed so all the updates
1760 ++ * above are seen by the woken threads. It might not be necessary, but
1761 ++ * proving that seems to be hard.
1762 + */
1763 ++ smp_mb();
1764 + if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
1765 + wake_up(&log_root_tree->log_commit_wait[index2]);
1766 + out:
1767 +@@ -2973,8 +2976,11 @@ out:
1768 + mutex_unlock(&root->log_mutex);
1769 +
1770 + /*
1771 +- * The barrier before waitqueue_active is implied by mutex_unlock
1772 ++ * The barrier before waitqueue_active is needed so all the updates
1773 ++ * above are seen by the woken threads. It might not be necessary, but
1774 ++ * proving that seems to be hard.
1775 + */
1776 ++ smp_mb();
1777 + if (waitqueue_active(&root->log_commit_wait[index1]))
1778 + wake_up(&root->log_commit_wait[index1]);
1779 + return ret;
1780 +diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
1781 +index 092da164bdc0..e0fb7cdcee89 100644
1782 +--- a/fs/ext4/balloc.c
1783 ++++ b/fs/ext4/balloc.c
1784 +@@ -378,6 +378,8 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
1785 + return -EFSCORRUPTED;
1786 +
1787 + ext4_lock_group(sb, block_group);
1788 ++ if (buffer_verified(bh))
1789 ++ goto verified;
1790 + if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
1791 + desc, bh))) {
1792 + ext4_unlock_group(sb, block_group);
1793 +@@ -400,6 +402,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
1794 + return -EFSCORRUPTED;
1795 + }
1796 + set_buffer_verified(bh);
1797 ++verified:
1798 + ext4_unlock_group(sb, block_group);
1799 + return 0;
1800 + }
1801 +diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
1802 +index 48d818eba9c3..041117fd8fd7 100644
1803 +--- a/fs/ext4/ialloc.c
1804 ++++ b/fs/ext4/ialloc.c
1805 +@@ -88,6 +88,8 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
1806 + return -EFSCORRUPTED;
1807 +
1808 + ext4_lock_group(sb, block_group);
1809 ++ if (buffer_verified(bh))
1810 ++ goto verified;
1811 + blk = ext4_inode_bitmap(sb, desc);
1812 + if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
1813 + EXT4_INODES_PER_GROUP(sb) / 8)) {
1814 +@@ -105,6 +107,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
1815 + return -EFSBADCRC;
1816 + }
1817 + set_buffer_verified(bh);
1818 ++verified:
1819 + ext4_unlock_group(sb, block_group);
1820 + return 0;
1821 + }
1822 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
1823 +index e72f53a89764..c449bc089c94 100644
1824 +--- a/fs/ext4/inline.c
1825 ++++ b/fs/ext4/inline.c
1826 +@@ -678,6 +678,10 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,
1827 + goto convert;
1828 + }
1829 +
1830 ++ ret = ext4_journal_get_write_access(handle, iloc.bh);
1831 ++ if (ret)
1832 ++ goto out;
1833 ++
1834 + flags |= AOP_FLAG_NOFS;
1835 +
1836 + page = grab_cache_page_write_begin(mapping, 0, flags);
1837 +@@ -706,7 +710,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,
1838 + out_up_read:
1839 + up_read(&EXT4_I(inode)->xattr_sem);
1840 + out:
1841 +- if (handle)
1842 ++ if (handle && (ret != 1))
1843 + ext4_journal_stop(handle);
1844 + brelse(iloc.bh);
1845 + return ret;
1846 +@@ -748,6 +752,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
1847 +
1848 + ext4_write_unlock_xattr(inode, &no_expand);
1849 + brelse(iloc.bh);
1850 ++ mark_inode_dirty(inode);
1851 + out:
1852 + return copied;
1853 + }
1854 +@@ -894,7 +899,6 @@ retry_journal:
1855 + goto out;
1856 + }
1857 +
1858 +-
1859 + page = grab_cache_page_write_begin(mapping, 0, flags);
1860 + if (!page) {
1861 + ret = -ENOMEM;
1862 +@@ -912,6 +916,9 @@ retry_journal:
1863 + if (ret < 0)
1864 + goto out_release_page;
1865 + }
1866 ++ ret = ext4_journal_get_write_access(handle, iloc.bh);
1867 ++ if (ret)
1868 ++ goto out_release_page;
1869 +
1870 + up_read(&EXT4_I(inode)->xattr_sem);
1871 + *pagep = page;
1872 +@@ -932,7 +939,6 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos,
1873 + unsigned len, unsigned copied,
1874 + struct page *page)
1875 + {
1876 +- int i_size_changed = 0;
1877 + int ret;
1878 +
1879 + ret = ext4_write_inline_data_end(inode, pos, len, copied, page);
1880 +@@ -950,10 +956,8 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos,
1881 + * But it's important to update i_size while still holding page lock:
1882 + * page writeout could otherwise come in and zero beyond i_size.
1883 + */
1884 +- if (pos+copied > inode->i_size) {
1885 ++ if (pos+copied > inode->i_size)
1886 + i_size_write(inode, pos+copied);
1887 +- i_size_changed = 1;
1888 +- }
1889 + unlock_page(page);
1890 + page_cache_release(page);
1891 +
1892 +@@ -963,8 +967,7 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos,
1893 + * ordering of page lock and transaction start for journaling
1894 + * filesystems.
1895 + */
1896 +- if (i_size_changed)
1897 +- mark_inode_dirty(inode);
1898 ++ mark_inode_dirty(inode);
1899 +
1900 + return copied;
1901 + }
1902 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1903 +index b507de0e4bbf..181db3c7f5d1 100644
1904 +--- a/fs/ext4/inode.c
1905 ++++ b/fs/ext4/inode.c
1906 +@@ -1164,9 +1164,10 @@ static int ext4_write_end(struct file *file,
1907 + loff_t old_size = inode->i_size;
1908 + int ret = 0, ret2;
1909 + int i_size_changed = 0;
1910 ++ int inline_data = ext4_has_inline_data(inode);
1911 +
1912 + trace_ext4_write_end(inode, pos, len, copied);
1913 +- if (ext4_has_inline_data(inode)) {
1914 ++ if (inline_data) {
1915 + ret = ext4_write_inline_data_end(inode, pos, len,
1916 + copied, page);
1917 + if (ret < 0) {
1918 +@@ -1194,7 +1195,7 @@ static int ext4_write_end(struct file *file,
1919 + * ordering of page lock and transaction start for journaling
1920 + * filesystems.
1921 + */
1922 +- if (i_size_changed)
1923 ++ if (i_size_changed || inline_data)
1924 + ext4_mark_inode_dirty(handle, inode);
1925 +
1926 + if (pos + len > inode->i_size && ext4_can_truncate(inode))
1927 +@@ -1268,6 +1269,7 @@ static int ext4_journalled_write_end(struct file *file,
1928 + int partial = 0;
1929 + unsigned from, to;
1930 + int size_changed = 0;
1931 ++ int inline_data = ext4_has_inline_data(inode);
1932 +
1933 + trace_ext4_journalled_write_end(inode, pos, len, copied);
1934 + from = pos & (PAGE_CACHE_SIZE - 1);
1935 +@@ -1275,7 +1277,7 @@ static int ext4_journalled_write_end(struct file *file,
1936 +
1937 + BUG_ON(!ext4_handle_valid(handle));
1938 +
1939 +- if (ext4_has_inline_data(inode)) {
1940 ++ if (inline_data) {
1941 + ret = ext4_write_inline_data_end(inode, pos, len,
1942 + copied, page);
1943 + if (ret < 0) {
1944 +@@ -1306,7 +1308,7 @@ static int ext4_journalled_write_end(struct file *file,
1945 + if (old_size < pos)
1946 + pagecache_isize_extended(inode, old_size, pos);
1947 +
1948 +- if (size_changed) {
1949 ++ if (size_changed || inline_data) {
1950 + ret2 = ext4_mark_inode_dirty(handle, inode);
1951 + if (!ret)
1952 + ret = ret2;
1953 +@@ -1804,11 +1806,7 @@ static int __ext4_journalled_writepage(struct page *page,
1954 + }
1955 +
1956 + if (inline_data) {
1957 +- BUFFER_TRACE(inode_bh, "get write access");
1958 +- ret = ext4_journal_get_write_access(handle, inode_bh);
1959 +-
1960 +- err = ext4_handle_dirty_metadata(handle, inode, inode_bh);
1961 +-
1962 ++ ret = ext4_mark_inode_dirty(handle, inode);
1963 + } else {
1964 + ret = ext4_walk_page_buffers(handle, page_bufs, 0, len, NULL,
1965 + do_journal_get_write_access);
1966 +diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
1967 +index f77b3258454a..2bba0c4ef4b7 100644
1968 +--- a/fs/f2fs/segment.c
1969 ++++ b/fs/f2fs/segment.c
1970 +@@ -295,6 +295,9 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi)
1971 +
1972 + void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi)
1973 + {
1974 ++ if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
1975 ++ return;
1976 ++
1977 + /* try to shrink extent cache when there is no enough memory */
1978 + if (!available_free_memory(sbi, EXTENT_CACHE))
1979 + f2fs_shrink_extent_tree(sbi, EXTENT_CACHE_SHRINK_NUMBER);
1980 +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
1981 +index 4f666368aa85..6cc67e1bbb41 100644
1982 +--- a/fs/f2fs/super.c
1983 ++++ b/fs/f2fs/super.c
1984 +@@ -1566,6 +1566,12 @@ static int __init init_f2fs_fs(void)
1985 + {
1986 + int err;
1987 +
1988 ++ if (PAGE_SIZE != F2FS_BLKSIZE) {
1989 ++ printk("F2FS not supported on PAGE_SIZE(%lu) != %d\n",
1990 ++ PAGE_SIZE, F2FS_BLKSIZE);
1991 ++ return -EINVAL;
1992 ++ }
1993 ++
1994 + f2fs_build_trace_ios();
1995 +
1996 + err = init_inodecache();
1997 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
1998 +index 57e3262ec57a..ee0da259a3d3 100644
1999 +--- a/fs/nfsd/nfs4xdr.c
2000 ++++ b/fs/nfsd/nfs4xdr.c
2001 +@@ -1538,6 +1538,8 @@ nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
2002 + gdev->gd_maxcount = be32_to_cpup(p++);
2003 + num = be32_to_cpup(p++);
2004 + if (num) {
2005 ++ if (num > 1000)
2006 ++ goto xdr_error;
2007 + READ_BUF(4 * num);
2008 + gdev->gd_notify_types = be32_to_cpup(p++);
2009 + for (i = 1; i < num; i++) {
2010 +diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
2011 +index 0cea9b9236d0..82bc942fc437 100644
2012 +--- a/fs/squashfs/block.c
2013 ++++ b/fs/squashfs/block.c
2014 +@@ -166,6 +166,8 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
2015 + }
2016 +
2017 + if (compressed) {
2018 ++ if (!msblk->stream)
2019 ++ goto read_failure;
2020 + length = squashfs_decompress(msblk, bh, b, offset, length,
2021 + output);
2022 + if (length < 0)
2023 +diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
2024 +index 1cb70a0b2168..91ce49c05b7c 100644
2025 +--- a/fs/squashfs/cache.c
2026 ++++ b/fs/squashfs/cache.c
2027 +@@ -350,6 +350,9 @@ int squashfs_read_metadata(struct super_block *sb, void *buffer,
2028 +
2029 + TRACE("Entered squashfs_read_metadata [%llx:%x]\n", *block, *offset);
2030 +
2031 ++ if (unlikely(length < 0))
2032 ++ return -EIO;
2033 ++
2034 + while (length) {
2035 + entry = squashfs_cache_get(sb, msblk->block_cache, *block, 0);
2036 + if (entry->error) {
2037 +diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
2038 +index e5c9689062ba..1ec7bae2751d 100644
2039 +--- a/fs/squashfs/file.c
2040 ++++ b/fs/squashfs/file.c
2041 +@@ -194,7 +194,11 @@ static long long read_indexes(struct super_block *sb, int n,
2042 + }
2043 +
2044 + for (i = 0; i < blocks; i++) {
2045 +- int size = le32_to_cpu(blist[i]);
2046 ++ int size = squashfs_block_size(blist[i]);
2047 ++ if (size < 0) {
2048 ++ err = size;
2049 ++ goto failure;
2050 ++ }
2051 + block += SQUASHFS_COMPRESSED_SIZE_BLOCK(size);
2052 + }
2053 + n -= blocks;
2054 +@@ -367,7 +371,7 @@ static int read_blocklist(struct inode *inode, int index, u64 *block)
2055 + sizeof(size));
2056 + if (res < 0)
2057 + return res;
2058 +- return le32_to_cpu(size);
2059 ++ return squashfs_block_size(size);
2060 + }
2061 +
2062 + /* Copy data into page cache */
2063 +diff --git a/fs/squashfs/fragment.c b/fs/squashfs/fragment.c
2064 +index 0ed6edbc5c71..0681feab4a84 100644
2065 +--- a/fs/squashfs/fragment.c
2066 ++++ b/fs/squashfs/fragment.c
2067 +@@ -49,11 +49,16 @@ int squashfs_frag_lookup(struct super_block *sb, unsigned int fragment,
2068 + u64 *fragment_block)
2069 + {
2070 + struct squashfs_sb_info *msblk = sb->s_fs_info;
2071 +- int block = SQUASHFS_FRAGMENT_INDEX(fragment);
2072 +- int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET(fragment);
2073 +- u64 start_block = le64_to_cpu(msblk->fragment_index[block]);
2074 ++ int block, offset, size;
2075 + struct squashfs_fragment_entry fragment_entry;
2076 +- int size;
2077 ++ u64 start_block;
2078 ++
2079 ++ if (fragment >= msblk->fragments)
2080 ++ return -EIO;
2081 ++ block = SQUASHFS_FRAGMENT_INDEX(fragment);
2082 ++ offset = SQUASHFS_FRAGMENT_INDEX_OFFSET(fragment);
2083 ++
2084 ++ start_block = le64_to_cpu(msblk->fragment_index[block]);
2085 +
2086 + size = squashfs_read_metadata(sb, &fragment_entry, &start_block,
2087 + &offset, sizeof(fragment_entry));
2088 +@@ -61,9 +66,7 @@ int squashfs_frag_lookup(struct super_block *sb, unsigned int fragment,
2089 + return size;
2090 +
2091 + *fragment_block = le64_to_cpu(fragment_entry.start_block);
2092 +- size = le32_to_cpu(fragment_entry.size);
2093 +-
2094 +- return size;
2095 ++ return squashfs_block_size(fragment_entry.size);
2096 + }
2097 +
2098 +
2099 +diff --git a/fs/squashfs/squashfs_fs.h b/fs/squashfs/squashfs_fs.h
2100 +index 506f4ba5b983..e66486366f02 100644
2101 +--- a/fs/squashfs/squashfs_fs.h
2102 ++++ b/fs/squashfs/squashfs_fs.h
2103 +@@ -129,6 +129,12 @@
2104 +
2105 + #define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK))
2106 +
2107 ++static inline int squashfs_block_size(__le32 raw)
2108 ++{
2109 ++ u32 size = le32_to_cpu(raw);
2110 ++ return (size >> 25) ? -EIO : size;
2111 ++}
2112 ++
2113 + /*
2114 + * Inode number ops. Inodes consist of a compressed block number, and an
2115 + * uncompressed offset within that block
2116 +diff --git a/fs/squashfs/squashfs_fs_sb.h b/fs/squashfs/squashfs_fs_sb.h
2117 +index 1da565cb50c3..ef69c31947bf 100644
2118 +--- a/fs/squashfs/squashfs_fs_sb.h
2119 ++++ b/fs/squashfs/squashfs_fs_sb.h
2120 +@@ -75,6 +75,7 @@ struct squashfs_sb_info {
2121 + unsigned short block_log;
2122 + long long bytes_used;
2123 + unsigned int inodes;
2124 ++ unsigned int fragments;
2125 + int xattr_ids;
2126 + };
2127 + #endif
2128 +diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
2129 +index 5056babe00df..93aa3e23c845 100644
2130 +--- a/fs/squashfs/super.c
2131 ++++ b/fs/squashfs/super.c
2132 +@@ -176,6 +176,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
2133 + msblk->inode_table = le64_to_cpu(sblk->inode_table_start);
2134 + msblk->directory_table = le64_to_cpu(sblk->directory_table_start);
2135 + msblk->inodes = le32_to_cpu(sblk->inodes);
2136 ++ msblk->fragments = le32_to_cpu(sblk->fragments);
2137 + flags = le16_to_cpu(sblk->flags);
2138 +
2139 + TRACE("Found valid superblock on %s\n", bdevname(sb->s_bdev, b));
2140 +@@ -186,7 +187,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
2141 + TRACE("Filesystem size %lld bytes\n", msblk->bytes_used);
2142 + TRACE("Block size %d\n", msblk->block_size);
2143 + TRACE("Number of inodes %d\n", msblk->inodes);
2144 +- TRACE("Number of fragments %d\n", le32_to_cpu(sblk->fragments));
2145 ++ TRACE("Number of fragments %d\n", msblk->fragments);
2146 + TRACE("Number of ids %d\n", le16_to_cpu(sblk->no_ids));
2147 + TRACE("sblk->inode_table_start %llx\n", msblk->inode_table);
2148 + TRACE("sblk->directory_table_start %llx\n", msblk->directory_table);
2149 +@@ -273,7 +274,7 @@ allocate_id_index_table:
2150 + sb->s_export_op = &squashfs_export_ops;
2151 +
2152 + handle_fragments:
2153 +- fragments = le32_to_cpu(sblk->fragments);
2154 ++ fragments = msblk->fragments;
2155 + if (fragments == 0)
2156 + goto check_directory_table;
2157 +
2158 +diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
2159 +index bb9d0deca07c..0fb4975fae91 100644
2160 +--- a/include/drm/drm_dp_helper.h
2161 ++++ b/include/drm/drm_dp_helper.h
2162 +@@ -342,6 +342,7 @@
2163 + # define DP_PSR_FRAME_CAPTURE (1 << 3)
2164 + # define DP_PSR_SELECTIVE_UPDATE (1 << 4)
2165 + # define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS (1 << 5)
2166 ++# define DP_PSR_ENABLE_PSR2 (1 << 6) /* eDP 1.4a */
2167 +
2168 + #define DP_ADAPTER_CTRL 0x1a0
2169 + # define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0)
2170 +diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
2171 +index fc481037478a..19baa7f4f403 100644
2172 +--- a/include/linux/dma-iommu.h
2173 ++++ b/include/linux/dma-iommu.h
2174 +@@ -17,6 +17,7 @@
2175 + #define __DMA_IOMMU_H
2176 +
2177 + #ifdef __KERNEL__
2178 ++#include <linux/types.h>
2179 + #include <asm/errno.h>
2180 +
2181 + #ifdef CONFIG_IOMMU_DMA
2182 +diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
2183 +index 83430f2ea757..e0325706b76d 100644
2184 +--- a/include/linux/mmc/sdio_ids.h
2185 ++++ b/include/linux/mmc/sdio_ids.h
2186 +@@ -33,6 +33,7 @@
2187 + #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
2188 + #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
2189 + #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
2190 ++#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4
2191 + #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
2192 + #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
2193 + #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
2194 +diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
2195 +index 1d6a935c1ac5..8793f5a7b820 100644
2196 +--- a/include/linux/netfilter/ipset/ip_set_timeout.h
2197 ++++ b/include/linux/netfilter/ipset/ip_set_timeout.h
2198 +@@ -65,8 +65,14 @@ ip_set_timeout_set(unsigned long *timeout, u32 value)
2199 + static inline u32
2200 + ip_set_timeout_get(unsigned long *timeout)
2201 + {
2202 +- return *timeout == IPSET_ELEM_PERMANENT ? 0 :
2203 +- jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC;
2204 ++ u32 t;
2205 ++
2206 ++ if (*timeout == IPSET_ELEM_PERMANENT)
2207 ++ return 0;
2208 ++
2209 ++ t = jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC;
2210 ++ /* Zero value in userspace means no timeout */
2211 ++ return t == 0 ? 1 : t;
2212 + }
2213 +
2214 + #endif /* __KERNEL__ */
2215 +diff --git a/include/net/tcp.h b/include/net/tcp.h
2216 +index 65babd8a682d..cac4a6ad5db3 100644
2217 +--- a/include/net/tcp.h
2218 ++++ b/include/net/tcp.h
2219 +@@ -376,7 +376,7 @@ ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
2220 + struct pipe_inode_info *pipe, size_t len,
2221 + unsigned int flags);
2222 +
2223 +-void tcp_enter_quickack_mode(struct sock *sk);
2224 ++void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks);
2225 + static inline void tcp_dec_quickack_mode(struct sock *sk,
2226 + const unsigned int pkts)
2227 + {
2228 +diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
2229 +index 44202ff897fd..f759e0918037 100644
2230 +--- a/include/soc/tegra/mc.h
2231 ++++ b/include/soc/tegra/mc.h
2232 +@@ -99,6 +99,8 @@ struct tegra_mc_soc {
2233 + u8 client_id_mask;
2234 +
2235 + const struct tegra_smmu_soc *smmu;
2236 ++
2237 ++ u32 intmask;
2238 + };
2239 +
2240 + struct tegra_mc {
2241 +diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
2242 +index b8ff9e193753..b57f929f1b46 100644
2243 +--- a/kernel/auditfilter.c
2244 ++++ b/kernel/auditfilter.c
2245 +@@ -406,7 +406,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
2246 + return -EINVAL;
2247 + break;
2248 + case AUDIT_EXE:
2249 +- if (f->op != Audit_equal)
2250 ++ if (f->op != Audit_not_equal && f->op != Audit_equal)
2251 + return -EINVAL;
2252 + if (entry->rule.listnr != AUDIT_FILTER_EXIT)
2253 + return -EINVAL;
2254 +diff --git a/kernel/auditsc.c b/kernel/auditsc.c
2255 +index 7444f95f3ee9..0fe8b337291a 100644
2256 +--- a/kernel/auditsc.c
2257 ++++ b/kernel/auditsc.c
2258 +@@ -470,6 +470,8 @@ static int audit_filter_rules(struct task_struct *tsk,
2259 + break;
2260 + case AUDIT_EXE:
2261 + result = audit_exe_compare(tsk, rule->exe);
2262 ++ if (f->op == Audit_not_equal)
2263 ++ result = !result;
2264 + break;
2265 + case AUDIT_UID:
2266 + result = audit_uid_comparator(cred->uid, f->op, f->uid);
2267 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
2268 +index 79e3c21a35d0..35dfa9e9d69e 100644
2269 +--- a/kernel/bpf/verifier.c
2270 ++++ b/kernel/bpf/verifier.c
2271 +@@ -2101,7 +2101,7 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env)
2272 + /* hold the map. If the program is rejected by verifier,
2273 + * the map will be released by release_maps() or it
2274 + * will be used by the valid program until it's unloaded
2275 +- * and all maps are released in free_bpf_prog_info()
2276 ++ * and all maps are released in free_used_maps()
2277 + */
2278 + map = bpf_map_inc(map, false);
2279 + if (IS_ERR(map)) {
2280 +@@ -2487,7 +2487,7 @@ free_log_buf:
2281 + vfree(log_buf);
2282 + if (!env->prog->aux->used_maps)
2283 + /* if we didn't copy map pointers into bpf_prog_info, release
2284 +- * them now. Otherwise free_bpf_prog_info() will release them.
2285 ++ * them now. Otherwise free_used_maps() will release them.
2286 + */
2287 + release_maps(env);
2288 + *prog = env->prog;
2289 +diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
2290 +index 2172dd61577e..b8a894adab2c 100644
2291 +--- a/kernel/trace/trace_events_trigger.c
2292 ++++ b/kernel/trace/trace_events_trigger.c
2293 +@@ -663,6 +663,8 @@ event_trigger_callback(struct event_command *cmd_ops,
2294 + goto out_free;
2295 +
2296 + out_reg:
2297 ++ /* Up the trigger_data count to make sure reg doesn't free it on failure */
2298 ++ event_trigger_init(trigger_ops, trigger_data);
2299 + ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
2300 + /*
2301 + * The above returns on success the # of functions enabled,
2302 +@@ -670,11 +672,13 @@ event_trigger_callback(struct event_command *cmd_ops,
2303 + * Consider no functions a failure too.
2304 + */
2305 + if (!ret) {
2306 ++ cmd_ops->unreg(glob, trigger_ops, trigger_data, file);
2307 + ret = -ENOENT;
2308 +- goto out_free;
2309 +- } else if (ret < 0)
2310 +- goto out_free;
2311 +- ret = 0;
2312 ++ } else if (ret > 0)
2313 ++ ret = 0;
2314 ++
2315 ++ /* Down the counter of trigger_data or free it if not used anymore */
2316 ++ event_trigger_free(trigger_ops, trigger_data);
2317 + out:
2318 + return ret;
2319 +
2320 +@@ -1227,6 +1231,9 @@ event_enable_trigger_func(struct event_command *cmd_ops,
2321 + goto out;
2322 + }
2323 +
2324 ++ /* Up the trigger_data count to make sure nothing frees it on failure */
2325 ++ event_trigger_init(trigger_ops, trigger_data);
2326 ++
2327 + if (trigger) {
2328 + number = strsep(&trigger, ":");
2329 +
2330 +@@ -1277,6 +1284,7 @@ event_enable_trigger_func(struct event_command *cmd_ops,
2331 + goto out_disable;
2332 + /* Just return zero, not the number of enabled functions */
2333 + ret = 0;
2334 ++ event_trigger_free(trigger_ops, trigger_data);
2335 + out:
2336 + return ret;
2337 +
2338 +@@ -1287,7 +1295,7 @@ event_enable_trigger_func(struct event_command *cmd_ops,
2339 + out_free:
2340 + if (cmd_ops->set_filter)
2341 + cmd_ops->set_filter(NULL, trigger_data, NULL);
2342 +- kfree(trigger_data);
2343 ++ event_trigger_free(trigger_ops, trigger_data);
2344 + kfree(enable_data);
2345 + goto out;
2346 + }
2347 +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
2348 +index f2682799c215..f0ee722be520 100644
2349 +--- a/kernel/trace/trace_kprobe.c
2350 ++++ b/kernel/trace/trace_kprobe.c
2351 +@@ -349,11 +349,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
2352 + static int
2353 + enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
2354 + {
2355 ++ struct event_file_link *link = NULL;
2356 + int ret = 0;
2357 +
2358 + if (file) {
2359 +- struct event_file_link *link;
2360 +-
2361 + link = kmalloc(sizeof(*link), GFP_KERNEL);
2362 + if (!link) {
2363 + ret = -ENOMEM;
2364 +@@ -373,6 +372,18 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
2365 + else
2366 + ret = enable_kprobe(&tk->rp.kp);
2367 + }
2368 ++
2369 ++ if (ret) {
2370 ++ if (file) {
2371 ++ /* Notice the if is true on not WARN() */
2372 ++ if (!WARN_ON_ONCE(!link))
2373 ++ list_del_rcu(&link->list);
2374 ++ kfree(link);
2375 ++ tk->tp.flags &= ~TP_FLAG_TRACE;
2376 ++ } else {
2377 ++ tk->tp.flags &= ~TP_FLAG_PROFILE;
2378 ++ }
2379 ++ }
2380 + out:
2381 + return ret;
2382 + }
2383 +diff --git a/mm/slub.c b/mm/slub.c
2384 +index 4cf3a9c768b1..2284c4333857 100644
2385 +--- a/mm/slub.c
2386 ++++ b/mm/slub.c
2387 +@@ -659,7 +659,7 @@ void object_err(struct kmem_cache *s, struct page *page,
2388 + print_trailer(s, page, object);
2389 + }
2390 +
2391 +-static void slab_err(struct kmem_cache *s, struct page *page,
2392 ++static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
2393 + const char *fmt, ...)
2394 + {
2395 + va_list args;
2396 +diff --git a/mm/vmalloc.c b/mm/vmalloc.c
2397 +index 8e3c9c5a3042..de8e372ece04 100644
2398 +--- a/mm/vmalloc.c
2399 ++++ b/mm/vmalloc.c
2400 +@@ -1460,7 +1460,7 @@ static void __vunmap(const void *addr, int deallocate_pages)
2401 + addr))
2402 + return;
2403 +
2404 +- area = remove_vm_area(addr);
2405 ++ area = find_vmap_area((unsigned long)addr)->vm;
2406 + if (unlikely(!area)) {
2407 + WARN(1, KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
2408 + addr);
2409 +@@ -1470,6 +1470,7 @@ static void __vunmap(const void *addr, int deallocate_pages)
2410 + debug_check_no_locks_freed(addr, get_vm_area_size(area));
2411 + debug_check_no_obj_freed(addr, get_vm_area_size(area));
2412 +
2413 ++ remove_vm_area(addr);
2414 + if (deallocate_pages) {
2415 + int i;
2416 +
2417 +diff --git a/net/dsa/slave.c b/net/dsa/slave.c
2418 +index 554c2a961ad5..48b28a7ecc7a 100644
2419 +--- a/net/dsa/slave.c
2420 ++++ b/net/dsa/slave.c
2421 +@@ -1099,6 +1099,9 @@ int dsa_slave_suspend(struct net_device *slave_dev)
2422 + {
2423 + struct dsa_slave_priv *p = netdev_priv(slave_dev);
2424 +
2425 ++ if (!netif_running(slave_dev))
2426 ++ return 0;
2427 ++
2428 + netif_device_detach(slave_dev);
2429 +
2430 + if (p->phy) {
2431 +@@ -1116,6 +1119,9 @@ int dsa_slave_resume(struct net_device *slave_dev)
2432 + {
2433 + struct dsa_slave_priv *p = netdev_priv(slave_dev);
2434 +
2435 ++ if (!netif_running(slave_dev))
2436 ++ return 0;
2437 ++
2438 + netif_device_attach(slave_dev);
2439 +
2440 + if (p->phy) {
2441 +diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
2442 +index 8f05816a8be2..015c33712803 100644
2443 +--- a/net/ipv4/fib_frontend.c
2444 ++++ b/net/ipv4/fib_frontend.c
2445 +@@ -289,19 +289,19 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)
2446 + return ip_hdr(skb)->daddr;
2447 +
2448 + in_dev = __in_dev_get_rcu(dev);
2449 +- BUG_ON(!in_dev);
2450 +
2451 + net = dev_net(dev);
2452 +
2453 + scope = RT_SCOPE_UNIVERSE;
2454 + if (!ipv4_is_zeronet(ip_hdr(skb)->saddr)) {
2455 ++ bool vmark = in_dev && IN_DEV_SRC_VMARK(in_dev);
2456 + struct flowi4 fl4 = {
2457 + .flowi4_iif = LOOPBACK_IFINDEX,
2458 + .flowi4_oif = l3mdev_master_ifindex_rcu(dev),
2459 + .daddr = ip_hdr(skb)->saddr,
2460 + .flowi4_tos = RT_TOS(ip_hdr(skb)->tos),
2461 + .flowi4_scope = scope,
2462 +- .flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0,
2463 ++ .flowi4_mark = vmark ? skb->mark : 0,
2464 + };
2465 + if (!fib_lookup(net, &fl4, &res, 0))
2466 + return FIB_RES_PREFSRC(net, res);
2467 +diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
2468 +index b34fa1bb278f..b2001b20e029 100644
2469 +--- a/net/ipv4/inet_fragment.c
2470 ++++ b/net/ipv4/inet_fragment.c
2471 +@@ -364,11 +364,6 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf,
2472 + {
2473 + struct inet_frag_queue *q;
2474 +
2475 +- if (frag_mem_limit(nf) > nf->high_thresh) {
2476 +- inet_frag_schedule_worker(f);
2477 +- return NULL;
2478 +- }
2479 +-
2480 + q = kmem_cache_zalloc(f->frags_cachep, GFP_ATOMIC);
2481 + if (!q)
2482 + return NULL;
2483 +@@ -405,6 +400,11 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
2484 + struct inet_frag_queue *q;
2485 + int depth = 0;
2486 +
2487 ++ if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh) {
2488 ++ inet_frag_schedule_worker(f);
2489 ++ return NULL;
2490 ++ }
2491 ++
2492 + if (frag_mem_limit(nf) > nf->low_thresh)
2493 + inet_frag_schedule_worker(f);
2494 +
2495 +diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
2496 +index 9d6b9c4c5f82..60f564db25a3 100644
2497 +--- a/net/ipv4/ipconfig.c
2498 ++++ b/net/ipv4/ipconfig.c
2499 +@@ -790,6 +790,11 @@ static void __init ic_bootp_init_ext(u8 *e)
2500 + */
2501 + static inline void __init ic_bootp_init(void)
2502 + {
2503 ++ /* Re-initialise all name servers to NONE, in case any were set via the
2504 ++ * "ip=" or "nfsaddrs=" kernel command line parameters: any IP addresses
2505 ++ * specified there will already have been decoded but are no longer
2506 ++ * needed
2507 ++ */
2508 + ic_nameservers_predef();
2509 +
2510 + dev_add_pack(&bootp_packet_type);
2511 +@@ -1423,6 +1428,13 @@ static int __init ip_auto_config(void)
2512 + int err;
2513 + unsigned int i;
2514 +
2515 ++ /* Initialise all name servers to NONE (but only if the "ip=" or
2516 ++ * "nfsaddrs=" kernel command line parameters weren't decoded, otherwise
2517 ++ * we'll overwrite the IP addresses specified there)
2518 ++ */
2519 ++ if (ic_set_manually == 0)
2520 ++ ic_nameservers_predef();
2521 ++
2522 + #ifdef CONFIG_PROC_FS
2523 + proc_create("pnp", S_IRUGO, init_net.proc_net, &pnp_seq_fops);
2524 + #endif /* CONFIG_PROC_FS */
2525 +@@ -1640,6 +1652,7 @@ static int __init ip_auto_config_setup(char *addrs)
2526 + return 1;
2527 + }
2528 +
2529 ++ /* Initialise all name servers to NONE */
2530 + ic_nameservers_predef();
2531 +
2532 + /* Parse string for static IP assignment. */
2533 +diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c
2534 +index e63b764e55ea..6300edf90e60 100644
2535 +--- a/net/ipv4/tcp_dctcp.c
2536 ++++ b/net/ipv4/tcp_dctcp.c
2537 +@@ -138,7 +138,7 @@ static void dctcp_ce_state_0_to_1(struct sock *sk)
2538 + */
2539 + if (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER)
2540 + __tcp_send_ack(sk, ca->prior_rcv_nxt);
2541 +- tcp_enter_quickack_mode(sk);
2542 ++ tcp_enter_quickack_mode(sk, 1);
2543 + }
2544 +
2545 + ca->prior_rcv_nxt = tp->rcv_nxt;
2546 +@@ -159,7 +159,7 @@ static void dctcp_ce_state_1_to_0(struct sock *sk)
2547 + */
2548 + if (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER)
2549 + __tcp_send_ack(sk, ca->prior_rcv_nxt);
2550 +- tcp_enter_quickack_mode(sk);
2551 ++ tcp_enter_quickack_mode(sk, 1);
2552 + }
2553 +
2554 + ca->prior_rcv_nxt = tp->rcv_nxt;
2555 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2556 +index 5c645069a09a..4a261e078082 100644
2557 +--- a/net/ipv4/tcp_input.c
2558 ++++ b/net/ipv4/tcp_input.c
2559 +@@ -176,21 +176,23 @@ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)
2560 + }
2561 + }
2562 +
2563 +-static void tcp_incr_quickack(struct sock *sk)
2564 ++static void tcp_incr_quickack(struct sock *sk, unsigned int max_quickacks)
2565 + {
2566 + struct inet_connection_sock *icsk = inet_csk(sk);
2567 + unsigned int quickacks = tcp_sk(sk)->rcv_wnd / (2 * icsk->icsk_ack.rcv_mss);
2568 +
2569 + if (quickacks == 0)
2570 + quickacks = 2;
2571 ++ quickacks = min(quickacks, max_quickacks);
2572 + if (quickacks > icsk->icsk_ack.quick)
2573 +- icsk->icsk_ack.quick = min(quickacks, TCP_MAX_QUICKACKS);
2574 ++ icsk->icsk_ack.quick = quickacks;
2575 + }
2576 +
2577 +-void tcp_enter_quickack_mode(struct sock *sk)
2578 ++void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks)
2579 + {
2580 + struct inet_connection_sock *icsk = inet_csk(sk);
2581 +- tcp_incr_quickack(sk);
2582 ++
2583 ++ tcp_incr_quickack(sk, max_quickacks);
2584 + icsk->icsk_ack.pingpong = 0;
2585 + icsk->icsk_ack.ato = TCP_ATO_MIN;
2586 + }
2587 +@@ -226,8 +228,10 @@ static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp)
2588 + tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
2589 + }
2590 +
2591 +-static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb)
2592 ++static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb)
2593 + {
2594 ++ struct tcp_sock *tp = tcp_sk(sk);
2595 ++
2596 + switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) {
2597 + case INET_ECN_NOT_ECT:
2598 + /* Funny extension: if ECT is not set on a segment,
2599 +@@ -235,31 +239,31 @@ static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb)
2600 + * it is probably a retransmit.
2601 + */
2602 + if (tp->ecn_flags & TCP_ECN_SEEN)
2603 +- tcp_enter_quickack_mode((struct sock *)tp);
2604 ++ tcp_enter_quickack_mode(sk, 2);
2605 + break;
2606 + case INET_ECN_CE:
2607 +- if (tcp_ca_needs_ecn((struct sock *)tp))
2608 +- tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_IS_CE);
2609 ++ if (tcp_ca_needs_ecn(sk))
2610 ++ tcp_ca_event(sk, CA_EVENT_ECN_IS_CE);
2611 +
2612 + if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) {
2613 + /* Better not delay acks, sender can have a very low cwnd */
2614 +- tcp_enter_quickack_mode((struct sock *)tp);
2615 ++ tcp_enter_quickack_mode(sk, 2);
2616 + tp->ecn_flags |= TCP_ECN_DEMAND_CWR;
2617 + }
2618 + tp->ecn_flags |= TCP_ECN_SEEN;
2619 + break;
2620 + default:
2621 +- if (tcp_ca_needs_ecn((struct sock *)tp))
2622 +- tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_NO_CE);
2623 ++ if (tcp_ca_needs_ecn(sk))
2624 ++ tcp_ca_event(sk, CA_EVENT_ECN_NO_CE);
2625 + tp->ecn_flags |= TCP_ECN_SEEN;
2626 + break;
2627 + }
2628 + }
2629 +
2630 +-static void tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb)
2631 ++static void tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb)
2632 + {
2633 +- if (tp->ecn_flags & TCP_ECN_OK)
2634 +- __tcp_ecn_check_ce(tp, skb);
2635 ++ if (tcp_sk(sk)->ecn_flags & TCP_ECN_OK)
2636 ++ __tcp_ecn_check_ce(sk, skb);
2637 + }
2638 +
2639 + static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th)
2640 +@@ -651,7 +655,7 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb)
2641 + /* The _first_ data packet received, initialize
2642 + * delayed ACK engine.
2643 + */
2644 +- tcp_incr_quickack(sk);
2645 ++ tcp_incr_quickack(sk, TCP_MAX_QUICKACKS);
2646 + icsk->icsk_ack.ato = TCP_ATO_MIN;
2647 + } else {
2648 + int m = now - icsk->icsk_ack.lrcvtime;
2649 +@@ -667,13 +671,13 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb)
2650 + /* Too long gap. Apparently sender failed to
2651 + * restart window, so that we send ACKs quickly.
2652 + */
2653 +- tcp_incr_quickack(sk);
2654 ++ tcp_incr_quickack(sk, TCP_MAX_QUICKACKS);
2655 + sk_mem_reclaim(sk);
2656 + }
2657 + }
2658 + icsk->icsk_ack.lrcvtime = now;
2659 +
2660 +- tcp_ecn_check_ce(tp, skb);
2661 ++ tcp_ecn_check_ce(sk, skb);
2662 +
2663 + if (skb->len >= 128)
2664 + tcp_grow_window(sk, skb);
2665 +@@ -4136,7 +4140,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb)
2666 + if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
2667 + before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
2668 + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
2669 +- tcp_enter_quickack_mode(sk);
2670 ++ tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
2671 +
2672 + if (tcp_is_sack(tp) && sysctl_tcp_dsack) {
2673 + u32 end_seq = TCP_SKB_CB(skb)->end_seq;
2674 +@@ -4364,7 +4368,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
2675 + struct sk_buff *skb1;
2676 + u32 seq, end_seq;
2677 +
2678 +- tcp_ecn_check_ce(tp, skb);
2679 ++ tcp_ecn_check_ce(sk, skb);
2680 +
2681 + if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
2682 + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPOFODROP);
2683 +@@ -4638,7 +4642,7 @@ queue_and_out:
2684 + tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
2685 +
2686 + out_of_window:
2687 +- tcp_enter_quickack_mode(sk);
2688 ++ tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
2689 + inet_csk_schedule_ack(sk);
2690 + drop:
2691 + __kfree_skb(skb);
2692 +@@ -4649,8 +4653,6 @@ drop:
2693 + if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt + tcp_receive_window(tp)))
2694 + goto out_of_window;
2695 +
2696 +- tcp_enter_quickack_mode(sk);
2697 +-
2698 + if (before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
2699 + /* Partial packet, seq < rcv_next < end_seq */
2700 + SOCK_DEBUG(sk, "partial packet: rcv_next %X seq %X - %X\n",
2701 +@@ -5676,7 +5678,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
2702 + * to stand against the temptation 8) --ANK
2703 + */
2704 + inet_csk_schedule_ack(sk);
2705 +- tcp_enter_quickack_mode(sk);
2706 ++ tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
2707 + inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
2708 + TCP_DELACK_MAX, TCP_RTO_MAX);
2709 +
2710 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
2711 +index 818400fddc9b..9708fff318d5 100644
2712 +--- a/net/netlink/af_netlink.c
2713 ++++ b/net/netlink/af_netlink.c
2714 +@@ -62,6 +62,7 @@
2715 + #include <asm/cacheflush.h>
2716 + #include <linux/hash.h>
2717 + #include <linux/genetlink.h>
2718 ++#include <linux/nospec.h>
2719 +
2720 + #include <net/net_namespace.h>
2721 + #include <net/sock.h>
2722 +@@ -654,6 +655,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol,
2723 +
2724 + if (protocol < 0 || protocol >= MAX_LINKS)
2725 + return -EPROTONOSUPPORT;
2726 ++ protocol = array_index_nospec(protocol, MAX_LINKS);
2727 +
2728 + netlink_lock_table();
2729 + #ifdef CONFIG_MODULES
2730 +diff --git a/net/socket.c b/net/socket.c
2731 +index 5b31e5baf3b5..0c544ae48eac 100644
2732 +--- a/net/socket.c
2733 ++++ b/net/socket.c
2734 +@@ -89,6 +89,7 @@
2735 + #include <linux/magic.h>
2736 + #include <linux/slab.h>
2737 + #include <linux/xattr.h>
2738 ++#include <linux/nospec.h>
2739 +
2740 + #include <asm/uaccess.h>
2741 + #include <asm/unistd.h>
2742 +@@ -2324,6 +2325,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2743 +
2744 + if (call < 1 || call > SYS_SENDMMSG)
2745 + return -EINVAL;
2746 ++ call = array_index_nospec(call, SYS_SENDMMSG + 1);
2747 +
2748 + len = nargs[call];
2749 + if (len > sizeof(a))
2750 +diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
2751 +index 14a305bd8a98..72e442d86bb1 100644
2752 +--- a/sound/pci/emu10k1/emupcm.c
2753 ++++ b/sound/pci/emu10k1/emupcm.c
2754 +@@ -1850,7 +1850,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
2755 + if (!kctl)
2756 + return -ENOMEM;
2757 + kctl->id.device = device;
2758 +- snd_ctl_add(emu->card, kctl);
2759 ++ err = snd_ctl_add(emu->card, kctl);
2760 ++ if (err < 0)
2761 ++ return err;
2762 +
2763 + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);
2764 +
2765 +diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
2766 +index 4f1f69be1865..8c778fa33031 100644
2767 +--- a/sound/pci/emu10k1/memory.c
2768 ++++ b/sound/pci/emu10k1/memory.c
2769 +@@ -237,13 +237,13 @@ __found_pages:
2770 + static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr)
2771 + {
2772 + if (addr & ~emu->dma_mask) {
2773 +- dev_err(emu->card->dev,
2774 ++ dev_err_ratelimited(emu->card->dev,
2775 + "max memory size is 0x%lx (addr = 0x%lx)!!\n",
2776 + emu->dma_mask, (unsigned long)addr);
2777 + return 0;
2778 + }
2779 + if (addr & (EMUPAGESIZE-1)) {
2780 +- dev_err(emu->card->dev, "page is not aligned\n");
2781 ++ dev_err_ratelimited(emu->card->dev, "page is not aligned\n");
2782 + return 0;
2783 + }
2784 + return 1;
2785 +@@ -334,7 +334,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
2786 + else
2787 + addr = snd_pcm_sgbuf_get_addr(substream, ofs);
2788 + if (! is_valid_page(emu, addr)) {
2789 +- dev_err(emu->card->dev,
2790 ++ dev_err_ratelimited(emu->card->dev,
2791 + "emu: failure page = %d\n", idx);
2792 + mutex_unlock(&hdr->block_mutex);
2793 + return NULL;
2794 +diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
2795 +index 1fdd92b6f18f..d6e89a6d0bb9 100644
2796 +--- a/sound/pci/fm801.c
2797 ++++ b/sound/pci/fm801.c
2798 +@@ -1050,11 +1050,19 @@ static int snd_fm801_mixer(struct fm801 *chip)
2799 + if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0)
2800 + return err;
2801 + }
2802 +- for (i = 0; i < FM801_CONTROLS; i++)
2803 +- snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls[i], chip));
2804 ++ for (i = 0; i < FM801_CONTROLS; i++) {
2805 ++ err = snd_ctl_add(chip->card,
2806 ++ snd_ctl_new1(&snd_fm801_controls[i], chip));
2807 ++ if (err < 0)
2808 ++ return err;
2809 ++ }
2810 + if (chip->multichannel) {
2811 +- for (i = 0; i < FM801_CONTROLS_MULTI; i++)
2812 +- snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls_multi[i], chip));
2813 ++ for (i = 0; i < FM801_CONTROLS_MULTI; i++) {
2814 ++ err = snd_ctl_add(chip->card,
2815 ++ snd_ctl_new1(&snd_fm801_controls_multi[i], chip));
2816 ++ if (err < 0)
2817 ++ return err;
2818 ++ }
2819 + }
2820 + return 0;
2821 + }
2822 +diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
2823 +index 29e1ce2263bc..c55c0131be0a 100644
2824 +--- a/sound/pci/hda/patch_ca0132.c
2825 ++++ b/sound/pci/hda/patch_ca0132.c
2826 +@@ -38,6 +38,10 @@
2827 + /* Enable this to see controls for tuning purpose. */
2828 + /*#define ENABLE_TUNING_CONTROLS*/
2829 +
2830 ++#ifdef ENABLE_TUNING_CONTROLS
2831 ++#include <sound/tlv.h>
2832 ++#endif
2833 ++
2834 + #define FLOAT_ZERO 0x00000000
2835 + #define FLOAT_ONE 0x3f800000
2836 + #define FLOAT_TWO 0x40000000
2837 +@@ -3067,8 +3071,8 @@ static int equalizer_ctl_put(struct snd_kcontrol *kcontrol,
2838 + return 1;
2839 + }
2840 +
2841 +-static const DECLARE_TLV_DB_SCALE(voice_focus_db_scale, 2000, 100, 0);
2842 +-static const DECLARE_TLV_DB_SCALE(eq_db_scale, -2400, 100, 0);
2843 ++static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(voice_focus_db_scale, 2000, 100, 0);
2844 ++static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0);
2845 +
2846 + static int add_tuning_control(struct hda_codec *codec,
2847 + hda_nid_t pnid, hda_nid_t nid,
2848 +diff --git a/sound/soc/pxa/brownstone.c b/sound/soc/pxa/brownstone.c
2849 +index 6147e86e9b0f..55ca9c9364b8 100644
2850 +--- a/sound/soc/pxa/brownstone.c
2851 ++++ b/sound/soc/pxa/brownstone.c
2852 +@@ -136,3 +136,4 @@ module_platform_driver(mmp_driver);
2853 + MODULE_AUTHOR("Leo Yan <leoy@×××××××.com>");
2854 + MODULE_DESCRIPTION("ALSA SoC Brownstone");
2855 + MODULE_LICENSE("GPL");
2856 ++MODULE_ALIAS("platform:brownstone-audio");
2857 +diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c
2858 +index 29bc60e85e92..6cd28f95d548 100644
2859 +--- a/sound/soc/pxa/mioa701_wm9713.c
2860 ++++ b/sound/soc/pxa/mioa701_wm9713.c
2861 +@@ -203,3 +203,4 @@ module_platform_driver(mioa701_wm9713_driver);
2862 + MODULE_AUTHOR("Robert Jarzmik (rjarzmik@××××.fr)");
2863 + MODULE_DESCRIPTION("ALSA SoC WM9713 MIO A701");
2864 + MODULE_LICENSE("GPL");
2865 ++MODULE_ALIAS("platform:mioa701-wm9713");
2866 +diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c
2867 +index 51e790d006f5..96df9b2d8fc4 100644
2868 +--- a/sound/soc/pxa/mmp-pcm.c
2869 ++++ b/sound/soc/pxa/mmp-pcm.c
2870 +@@ -248,3 +248,4 @@ module_platform_driver(mmp_pcm_driver);
2871 + MODULE_AUTHOR("Leo Yan <leoy@×××××××.com>");
2872 + MODULE_DESCRIPTION("MMP Soc Audio DMA module");
2873 + MODULE_LICENSE("GPL");
2874 ++MODULE_ALIAS("platform:mmp-pcm-audio");
2875 +diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
2876 +index eca60c29791a..ca8b23f8c525 100644
2877 +--- a/sound/soc/pxa/mmp-sspa.c
2878 ++++ b/sound/soc/pxa/mmp-sspa.c
2879 +@@ -482,3 +482,4 @@ module_platform_driver(asoc_mmp_sspa_driver);
2880 + MODULE_AUTHOR("Leo Yan <leoy@×××××××.com>");
2881 + MODULE_DESCRIPTION("MMP SSPA SoC Interface");
2882 + MODULE_LICENSE("GPL");
2883 ++MODULE_ALIAS("platform:mmp-sspa-dai");
2884 +diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
2885 +index 4e74d9573f03..bcc81e920a67 100644
2886 +--- a/sound/soc/pxa/palm27x.c
2887 ++++ b/sound/soc/pxa/palm27x.c
2888 +@@ -161,3 +161,4 @@ module_platform_driver(palm27x_wm9712_driver);
2889 + MODULE_AUTHOR("Marek Vasut <marek.vasut@×××××.com>");
2890 + MODULE_DESCRIPTION("ALSA SoC Palm T|X, T5 and LifeDrive");
2891 + MODULE_LICENSE("GPL");
2892 ++MODULE_ALIAS("platform:palm27x-asoc");
2893 +diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
2894 +index da03fad1b9cd..3cad990dad2c 100644
2895 +--- a/sound/soc/pxa/pxa-ssp.c
2896 ++++ b/sound/soc/pxa/pxa-ssp.c
2897 +@@ -833,3 +833,4 @@ module_platform_driver(asoc_ssp_driver);
2898 + MODULE_AUTHOR("Mark Brown <broonie@×××××××××××××××××××××××.com>");
2899 + MODULE_DESCRIPTION("PXA SSP/PCM SoC Interface");
2900 + MODULE_LICENSE("GPL");
2901 ++MODULE_ALIAS("platform:pxa-ssp-dai");
2902 +diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
2903 +index f3de615aacd7..9615e6de1306 100644
2904 +--- a/sound/soc/pxa/pxa2xx-ac97.c
2905 ++++ b/sound/soc/pxa/pxa2xx-ac97.c
2906 +@@ -287,3 +287,4 @@ module_platform_driver(pxa2xx_ac97_driver);
2907 + MODULE_AUTHOR("Nicolas Pitre");
2908 + MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
2909 + MODULE_LICENSE("GPL");
2910 ++MODULE_ALIAS("platform:pxa2xx-ac97");
2911 +diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
2912 +index 9f390398d518..410d48b93031 100644
2913 +--- a/sound/soc/pxa/pxa2xx-pcm.c
2914 ++++ b/sound/soc/pxa/pxa2xx-pcm.c
2915 +@@ -117,3 +117,4 @@ module_platform_driver(pxa_pcm_driver);
2916 + MODULE_AUTHOR("Nicolas Pitre");
2917 + MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module");
2918 + MODULE_LICENSE("GPL");
2919 ++MODULE_ALIAS("platform:pxa-pcm-audio");
2920 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
2921 +index 977066ba1769..43b80db952d1 100644
2922 +--- a/sound/soc/soc-pcm.c
2923 ++++ b/sound/soc/soc-pcm.c
2924 +@@ -1682,8 +1682,10 @@ int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
2925 + continue;
2926 +
2927 + if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
2928 +- (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN))
2929 +- continue;
2930 ++ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) {
2931 ++ soc_pcm_hw_free(be_substream);
2932 ++ be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
2933 ++ }
2934 +
2935 + dev_dbg(be->dev, "ASoC: close BE %s\n",
2936 + dpcm->fe->dai_link->name);
2937 +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
2938 +index 8e8db4ddf365..a9079654107c 100644
2939 +--- a/sound/usb/pcm.c
2940 ++++ b/sound/usb/pcm.c
2941 +@@ -1300,7 +1300,7 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
2942 + if (bytes % (runtime->sample_bits >> 3) != 0) {
2943 + int oldbytes = bytes;
2944 + bytes = frames * stride;
2945 +- dev_warn(&subs->dev->dev,
2946 ++ dev_warn_ratelimited(&subs->dev->dev,
2947 + "Corrected urb data len. %d->%d\n",
2948 + oldbytes, bytes);
2949 + }
2950 +diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
2951 +index 9db9d21bb2ec..6a8db858caa5 100644
2952 +--- a/tools/usb/usbip/src/usbip_detach.c
2953 ++++ b/tools/usb/usbip/src/usbip_detach.c
2954 +@@ -43,7 +43,7 @@ void usbip_detach_usage(void)
2955 +
2956 + static int detach_port(char *port)
2957 + {
2958 +- int ret;
2959 ++ int ret = 0;
2960 + uint8_t portnum;
2961 + char path[PATH_MAX+1];
2962 +
2963 +@@ -73,9 +73,12 @@ static int detach_port(char *port)
2964 + }
2965 +
2966 + ret = usbip_vhci_detach_device(portnum);
2967 +- if (ret < 0)
2968 +- return -1;
2969 ++ if (ret < 0) {
2970 ++ ret = -1;
2971 ++ goto call_driver_close;
2972 ++ }
2973 +
2974 ++call_driver_close:
2975 + usbip_vhci_driver_close();
2976 +
2977 + return ret;