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, 01 Jul 2020 12:09:13
Message-Id: 1593605339.e9fefd89d63c0a1c31b269f37fb4729553a50411.mpagano@gentoo
1 commit: e9fefd89d63c0a1c31b269f37fb4729553a50411
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 1 12:08:59 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 1 12:08:59 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e9fefd89
7
8 Linux patch 4.4.229
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1228_linux-4.4.229.patch | 3466 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3470 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index b85027e..a090ee5 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -955,6 +955,10 @@ Patch: 1227_linux-4.4.228.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.228
23
24 +Patch: 1228_linux-4.4.229.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.229
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/1228_linux-4.4.229.patch b/1228_linux-4.4.229.patch
33 new file mode 100644
34 index 0000000..968e305
35 --- /dev/null
36 +++ b/1228_linux-4.4.229.patch
37 @@ -0,0 +1,3466 @@
38 +diff --git a/Makefile b/Makefile
39 +index 009a36b276f7..99b211904ac5 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 228
46 ++SUBLEVEL = 229
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
51 +index 532d4b08276d..fd996187fc5f 100644
52 +--- a/arch/arm/mach-imx/pm-imx5.c
53 ++++ b/arch/arm/mach-imx/pm-imx5.c
54 +@@ -301,14 +301,14 @@ static int __init imx_suspend_alloc_ocram(
55 + if (!ocram_pool) {
56 + pr_warn("%s: ocram pool unavailable!\n", __func__);
57 + ret = -ENODEV;
58 +- goto put_node;
59 ++ goto put_device;
60 + }
61 +
62 + ocram_base = gen_pool_alloc(ocram_pool, size);
63 + if (!ocram_base) {
64 + pr_warn("%s: unable to alloc ocram!\n", __func__);
65 + ret = -ENOMEM;
66 +- goto put_node;
67 ++ goto put_device;
68 + }
69 +
70 + phys = gen_pool_virt_to_phys(ocram_pool, ocram_base);
71 +@@ -318,6 +318,8 @@ static int __init imx_suspend_alloc_ocram(
72 + if (virt_out)
73 + *virt_out = virt;
74 +
75 ++put_device:
76 ++ put_device(&pdev->dev);
77 + put_node:
78 + of_node_put(node);
79 +
80 +diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
81 +index 3f62b35fb6f1..815c395a1076 100644
82 +--- a/arch/arm64/kernel/perf_regs.c
83 ++++ b/arch/arm64/kernel/perf_regs.c
84 +@@ -13,15 +13,34 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
85 + return 0;
86 +
87 + /*
88 +- * Compat (i.e. 32 bit) mode:
89 +- * - PC has been set in the pt_regs struct in kernel_entry,
90 +- * - Handle SP and LR here.
91 ++ * Our handling of compat tasks (PERF_SAMPLE_REGS_ABI_32) is weird, but
92 ++ * we're stuck with it for ABI compatability reasons.
93 ++ *
94 ++ * For a 32-bit consumer inspecting a 32-bit task, then it will look at
95 ++ * the first 16 registers (see arch/arm/include/uapi/asm/perf_regs.h).
96 ++ * These correspond directly to a prefix of the registers saved in our
97 ++ * 'struct pt_regs', with the exception of the PC, so we copy that down
98 ++ * (x15 corresponds to SP_hyp in the architecture).
99 ++ *
100 ++ * So far, so good.
101 ++ *
102 ++ * The oddity arises when a 64-bit consumer looks at a 32-bit task and
103 ++ * asks for registers beyond PERF_REG_ARM_MAX. In this case, we return
104 ++ * SP_usr, LR_usr and PC in the positions where the AArch64 SP, LR and
105 ++ * PC registers would normally live. The initial idea was to allow a
106 ++ * 64-bit unwinder to unwind a 32-bit task and, although it's not clear
107 ++ * how well that works in practice, somebody might be relying on it.
108 ++ *
109 ++ * At the time we make a sample, we don't know whether the consumer is
110 ++ * 32-bit or 64-bit, so we have to cater for both possibilities.
111 + */
112 + if (compat_user_mode(regs)) {
113 + if ((u32)idx == PERF_REG_ARM64_SP)
114 + return regs->compat_sp;
115 + if ((u32)idx == PERF_REG_ARM64_LR)
116 + return regs->compat_lr;
117 ++ if (idx == 15)
118 ++ return regs->pc;
119 + }
120 +
121 + if ((u32)idx == PERF_REG_ARM64_SP)
122 +diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
123 +index c17e8451d997..3fbe420f49c4 100644
124 +--- a/arch/openrisc/kernel/entry.S
125 ++++ b/arch/openrisc/kernel/entry.S
126 +@@ -1092,13 +1092,13 @@ ENTRY(__sys_clone)
127 + l.movhi r29,hi(sys_clone)
128 + l.ori r29,r29,lo(sys_clone)
129 + l.j _fork_save_extra_regs_and_call
130 +- l.addi r7,r1,0
131 ++ l.nop
132 +
133 + ENTRY(__sys_fork)
134 + l.movhi r29,hi(sys_fork)
135 + l.ori r29,r29,lo(sys_fork)
136 + l.j _fork_save_extra_regs_and_call
137 +- l.addi r3,r1,0
138 ++ l.nop
139 +
140 + ENTRY(sys_rt_sigreturn)
141 + l.j _sys_rt_sigreturn
142 +diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
143 +index 039b583db029..f0717eedf781 100644
144 +--- a/arch/powerpc/include/asm/kprobes.h
145 ++++ b/arch/powerpc/include/asm/kprobes.h
146 +@@ -29,6 +29,7 @@
147 + #include <linux/types.h>
148 + #include <linux/ptrace.h>
149 + #include <linux/percpu.h>
150 ++#include <linux/module.h>
151 + #include <asm/probes.h>
152 + #include <asm/code-patching.h>
153 +
154 +@@ -61,7 +62,7 @@ typedef ppc_opcode_t kprobe_opcode_t;
155 + #define kprobe_lookup_name(name, addr) \
156 + { \
157 + char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
158 +- char *modsym; \
159 ++ const char *modsym; \
160 + bool dot_appended = false; \
161 + if ((modsym = strchr(name, ':')) != NULL) { \
162 + modsym++; \
163 +diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
164 +index 8dff2b371219..a14d9b008f74 100644
165 +--- a/arch/powerpc/kernel/machine_kexec.c
166 ++++ b/arch/powerpc/kernel/machine_kexec.c
167 +@@ -113,11 +113,12 @@ void machine_kexec(struct kimage *image)
168 +
169 + void __init reserve_crashkernel(void)
170 + {
171 +- unsigned long long crash_size, crash_base;
172 ++ unsigned long long crash_size, crash_base, total_mem_sz;
173 + int ret;
174 +
175 ++ total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
176 + /* use common parsing */
177 +- ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
178 ++ ret = parse_crashkernel(boot_command_line, total_mem_sz,
179 + &crash_size, &crash_base);
180 + if (ret == 0 && crash_size > 0) {
181 + crashk_res.start = crash_base;
182 +@@ -176,6 +177,7 @@ void __init reserve_crashkernel(void)
183 + /* Crash kernel trumps memory limit */
184 + if (memory_limit && memory_limit <= crashk_res.end) {
185 + memory_limit = crashk_res.end + 1;
186 ++ total_mem_sz = memory_limit;
187 + printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
188 + memory_limit);
189 + }
190 +@@ -184,7 +186,7 @@ void __init reserve_crashkernel(void)
191 + "for crashkernel (System RAM: %ldMB)\n",
192 + (unsigned long)(crash_size >> 20),
193 + (unsigned long)(crashk_res.start >> 20),
194 +- (unsigned long)(memblock_phys_mem_size() >> 20));
195 ++ (unsigned long)(total_mem_sz >> 20));
196 +
197 + if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
198 + memblock_reserve(crashk_res.start, crash_size)) {
199 +diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
200 +index b0f34663b1ae..19bae78b1f25 100644
201 +--- a/arch/powerpc/platforms/ps3/mm.c
202 ++++ b/arch/powerpc/platforms/ps3/mm.c
203 +@@ -212,13 +212,14 @@ void ps3_mm_vas_destroy(void)
204 + {
205 + int result;
206 +
207 +- DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id);
208 +-
209 + if (map.vas_id) {
210 + result = lv1_select_virtual_address_space(0);
211 +- BUG_ON(result);
212 +- result = lv1_destruct_virtual_address_space(map.vas_id);
213 +- BUG_ON(result);
214 ++ result += lv1_destruct_virtual_address_space(map.vas_id);
215 ++
216 ++ if (result) {
217 ++ lv1_panic(0);
218 ++ }
219 ++
220 + map.vas_id = 0;
221 + }
222 + }
223 +@@ -316,19 +317,20 @@ static void ps3_mm_region_destroy(struct mem_region *r)
224 + int result;
225 +
226 + if (!r->destroy) {
227 +- pr_info("%s:%d: Not destroying high region: %llxh %llxh\n",
228 +- __func__, __LINE__, r->base, r->size);
229 + return;
230 + }
231 +
232 +- DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base);
233 +-
234 + if (r->base) {
235 + result = lv1_release_memory(r->base);
236 +- BUG_ON(result);
237 ++
238 ++ if (result) {
239 ++ lv1_panic(0);
240 ++ }
241 ++
242 + r->size = r->base = r->offset = 0;
243 + map.total = map.rm.size;
244 + }
245 ++
246 + ps3_mm_set_repository_highmem(NULL);
247 + }
248 +
249 +diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
250 +index 9795e52bab3d..9e817c1b7808 100644
251 +--- a/arch/powerpc/platforms/pseries/ras.c
252 ++++ b/arch/powerpc/platforms/pseries/ras.c
253 +@@ -265,10 +265,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
254 + /*
255 + * Some versions of FWNMI place the buffer inside the 4kB page starting at
256 + * 0x7000. Other versions place it inside the rtas buffer. We check both.
257 ++ * Minimum size of the buffer is 16 bytes.
258 + */
259 + #define VALID_FWNMI_BUFFER(A) \
260 +- ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \
261 +- (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16))))
262 ++ ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \
263 ++ (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16))))
264 +
265 + /*
266 + * Get the error information for errors coming through the
267 +diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
268 +index 6bc941be6921..166fbd74e316 100644
269 +--- a/arch/s390/include/asm/syscall.h
270 ++++ b/arch/s390/include/asm/syscall.h
271 +@@ -41,7 +41,17 @@ static inline void syscall_rollback(struct task_struct *task,
272 + static inline long syscall_get_error(struct task_struct *task,
273 + struct pt_regs *regs)
274 + {
275 +- return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0;
276 ++ unsigned long error = regs->gprs[2];
277 ++#ifdef CONFIG_COMPAT
278 ++ if (test_tsk_thread_flag(task, TIF_31BIT)) {
279 ++ /*
280 ++ * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
281 ++ * and will match correctly in comparisons.
282 ++ */
283 ++ error = (long)(int)error;
284 ++ }
285 ++#endif
286 ++ return IS_ERR_VALUE(error) ? error : 0;
287 + }
288 +
289 + static inline long syscall_get_return_value(struct task_struct *task,
290 +diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
291 +index 396dbdea0cfa..2f4316c14266 100644
292 +--- a/arch/sparc/kernel/ptrace_32.c
293 ++++ b/arch/sparc/kernel/ptrace_32.c
294 +@@ -167,12 +167,17 @@ static int genregs32_set(struct task_struct *target,
295 + if (ret || !count)
296 + return ret;
297 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
298 +- &regs->y,
299 ++ &regs->npc,
300 + 34 * sizeof(u32), 35 * sizeof(u32));
301 + if (ret || !count)
302 + return ret;
303 ++ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
304 ++ &regs->y,
305 ++ 35 * sizeof(u32), 36 * sizeof(u32));
306 ++ if (ret || !count)
307 ++ return ret;
308 + return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
309 +- 35 * sizeof(u32), 38 * sizeof(u32));
310 ++ 36 * sizeof(u32), 38 * sizeof(u32));
311 + }
312 +
313 + static int fpregs32_get(struct task_struct *target,
314 +diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
315 +index c1566170964f..829592d5efe0 100644
316 +--- a/arch/sparc/kernel/ptrace_64.c
317 ++++ b/arch/sparc/kernel/ptrace_64.c
318 +@@ -534,13 +534,8 @@ static int genregs32_get(struct task_struct *target,
319 + &reg, sizeof(reg), 0)
320 + != sizeof(reg))
321 + return -EFAULT;
322 +- if (access_process_vm(target,
323 +- (unsigned long) u,
324 +- &reg, sizeof(reg), 1)
325 +- != sizeof(reg))
326 ++ if (put_user(reg, u++))
327 + return -EFAULT;
328 +- pos++;
329 +- u++;
330 + }
331 + }
332 + }
333 +@@ -639,11 +634,7 @@ static int genregs32_set(struct task_struct *target,
334 + }
335 + } else {
336 + for (; count > 0 && pos < 32; count--) {
337 +- if (access_process_vm(target,
338 +- (unsigned long)
339 +- u,
340 +- &reg, sizeof(reg), 0)
341 +- != sizeof(reg))
342 ++ if (get_user(reg, u++))
343 + return -EFAULT;
344 + if (access_process_vm(target,
345 + (unsigned long)
346 +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
347 +index 7c48aa03fe77..5a6cb30b1c62 100644
348 +--- a/arch/x86/kernel/kprobes/core.c
349 ++++ b/arch/x86/kernel/kprobes/core.c
350 +@@ -750,6 +750,13 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
351 + void *frame_pointer;
352 + bool skipped = false;
353 +
354 ++ /*
355 ++ * Set a dummy kprobe for avoiding kretprobe recursion.
356 ++ * Since kretprobe never run in kprobe handler, kprobe must not
357 ++ * be running at this point.
358 ++ */
359 ++ kprobe_busy_begin();
360 ++
361 + INIT_HLIST_HEAD(&empty_rp);
362 + kretprobe_hash_lock(current, &head, &flags);
363 + /* fixup registers */
364 +@@ -825,10 +832,9 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
365 + orig_ret_address = (unsigned long)ri->ret_addr;
366 + if (ri->rp && ri->rp->handler) {
367 + __this_cpu_write(current_kprobe, &ri->rp->kp);
368 +- get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
369 + ri->ret_addr = correct_ret_addr;
370 + ri->rp->handler(ri, regs);
371 +- __this_cpu_write(current_kprobe, NULL);
372 ++ __this_cpu_write(current_kprobe, &kprobe_busy);
373 + }
374 +
375 + recycle_rp_inst(ri, &empty_rp);
376 +@@ -844,6 +850,8 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
377 +
378 + kretprobe_hash_unlock(current, &flags);
379 +
380 ++ kprobe_busy_end();
381 ++
382 + hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
383 + hlist_del(&ri->hlist);
384 + kfree(ri);
385 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
386 +index aac60d1605ff..61fc92f92e0a 100644
387 +--- a/arch/x86/kvm/x86.c
388 ++++ b/arch/x86/kvm/x86.c
389 +@@ -2162,7 +2162,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
390 + return kvm_mtrr_set_msr(vcpu, msr, data);
391 + case MSR_IA32_APICBASE:
392 + return kvm_set_apic_base(vcpu, msr_info);
393 +- case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
394 ++ case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
395 + return kvm_x2apic_msr_write(vcpu, msr, data);
396 + case MSR_IA32_TSCDEADLINE:
397 + kvm_set_lapic_tscdeadline_msr(vcpu, data);
398 +@@ -2432,7 +2432,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
399 + case MSR_IA32_APICBASE:
400 + msr_info->data = kvm_get_apic_base(vcpu);
401 + break;
402 +- case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
403 ++ case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
404 + return kvm_x2apic_msr_read(vcpu, msr_info->index, &msr_info->data);
405 + break;
406 + case MSR_IA32_TSCDEADLINE:
407 +diff --git a/crypto/algboss.c b/crypto/algboss.c
408 +index 6e39d9c05b98..5cbc588555ca 100644
409 +--- a/crypto/algboss.c
410 ++++ b/crypto/algboss.c
411 +@@ -194,8 +194,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
412 + if (IS_ERR(thread))
413 + goto err_put_larval;
414 +
415 +- wait_for_completion_interruptible(&larval->completion);
416 +-
417 + return NOTIFY_STOP;
418 +
419 + err_put_larval:
420 +diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
421 +index ef3dfc90e817..13c308323e94 100644
422 +--- a/drivers/acpi/sysfs.c
423 ++++ b/drivers/acpi/sysfs.c
424 +@@ -776,13 +776,13 @@ static void __exit interrupt_stats_exit(void)
425 + }
426 +
427 + static ssize_t
428 +-acpi_show_profile(struct device *dev, struct device_attribute *attr,
429 ++acpi_show_profile(struct kobject *kobj, struct kobj_attribute *attr,
430 + char *buf)
431 + {
432 + return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
433 + }
434 +
435 +-static const struct device_attribute pm_profile_attr =
436 ++static const struct kobj_attribute pm_profile_attr =
437 + __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
438 +
439 + static ssize_t hotplug_enabled_show(struct kobject *kobj,
440 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
441 +index fc4bf8ff40ea..17cebfe5acc8 100644
442 +--- a/drivers/ata/libata-core.c
443 ++++ b/drivers/ata/libata-core.c
444 +@@ -56,7 +56,6 @@
445 + #include <linux/workqueue.h>
446 + #include <linux/scatterlist.h>
447 + #include <linux/io.h>
448 +-#include <linux/async.h>
449 + #include <linux/log2.h>
450 + #include <linux/slab.h>
451 + #include <linux/glob.h>
452 +@@ -6222,7 +6221,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
453 + /* perform each probe asynchronously */
454 + for (i = 0; i < host->n_ports; i++) {
455 + struct ata_port *ap = host->ports[i];
456 +- async_schedule(async_port_probe, ap);
457 ++ ap->cookie = async_schedule(async_port_probe, ap);
458 + }
459 +
460 + return 0;
461 +@@ -6355,11 +6354,11 @@ void ata_host_detach(struct ata_host *host)
462 + {
463 + int i;
464 +
465 +- /* Ensure ata_port probe has completed */
466 +- async_synchronize_full();
467 +-
468 +- for (i = 0; i < host->n_ports; i++)
469 ++ for (i = 0; i < host->n_ports; i++) {
470 ++ /* Ensure ata_port probe has completed */
471 ++ async_synchronize_cookie(host->ports[i]->cookie + 1);
472 + ata_port_detach(host->ports[i]);
473 ++ }
474 +
475 + /* the host is dead now, dissociate ACPI */
476 + ata_acpi_dissociate(host);
477 +diff --git a/drivers/base/platform.c b/drivers/base/platform.c
478 +index 065fcc4be263..f89cb143f1cd 100644
479 +--- a/drivers/base/platform.c
480 ++++ b/drivers/base/platform.c
481 +@@ -638,6 +638,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv,
482 + /* temporary section violation during probe() */
483 + drv->probe = probe;
484 + retval = code = __platform_driver_register(drv, module);
485 ++ if (retval)
486 ++ return retval;
487 +
488 + /*
489 + * Fixup that section violation, being paranoid about code scanning
490 +diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
491 +index c120d70d3fb3..fc7a20286090 100644
492 +--- a/drivers/block/ps3disk.c
493 ++++ b/drivers/block/ps3disk.c
494 +@@ -464,7 +464,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev)
495 + blk_queue_bounce_limit(queue, BLK_BOUNCE_HIGH);
496 +
497 + blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9);
498 +- blk_queue_segment_boundary(queue, -1UL);
499 + blk_queue_dma_alignment(queue, dev->blk_size-1);
500 + blk_queue_logical_block_size(queue, dev->blk_size);
501 +
502 +diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c
503 +index 95a4dd290f35..d7dd0417ef5e 100644
504 +--- a/drivers/clk/qcom/gcc-msm8916.c
505 ++++ b/drivers/clk/qcom/gcc-msm8916.c
506 +@@ -270,7 +270,7 @@ static struct clk_pll gpll0 = {
507 + .l_reg = 0x21004,
508 + .m_reg = 0x21008,
509 + .n_reg = 0x2100c,
510 +- .config_reg = 0x21014,
511 ++ .config_reg = 0x21010,
512 + .mode_reg = 0x21000,
513 + .status_reg = 0x2101c,
514 + .status_bit = 17,
515 +@@ -297,7 +297,7 @@ static struct clk_pll gpll1 = {
516 + .l_reg = 0x20004,
517 + .m_reg = 0x20008,
518 + .n_reg = 0x2000c,
519 +- .config_reg = 0x20014,
520 ++ .config_reg = 0x20010,
521 + .mode_reg = 0x20000,
522 + .status_reg = 0x2001c,
523 + .status_bit = 17,
524 +@@ -324,7 +324,7 @@ static struct clk_pll gpll2 = {
525 + .l_reg = 0x4a004,
526 + .m_reg = 0x4a008,
527 + .n_reg = 0x4a00c,
528 +- .config_reg = 0x4a014,
529 ++ .config_reg = 0x4a010,
530 + .mode_reg = 0x4a000,
531 + .status_reg = 0x4a01c,
532 + .status_bit = 17,
533 +@@ -351,7 +351,7 @@ static struct clk_pll bimc_pll = {
534 + .l_reg = 0x23004,
535 + .m_reg = 0x23008,
536 + .n_reg = 0x2300c,
537 +- .config_reg = 0x23014,
538 ++ .config_reg = 0x23010,
539 + .mode_reg = 0x23000,
540 + .status_reg = 0x2301c,
541 + .status_bit = 17,
542 +diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
543 +index 91c89ac193b9..77ae2d21c488 100644
544 +--- a/drivers/clk/samsung/clk-exynos5433.c
545 ++++ b/drivers/clk/samsung/clk-exynos5433.c
546 +@@ -1708,7 +1708,8 @@ static struct samsung_gate_clock peric_gate_clks[] __initdata = {
547 + GATE(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_pcm1_peric",
548 + ENABLE_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0),
549 + GATE(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_i2s1_peric",
550 +- ENABLE_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0),
551 ++ ENABLE_SCLK_PERIC, 6,
552 ++ CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0),
553 + GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC,
554 + 5, CLK_SET_RATE_PARENT, 0),
555 + GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC,
556 +diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
557 +index 9c79af0c03b2..2cec9e83831f 100644
558 +--- a/drivers/clk/sunxi/clk-sunxi.c
559 ++++ b/drivers/clk/sunxi/clk-sunxi.c
560 +@@ -311,7 +311,7 @@ static void sun6i_a31_get_pll1_factors(u32 *freq, u32 parent_rate,
561 + * Round down the frequency to the closest multiple of either
562 + * 6 or 16
563 + */
564 +- u32 round_freq_6 = round_down(freq_mhz, 6);
565 ++ u32 round_freq_6 = rounddown(freq_mhz, 6);
566 + u32 round_freq_16 = round_down(freq_mhz, 16);
567 +
568 + if (round_freq_6 > round_freq_16)
569 +diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c
570 +index dbef218fe5ec..14201c52b44b 100644
571 +--- a/drivers/clk/ti/composite.c
572 ++++ b/drivers/clk/ti/composite.c
573 +@@ -228,6 +228,7 @@ cleanup:
574 + if (!cclk->comp_clks[i])
575 + continue;
576 + list_del(&cclk->comp_clks[i]->link);
577 ++ kfree(cclk->comp_clks[i]->parent_names);
578 + kfree(cclk->comp_clks[i]);
579 + }
580 +
581 +diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
582 +index 341b8c686ec7..4aaaccf95b36 100644
583 +--- a/drivers/firmware/efi/esrt.c
584 ++++ b/drivers/firmware/efi/esrt.c
585 +@@ -182,7 +182,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
586 + rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
587 + "%s", name);
588 + if (rc) {
589 +- kfree(entry);
590 ++ kobject_put(&entry->kobj);
591 + return rc;
592 + }
593 + }
594 +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
595 +index bb25abba7ad0..51cdff2af8b2 100644
596 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c
597 ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c
598 +@@ -29,6 +29,7 @@
599 + #include <linux/i2c.h>
600 + #include <drm/drm_dp_mst_helper.h>
601 + #include <drm/drmP.h>
602 ++#include <linux/iopoll.h>
603 +
604 + #include <drm/drm_fixed.h>
605 +
606 +@@ -2647,6 +2648,17 @@ fail:
607 + return ret;
608 + }
609 +
610 ++static int do_get_act_status(struct drm_dp_aux *aux)
611 ++{
612 ++ int ret;
613 ++ u8 status;
614 ++
615 ++ ret = drm_dp_dpcd_readb(aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status);
616 ++ if (ret < 0)
617 ++ return ret;
618 ++
619 ++ return status;
620 ++}
621 +
622 + /**
623 + * drm_dp_check_act_status() - Check ACT handled status.
624 +@@ -2656,33 +2668,29 @@ fail:
625 + */
626 + int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr)
627 + {
628 +- u8 status;
629 +- int ret;
630 +- int count = 0;
631 +-
632 +- do {
633 +- ret = drm_dp_dpcd_readb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status);
634 +-
635 +- if (ret < 0) {
636 +- DRM_DEBUG_KMS("failed to read payload table status %d\n", ret);
637 +- goto fail;
638 +- }
639 +-
640 +- if (status & DP_PAYLOAD_ACT_HANDLED)
641 +- break;
642 +- count++;
643 +- udelay(100);
644 +-
645 +- } while (count < 30);
646 +-
647 +- if (!(status & DP_PAYLOAD_ACT_HANDLED)) {
648 +- DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n", status, count);
649 +- ret = -EINVAL;
650 +- goto fail;
651 ++ /*
652 ++ * There doesn't seem to be any recommended retry count or timeout in
653 ++ * the MST specification. Since some hubs have been observed to take
654 ++ * over 1 second to update their payload allocations under certain
655 ++ * conditions, we use a rather large timeout value.
656 ++ */
657 ++ const int timeout_ms = 3000;
658 ++ int ret, status;
659 ++
660 ++ ret = readx_poll_timeout(do_get_act_status, mgr->aux, status,
661 ++ status & DP_PAYLOAD_ACT_HANDLED || status < 0,
662 ++ 200, timeout_ms * USEC_PER_MSEC);
663 ++ if (ret < 0 && status >= 0) {
664 ++ DRM_DEBUG_KMS("Failed to get ACT after %dms, last status: %02x\n",
665 ++ timeout_ms, status);
666 ++ return -EINVAL;
667 ++ } else if (status < 0) {
668 ++ DRM_DEBUG_KMS("Failed to read payload table status: %d\n",
669 ++ status);
670 ++ return status;
671 + }
672 ++
673 + return 0;
674 +-fail:
675 +- return ret;
676 + }
677 + EXPORT_SYMBOL(drm_dp_check_act_status);
678 +
679 +diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
680 +index d18b88b755c3..5c595d9f7e8f 100644
681 +--- a/drivers/gpu/drm/drm_encoder_slave.c
682 ++++ b/drivers/gpu/drm/drm_encoder_slave.c
683 +@@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev,
684 +
685 + err = encoder_drv->encoder_init(client, dev, encoder);
686 + if (err)
687 +- goto fail_unregister;
688 ++ goto fail_module_put;
689 +
690 + if (info->platform_data)
691 + encoder->slave_funcs->set_config(&encoder->base,
692 +@@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev,
693 +
694 + return 0;
695 +
696 ++fail_module_put:
697 ++ module_put(module);
698 + fail_unregister:
699 + i2c_unregister_device(client);
700 +- module_put(module);
701 + fail:
702 + return err;
703 + }
704 +diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
705 +index b2977a181935..e8664a9f1e77 100644
706 +--- a/drivers/gpu/drm/qxl/qxl_kms.c
707 ++++ b/drivers/gpu/drm/qxl/qxl_kms.c
708 +@@ -199,7 +199,7 @@ static int qxl_device_init(struct qxl_device *qdev,
709 + &(qdev->ram_header->cursor_ring_hdr),
710 + sizeof(struct qxl_command),
711 + QXL_CURSOR_RING_SIZE,
712 +- qdev->io_base + QXL_IO_NOTIFY_CMD,
713 ++ qdev->io_base + QXL_IO_NOTIFY_CURSOR,
714 + false,
715 + &qdev->cursor_event);
716 +
717 +diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
718 +index c3d531a1114b..14ee1d9a56a7 100644
719 +--- a/drivers/gpu/drm/radeon/ni_dpm.c
720 ++++ b/drivers/gpu/drm/radeon/ni_dpm.c
721 +@@ -2128,7 +2128,7 @@ static int ni_init_smc_spll_table(struct radeon_device *rdev)
722 + if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT))
723 + ret = -EINVAL;
724 +
725 +- if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT))
726 ++ if (fb_div & ~(SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT))
727 + ret = -EINVAL;
728 +
729 + if (clk_v & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT))
730 +diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
731 +index b61db9db3ca5..c85ac178c483 100644
732 +--- a/drivers/i2c/busses/i2c-piix4.c
733 ++++ b/drivers/i2c/busses/i2c-piix4.c
734 +@@ -647,7 +647,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
735 + }
736 +
737 + if (dev->vendor == PCI_VENDOR_ID_AMD &&
738 +- dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) {
739 ++ (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS ||
740 ++ dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) {
741 + retval = piix4_setup_sb800(dev, id, 1);
742 + }
743 +
744 +diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
745 +index 0d351954db02..8fca6e3dd750 100644
746 +--- a/drivers/i2c/busses/i2c-pxa.c
747 ++++ b/drivers/i2c/busses/i2c-pxa.c
748 +@@ -297,11 +297,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
749 + dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n",
750 + readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)),
751 + readl(_ISR(i2c)));
752 +- dev_dbg(dev, "log: ");
753 ++ dev_err(dev, "log:");
754 + for (i = 0; i < i2c->irqlogidx; i++)
755 +- pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
756 +-
757 +- pr_debug("\n");
758 ++ pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]);
759 ++ pr_cont("\n");
760 + }
761 +
762 + #else /* ifdef DEBUG */
763 +@@ -691,11 +690,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
764 + {
765 + u32 icr;
766 +
767 +- /*
768 +- * Clear the STOP and ACK flags
769 +- */
770 ++ /* Clear the START, STOP, ACK, TB and MA flags */
771 + icr = readl(_ICR(i2c));
772 +- icr &= ~(ICR_STOP | ICR_ACKNAK);
773 ++ icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA);
774 + writel(icr, _ICR(i2c));
775 + }
776 +
777 +diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
778 +index 616173b7a5e8..c26fdcb7dddf 100644
779 +--- a/drivers/infiniband/core/mad.c
780 ++++ b/drivers/infiniband/core/mad.c
781 +@@ -2912,6 +2912,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
782 + DMA_FROM_DEVICE);
783 + if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device,
784 + sg_list.addr))) {
785 ++ kfree(mad_priv);
786 + ret = -ENOMEM;
787 + break;
788 + }
789 +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
790 +index 5c93582c71cc..634e9284b7be 100644
791 +--- a/drivers/md/bcache/btree.c
792 ++++ b/drivers/md/bcache/btree.c
793 +@@ -1375,7 +1375,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
794 + if (__set_blocks(n1, n1->keys + n2->keys,
795 + block_bytes(b->c)) >
796 + btree_blocks(new_nodes[i]))
797 +- goto out_nocoalesce;
798 ++ goto out_unlock_nocoalesce;
799 +
800 + keys = n2->keys;
801 + /* Take the key of the node we're getting rid of */
802 +@@ -1404,7 +1404,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
803 +
804 + if (__bch_keylist_realloc(&keylist,
805 + bkey_u64s(&new_nodes[i]->key)))
806 +- goto out_nocoalesce;
807 ++ goto out_unlock_nocoalesce;
808 +
809 + bch_btree_node_write(new_nodes[i], &cl);
810 + bch_keylist_add(&keylist, &new_nodes[i]->key);
811 +@@ -1450,6 +1450,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
812 + /* Invalidated our iterator */
813 + return -EINTR;
814 +
815 ++out_unlock_nocoalesce:
816 ++ for (i = 0; i < nodes; i++)
817 ++ mutex_unlock(&new_nodes[i]->write_lock);
818 ++
819 + out_nocoalesce:
820 + closure_sync(&cl);
821 + bch_keylist_free(&keylist);
822 +diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
823 +index 7eec619a6023..3d1457189fa2 100644
824 +--- a/drivers/mfd/wm8994-core.c
825 ++++ b/drivers/mfd/wm8994-core.c
826 +@@ -690,3 +690,4 @@ module_i2c_driver(wm8994_i2c_driver);
827 + MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC");
828 + MODULE_LICENSE("GPL");
829 + MODULE_AUTHOR("Mark Brown <broonie@×××××××××××××××××××××××.com>");
830 ++MODULE_SOFTDEP("pre: wm8994_regulator");
831 +diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
832 +index df54475d163b..43bcc19c9068 100644
833 +--- a/drivers/net/ethernet/atheros/alx/main.c
834 ++++ b/drivers/net/ethernet/atheros/alx/main.c
835 +@@ -872,8 +872,12 @@ out_free_rings:
836 +
837 + static void __alx_stop(struct alx_priv *alx)
838 + {
839 +- alx_halt(alx);
840 + alx_free_irq(alx);
841 ++
842 ++ cancel_work_sync(&alx->link_check_wk);
843 ++ cancel_work_sync(&alx->reset_wk);
844 ++
845 ++ alx_halt(alx);
846 + alx_free_rings(alx);
847 + }
848 +
849 +@@ -1406,9 +1410,6 @@ static void alx_remove(struct pci_dev *pdev)
850 + struct alx_priv *alx = pci_get_drvdata(pdev);
851 + struct alx_hw *hw = &alx->hw;
852 +
853 +- cancel_work_sync(&alx->link_check_wk);
854 +- cancel_work_sync(&alx->reset_wk);
855 +-
856 + /* restore permanent mac address */
857 + alx_set_macaddr(hw, hw->perm_addr);
858 +
859 +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
860 +index 58102e96ac5c..e198427d0f29 100644
861 +--- a/drivers/net/ethernet/broadcom/tg3.c
862 ++++ b/drivers/net/ethernet/broadcom/tg3.c
863 +@@ -18182,8 +18182,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
864 +
865 + rtnl_lock();
866 +
867 +- /* We probably don't have netdev yet */
868 +- if (!netdev || !netif_running(netdev))
869 ++ /* Could be second call or maybe we don't have netdev yet */
870 ++ if (!netdev || tp->pcierr_recovery || !netif_running(netdev))
871 + goto done;
872 +
873 + /* We needn't recover from permanent error */
874 +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
875 +index 203f96faf6fb..3bd0bdbdfa0e 100644
876 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c
877 ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
878 +@@ -6270,11 +6270,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
879 + struct net_device *netdev = pci_get_drvdata(pdev);
880 + struct e1000_adapter *adapter = netdev_priv(netdev);
881 + struct e1000_hw *hw = &adapter->hw;
882 +- u32 ctrl, ctrl_ext, rctl, status;
883 +- /* Runtime suspend should only enable wakeup for link changes */
884 +- u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol;
885 ++ u32 ctrl, ctrl_ext, rctl, status, wufc;
886 + int retval = 0;
887 +
888 ++ /* Runtime suspend should only enable wakeup for link changes */
889 ++ if (runtime)
890 ++ wufc = E1000_WUFC_LNKC;
891 ++ else if (device_may_wakeup(&pdev->dev))
892 ++ wufc = adapter->wol;
893 ++ else
894 ++ wufc = 0;
895 ++
896 + status = er32(STATUS);
897 + if (status & E1000_STATUS_LU)
898 + wufc &= ~E1000_WUFC_LNKC;
899 +@@ -6332,7 +6338,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
900 + e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
901 + } else if ((hw->mac.type == e1000_pch_lpt) ||
902 + (hw->mac.type == e1000_pch_spt)) {
903 +- if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)))
904 ++ if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)))
905 + /* ULP does not support wake from unicast, multicast
906 + * or broadcast.
907 + */
908 +diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
909 +index 1a4729c36aa4..623e4225e7c8 100644
910 +--- a/drivers/net/hamradio/yam.c
911 ++++ b/drivers/net/hamradio/yam.c
912 +@@ -1160,6 +1160,7 @@ static int __init yam_init_driver(void)
913 + err = register_netdev(dev);
914 + if (err) {
915 + printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name);
916 ++ free_netdev(dev);
917 + goto error;
918 + }
919 + yam_devs[i] = dev;
920 +diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
921 +index e3f2e6098db4..2dcc8a039d42 100644
922 +--- a/drivers/net/usb/ax88179_178a.c
923 ++++ b/drivers/net/usb/ax88179_178a.c
924 +@@ -1396,10 +1396,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
925 + }
926 +
927 + if (pkt_cnt == 0) {
928 +- /* Skip IP alignment psudo header */
929 +- skb_pull(skb, 2);
930 + skb->len = pkt_len;
931 +- skb_set_tail_pointer(skb, pkt_len);
932 ++ /* Skip IP alignment pseudo header */
933 ++ skb_pull(skb, 2);
934 ++ skb_set_tail_pointer(skb, skb->len);
935 + skb->truesize = pkt_len + sizeof(struct sk_buff);
936 + ax88179_rx_checksum(skb, pkt_hdr);
937 + return 1;
938 +@@ -1408,8 +1408,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
939 + ax_skb = skb_clone(skb, GFP_ATOMIC);
940 + if (ax_skb) {
941 + ax_skb->len = pkt_len;
942 +- ax_skb->data = skb->data + 2;
943 +- skb_set_tail_pointer(ax_skb, pkt_len);
944 ++ /* Skip IP alignment pseudo header */
945 ++ skb_pull(ax_skb, 2);
946 ++ skb_set_tail_pointer(ax_skb, ax_skb->len);
947 + ax_skb->truesize = pkt_len + sizeof(struct sk_buff);
948 + ax88179_rx_checksum(ax_skb, pkt_hdr);
949 + usbnet_skb_return(dev, ax_skb);
950 +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
951 +index c6a012b5ba39..966b6947e565 100644
952 +--- a/drivers/pci/pcie/aspm.c
953 ++++ b/drivers/pci/pcie/aspm.c
954 +@@ -388,16 +388,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
955 +
956 + /* Setup initial capable state. Will be updated later */
957 + link->aspm_capable = link->aspm_support;
958 +- /*
959 +- * If the downstream component has pci bridge function, don't
960 +- * do ASPM for now.
961 +- */
962 +- list_for_each_entry(child, &linkbus->devices, bus_list) {
963 +- if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) {
964 +- link->aspm_disable = ASPM_STATE_ALL;
965 +- break;
966 +- }
967 +- }
968 +
969 + /* Get and check endpoint acceptable latencies */
970 + list_for_each_entry(child, &linkbus->devices, bus_list) {
971 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
972 +index 83ad32b07cc3..ab161bbeb4d4 100644
973 +--- a/drivers/pci/quirks.c
974 ++++ b/drivers/pci/quirks.c
975 +@@ -1624,6 +1624,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quir
976 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_pcie_mch);
977 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_pcie_mch);
978 +
979 ++DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1610, PCI_CLASS_BRIDGE_PCI, 8, quirk_pcie_mch);
980 +
981 + /*
982 + * It's possible for the MSI to get corrupted if shpc and acpi
983 +diff --git a/drivers/power/smb347-charger.c b/drivers/power/smb347-charger.c
984 +index 072c5189bd6d..0655dbdc7000 100644
985 +--- a/drivers/power/smb347-charger.c
986 ++++ b/drivers/power/smb347-charger.c
987 +@@ -1141,6 +1141,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg)
988 + switch (reg) {
989 + case IRQSTAT_A:
990 + case IRQSTAT_C:
991 ++ case IRQSTAT_D:
992 + case IRQSTAT_E:
993 + case IRQSTAT_F:
994 + case STAT_A:
995 +diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
996 +index 7e70f9298cc1..11f6ebd04545 100644
997 +--- a/drivers/s390/cio/qdio.h
998 ++++ b/drivers/s390/cio/qdio.h
999 +@@ -376,7 +376,6 @@ static inline int multicast_outbound(struct qdio_q *q)
1000 + extern u64 last_ai_time;
1001 +
1002 + /* prototypes for thin interrupt */
1003 +-void qdio_setup_thinint(struct qdio_irq *irq_ptr);
1004 + int qdio_establish_thinint(struct qdio_irq *irq_ptr);
1005 + void qdio_shutdown_thinint(struct qdio_irq *irq_ptr);
1006 + void tiqdio_add_input_queues(struct qdio_irq *irq_ptr);
1007 +diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
1008 +index d0090c5c88e7..a64615a10352 100644
1009 +--- a/drivers/s390/cio/qdio_setup.c
1010 ++++ b/drivers/s390/cio/qdio_setup.c
1011 +@@ -479,7 +479,6 @@ int qdio_setup_irq(struct qdio_initialize *init_data)
1012 + setup_queues(irq_ptr, init_data);
1013 +
1014 + setup_qib(irq_ptr, init_data);
1015 +- qdio_setup_thinint(irq_ptr);
1016 + set_impl_params(irq_ptr, init_data->qib_param_field_format,
1017 + init_data->qib_param_field,
1018 + init_data->input_slib_elements,
1019 +diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
1020 +index debe69adfc70..aecb6445a567 100644
1021 +--- a/drivers/s390/cio/qdio_thinint.c
1022 ++++ b/drivers/s390/cio/qdio_thinint.c
1023 +@@ -268,17 +268,19 @@ int __init tiqdio_register_thinints(void)
1024 +
1025 + int qdio_establish_thinint(struct qdio_irq *irq_ptr)
1026 + {
1027 ++ int rc;
1028 ++
1029 + if (!is_thinint_irq(irq_ptr))
1030 + return 0;
1031 +- return set_subchannel_ind(irq_ptr, 0);
1032 +-}
1033 +
1034 +-void qdio_setup_thinint(struct qdio_irq *irq_ptr)
1035 +-{
1036 +- if (!is_thinint_irq(irq_ptr))
1037 +- return;
1038 + irq_ptr->dsci = get_indicator();
1039 + DBF_HEX(&irq_ptr->dsci, sizeof(void *));
1040 ++
1041 ++ rc = set_subchannel_ind(irq_ptr, 0);
1042 ++ if (rc)
1043 ++ put_indicator(irq_ptr->dsci);
1044 ++
1045 ++ return rc;
1046 + }
1047 +
1048 + void qdio_shutdown_thinint(struct qdio_irq *irq_ptr)
1049 +diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
1050 +index deaaf84989cd..be595add8026 100644
1051 +--- a/drivers/scsi/arm/acornscsi.c
1052 ++++ b/drivers/scsi/arm/acornscsi.c
1053 +@@ -2912,8 +2912,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
1054 +
1055 + ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
1056 + ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
1057 +- if (!ashost->base || !ashost->fast)
1058 ++ if (!ashost->base || !ashost->fast) {
1059 ++ ret = -ENOMEM;
1060 + goto out_put;
1061 ++ }
1062 +
1063 + host->irq = ec->irq;
1064 + ashost->host = host;
1065 +diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
1066 +index e26747a1b35a..e7075aae15da 100644
1067 +--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
1068 ++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
1069 +@@ -427,6 +427,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,
1070 + int rc = 0;
1071 + struct vio_dev *vdev = to_vio_dev(hostdata->dev);
1072 +
1073 ++ set_adapter_info(hostdata);
1074 ++
1075 + /* Re-enable the CRQ */
1076 + do {
1077 + if (rc)
1078 +diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
1079 +index 680bf6f0ce76..476f46aad54c 100644
1080 +--- a/drivers/scsi/iscsi_boot_sysfs.c
1081 ++++ b/drivers/scsi/iscsi_boot_sysfs.c
1082 +@@ -319,7 +319,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset,
1083 + boot_kobj->kobj.kset = boot_kset->kset;
1084 + if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype,
1085 + NULL, name, index)) {
1086 +- kfree(boot_kobj);
1087 ++ kobject_put(&boot_kobj->kobj);
1088 + return NULL;
1089 + }
1090 + boot_kobj->data = data;
1091 +diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
1092 +index 530b7df21322..315dd25a0c44 100644
1093 +--- a/drivers/scsi/lpfc/lpfc_els.c
1094 ++++ b/drivers/scsi/lpfc/lpfc_els.c
1095 +@@ -7315,6 +7315,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1096 + spin_lock_irq(shost->host_lock);
1097 + if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) {
1098 + spin_unlock_irq(shost->host_lock);
1099 ++ if (newnode)
1100 ++ lpfc_nlp_put(ndlp);
1101 + goto dropit;
1102 + }
1103 + spin_unlock_irq(shost->host_lock);
1104 +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
1105 +index 7af7a0859478..8d52afd1f71d 100644
1106 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
1107 ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
1108 +@@ -3136,7 +3136,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
1109 + ioc->scsi_lookup = NULL;
1110 + }
1111 + kfree(ioc->hpr_lookup);
1112 ++ ioc->hpr_lookup = NULL;
1113 + kfree(ioc->internal_lookup);
1114 ++ ioc->internal_lookup = NULL;
1115 + if (ioc->chain_lookup) {
1116 + for (i = 0; i < ioc->chain_depth; i++) {
1117 + if (ioc->chain_lookup[i].chain_buffer)
1118 +diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
1119 +index b1233ce6cb47..1cef25ea0da1 100644
1120 +--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
1121 ++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
1122 +@@ -827,6 +827,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,
1123 +
1124 + atomic_set(&tpg->lport_tpg_enabled, 0);
1125 + qlt_stop_phase1(vha->vha_tgt.qla_tgt);
1126 ++ qlt_stop_phase2(vha->vha_tgt.qla_tgt);
1127 + }
1128 +
1129 + return count;
1130 +@@ -990,6 +991,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item,
1131 +
1132 + atomic_set(&tpg->lport_tpg_enabled, 0);
1133 + qlt_stop_phase1(vha->vha_tgt.qla_tgt);
1134 ++ qlt_stop_phase2(vha->vha_tgt.qla_tgt);
1135 + }
1136 +
1137 + return count;
1138 +diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
1139 +index 4055cb7c212b..3a9b6b61607e 100644
1140 +--- a/drivers/scsi/scsi_devinfo.c
1141 ++++ b/drivers/scsi/scsi_devinfo.c
1142 +@@ -443,7 +443,8 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
1143 + /*
1144 + * vendor strings must be an exact match
1145 + */
1146 +- if (vmax != strlen(devinfo->vendor) ||
1147 ++ if (vmax != strnlen(devinfo->vendor,
1148 ++ sizeof(devinfo->vendor)) ||
1149 + memcmp(devinfo->vendor, vskip, vmax))
1150 + continue;
1151 +
1152 +@@ -451,7 +452,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
1153 + * @model specifies the full string, and
1154 + * must be larger or equal to devinfo->model
1155 + */
1156 +- mlen = strlen(devinfo->model);
1157 ++ mlen = strnlen(devinfo->model, sizeof(devinfo->model));
1158 + if (mmax < mlen || memcmp(devinfo->model, mskip, mlen))
1159 + continue;
1160 + return devinfo;
1161 +diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
1162 +index 5dc288fecace..7dd4d9ded249 100644
1163 +--- a/drivers/scsi/sr.c
1164 ++++ b/drivers/scsi/sr.c
1165 +@@ -746,7 +746,7 @@ static int sr_probe(struct device *dev)
1166 + cd->cdi.disk = disk;
1167 +
1168 + if (register_cdrom(&cd->cdi))
1169 +- goto fail_put;
1170 ++ goto fail_minor;
1171 +
1172 + /*
1173 + * Initialize block layer runtime PM stuffs before the
1174 +@@ -764,6 +764,10 @@ static int sr_probe(struct device *dev)
1175 +
1176 + return 0;
1177 +
1178 ++fail_minor:
1179 ++ spin_lock(&sr_index_lock);
1180 ++ clear_bit(minor, sr_index_bits);
1181 ++ spin_unlock(&sr_index_lock);
1182 + fail_put:
1183 + put_disk(disk);
1184 + fail_free:
1185 +diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
1186 +index 860e1c288ad5..75b47d61318a 100644
1187 +--- a/drivers/staging/sm750fb/sm750.c
1188 ++++ b/drivers/staging/sm750fb/sm750.c
1189 +@@ -894,6 +894,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
1190 + fix->visual = FB_VISUAL_PSEUDOCOLOR;
1191 + break;
1192 + case 16:
1193 ++ case 24:
1194 + case 32:
1195 + fix->visual = FB_VISUAL_TRUECOLOR;
1196 + break;
1197 +diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
1198 +index acf6d143c753..81f23af8beca 100644
1199 +--- a/drivers/tty/hvc/hvc_console.c
1200 ++++ b/drivers/tty/hvc/hvc_console.c
1201 +@@ -89,6 +89,8 @@ static LIST_HEAD(hvc_structs);
1202 + */
1203 + static DEFINE_SPINLOCK(hvc_structs_lock);
1204 +
1205 ++/* Mutex to serialize hvc_open */
1206 ++static DEFINE_MUTEX(hvc_open_mutex);
1207 + /*
1208 + * This value is used to assign a tty->index value to a hvc_struct based
1209 + * upon order of exposure via hvc_probe(), when we can not match it to
1210 +@@ -333,16 +335,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)
1211 + */
1212 + static int hvc_open(struct tty_struct *tty, struct file * filp)
1213 + {
1214 +- struct hvc_struct *hp = tty->driver_data;
1215 ++ struct hvc_struct *hp;
1216 + unsigned long flags;
1217 + int rc = 0;
1218 +
1219 ++ mutex_lock(&hvc_open_mutex);
1220 ++
1221 ++ hp = tty->driver_data;
1222 ++ if (!hp) {
1223 ++ rc = -EIO;
1224 ++ goto out;
1225 ++ }
1226 ++
1227 + spin_lock_irqsave(&hp->port.lock, flags);
1228 + /* Check and then increment for fast path open. */
1229 + if (hp->port.count++ > 0) {
1230 + spin_unlock_irqrestore(&hp->port.lock, flags);
1231 + hvc_kick();
1232 +- return 0;
1233 ++ goto out;
1234 + } /* else count == 0 */
1235 + spin_unlock_irqrestore(&hp->port.lock, flags);
1236 +
1237 +@@ -371,6 +381,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
1238 + /* Force wakeup of the polling thread */
1239 + hvc_kick();
1240 +
1241 ++out:
1242 ++ mutex_unlock(&hvc_open_mutex);
1243 + return rc;
1244 + }
1245 +
1246 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
1247 +index 6060c3e8925e..9b2beada2ff3 100644
1248 +--- a/drivers/tty/n_gsm.c
1249 ++++ b/drivers/tty/n_gsm.c
1250 +@@ -681,11 +681,10 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len,
1251 + * FIXME: lock against link layer control transmissions
1252 + */
1253 +
1254 +-static void gsm_data_kick(struct gsm_mux *gsm)
1255 ++static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
1256 + {
1257 + struct gsm_msg *msg, *nmsg;
1258 + int len;
1259 +- int skip_sof = 0;
1260 +
1261 + list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) {
1262 + if (gsm->constipated && msg->addr)
1263 +@@ -707,18 +706,23 @@ static void gsm_data_kick(struct gsm_mux *gsm)
1264 + print_hex_dump_bytes("gsm_data_kick: ",
1265 + DUMP_PREFIX_OFFSET,
1266 + gsm->txframe, len);
1267 +-
1268 +- if (gsm->output(gsm, gsm->txframe + skip_sof,
1269 +- len - skip_sof) < 0)
1270 ++ if (gsm->output(gsm, gsm->txframe, len) < 0)
1271 + break;
1272 + /* FIXME: Can eliminate one SOF in many more cases */
1273 + gsm->tx_bytes -= msg->len;
1274 +- /* For a burst of frames skip the extra SOF within the
1275 +- burst */
1276 +- skip_sof = 1;
1277 +
1278 + list_del(&msg->list);
1279 + kfree(msg);
1280 ++
1281 ++ if (dlci) {
1282 ++ tty_port_tty_wakeup(&dlci->port);
1283 ++ } else {
1284 ++ int i = 0;
1285 ++
1286 ++ for (i = 0; i < NUM_DLCI; i++)
1287 ++ if (gsm->dlci[i])
1288 ++ tty_port_tty_wakeup(&gsm->dlci[i]->port);
1289 ++ }
1290 + }
1291 + }
1292 +
1293 +@@ -770,7 +774,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
1294 + /* Add to the actual output queue */
1295 + list_add_tail(&msg->list, &gsm->tx_list);
1296 + gsm->tx_bytes += msg->len;
1297 +- gsm_data_kick(gsm);
1298 ++ gsm_data_kick(gsm, dlci);
1299 + }
1300 +
1301 + /**
1302 +@@ -1231,7 +1235,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,
1303 + gsm_control_reply(gsm, CMD_FCON, NULL, 0);
1304 + /* Kick the link in case it is idling */
1305 + spin_lock_irqsave(&gsm->tx_lock, flags);
1306 +- gsm_data_kick(gsm);
1307 ++ gsm_data_kick(gsm, NULL);
1308 + spin_unlock_irqrestore(&gsm->tx_lock, flags);
1309 + break;
1310 + case CMD_FCOFF:
1311 +@@ -2429,7 +2433,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty)
1312 + /* Queue poll */
1313 + clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1314 + spin_lock_irqsave(&gsm->tx_lock, flags);
1315 +- gsm_data_kick(gsm);
1316 ++ gsm_data_kick(gsm, NULL);
1317 + if (gsm->tx_bytes < TX_THRESH_LO) {
1318 + gsm_dlci_data_sweep(gsm);
1319 + }
1320 +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
1321 +index 899a77187bde..c5da46f7b909 100644
1322 +--- a/drivers/tty/serial/amba-pl011.c
1323 ++++ b/drivers/tty/serial/amba-pl011.c
1324 +@@ -2323,6 +2323,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
1325 + uap->port.fifosize = uap->fifosize;
1326 + uap->port.flags = UPF_BOOT_AUTOCONF;
1327 + uap->port.line = index;
1328 ++ spin_lock_init(&uap->port.lock);
1329 +
1330 + amba_ports[index] = uap;
1331 +
1332 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1333 +index 04fd6c8e3090..515839034dfb 100644
1334 +--- a/drivers/usb/class/cdc-acm.c
1335 ++++ b/drivers/usb/class/cdc-acm.c
1336 +@@ -1684,6 +1684,8 @@ static int acm_reset_resume(struct usb_interface *intf)
1337 +
1338 + static const struct usb_device_id acm_ids[] = {
1339 + /* quirky and broken devices */
1340 ++ { USB_DEVICE(0x0424, 0x274e), /* Microchip Technology, Inc. (formerly SMSC) */
1341 ++ .driver_info = DISABLE_ECHO, }, /* DISABLE ECHO in termios flag */
1342 + { USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */
1343 + .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
1344 + { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
1345 +diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
1346 +index 07c3c3449147..c578d64edc15 100644
1347 +--- a/drivers/usb/class/usblp.c
1348 ++++ b/drivers/usb/class/usblp.c
1349 +@@ -481,7 +481,8 @@ static int usblp_release(struct inode *inode, struct file *file)
1350 + usb_autopm_put_interface(usblp->intf);
1351 +
1352 + if (!usblp->present) /* finish cleanup from disconnect */
1353 +- usblp_cleanup(usblp);
1354 ++ usblp_cleanup(usblp); /* any URBs must be dead */
1355 ++
1356 + mutex_unlock(&usblp_mutex);
1357 + return 0;
1358 + }
1359 +@@ -1397,9 +1398,11 @@ static void usblp_disconnect(struct usb_interface *intf)
1360 +
1361 + usblp_unlink_urbs(usblp);
1362 + mutex_unlock(&usblp->mut);
1363 ++ usb_poison_anchored_urbs(&usblp->urbs);
1364 +
1365 + if (!usblp->used)
1366 + usblp_cleanup(usblp);
1367 ++
1368 + mutex_unlock(&usblp_mutex);
1369 + }
1370 +
1371 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1372 +index 27d05f0134de..e6e0f786547b 100644
1373 +--- a/drivers/usb/core/quirks.c
1374 ++++ b/drivers/usb/core/quirks.c
1375 +@@ -73,11 +73,12 @@ static const struct usb_device_id usb_quirk_list[] = {
1376 + /* Logitech HD Webcam C270 */
1377 + { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
1378 +
1379 +- /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */
1380 ++ /* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */
1381 + { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
1382 + { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT },
1383 + { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
1384 + { USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT },
1385 ++ { USB_DEVICE(0x046d, 0x085c), .driver_info = USB_QUIRK_DELAY_INIT },
1386 +
1387 + /* Logitech ConferenceCam CC3000e */
1388 + { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
1389 +diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
1390 +index 27daa42788b1..796d60d49ac5 100644
1391 +--- a/drivers/usb/dwc2/core_intr.c
1392 ++++ b/drivers/usb/dwc2/core_intr.c
1393 +@@ -363,10 +363,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
1394 + if (ret && (ret != -ENOTSUPP))
1395 + dev_err(hsotg->dev, "exit hibernation failed\n");
1396 +
1397 ++ /* Change to L0 state */
1398 ++ hsotg->lx_state = DWC2_L0;
1399 + call_gadget(hsotg, resume);
1400 ++ } else {
1401 ++ /* Change to L0 state */
1402 ++ hsotg->lx_state = DWC2_L0;
1403 + }
1404 +- /* Change to L0 state */
1405 +- hsotg->lx_state = DWC2_L0;
1406 + } else {
1407 + if (hsotg->core_params->hibernation) {
1408 + dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
1409 +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
1410 +index 842c1ae7a291..e5ad717cba22 100644
1411 +--- a/drivers/usb/dwc2/gadget.c
1412 ++++ b/drivers/usb/dwc2/gadget.c
1413 +@@ -3656,12 +3656,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
1414 + epnum, 0);
1415 + }
1416 +
1417 +- ret = usb_add_gadget_udc(dev, &hsotg->gadget);
1418 +- if (ret) {
1419 +- dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep,
1420 +- hsotg->ctrl_req);
1421 +- return ret;
1422 +- }
1423 + dwc2_hsotg_dump(hsotg);
1424 +
1425 + return 0;
1426 +diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
1427 +index 39c1cbf0e75d..5e554b1d5a8f 100644
1428 +--- a/drivers/usb/dwc2/platform.c
1429 ++++ b/drivers/usb/dwc2/platform.c
1430 +@@ -452,6 +452,17 @@ static int dwc2_driver_probe(struct platform_device *dev)
1431 + if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL)
1432 + dwc2_lowlevel_hw_disable(hsotg);
1433 +
1434 ++#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
1435 ++ IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
1436 ++ /* Postponed adding a new gadget to the udc class driver list */
1437 ++ if (hsotg->gadget_enabled) {
1438 ++ retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget);
1439 ++ if (retval) {
1440 ++ dwc2_hsotg_remove(hsotg);
1441 ++ goto error;
1442 ++ }
1443 ++ }
1444 ++#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
1445 + return 0;
1446 +
1447 + error:
1448 +diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
1449 +index ea43cb74a6f2..c9590949e4f0 100644
1450 +--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
1451 ++++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
1452 +@@ -1662,17 +1662,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep,
1453 + const struct usb_endpoint_descriptor *desc)
1454 + {
1455 + struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep);
1456 +- struct lpc32xx_udc *udc = ep->udc;
1457 ++ struct lpc32xx_udc *udc;
1458 + u16 maxpacket;
1459 + u32 tmp;
1460 + unsigned long flags;
1461 +
1462 + /* Verify EP data */
1463 + if ((!_ep) || (!ep) || (!desc) ||
1464 +- (desc->bDescriptorType != USB_DT_ENDPOINT)) {
1465 +- dev_dbg(udc->dev, "bad ep or descriptor\n");
1466 ++ (desc->bDescriptorType != USB_DT_ENDPOINT))
1467 + return -EINVAL;
1468 +- }
1469 ++
1470 ++ udc = ep->udc;
1471 + maxpacket = usb_endpoint_maxp(desc);
1472 + if ((maxpacket == 0) || (maxpacket > ep->maxpacket)) {
1473 + dev_dbg(udc->dev, "bad ep descriptor's packet size\n");
1474 +@@ -1920,7 +1920,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
1475 + static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value)
1476 + {
1477 + struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep);
1478 +- struct lpc32xx_udc *udc = ep->udc;
1479 ++ struct lpc32xx_udc *udc;
1480 + unsigned long flags;
1481 +
1482 + if ((!ep) || (ep->hwep_num <= 1))
1483 +@@ -1930,6 +1930,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value)
1484 + if (ep->is_in)
1485 + return -EAGAIN;
1486 +
1487 ++ udc = ep->udc;
1488 + spin_lock_irqsave(&udc->lock, flags);
1489 +
1490 + if (value == 1) {
1491 +diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
1492 +index b1cfa96cc88f..db95eab8b432 100644
1493 +--- a/drivers/usb/gadget/udc/m66592-udc.c
1494 ++++ b/drivers/usb/gadget/udc/m66592-udc.c
1495 +@@ -1684,7 +1684,7 @@ static int m66592_probe(struct platform_device *pdev)
1496 +
1497 + err_add_udc:
1498 + m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
1499 +-
1500 ++ m66592->ep0_req = NULL;
1501 + clean_up3:
1502 + if (m66592->pdata->on_chip) {
1503 + clk_disable(m66592->clk);
1504 +diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
1505 +index 81b6229c7805..4f480059f851 100644
1506 +--- a/drivers/usb/gadget/udc/mv_udc_core.c
1507 ++++ b/drivers/usb/gadget/udc/mv_udc_core.c
1508 +@@ -2322,7 +2322,8 @@ static int mv_udc_probe(struct platform_device *pdev)
1509 + return 0;
1510 +
1511 + err_create_workqueue:
1512 +- destroy_workqueue(udc->qwork);
1513 ++ if (udc->qwork)
1514 ++ destroy_workqueue(udc->qwork);
1515 + err_destroy_dma:
1516 + dma_pool_destroy(udc->dtd_pool);
1517 + err_free_dma:
1518 +diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c
1519 +index eb3571ee59e3..08153a48704b 100644
1520 +--- a/drivers/usb/gadget/udc/s3c2410_udc.c
1521 ++++ b/drivers/usb/gadget/udc/s3c2410_udc.c
1522 +@@ -269,10 +269,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep,
1523 + static void s3c2410_udc_nuke(struct s3c2410_udc *udc,
1524 + struct s3c2410_ep *ep, int status)
1525 + {
1526 +- /* Sanity check */
1527 +- if (&ep->queue == NULL)
1528 +- return;
1529 +-
1530 + while (!list_empty(&ep->queue)) {
1531 + struct s3c2410_request *req;
1532 + req = list_entry(ep->queue.next, struct s3c2410_request,
1533 +diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
1534 +index 46f5354c534d..3b5a28f43ef9 100644
1535 +--- a/drivers/usb/host/ehci-exynos.c
1536 ++++ b/drivers/usb/host/ehci-exynos.c
1537 +@@ -199,9 +199,8 @@ skip_phy:
1538 + hcd->rsrc_len = resource_size(res);
1539 +
1540 + irq = platform_get_irq(pdev, 0);
1541 +- if (!irq) {
1542 +- dev_err(&pdev->dev, "Failed to get IRQ\n");
1543 +- err = -ENODEV;
1544 ++ if (irq < 0) {
1545 ++ err = irq;
1546 + goto fail_io;
1547 + }
1548 +
1549 +diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
1550 +index c7a9b31eeaef..637079a35003 100644
1551 +--- a/drivers/usb/host/ehci-mxc.c
1552 ++++ b/drivers/usb/host/ehci-mxc.c
1553 +@@ -63,6 +63,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
1554 + }
1555 +
1556 + irq = platform_get_irq(pdev, 0);
1557 ++ if (irq < 0)
1558 ++ return irq;
1559 +
1560 + hcd = usb_create_hcd(&ehci_mxc_hc_driver, dev, dev_name(dev));
1561 + if (!hcd)
1562 +diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
1563 +index 2a5d2fd76040..33e9ed7fe026 100644
1564 +--- a/drivers/usb/host/ehci-pci.c
1565 ++++ b/drivers/usb/host/ehci-pci.c
1566 +@@ -229,6 +229,13 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
1567 + ehci_info(ehci, "applying MosChip frame-index workaround\n");
1568 + ehci->frame_index_bug = 1;
1569 + break;
1570 ++ case PCI_VENDOR_ID_HUAWEI:
1571 ++ /* Synopsys HC bug */
1572 ++ if (pdev->device == 0xa239) {
1573 ++ ehci_info(ehci, "applying Synopsys HC workaround\n");
1574 ++ ehci->has_synopsys_hc_bug = 1;
1575 ++ }
1576 ++ break;
1577 + }
1578 +
1579 + /* optional debug port, normally in the first BAR */
1580 +diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
1581 +index bd7082f297bb..56200650b46b 100644
1582 +--- a/drivers/usb/host/ehci-platform.c
1583 ++++ b/drivers/usb/host/ehci-platform.c
1584 +@@ -375,6 +375,11 @@ static int ehci_platform_resume(struct device *dev)
1585 + }
1586 +
1587 + ehci_resume(hcd, priv->reset_on_resume);
1588 ++
1589 ++ pm_runtime_disable(dev);
1590 ++ pm_runtime_set_active(dev);
1591 ++ pm_runtime_enable(dev);
1592 ++
1593 + return 0;
1594 + }
1595 + #endif /* CONFIG_PM_SLEEP */
1596 +diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
1597 +index c2669f185f65..0e5580e6f35c 100644
1598 +--- a/drivers/usb/host/ohci-platform.c
1599 ++++ b/drivers/usb/host/ohci-platform.c
1600 +@@ -339,6 +339,11 @@ static int ohci_platform_resume(struct device *dev)
1601 + }
1602 +
1603 + ohci_resume(hcd, false);
1604 ++
1605 ++ pm_runtime_disable(dev);
1606 ++ pm_runtime_set_active(dev);
1607 ++ pm_runtime_enable(dev);
1608 ++
1609 + return 0;
1610 + }
1611 + #endif /* CONFIG_PM_SLEEP */
1612 +diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
1613 +index a8b8d8b8d9f3..a960d2bb8dd1 100644
1614 +--- a/drivers/usb/host/ohci-sm501.c
1615 ++++ b/drivers/usb/host/ohci-sm501.c
1616 +@@ -196,6 +196,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)
1617 + struct resource *mem;
1618 +
1619 + usb_remove_hcd(hcd);
1620 ++ iounmap(hcd->regs);
1621 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
1622 + usb_put_hcd(hcd);
1623 + dma_release_declared_memory(&pdev->dev);
1624 +diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
1625 +index c4c40e9d4247..510fb7853f92 100644
1626 +--- a/drivers/usb/host/xhci-plat.c
1627 ++++ b/drivers/usb/host/xhci-plat.c
1628 +@@ -249,8 +249,17 @@ static int xhci_plat_resume(struct device *dev)
1629 + {
1630 + struct usb_hcd *hcd = dev_get_drvdata(dev);
1631 + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
1632 ++ int ret;
1633 ++
1634 ++ ret = xhci_resume(xhci, 0);
1635 ++ if (ret)
1636 ++ return ret;
1637 +
1638 +- return xhci_resume(xhci, 0);
1639 ++ pm_runtime_disable(dev);
1640 ++ pm_runtime_set_active(dev);
1641 ++ pm_runtime_enable(dev);
1642 ++
1643 ++ return 0;
1644 + }
1645 +
1646 + static const struct dev_pm_ops xhci_plat_pm_ops = {
1647 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1648 +index af4e68152776..51d84332eb78 100644
1649 +--- a/drivers/usb/host/xhci.c
1650 ++++ b/drivers/usb/host/xhci.c
1651 +@@ -1340,6 +1340,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
1652 + xhci->devs[slot_id]->out_ctx, ep_index);
1653 +
1654 + ep_ctx = xhci_get_ep_ctx(xhci, command->in_ctx, ep_index);
1655 ++ ep_ctx->ep_info &= cpu_to_le32(~EP_STATE_MASK);/* must clear */
1656 + ep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK);
1657 + ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size));
1658 +
1659 +@@ -4263,6 +4264,9 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
1660 + mutex_lock(hcd->bandwidth_mutex);
1661 + xhci_change_max_exit_latency(xhci, udev, 0);
1662 + mutex_unlock(hcd->bandwidth_mutex);
1663 ++ readl_poll_timeout(port_array[port_num], pm_val,
1664 ++ (pm_val & PORT_PLS_MASK) == XDEV_U0,
1665 ++ 100, 10000);
1666 + return 0;
1667 + }
1668 + }
1669 +diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
1670 +index 0a3aa38b3c96..a7f346529f91 100644
1671 +--- a/drivers/usb/host/xhci.h
1672 ++++ b/drivers/usb/host/xhci.h
1673 +@@ -706,7 +706,7 @@ struct xhci_ep_ctx {
1674 + * 4 - TRB error
1675 + * 5-7 - reserved
1676 + */
1677 +-#define EP_STATE_MASK (0xf)
1678 ++#define EP_STATE_MASK (0x7)
1679 + #define EP_STATE_DISABLED 0
1680 + #define EP_STATE_RUNNING 1
1681 + #define EP_STATE_HALTED 2
1682 +diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
1683 +index 98a12be76c9c..666b234acca0 100644
1684 +--- a/drivers/vfio/pci/vfio_pci_config.c
1685 ++++ b/drivers/vfio/pci/vfio_pci_config.c
1686 +@@ -1405,7 +1405,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev)
1687 + if (ret)
1688 + return ret;
1689 +
1690 +- if (cap <= PCI_CAP_ID_MAX) {
1691 ++ /*
1692 ++ * ID 0 is a NULL capability, conflicting with our fake
1693 ++ * PCI_CAP_ID_BASIC. As it has no content, consider it
1694 ++ * hidden for now.
1695 ++ */
1696 ++ if (cap && cap <= PCI_CAP_ID_MAX) {
1697 + len = pci_cap_length[cap];
1698 + if (len == 0xFF) { /* Variable length */
1699 + len = vfio_cap_len(vdev, cap, pos);
1700 +@@ -1644,8 +1649,11 @@ void vfio_config_free(struct vfio_pci_device *vdev)
1701 + vdev->vconfig = NULL;
1702 + kfree(vdev->pci_config_map);
1703 + vdev->pci_config_map = NULL;
1704 +- kfree(vdev->msi_perm);
1705 +- vdev->msi_perm = NULL;
1706 ++ if (vdev->msi_perm) {
1707 ++ free_perm_bits(vdev->msi_perm);
1708 ++ kfree(vdev->msi_perm);
1709 ++ vdev->msi_perm = NULL;
1710 ++ }
1711 + }
1712 +
1713 + /*
1714 +diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
1715 +index daeb645fcea8..519419136ce8 100644
1716 +--- a/drivers/watchdog/da9062_wdt.c
1717 ++++ b/drivers/watchdog/da9062_wdt.c
1718 +@@ -94,11 +94,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt,
1719 + unsigned int regval)
1720 + {
1721 + struct da9062 *chip = wdt->hw;
1722 +- int ret;
1723 +-
1724 +- ret = da9062_reset_watchdog_timer(wdt);
1725 +- if (ret)
1726 +- return ret;
1727 +
1728 + return regmap_update_bits(chip->regmap,
1729 + DA9062AA_CONTROL_D,
1730 +diff --git a/fs/block_dev.c b/fs/block_dev.c
1731 +index 26bbaaefdff4..b2ebfd96785b 100644
1732 +--- a/fs/block_dev.c
1733 ++++ b/fs/block_dev.c
1734 +@@ -1181,10 +1181,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1735 + */
1736 + if (!for_part) {
1737 + ret = devcgroup_inode_permission(bdev->bd_inode, perm);
1738 +- if (ret != 0) {
1739 +- bdput(bdev);
1740 ++ if (ret != 0)
1741 + return ret;
1742 +- }
1743 + }
1744 +
1745 + restart:
1746 +@@ -1253,8 +1251,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1747 + goto out_clear;
1748 + BUG_ON(for_part);
1749 + ret = __blkdev_get(whole, mode, 1);
1750 +- if (ret)
1751 ++ if (ret) {
1752 ++ bdput(whole);
1753 + goto out_clear;
1754 ++ }
1755 + bdev->bd_contains = whole;
1756 + bdev->bd_part = disk_get_part(disk, partno);
1757 + if (!(disk->flags & GENHD_FL_UP) ||
1758 +@@ -1311,7 +1311,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1759 + put_disk(disk);
1760 + module_put(owner);
1761 + out:
1762 +- bdput(bdev);
1763 +
1764 + return ret;
1765 + }
1766 +@@ -1397,6 +1396,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
1767 + bdput(whole);
1768 + }
1769 +
1770 ++ if (res)
1771 ++ bdput(bdev);
1772 ++
1773 + return res;
1774 + }
1775 + EXPORT_SYMBOL(blkdev_get);
1776 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
1777 +index 0fcf42401a5d..087261ca6d46 100644
1778 +--- a/fs/cifs/smb2ops.c
1779 ++++ b/fs/cifs/smb2ops.c
1780 +@@ -1145,6 +1145,12 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
1781 + inode = d_inode(cfile->dentry);
1782 + cifsi = CIFS_I(inode);
1783 +
1784 ++ /*
1785 ++ * We zero the range through ioctl, so we need remove the page caches
1786 ++ * first, otherwise the data may be inconsistent with the server.
1787 ++ */
1788 ++ truncate_pagecache_range(inode, offset, offset + len - 1);
1789 ++
1790 + /* if file not oplocked can't be sure whether asking to extend size */
1791 + if (!CIFS_CACHE_READ(cifsi))
1792 + if (keep_size == false)
1793 +@@ -1201,6 +1207,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
1794 + if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse))
1795 + return -EOPNOTSUPP;
1796 +
1797 ++ /*
1798 ++ * We implement the punch hole through ioctl, so we need remove the page
1799 ++ * caches first, otherwise the data may be inconsistent with the server.
1800 ++ */
1801 ++ truncate_pagecache_range(inode, offset, offset + len - 1);
1802 ++
1803 + cifs_dbg(FYI, "offset %lld len %lld", offset, len);
1804 +
1805 + fsctl_buf.FileOffset = cpu_to_le64(offset);
1806 +diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
1807 +index 5eff6ea3e27f..63e856d90ed0 100644
1808 +--- a/fs/dlm/dlm_internal.h
1809 ++++ b/fs/dlm/dlm_internal.h
1810 +@@ -92,7 +92,6 @@ do { \
1811 + __LINE__, __FILE__, #x, jiffies); \
1812 + {do} \
1813 + printk("\n"); \
1814 +- BUG(); \
1815 + panic("DLM: Record message above and reboot.\n"); \
1816 + } \
1817 + }
1818 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
1819 +index 96336830f035..fc2746e14c42 100644
1820 +--- a/fs/ext4/extents.c
1821 ++++ b/fs/ext4/extents.c
1822 +@@ -2902,7 +2902,7 @@ again:
1823 + * in use to avoid freeing it when removing blocks.
1824 + */
1825 + if (sbi->s_cluster_ratio > 1) {
1826 +- pblk = ext4_ext_pblock(ex) + end - ee_block + 2;
1827 ++ pblk = ext4_ext_pblock(ex) + end - ee_block + 1;
1828 + partial_cluster =
1829 + -(long long) EXT4_B2C(sbi, pblk);
1830 + }
1831 +diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
1832 +index de7143e2b361..b7b43d00cc6d 100644
1833 +--- a/fs/gfs2/ops_fstype.c
1834 ++++ b/fs/gfs2/ops_fstype.c
1835 +@@ -916,7 +916,7 @@ fail:
1836 + }
1837 +
1838 + static const match_table_t nolock_tokens = {
1839 +- { Opt_jid, "jid=%d\n", },
1840 ++ { Opt_jid, "jid=%d", },
1841 + { Opt_err, NULL },
1842 + };
1843 +
1844 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
1845 +index 7789f0b9b999..4d76e9a97538 100644
1846 +--- a/fs/nfs/direct.c
1847 ++++ b/fs/nfs/direct.c
1848 +@@ -385,8 +385,6 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
1849 + if (write)
1850 + nfs_zap_mapping(inode, inode->i_mapping);
1851 +
1852 +- inode_dio_end(inode);
1853 +-
1854 + if (dreq->iocb) {
1855 + long res = (long) dreq->error;
1856 + if (!res)
1857 +@@ -396,7 +394,10 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
1858 +
1859 + complete_all(&dreq->completion);
1860 +
1861 ++ igrab(inode);
1862 + nfs_direct_req_release(dreq);
1863 ++ inode_dio_end(inode);
1864 ++ iput(inode);
1865 + }
1866 +
1867 + static void nfs_direct_readpage_release(struct nfs_page *req)
1868 +@@ -537,8 +538,10 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
1869 + * generic layer handle the completion.
1870 + */
1871 + if (requested_bytes == 0) {
1872 +- inode_dio_end(inode);
1873 ++ igrab(inode);
1874 + nfs_direct_req_release(dreq);
1875 ++ inode_dio_end(inode);
1876 ++ iput(inode);
1877 + return result < 0 ? result : -EIO;
1878 + }
1879 +
1880 +@@ -939,8 +942,10 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
1881 + * generic layer handle the completion.
1882 + */
1883 + if (requested_bytes == 0) {
1884 +- inode_dio_end(inode);
1885 ++ igrab(inode);
1886 + nfs_direct_req_release(dreq);
1887 ++ inode_dio_end(inode);
1888 ++ iput(inode);
1889 + return result < 0 ? result : -EIO;
1890 + }
1891 +
1892 +diff --git a/fs/nfs/file.c b/fs/nfs/file.c
1893 +index dc875cd0e11d..eaa6697d256e 100644
1894 +--- a/fs/nfs/file.c
1895 ++++ b/fs/nfs/file.c
1896 +@@ -82,6 +82,7 @@ nfs_file_release(struct inode *inode, struct file *filp)
1897 + dprintk("NFS: release(%pD2)\n", filp);
1898 +
1899 + nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
1900 ++ inode_dio_wait(inode);
1901 + nfs_file_clear_open_context(filp);
1902 + return 0;
1903 + }
1904 +diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
1905 +index 6506775575aa..17771e157e92 100644
1906 +--- a/fs/nfs/flexfilelayout/flexfilelayout.c
1907 ++++ b/fs/nfs/flexfilelayout/flexfilelayout.c
1908 +@@ -855,9 +855,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
1909 + goto out_mds;
1910 +
1911 + /* Use a direct mapping of ds_idx to pgio mirror_idx */
1912 +- if (WARN_ON_ONCE(pgio->pg_mirror_count !=
1913 +- FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)))
1914 +- goto out_mds;
1915 ++ if (pgio->pg_mirror_count != FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg))
1916 ++ goto out_eagain;
1917 +
1918 + for (i = 0; i < pgio->pg_mirror_count; i++) {
1919 + ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, i, true);
1920 +@@ -869,11 +868,15 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
1921 + }
1922 +
1923 + return;
1924 +-
1925 ++out_eagain:
1926 ++ pnfs_generic_pg_cleanup(pgio);
1927 ++ pgio->pg_error = -EAGAIN;
1928 ++ return;
1929 + out_mds:
1930 + pnfs_put_lseg(pgio->pg_lseg);
1931 + pgio->pg_lseg = NULL;
1932 + nfs_pageio_reset_write_mds(pgio);
1933 ++ pgio->pg_error = -EAGAIN;
1934 + }
1935 +
1936 + static unsigned int
1937 +diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
1938 +index 4fa3f0ba9ab3..0a0b41071ed7 100644
1939 +--- a/fs/nfsd/nfs4callback.c
1940 ++++ b/fs/nfsd/nfs4callback.c
1941 +@@ -1096,6 +1096,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
1942 + err = setup_callback_client(clp, &conn, ses);
1943 + if (err) {
1944 + nfsd4_mark_cb_down(clp, err);
1945 ++ if (c)
1946 ++ svc_xprt_put(c->cn_xprt);
1947 + return;
1948 + }
1949 + }
1950 +diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
1951 +index 540ab5b75dbb..5617ec167a9d 100644
1952 +--- a/fs/ocfs2/ocfs2_fs.h
1953 ++++ b/fs/ocfs2/ocfs2_fs.h
1954 +@@ -304,7 +304,7 @@
1955 + #define OCFS2_MAX_SLOTS 255
1956 +
1957 + /* Slot map indicator for an empty slot */
1958 +-#define OCFS2_INVALID_SLOT -1
1959 ++#define OCFS2_INVALID_SLOT ((u16)-1)
1960 +
1961 + #define OCFS2_VOL_UUID_LEN 16
1962 + #define OCFS2_MAX_VOL_LABEL_LEN 64
1963 +@@ -340,8 +340,8 @@ struct ocfs2_system_inode_info {
1964 + enum {
1965 + BAD_BLOCK_SYSTEM_INODE = 0,
1966 + GLOBAL_INODE_ALLOC_SYSTEM_INODE,
1967 ++#define OCFS2_FIRST_ONLINE_SYSTEM_INODE GLOBAL_INODE_ALLOC_SYSTEM_INODE
1968 + SLOT_MAP_SYSTEM_INODE,
1969 +-#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
1970 + HEARTBEAT_SYSTEM_INODE,
1971 + GLOBAL_BITMAP_SYSTEM_INODE,
1972 + USER_QUOTA_SYSTEM_INODE,
1973 +diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
1974 +index fc6d25f6d444..28cc343bf6e3 100644
1975 +--- a/fs/ocfs2/suballoc.c
1976 ++++ b/fs/ocfs2/suballoc.c
1977 +@@ -2863,9 +2863,12 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
1978 + goto bail;
1979 + }
1980 +
1981 +- inode_alloc_inode =
1982 +- ocfs2_get_system_file_inode(osb, INODE_ALLOC_SYSTEM_INODE,
1983 +- suballoc_slot);
1984 ++ if (suballoc_slot == (u16)OCFS2_INVALID_SLOT)
1985 ++ inode_alloc_inode = ocfs2_get_system_file_inode(osb,
1986 ++ GLOBAL_INODE_ALLOC_SYSTEM_INODE, suballoc_slot);
1987 ++ else
1988 ++ inode_alloc_inode = ocfs2_get_system_file_inode(osb,
1989 ++ INODE_ALLOC_SYSTEM_INODE, suballoc_slot);
1990 + if (!inode_alloc_inode) {
1991 + /* the error code could be inaccurate, but we are not able to
1992 + * get the correct one. */
1993 +diff --git a/include/linux/bitops.h b/include/linux/bitops.h
1994 +index ce2bb045b3fd..9b9711ea267a 100644
1995 +--- a/include/linux/bitops.h
1996 ++++ b/include/linux/bitops.h
1997 +@@ -59,7 +59,7 @@ static inline int get_count_order(unsigned int count)
1998 +
1999 + static __always_inline unsigned long hweight_long(unsigned long w)
2000 + {
2001 +- return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
2002 ++ return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w);
2003 + }
2004 +
2005 + /**
2006 +diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
2007 +index 278e3ef05336..56c6d9031663 100644
2008 +--- a/include/linux/elfnote.h
2009 ++++ b/include/linux/elfnote.h
2010 +@@ -53,7 +53,7 @@
2011 + .popsection ;
2012 +
2013 + #define ELFNOTE(name, type, desc) \
2014 +- ELFNOTE_START(name, type, "") \
2015 ++ ELFNOTE_START(name, type, "a") \
2016 + desc ; \
2017 + ELFNOTE_END
2018 +
2019 +diff --git a/include/linux/genhd.h b/include/linux/genhd.h
2020 +index 5012fcdb4c9e..a27d0aef07f6 100644
2021 +--- a/include/linux/genhd.h
2022 ++++ b/include/linux/genhd.h
2023 +@@ -727,9 +727,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part)
2024 + static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
2025 + {
2026 + #if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP)
2027 ++ preempt_disable();
2028 + write_seqcount_begin(&part->nr_sects_seq);
2029 + part->nr_sects = size;
2030 + write_seqcount_end(&part->nr_sects_seq);
2031 ++ preempt_enable();
2032 + #elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT)
2033 + preempt_disable();
2034 + part->nr_sects = size;
2035 +diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
2036 +index cb527c78de9f..4db62045f01a 100644
2037 +--- a/include/linux/kprobes.h
2038 ++++ b/include/linux/kprobes.h
2039 +@@ -366,6 +366,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
2040 + return this_cpu_ptr(&kprobe_ctlblk);
2041 + }
2042 +
2043 ++extern struct kprobe kprobe_busy;
2044 ++void kprobe_busy_begin(void);
2045 ++void kprobe_busy_end(void);
2046 ++
2047 + int register_kprobe(struct kprobe *p);
2048 + void unregister_kprobe(struct kprobe *p);
2049 + int register_kprobes(struct kprobe **kps, int num);
2050 +diff --git a/include/linux/libata.h b/include/linux/libata.h
2051 +index 6428ac4746de..af561d33221d 100644
2052 +--- a/include/linux/libata.h
2053 ++++ b/include/linux/libata.h
2054 +@@ -38,6 +38,7 @@
2055 + #include <linux/acpi.h>
2056 + #include <linux/cdrom.h>
2057 + #include <linux/sched.h>
2058 ++#include <linux/async.h>
2059 +
2060 + /*
2061 + * Define if arch has non-standard setup. This is a _PCI_ standard
2062 +@@ -872,6 +873,8 @@ struct ata_port {
2063 + struct timer_list fastdrain_timer;
2064 + unsigned long fastdrain_cnt;
2065 +
2066 ++ async_cookie_t cookie;
2067 ++
2068 + int em_message_type;
2069 + void *private_data;
2070 +
2071 +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
2072 +index 1af616138d1d..5547f1a0f83b 100644
2073 +--- a/include/linux/pci_ids.h
2074 ++++ b/include/linux/pci_ids.h
2075 +@@ -2496,6 +2496,8 @@
2076 + #define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700
2077 + #define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff
2078 +
2079 ++#define PCI_VENDOR_ID_HUAWEI 0x19e5
2080 ++
2081 + #define PCI_VENDOR_ID_NETRONOME 0x19ee
2082 + #define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200
2083 + #define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240
2084 +diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
2085 +index 8c337cd0e1e4..bf03bab93d9e 100644
2086 +--- a/include/net/sctp/constants.h
2087 ++++ b/include/net/sctp/constants.h
2088 +@@ -357,11 +357,13 @@ typedef enum {
2089 + ipv4_is_anycast_6to4(a))
2090 +
2091 + /* Flags used for the bind address copy functions. */
2092 +-#define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by
2093 ++#define SCTP_ADDR4_ALLOWED 0x00000001 /* IPv4 address is allowed by
2094 + local sock family */
2095 +-#define SCTP_ADDR4_PEERSUPP 0x00000002 /* IPv4 address is supported by
2096 ++#define SCTP_ADDR6_ALLOWED 0x00000002 /* IPv6 address is allowed by
2097 ++ local sock family */
2098 ++#define SCTP_ADDR4_PEERSUPP 0x00000004 /* IPv4 address is supported by
2099 + peer */
2100 +-#define SCTP_ADDR6_PEERSUPP 0x00000004 /* IPv6 address is supported by
2101 ++#define SCTP_ADDR6_PEERSUPP 0x00000008 /* IPv6 address is supported by
2102 + peer */
2103 +
2104 + /* Reasons to retransmit. */
2105 +diff --git a/include/net/sock.h b/include/net/sock.h
2106 +index be5ec94020f1..426a57874964 100644
2107 +--- a/include/net/sock.h
2108 ++++ b/include/net/sock.h
2109 +@@ -1678,7 +1678,6 @@ static inline int sk_tx_queue_get(const struct sock *sk)
2110 +
2111 + static inline void sk_set_socket(struct sock *sk, struct socket *sock)
2112 + {
2113 +- sk_tx_queue_clear(sk);
2114 + sk->sk_socket = sock;
2115 + }
2116 +
2117 +diff --git a/kernel/kprobes.c b/kernel/kprobes.c
2118 +index f59f49bc2a5d..5bda113a3116 100644
2119 +--- a/kernel/kprobes.c
2120 ++++ b/kernel/kprobes.c
2121 +@@ -561,11 +561,12 @@ static void kprobe_optimizer(struct work_struct *work)
2122 + do_free_cleaned_kprobes();
2123 +
2124 + mutex_unlock(&module_mutex);
2125 +- mutex_unlock(&kprobe_mutex);
2126 +
2127 + /* Step 5: Kick optimizer again if needed */
2128 + if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list))
2129 + kick_kprobe_optimizer();
2130 ++
2131 ++ mutex_unlock(&kprobe_mutex);
2132 + }
2133 +
2134 + /* Wait for completing optimization and unoptimization */
2135 +@@ -1149,6 +1150,26 @@ __releases(hlist_lock)
2136 + }
2137 + NOKPROBE_SYMBOL(kretprobe_table_unlock);
2138 +
2139 ++struct kprobe kprobe_busy = {
2140 ++ .addr = (void *) get_kprobe,
2141 ++};
2142 ++
2143 ++void kprobe_busy_begin(void)
2144 ++{
2145 ++ struct kprobe_ctlblk *kcb;
2146 ++
2147 ++ preempt_disable();
2148 ++ __this_cpu_write(current_kprobe, &kprobe_busy);
2149 ++ kcb = get_kprobe_ctlblk();
2150 ++ kcb->kprobe_status = KPROBE_HIT_ACTIVE;
2151 ++}
2152 ++
2153 ++void kprobe_busy_end(void)
2154 ++{
2155 ++ __this_cpu_write(current_kprobe, NULL);
2156 ++ preempt_enable();
2157 ++}
2158 ++
2159 + /*
2160 + * This function is called from finish_task_switch when task tk becomes dead,
2161 + * so that we can recycle any function-return probe instances associated
2162 +@@ -1166,6 +1187,8 @@ void kprobe_flush_task(struct task_struct *tk)
2163 + /* Early boot. kretprobe_table_locks not yet initialized. */
2164 + return;
2165 +
2166 ++ kprobe_busy_begin();
2167 ++
2168 + INIT_HLIST_HEAD(&empty_rp);
2169 + hash = hash_ptr(tk, KPROBE_HASH_BITS);
2170 + head = &kretprobe_inst_table[hash];
2171 +@@ -1179,6 +1202,8 @@ void kprobe_flush_task(struct task_struct *tk)
2172 + hlist_del(&ri->hlist);
2173 + kfree(ri);
2174 + }
2175 ++
2176 ++ kprobe_busy_end();
2177 + }
2178 + NOKPROBE_SYMBOL(kprobe_flush_task);
2179 +
2180 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
2181 +index d81bcc6362ff..14a87c1f3a3a 100644
2182 +--- a/kernel/sched/core.c
2183 ++++ b/kernel/sched/core.c
2184 +@@ -3439,7 +3439,8 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
2185 + if (dl_prio(prio)) {
2186 + struct task_struct *pi_task = rt_mutex_get_top_task(p);
2187 + if (!dl_prio(p->normal_prio) ||
2188 +- (pi_task && dl_entity_preempt(&pi_task->dl, &p->dl))) {
2189 ++ (pi_task && dl_prio(pi_task->prio) &&
2190 ++ dl_entity_preempt(&pi_task->dl, &p->dl))) {
2191 + p->dl.dl_boosted = 1;
2192 + enqueue_flag |= ENQUEUE_REPLENISH;
2193 + } else
2194 +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
2195 +index 673756468019..8ac3663e0012 100644
2196 +--- a/kernel/trace/blktrace.c
2197 ++++ b/kernel/trace/blktrace.c
2198 +@@ -15,6 +15,9 @@
2199 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2200 + *
2201 + */
2202 ++
2203 ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2204 ++
2205 + #include <linux/kernel.h>
2206 + #include <linux/blkdev.h>
2207 + #include <linux/blktrace_api.h>
2208 +@@ -481,6 +484,16 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
2209 + */
2210 + strreplace(buts->name, '/', '_');
2211 +
2212 ++ /*
2213 ++ * bdev can be NULL, as with scsi-generic, this is a helpful as
2214 ++ * we can be.
2215 ++ */
2216 ++ if (q->blk_trace) {
2217 ++ pr_warn("Concurrent blktraces are not allowed on %s\n",
2218 ++ buts->name);
2219 ++ return -EBUSY;
2220 ++ }
2221 ++
2222 + bt = kzalloc(sizeof(*bt), GFP_KERNEL);
2223 + if (!bt)
2224 + return -ENOMEM;
2225 +diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
2226 +index 78346aba6980..94fca4d687ad 100644
2227 +--- a/kernel/trace/trace_events_trigger.c
2228 ++++ b/kernel/trace/trace_events_trigger.c
2229 +@@ -204,11 +204,17 @@ static int event_trigger_regex_open(struct inode *inode, struct file *file)
2230 +
2231 + static int trigger_process_regex(struct trace_event_file *file, char *buff)
2232 + {
2233 +- char *command, *next = buff;
2234 ++ char *command, *next;
2235 + struct event_command *p;
2236 + int ret = -EINVAL;
2237 +
2238 ++ next = buff = skip_spaces(buff);
2239 + command = strsep(&next, ": \t");
2240 ++ if (next) {
2241 ++ next = skip_spaces(next);
2242 ++ if (!*next)
2243 ++ next = NULL;
2244 ++ }
2245 + command = (command[0] != '!') ? command : command + 1;
2246 +
2247 + mutex_lock(&trigger_cmd_mutex);
2248 +@@ -615,8 +621,14 @@ event_trigger_callback(struct event_command *cmd_ops,
2249 + int ret;
2250 +
2251 + /* separate the trigger from the filter (t:n [if filter]) */
2252 +- if (param && isdigit(param[0]))
2253 ++ if (param && isdigit(param[0])) {
2254 + trigger = strsep(&param, " \t");
2255 ++ if (param) {
2256 ++ param = skip_spaces(param);
2257 ++ if (!*param)
2258 ++ param = NULL;
2259 ++ }
2260 ++ }
2261 +
2262 + trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
2263 +
2264 +@@ -1185,6 +1197,11 @@ event_enable_trigger_func(struct event_command *cmd_ops,
2265 + trigger = strsep(&param, " \t");
2266 + if (!trigger)
2267 + return -EINVAL;
2268 ++ if (param) {
2269 ++ param = skip_spaces(param);
2270 ++ if (!*param)
2271 ++ param = NULL;
2272 ++ }
2273 +
2274 + system = strsep(&trigger, ":");
2275 + if (!trigger)
2276 +diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
2277 +index 2c13ecc5bb2c..ed1f3df27260 100644
2278 +--- a/lib/zlib_inflate/inffast.c
2279 ++++ b/lib/zlib_inflate/inffast.c
2280 +@@ -10,17 +10,6 @@
2281 +
2282 + #ifndef ASMINF
2283 +
2284 +-/* Allow machine dependent optimization for post-increment or pre-increment.
2285 +- Based on testing to date,
2286 +- Pre-increment preferred for:
2287 +- - PowerPC G3 (Adler)
2288 +- - MIPS R5000 (Randers-Pehrson)
2289 +- Post-increment preferred for:
2290 +- - none
2291 +- No measurable difference:
2292 +- - Pentium III (Anderson)
2293 +- - M68060 (Nikl)
2294 +- */
2295 + union uu {
2296 + unsigned short us;
2297 + unsigned char b[2];
2298 +@@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p)
2299 + return mm.us;
2300 + }
2301 +
2302 +-#ifdef POSTINC
2303 +-# define OFF 0
2304 +-# define PUP(a) *(a)++
2305 +-# define UP_UNALIGNED(a) get_unaligned16((a)++)
2306 +-#else
2307 +-# define OFF 1
2308 +-# define PUP(a) *++(a)
2309 +-# define UP_UNALIGNED(a) get_unaligned16(++(a))
2310 +-#endif
2311 +-
2312 + /*
2313 + Decode literal, length, and distance codes and write out the resulting
2314 + literal and match bytes until either not enough input or output is
2315 +@@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start)
2316 +
2317 + /* copy state to local variables */
2318 + state = (struct inflate_state *)strm->state;
2319 +- in = strm->next_in - OFF;
2320 ++ in = strm->next_in;
2321 + last = in + (strm->avail_in - 5);
2322 +- out = strm->next_out - OFF;
2323 ++ out = strm->next_out;
2324 + beg = out - (start - strm->avail_out);
2325 + end = out + (strm->avail_out - 257);
2326 + #ifdef INFLATE_STRICT
2327 +@@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start)
2328 + input data or output space */
2329 + do {
2330 + if (bits < 15) {
2331 +- hold += (unsigned long)(PUP(in)) << bits;
2332 ++ hold += (unsigned long)(*in++) << bits;
2333 + bits += 8;
2334 +- hold += (unsigned long)(PUP(in)) << bits;
2335 ++ hold += (unsigned long)(*in++) << bits;
2336 + bits += 8;
2337 + }
2338 + this = lcode[hold & lmask];
2339 +@@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start)
2340 + bits -= op;
2341 + op = (unsigned)(this.op);
2342 + if (op == 0) { /* literal */
2343 +- PUP(out) = (unsigned char)(this.val);
2344 ++ *out++ = (unsigned char)(this.val);
2345 + }
2346 + else if (op & 16) { /* length base */
2347 + len = (unsigned)(this.val);
2348 + op &= 15; /* number of extra bits */
2349 + if (op) {
2350 + if (bits < op) {
2351 +- hold += (unsigned long)(PUP(in)) << bits;
2352 ++ hold += (unsigned long)(*in++) << bits;
2353 + bits += 8;
2354 + }
2355 + len += (unsigned)hold & ((1U << op) - 1);
2356 +@@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start)
2357 + bits -= op;
2358 + }
2359 + if (bits < 15) {
2360 +- hold += (unsigned long)(PUP(in)) << bits;
2361 ++ hold += (unsigned long)(*in++) << bits;
2362 + bits += 8;
2363 +- hold += (unsigned long)(PUP(in)) << bits;
2364 ++ hold += (unsigned long)(*in++) << bits;
2365 + bits += 8;
2366 + }
2367 + this = dcode[hold & dmask];
2368 +@@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start)
2369 + dist = (unsigned)(this.val);
2370 + op &= 15; /* number of extra bits */
2371 + if (bits < op) {
2372 +- hold += (unsigned long)(PUP(in)) << bits;
2373 ++ hold += (unsigned long)(*in++) << bits;
2374 + bits += 8;
2375 + if (bits < op) {
2376 +- hold += (unsigned long)(PUP(in)) << bits;
2377 ++ hold += (unsigned long)(*in++) << bits;
2378 + bits += 8;
2379 + }
2380 + }
2381 +@@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start)
2382 + state->mode = BAD;
2383 + break;
2384 + }
2385 +- from = window - OFF;
2386 ++ from = window;
2387 + if (write == 0) { /* very common case */
2388 + from += wsize - op;
2389 + if (op < len) { /* some from window */
2390 + len -= op;
2391 + do {
2392 +- PUP(out) = PUP(from);
2393 ++ *out++ = *from++;
2394 + } while (--op);
2395 + from = out - dist; /* rest from output */
2396 + }
2397 +@@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start)
2398 + if (op < len) { /* some from end of window */
2399 + len -= op;
2400 + do {
2401 +- PUP(out) = PUP(from);
2402 ++ *out++ = *from++;
2403 + } while (--op);
2404 +- from = window - OFF;
2405 ++ from = window;
2406 + if (write < len) { /* some from start of window */
2407 + op = write;
2408 + len -= op;
2409 + do {
2410 +- PUP(out) = PUP(from);
2411 ++ *out++ = *from++;
2412 + } while (--op);
2413 + from = out - dist; /* rest from output */
2414 + }
2415 +@@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start)
2416 + if (op < len) { /* some from window */
2417 + len -= op;
2418 + do {
2419 +- PUP(out) = PUP(from);
2420 ++ *out++ = *from++;
2421 + } while (--op);
2422 + from = out - dist; /* rest from output */
2423 + }
2424 + }
2425 + while (len > 2) {
2426 +- PUP(out) = PUP(from);
2427 +- PUP(out) = PUP(from);
2428 +- PUP(out) = PUP(from);
2429 ++ *out++ = *from++;
2430 ++ *out++ = *from++;
2431 ++ *out++ = *from++;
2432 + len -= 3;
2433 + }
2434 + if (len) {
2435 +- PUP(out) = PUP(from);
2436 ++ *out++ = *from++;
2437 + if (len > 1)
2438 +- PUP(out) = PUP(from);
2439 ++ *out++ = *from++;
2440 + }
2441 + }
2442 + else {
2443 +@@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start)
2444 + from = out - dist; /* copy direct from output */
2445 + /* minimum length is three */
2446 + /* Align out addr */
2447 +- if (!((long)(out - 1 + OFF) & 1)) {
2448 +- PUP(out) = PUP(from);
2449 ++ if (!((long)(out - 1) & 1)) {
2450 ++ *out++ = *from++;
2451 + len--;
2452 + }
2453 +- sout = (unsigned short *)(out - OFF);
2454 ++ sout = (unsigned short *)(out);
2455 + if (dist > 2) {
2456 + unsigned short *sfrom;
2457 +
2458 +- sfrom = (unsigned short *)(from - OFF);
2459 ++ sfrom = (unsigned short *)(from);
2460 + loops = len >> 1;
2461 + do
2462 + #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
2463 +- PUP(sout) = PUP(sfrom);
2464 ++ *sout++ = *sfrom++;
2465 + #else
2466 +- PUP(sout) = UP_UNALIGNED(sfrom);
2467 ++ *sout++ = get_unaligned16(sfrom++);
2468 + #endif
2469 + while (--loops);
2470 +- out = (unsigned char *)sout + OFF;
2471 +- from = (unsigned char *)sfrom + OFF;
2472 ++ out = (unsigned char *)sout;
2473 ++ from = (unsigned char *)sfrom;
2474 + } else { /* dist == 1 or dist == 2 */
2475 + unsigned short pat16;
2476 +
2477 +- pat16 = *(sout-1+OFF);
2478 ++ pat16 = *(sout-1);
2479 + if (dist == 1) {
2480 + union uu mm;
2481 + /* copy one char pattern to both bytes */
2482 +@@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start)
2483 + }
2484 + loops = len >> 1;
2485 + do
2486 +- PUP(sout) = pat16;
2487 ++ *sout++ = pat16;
2488 + while (--loops);
2489 +- out = (unsigned char *)sout + OFF;
2490 ++ out = (unsigned char *)sout;
2491 + }
2492 + if (len & 1)
2493 +- PUP(out) = PUP(from);
2494 ++ *out++ = *from++;
2495 + }
2496 + }
2497 + else if ((op & 64) == 0) { /* 2nd level distance code */
2498 +@@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start)
2499 + hold &= (1U << bits) - 1;
2500 +
2501 + /* update state and return */
2502 +- strm->next_in = in + OFF;
2503 +- strm->next_out = out + OFF;
2504 ++ strm->next_in = in;
2505 ++ strm->next_out = out;
2506 + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
2507 + strm->avail_out = (unsigned)(out < end ?
2508 + 257 + (end - out) : 257 - (out - end));
2509 +diff --git a/mm/slab_common.c b/mm/slab_common.c
2510 +index 01e7246de8df..5d8c809a3ff7 100644
2511 +--- a/mm/slab_common.c
2512 ++++ b/mm/slab_common.c
2513 +@@ -1269,7 +1269,7 @@ void kzfree(const void *p)
2514 + if (unlikely(ZERO_OR_NULL_PTR(mem)))
2515 + return;
2516 + ks = ksize(mem);
2517 +- memset(mem, 0, ks);
2518 ++ memzero_explicit(mem, ks);
2519 + kfree(mem);
2520 + }
2521 + EXPORT_SYMBOL(kzfree);
2522 +diff --git a/net/core/dev.c b/net/core/dev.c
2523 +index 38e4977eb09d..09115c68f29d 100644
2524 +--- a/net/core/dev.c
2525 ++++ b/net/core/dev.c
2526 +@@ -82,6 +82,7 @@
2527 + #include <linux/slab.h>
2528 + #include <linux/sched.h>
2529 + #include <linux/mutex.h>
2530 ++#include <linux/rwsem.h>
2531 + #include <linux/string.h>
2532 + #include <linux/mm.h>
2533 + #include <linux/socket.h>
2534 +@@ -185,7 +186,7 @@ static DEFINE_SPINLOCK(napi_hash_lock);
2535 + static unsigned int napi_gen_id = NR_CPUS;
2536 + static DEFINE_HASHTABLE(napi_hash, 8);
2537 +
2538 +-static seqcount_t devnet_rename_seq;
2539 ++static DECLARE_RWSEM(devnet_rename_sem);
2540 +
2541 + static inline void dev_base_seq_inc(struct net *net)
2542 + {
2543 +@@ -862,33 +863,28 @@ EXPORT_SYMBOL(dev_get_by_index);
2544 + * @net: network namespace
2545 + * @name: a pointer to the buffer where the name will be stored.
2546 + * @ifindex: the ifindex of the interface to get the name from.
2547 +- *
2548 +- * The use of raw_seqcount_begin() and cond_resched() before
2549 +- * retrying is required as we want to give the writers a chance
2550 +- * to complete when CONFIG_PREEMPT is not set.
2551 + */
2552 + int netdev_get_name(struct net *net, char *name, int ifindex)
2553 + {
2554 + struct net_device *dev;
2555 +- unsigned int seq;
2556 ++ int ret;
2557 +
2558 +-retry:
2559 +- seq = raw_seqcount_begin(&devnet_rename_seq);
2560 ++ down_read(&devnet_rename_sem);
2561 + rcu_read_lock();
2562 ++
2563 + dev = dev_get_by_index_rcu(net, ifindex);
2564 + if (!dev) {
2565 +- rcu_read_unlock();
2566 +- return -ENODEV;
2567 ++ ret = -ENODEV;
2568 ++ goto out;
2569 + }
2570 +
2571 + strcpy(name, dev->name);
2572 +- rcu_read_unlock();
2573 +- if (read_seqcount_retry(&devnet_rename_seq, seq)) {
2574 +- cond_resched();
2575 +- goto retry;
2576 +- }
2577 +
2578 +- return 0;
2579 ++ ret = 0;
2580 ++out:
2581 ++ rcu_read_unlock();
2582 ++ up_read(&devnet_rename_sem);
2583 ++ return ret;
2584 + }
2585 +
2586 + /**
2587 +@@ -1153,10 +1149,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
2588 + if (dev->flags & IFF_UP)
2589 + return -EBUSY;
2590 +
2591 +- write_seqcount_begin(&devnet_rename_seq);
2592 ++ down_write(&devnet_rename_sem);
2593 +
2594 + if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
2595 +- write_seqcount_end(&devnet_rename_seq);
2596 ++ up_write(&devnet_rename_sem);
2597 + return 0;
2598 + }
2599 +
2600 +@@ -1164,7 +1160,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
2601 +
2602 + err = dev_get_valid_name(net, dev, newname);
2603 + if (err < 0) {
2604 +- write_seqcount_end(&devnet_rename_seq);
2605 ++ up_write(&devnet_rename_sem);
2606 + return err;
2607 + }
2608 +
2609 +@@ -1179,11 +1175,11 @@ rollback:
2610 + if (ret) {
2611 + memcpy(dev->name, oldname, IFNAMSIZ);
2612 + dev->name_assign_type = old_assign_type;
2613 +- write_seqcount_end(&devnet_rename_seq);
2614 ++ up_write(&devnet_rename_sem);
2615 + return ret;
2616 + }
2617 +
2618 +- write_seqcount_end(&devnet_rename_seq);
2619 ++ up_write(&devnet_rename_sem);
2620 +
2621 + netdev_adjacent_rename_links(dev, oldname);
2622 +
2623 +@@ -1204,7 +1200,7 @@ rollback:
2624 + /* err >= 0 after dev_alloc_name() or stores the first errno */
2625 + if (err >= 0) {
2626 + err = ret;
2627 +- write_seqcount_begin(&devnet_rename_seq);
2628 ++ down_write(&devnet_rename_sem);
2629 + memcpy(dev->name, oldname, IFNAMSIZ);
2630 + memcpy(oldname, newname, IFNAMSIZ);
2631 + dev->name_assign_type = old_assign_type;
2632 +@@ -3021,7 +3017,7 @@ static void skb_update_prio(struct sk_buff *skb)
2633 + DEFINE_PER_CPU(int, xmit_recursion);
2634 + EXPORT_SYMBOL(xmit_recursion);
2635 +
2636 +-#define RECURSION_LIMIT 10
2637 ++#define RECURSION_LIMIT 8
2638 +
2639 + /**
2640 + * dev_loopback_xmit - loop back @skb
2641 +@@ -6844,6 +6840,13 @@ int register_netdevice(struct net_device *dev)
2642 + rcu_barrier();
2643 +
2644 + dev->reg_state = NETREG_UNREGISTERED;
2645 ++ /* We should put the kobject that hold in
2646 ++ * netdev_unregister_kobject(), otherwise
2647 ++ * the net device cannot be freed when
2648 ++ * driver calls free_netdev(), because the
2649 ++ * kobject is being hold.
2650 ++ */
2651 ++ kobject_put(&dev->dev.kobj);
2652 + }
2653 + /*
2654 + * Prevent userspace races by waiting until the network
2655 +diff --git a/net/core/sock.c b/net/core/sock.c
2656 +index 60b19c3bb0f7..120d5058d81a 100644
2657 +--- a/net/core/sock.c
2658 ++++ b/net/core/sock.c
2659 +@@ -1435,6 +1435,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
2660 +
2661 + sock_update_classid(sk);
2662 + sock_update_netprioidx(sk);
2663 ++ sk_tx_queue_clear(sk);
2664 + }
2665 +
2666 + return sk;
2667 +@@ -1601,6 +1602,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
2668 + */
2669 + sk_refcnt_debug_inc(newsk);
2670 + sk_set_socket(newsk, NULL);
2671 ++ sk_tx_queue_clear(newsk);
2672 + newsk->sk_wq = NULL;
2673 +
2674 + sk_update_clone(sk, newsk);
2675 +diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
2676 +index 498d5a929d6f..3c1e42d49520 100644
2677 +--- a/net/ipv4/fib_semantics.c
2678 ++++ b/net/ipv4/fib_semantics.c
2679 +@@ -776,7 +776,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
2680 + if (fl4.flowi4_scope < RT_SCOPE_LINK)
2681 + fl4.flowi4_scope = RT_SCOPE_LINK;
2682 +
2683 +- if (cfg->fc_table)
2684 ++ if (cfg->fc_table && cfg->fc_table != RT_TABLE_MAIN)
2685 + tbl = fib_get_table(net, cfg->fc_table);
2686 +
2687 + if (tbl)
2688 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
2689 +index 20b21f8578e1..3d9761516683 100644
2690 +--- a/net/ipv4/ip_tunnel.c
2691 ++++ b/net/ipv4/ip_tunnel.c
2692 +@@ -98,9 +98,10 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2693 + __be32 remote, __be32 local,
2694 + __be32 key)
2695 + {
2696 +- unsigned int hash;
2697 + struct ip_tunnel *t, *cand = NULL;
2698 + struct hlist_head *head;
2699 ++ struct net_device *ndev;
2700 ++ unsigned int hash;
2701 +
2702 + hash = ip_tunnel_hash(key, remote);
2703 + head = &itn->tunnels[hash];
2704 +@@ -175,8 +176,9 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2705 + if (t)
2706 + return t;
2707 +
2708 +- if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags & IFF_UP)
2709 +- return netdev_priv(itn->fb_tunnel_dev);
2710 ++ ndev = READ_ONCE(itn->fb_tunnel_dev);
2711 ++ if (ndev && ndev->flags & IFF_UP)
2712 ++ return netdev_priv(ndev);
2713 +
2714 + return NULL;
2715 + }
2716 +@@ -1160,9 +1162,9 @@ void ip_tunnel_uninit(struct net_device *dev)
2717 + struct ip_tunnel_net *itn;
2718 +
2719 + itn = net_generic(net, tunnel->ip_tnl_net_id);
2720 +- /* fb_tunnel_dev will be unregisted in net-exit call. */
2721 +- if (itn->fb_tunnel_dev != dev)
2722 +- ip_tunnel_del(itn, netdev_priv(dev));
2723 ++ ip_tunnel_del(itn, netdev_priv(dev));
2724 ++ if (itn->fb_tunnel_dev == dev)
2725 ++ WRITE_ONCE(itn->fb_tunnel_dev, NULL);
2726 +
2727 + dst_cache_reset(&tunnel->dst_cache);
2728 + }
2729 +diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
2730 +index 448c2615fece..9fb3a5e83a7c 100644
2731 +--- a/net/ipv4/tcp_cubic.c
2732 ++++ b/net/ipv4/tcp_cubic.c
2733 +@@ -414,6 +414,8 @@ static void hystart_update(struct sock *sk, u32 delay)
2734 +
2735 + if (hystart_detect & HYSTART_DELAY) {
2736 + /* obtain the minimum delay of more than sampling packets */
2737 ++ if (ca->curr_rtt > delay)
2738 ++ ca->curr_rtt = delay;
2739 + if (ca->sample_cnt < HYSTART_MIN_SAMPLES) {
2740 + if (ca->curr_rtt == 0 || ca->curr_rtt > delay)
2741 + ca->curr_rtt = delay;
2742 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2743 +index 64c7265793a5..e2066f2f19b4 100644
2744 +--- a/net/ipv4/tcp_input.c
2745 ++++ b/net/ipv4/tcp_input.c
2746 +@@ -4465,7 +4465,11 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
2747 + if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb,
2748 + skb, &fragstolen)) {
2749 + coalesce_done:
2750 +- tcp_grow_window(sk, skb);
2751 ++ /* For non sack flows, do not grow window to force DUPACK
2752 ++ * and trigger fast retransmit.
2753 ++ */
2754 ++ if (tcp_is_sack(tp))
2755 ++ tcp_grow_window(sk, skb);
2756 + kfree_skb_partial(skb, fragstolen);
2757 + skb = NULL;
2758 + goto add_sack;
2759 +@@ -4545,7 +4549,11 @@ add_sack:
2760 + tcp_sack_new_ofo_skb(sk, seq, end_seq);
2761 + end:
2762 + if (skb) {
2763 +- tcp_grow_window(sk, skb);
2764 ++ /* For non sack flows, do not grow window to force DUPACK
2765 ++ * and trigger fast retransmit.
2766 ++ */
2767 ++ if (tcp_is_sack(tp))
2768 ++ tcp_grow_window(sk, skb);
2769 + skb_set_owner_r(skb, sk);
2770 + }
2771 + }
2772 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
2773 +index b25f4ad28b03..546172bfaba1 100644
2774 +--- a/net/ipv6/ip6_gre.c
2775 ++++ b/net/ipv6/ip6_gre.c
2776 +@@ -125,6 +125,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
2777 + int dev_type = (gre_proto == htons(ETH_P_TEB)) ?
2778 + ARPHRD_ETHER : ARPHRD_IP6GRE;
2779 + int score, cand_score = 4;
2780 ++ struct net_device *ndev;
2781 +
2782 + for_each_ip_tunnel_rcu(t, ign->tunnels_r_l[h0 ^ h1]) {
2783 + if (!ipv6_addr_equal(local, &t->parms.laddr) ||
2784 +@@ -227,9 +228,9 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
2785 + if (cand)
2786 + return cand;
2787 +
2788 +- dev = ign->fb_tunnel_dev;
2789 +- if (dev->flags & IFF_UP)
2790 +- return netdev_priv(dev);
2791 ++ ndev = READ_ONCE(ign->fb_tunnel_dev);
2792 ++ if (ndev && ndev->flags & IFF_UP)
2793 ++ return netdev_priv(ndev);
2794 +
2795 + return NULL;
2796 + }
2797 +@@ -364,6 +365,8 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)
2798 + struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id);
2799 +
2800 + ip6gre_tunnel_unlink(ign, t);
2801 ++ if (ign->fb_tunnel_dev == dev)
2802 ++ WRITE_ONCE(ign->fb_tunnel_dev, NULL);
2803 + dst_cache_reset(&t->dst_cache);
2804 + dev_put(dev);
2805 + }
2806 +diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
2807 +index 976c8133a281..2d28f0b54494 100644
2808 +--- a/net/ipv6/mcast.c
2809 ++++ b/net/ipv6/mcast.c
2810 +@@ -2580,6 +2580,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev)
2811 + write_unlock_bh(&idev->lock);
2812 +
2813 + igmp6_group_dropped(i);
2814 ++ ip6_mc_clear_src(i);
2815 + ma_put(i);
2816 +
2817 + write_lock_bh(&idev->lock);
2818 +diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
2819 +index 239464045697..53c53b1c881c 100644
2820 +--- a/net/l2tp/l2tp_core.c
2821 ++++ b/net/l2tp/l2tp_core.c
2822 +@@ -351,8 +351,13 @@ int l2tp_session_register(struct l2tp_session *session,
2823 +
2824 + spin_lock_bh(&pn->l2tp_session_hlist_lock);
2825 +
2826 ++ /* IP encap expects session IDs to be globally unique, while
2827 ++ * UDP encap doesn't.
2828 ++ */
2829 + hlist_for_each_entry(session_walk, g_head, global_hlist)
2830 +- if (session_walk->session_id == session->session_id) {
2831 ++ if (session_walk->session_id == session->session_id &&
2832 ++ (session_walk->tunnel->encap == L2TP_ENCAPTYPE_IP ||
2833 ++ tunnel->encap == L2TP_ENCAPTYPE_IP)) {
2834 + err = -EEXIST;
2835 + goto err_tlock_pnlock;
2836 + }
2837 +diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
2838 +index 0583e2491770..3231030a73ed 100644
2839 +--- a/net/netfilter/ipset/ip_set_core.c
2840 ++++ b/net/netfilter/ipset/ip_set_core.c
2841 +@@ -379,6 +379,8 @@ ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], size_t len,
2842 + for (id = 0; id < IPSET_EXT_ID_MAX; id++) {
2843 + if (!add_extension(id, cadt_flags, tb))
2844 + continue;
2845 ++ if (align < ip_set_extensions[id].align)
2846 ++ align = ip_set_extensions[id].align;
2847 + len = ALIGN(len, ip_set_extensions[id].align);
2848 + set->offset[id] = len;
2849 + set->extensions |= ip_set_extensions[id].type;
2850 +diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
2851 +index f4aa2ab4713a..eb814ffc0902 100644
2852 +--- a/net/sched/sch_fq.c
2853 ++++ b/net/sched/sch_fq.c
2854 +@@ -830,24 +830,20 @@ nla_put_failure:
2855 + static int fq_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
2856 + {
2857 + struct fq_sched_data *q = qdisc_priv(sch);
2858 +- struct tc_fq_qd_stats st;
2859 +-
2860 +- sch_tree_lock(sch);
2861 +-
2862 +- st.gc_flows = q->stat_gc_flows;
2863 +- st.highprio_packets = q->stat_internal_packets;
2864 +- st.tcp_retrans = q->stat_tcp_retrans;
2865 +- st.throttled = q->stat_throttled;
2866 +- st.flows_plimit = q->stat_flows_plimit;
2867 +- st.pkts_too_long = q->stat_pkts_too_long;
2868 +- st.allocation_errors = q->stat_allocation_errors;
2869 +- st.time_next_delayed_flow = q->time_next_delayed_flow - ktime_get_ns();
2870 +- st.flows = q->flows;
2871 +- st.inactive_flows = q->inactive_flows;
2872 +- st.throttled_flows = q->throttled_flows;
2873 +- st.pad = 0;
2874 +-
2875 +- sch_tree_unlock(sch);
2876 ++ u64 now = ktime_get_ns();
2877 ++ struct tc_fq_qd_stats st = {
2878 ++ .gc_flows = q->stat_gc_flows,
2879 ++ .highprio_packets = q->stat_internal_packets,
2880 ++ .tcp_retrans = q->stat_tcp_retrans,
2881 ++ .throttled = q->stat_throttled,
2882 ++ .flows_plimit = q->stat_flows_plimit,
2883 ++ .pkts_too_long = q->stat_pkts_too_long,
2884 ++ .allocation_errors = q->stat_allocation_errors,
2885 ++ .flows = q->flows,
2886 ++ .inactive_flows = q->inactive_flows,
2887 ++ .throttled_flows = q->throttled_flows,
2888 ++ .time_next_delayed_flow = q->time_next_delayed_flow - now,
2889 ++ };
2890 +
2891 + return gnet_stats_copy_app(d, &st, sizeof(st));
2892 + }
2893 +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
2894 +index 09cd65434748..10c05fa0e6b3 100644
2895 +--- a/net/sched/sch_generic.c
2896 ++++ b/net/sched/sch_generic.c
2897 +@@ -329,6 +329,7 @@ void __netdev_watchdog_up(struct net_device *dev)
2898 + dev_hold(dev);
2899 + }
2900 + }
2901 ++EXPORT_SYMBOL_GPL(__netdev_watchdog_up);
2902 +
2903 + static void dev_watchdog_up(struct net_device *dev)
2904 + {
2905 +diff --git a/net/sctp/associola.c b/net/sctp/associola.c
2906 +index f24d31f12cb4..aa38578fdfcd 100644
2907 +--- a/net/sctp/associola.c
2908 ++++ b/net/sctp/associola.c
2909 +@@ -1575,12 +1575,15 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
2910 + int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
2911 + sctp_scope_t scope, gfp_t gfp)
2912 + {
2913 ++ struct sock *sk = asoc->base.sk;
2914 + int flags;
2915 +
2916 + /* Use scoping rules to determine the subset of addresses from
2917 + * the endpoint.
2918 + */
2919 +- flags = (PF_INET6 == asoc->base.sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
2920 ++ flags = (PF_INET6 == sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
2921 ++ if (!inet_v6_ipv6only(sk))
2922 ++ flags |= SCTP_ADDR4_ALLOWED;
2923 + if (asoc->peer.ipv4_address)
2924 + flags |= SCTP_ADDR4_PEERSUPP;
2925 + if (asoc->peer.ipv6_address)
2926 +diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
2927 +index 871cdf9567e6..664215448d09 100644
2928 +--- a/net/sctp/bind_addr.c
2929 ++++ b/net/sctp/bind_addr.c
2930 +@@ -449,6 +449,7 @@ static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest,
2931 + * well as the remote peer.
2932 + */
2933 + if ((((AF_INET == addr->sa.sa_family) &&
2934 ++ (flags & SCTP_ADDR4_ALLOWED) &&
2935 + (flags & SCTP_ADDR4_PEERSUPP))) ||
2936 + (((AF_INET6 == addr->sa.sa_family) &&
2937 + (flags & SCTP_ADDR6_ALLOWED) &&
2938 +diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
2939 +index 9c6c42fd9f8a..b0e401dfe160 100644
2940 +--- a/net/sctp/protocol.c
2941 ++++ b/net/sctp/protocol.c
2942 +@@ -210,6 +210,7 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp,
2943 + * sock as well as the remote peer.
2944 + */
2945 + if ((((AF_INET == addr->a.sa.sa_family) &&
2946 ++ (copy_flags & SCTP_ADDR4_ALLOWED) &&
2947 + (copy_flags & SCTP_ADDR4_PEERSUPP))) ||
2948 + (((AF_INET6 == addr->a.sa.sa_family) &&
2949 + (copy_flags & SCTP_ADDR6_ALLOWED) &&
2950 +diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
2951 +index 2e0a6f92e563..8391c2785550 100644
2952 +--- a/net/sunrpc/addr.c
2953 ++++ b/net/sunrpc/addr.c
2954 +@@ -81,11 +81,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap,
2955 +
2956 + rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u",
2957 + IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id);
2958 +- if (unlikely((size_t)rc > sizeof(scopebuf)))
2959 ++ if (unlikely((size_t)rc >= sizeof(scopebuf)))
2960 + return 0;
2961 +
2962 + len += rc;
2963 +- if (unlikely(len > buflen))
2964 ++ if (unlikely(len >= buflen))
2965 + return 0;
2966 +
2967 + strcat(buf, scopebuf);
2968 +diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
2969 +index 9103dd15511c..12dd5cc499c1 100644
2970 +--- a/net/sunrpc/rpc_pipe.c
2971 ++++ b/net/sunrpc/rpc_pipe.c
2972 +@@ -1347,6 +1347,7 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
2973 + q.len = strlen(gssd_dummy_clnt_dir[0].name);
2974 + clnt_dentry = d_hash_and_lookup(gssd_dentry, &q);
2975 + if (!clnt_dentry) {
2976 ++ __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1);
2977 + pipe_dentry = ERR_PTR(-ENOENT);
2978 + goto out;
2979 + }
2980 +diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
2981 +index ed9bbd383f7d..df7ecf9584f6 100644
2982 +--- a/net/sunrpc/xdr.c
2983 ++++ b/net/sunrpc/xdr.c
2984 +@@ -1031,6 +1031,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
2985 + base = 0;
2986 + } else {
2987 + base -= buf->head[0].iov_len;
2988 ++ subbuf->head[0].iov_base = buf->head[0].iov_base;
2989 + subbuf->head[0].iov_len = 0;
2990 + }
2991 +
2992 +@@ -1043,6 +1044,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
2993 + base = 0;
2994 + } else {
2995 + base -= buf->page_len;
2996 ++ subbuf->pages = buf->pages;
2997 ++ subbuf->page_base = 0;
2998 + subbuf->page_len = 0;
2999 + }
3000 +
3001 +@@ -1054,6 +1057,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
3002 + base = 0;
3003 + } else {
3004 + base -= buf->tail[0].iov_len;
3005 ++ subbuf->tail[0].iov_base = buf->tail[0].iov_base;
3006 + subbuf->tail[0].iov_len = 0;
3007 + }
3008 +
3009 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
3010 +index e61a5c29b08c..b6f055157b89 100644
3011 +--- a/scripts/Kbuild.include
3012 ++++ b/scripts/Kbuild.include
3013 +@@ -81,20 +81,21 @@ cc-cross-prefix = \
3014 + fi)))
3015 +
3016 + # output directory for tests below
3017 +-TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
3018 ++TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
3019 +
3020 + # try-run
3021 + # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
3022 + # Exit code chooses option. "$$TMP" is can be used as temporary file and
3023 + # is automatically cleaned up.
3024 + try-run = $(shell set -e; \
3025 +- TMP="$(TMPOUT).$$$$.tmp"; \
3026 +- TMPO="$(TMPOUT).$$$$.o"; \
3027 ++ TMP=$(TMPOUT)/tmp; \
3028 ++ TMPO=$(TMPOUT)/tmp.o; \
3029 ++ mkdir -p $(TMPOUT); \
3030 ++ trap "rm -rf $(TMPOUT)" EXIT; \
3031 + if ($(1)) >/dev/null 2>&1; \
3032 + then echo "$(2)"; \
3033 + else echo "$(3)"; \
3034 +- fi; \
3035 +- rm -f "$$TMP" "$$TMPO")
3036 ++ fi)
3037 +
3038 + # as-option
3039 + # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
3040 +diff --git a/scripts/mksysmap b/scripts/mksysmap
3041 +index a35acc0d0b82..9aa23d15862a 100755
3042 +--- a/scripts/mksysmap
3043 ++++ b/scripts/mksysmap
3044 +@@ -41,4 +41,4 @@
3045 + # so we just ignore them to let readprofile continue to work.
3046 + # (At least sparc64 has __crc_ in the middle).
3047 +
3048 +-$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2
3049 ++$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2
3050 +diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
3051 +index 0a258c0602d1..55c869e0a3a0 100644
3052 +--- a/security/selinux/ss/services.c
3053 ++++ b/security/selinux/ss/services.c
3054 +@@ -2622,8 +2622,12 @@ err:
3055 + if (*names) {
3056 + for (i = 0; i < *len; i++)
3057 + kfree((*names)[i]);
3058 ++ kfree(*names);
3059 + }
3060 + kfree(*values);
3061 ++ *len = 0;
3062 ++ *names = NULL;
3063 ++ *values = NULL;
3064 + goto out;
3065 + }
3066 +
3067 +diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
3068 +index 718d5e3b7806..6c06d0645779 100644
3069 +--- a/sound/isa/wavefront/wavefront_synth.c
3070 ++++ b/sound/isa/wavefront/wavefront_synth.c
3071 +@@ -1174,7 +1174,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)
3072 + "alias for %d\n",
3073 + header->number,
3074 + header->hdr.a.OriginalSample);
3075 +-
3076 ++
3077 ++ if (header->number >= WF_MAX_SAMPLE)
3078 ++ return -EINVAL;
3079 ++
3080 + munge_int32 (header->number, &alias_hdr[0], 2);
3081 + munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2);
3082 + munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset),
3083 +@@ -1205,6 +1208,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)
3084 + int num_samples;
3085 + unsigned char *msample_hdr;
3086 +
3087 ++ if (header->number >= WF_MAX_SAMPLE)
3088 ++ return -EINVAL;
3089 ++
3090 + msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL);
3091 + if (! msample_hdr)
3092 + return -ENOMEM;
3093 +diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
3094 +index ffc000bc1f15..56a873ba08e4 100644
3095 +--- a/sound/soc/fsl/fsl_asrc_dma.c
3096 ++++ b/sound/soc/fsl/fsl_asrc_dma.c
3097 +@@ -243,6 +243,7 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream,
3098 + ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be);
3099 + if (ret) {
3100 + dev_err(dev, "failed to config DMA channel for Back-End\n");
3101 ++ dma_release_channel(pair->dma_chan[dir]);
3102 + return ret;
3103 + }
3104 +
3105 +diff --git a/sound/usb/card.h b/sound/usb/card.h
3106 +index 71778ca4b26a..844c68863810 100644
3107 +--- a/sound/usb/card.h
3108 ++++ b/sound/usb/card.h
3109 +@@ -80,6 +80,10 @@ struct snd_usb_endpoint {
3110 + dma_addr_t sync_dma; /* DMA address of syncbuf */
3111 +
3112 + unsigned int pipe; /* the data i/o pipe */
3113 ++ unsigned int framesize[2]; /* small/large frame sizes in samples */
3114 ++ unsigned int sample_rem; /* remainder from division fs/fps */
3115 ++ unsigned int sample_accum; /* sample accumulator */
3116 ++ unsigned int fps; /* frames per second */
3117 + unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */
3118 + unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */
3119 + int freqshift; /* how much to shift the feedback value to get Q16.16 */
3120 +diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
3121 +index 66648b4bdd28..666731317b33 100644
3122 +--- a/sound/usb/endpoint.c
3123 ++++ b/sound/usb/endpoint.c
3124 +@@ -137,12 +137,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep)
3125 +
3126 + /*
3127 + * For streaming based on information derived from sync endpoints,
3128 +- * prepare_outbound_urb_sizes() will call next_packet_size() to
3129 ++ * prepare_outbound_urb_sizes() will call slave_next_packet_size() to
3130 + * determine the number of samples to be sent in the next packet.
3131 + *
3132 +- * For implicit feedback, next_packet_size() is unused.
3133 ++ * For implicit feedback, slave_next_packet_size() is unused.
3134 + */
3135 +-int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
3136 ++int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep)
3137 + {
3138 + unsigned long flags;
3139 + int ret;
3140 +@@ -159,6 +159,29 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
3141 + return ret;
3142 + }
3143 +
3144 ++/*
3145 ++ * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes()
3146 ++ * will call next_packet_size() to determine the number of samples to be
3147 ++ * sent in the next packet.
3148 ++ */
3149 ++int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
3150 ++{
3151 ++ int ret;
3152 ++
3153 ++ if (ep->fill_max)
3154 ++ return ep->maxframesize;
3155 ++
3156 ++ ep->sample_accum += ep->sample_rem;
3157 ++ if (ep->sample_accum >= ep->fps) {
3158 ++ ep->sample_accum -= ep->fps;
3159 ++ ret = ep->framesize[1];
3160 ++ } else {
3161 ++ ret = ep->framesize[0];
3162 ++ }
3163 ++
3164 ++ return ret;
3165 ++}
3166 ++
3167 + static void retire_outbound_urb(struct snd_usb_endpoint *ep,
3168 + struct snd_urb_ctx *urb_ctx)
3169 + {
3170 +@@ -203,6 +226,8 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep,
3171 +
3172 + if (ctx->packet_size[i])
3173 + counts = ctx->packet_size[i];
3174 ++ else if (ep->sync_master)
3175 ++ counts = snd_usb_endpoint_slave_next_packet_size(ep);
3176 + else
3177 + counts = snd_usb_endpoint_next_packet_size(ep);
3178 +
3179 +@@ -879,10 +904,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
3180 + ep->maxpacksize = fmt->maxpacksize;
3181 + ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX);
3182 +
3183 +- if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL)
3184 ++ if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) {
3185 + ep->freqn = get_usb_full_speed_rate(rate);
3186 +- else
3187 ++ ep->fps = 1000;
3188 ++ } else {
3189 + ep->freqn = get_usb_high_speed_rate(rate);
3190 ++ ep->fps = 8000;
3191 ++ }
3192 ++
3193 ++ ep->sample_rem = rate % ep->fps;
3194 ++ ep->framesize[0] = rate / ep->fps;
3195 ++ ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps;
3196 +
3197 + /* calculate the frequency in 16.16 format */
3198 + ep->freqm = ep->freqn;
3199 +@@ -941,6 +973,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
3200 + ep->active_mask = 0;
3201 + ep->unlink_mask = 0;
3202 + ep->phase = 0;
3203 ++ ep->sample_accum = 0;
3204 +
3205 + snd_usb_endpoint_start_quirk(ep);
3206 +
3207 +diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
3208 +index 584f295d7c77..4aad49cbeb5f 100644
3209 +--- a/sound/usb/endpoint.h
3210 ++++ b/sound/usb/endpoint.h
3211 +@@ -27,6 +27,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
3212 + void snd_usb_endpoint_free(struct snd_usb_endpoint *ep);
3213 +
3214 + int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
3215 ++int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep);
3216 + int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep);
3217 +
3218 + void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
3219 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
3220 +index 9bbe84ce7d07..9b9d653d5e90 100644
3221 +--- a/sound/usb/mixer.c
3222 ++++ b/sound/usb/mixer.c
3223 +@@ -584,8 +584,9 @@ static int check_matrix_bitmap(unsigned char *bmap,
3224 + * if failed, give up and free the control instance.
3225 + */
3226 +
3227 +-int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
3228 +- struct snd_kcontrol *kctl)
3229 ++int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
3230 ++ struct snd_kcontrol *kctl,
3231 ++ bool is_std_info)
3232 + {
3233 + struct usb_mixer_interface *mixer = list->mixer;
3234 + int err;
3235 +@@ -598,6 +599,7 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
3236 + return err;
3237 + }
3238 + list->kctl = kctl;
3239 ++ list->is_std_info = is_std_info;
3240 + list->next_id_elem = mixer->id_elems[list->id];
3241 + mixer->id_elems[list->id] = list;
3242 + return 0;
3243 +@@ -2330,15 +2332,23 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
3244 + {
3245 + struct usb_mixer_elem_list *list;
3246 +
3247 +- for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem)
3248 ++ for_each_mixer_elem(list, mixer, unitid) {
3249 ++ struct usb_mixer_elem_info *info;
3250 ++
3251 ++ if (!list->is_std_info)
3252 ++ continue;
3253 ++ info = mixer_elem_list_to_info(list);
3254 ++ /* invalidate cache, so the value is read from the device */
3255 ++ info->cached = 0;
3256 + snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
3257 + &list->kctl->id);
3258 ++ }
3259 + }
3260 +
3261 + static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer,
3262 + struct usb_mixer_elem_list *list)
3263 + {
3264 +- struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list;
3265 ++ struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list);
3266 + static char *val_types[] = {"BOOLEAN", "INV_BOOLEAN",
3267 + "S8", "U8", "S16", "U16"};
3268 + snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, "
3269 +@@ -2364,8 +2374,7 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry,
3270 + mixer->ignore_ctl_error);
3271 + snd_iprintf(buffer, "Card: %s\n", chip->card->longname);
3272 + for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) {
3273 +- for (list = mixer->id_elems[unitid]; list;
3274 +- list = list->next_id_elem) {
3275 ++ for_each_mixer_elem(list, mixer, unitid) {
3276 + snd_iprintf(buffer, " Unit: %i\n", list->id);
3277 + if (list->kctl)
3278 + snd_iprintf(buffer,
3279 +@@ -2386,6 +2395,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
3280 + __u8 unitid = (index >> 8) & 0xff;
3281 + __u8 control = (value >> 8) & 0xff;
3282 + __u8 channel = value & 0xff;
3283 ++ unsigned int count = 0;
3284 +
3285 + if (channel >= MAX_CHANNELS) {
3286 + usb_audio_dbg(mixer->chip,
3287 +@@ -2394,14 +2404,22 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
3288 + return;
3289 + }
3290 +
3291 +- for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) {
3292 ++ for_each_mixer_elem(list, mixer, unitid)
3293 ++ count++;
3294 ++
3295 ++ if (count == 0)
3296 ++ return;
3297 ++
3298 ++ for_each_mixer_elem(list, mixer, unitid) {
3299 + struct usb_mixer_elem_info *info;
3300 +
3301 + if (!list->kctl)
3302 + continue;
3303 ++ if (!list->is_std_info)
3304 ++ continue;
3305 +
3306 +- info = (struct usb_mixer_elem_info *)list;
3307 +- if (info->control != control)
3308 ++ info = mixer_elem_list_to_info(list);
3309 ++ if (count > 1 && info->control != control)
3310 + continue;
3311 +
3312 + switch (attribute) {
3313 +@@ -2620,7 +2638,7 @@ int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer)
3314 +
3315 + static int restore_mixer_value(struct usb_mixer_elem_list *list)
3316 + {
3317 +- struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list;
3318 ++ struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list);
3319 + int c, err, idx;
3320 +
3321 + if (cval->cmask) {
3322 +@@ -2656,8 +2674,7 @@ int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume)
3323 + if (reset_resume) {
3324 + /* restore cached mixer values */
3325 + for (id = 0; id < MAX_ID_ELEMS; id++) {
3326 +- for (list = mixer->id_elems[id]; list;
3327 +- list = list->next_id_elem) {
3328 ++ for_each_mixer_elem(list, mixer, id) {
3329 + if (list->resume) {
3330 + err = list->resume(list);
3331 + if (err < 0)
3332 +diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
3333 +index 545d99b09706..7d16a9221070 100644
3334 +--- a/sound/usb/mixer.h
3335 ++++ b/sound/usb/mixer.h
3336 +@@ -48,10 +48,17 @@ struct usb_mixer_elem_list {
3337 + struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
3338 + struct snd_kcontrol *kctl;
3339 + unsigned int id;
3340 ++ bool is_std_info;
3341 + usb_mixer_elem_dump_func_t dump;
3342 + usb_mixer_elem_resume_func_t resume;
3343 + };
3344 +
3345 ++/* iterate over mixer element list of the given unit id */
3346 ++#define for_each_mixer_elem(list, mixer, id) \
3347 ++ for ((list) = (mixer)->id_elems[id]; (list); (list) = (list)->next_id_elem)
3348 ++#define mixer_elem_list_to_info(list) \
3349 ++ container_of(list, struct usb_mixer_elem_info, head)
3350 ++
3351 + struct usb_mixer_elem_info {
3352 + struct usb_mixer_elem_list head;
3353 + unsigned int control; /* CS or ICN (high byte) */
3354 +@@ -79,8 +86,12 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
3355 + int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
3356 + int request, int validx, int value_set);
3357 +
3358 +-int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
3359 +- struct snd_kcontrol *kctl);
3360 ++int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
3361 ++ struct snd_kcontrol *kctl,
3362 ++ bool is_std_info);
3363 ++
3364 ++#define snd_usb_mixer_add_control(list, kctl) \
3365 ++ snd_usb_mixer_add_list(list, kctl, true)
3366 +
3367 + void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
3368 + struct usb_mixer_interface *mixer,
3369 +diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
3370 +index 723b535ca2ec..9646513f4b4a 100644
3371 +--- a/sound/usb/mixer_quirks.c
3372 ++++ b/sound/usb/mixer_quirks.c
3373 +@@ -168,7 +168,8 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer,
3374 + return -ENOMEM;
3375 + }
3376 + kctl->private_free = snd_usb_mixer_elem_free;
3377 +- return snd_usb_mixer_add_control(list, kctl);
3378 ++ /* don't use snd_usb_mixer_add_control() here, this is a special list element */
3379 ++ return snd_usb_mixer_add_list(list, kctl, false);
3380 + }
3381 +
3382 + /*
3383 +@@ -1167,17 +1168,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
3384 + {
3385 + struct usb_mixer_interface *mixer;
3386 + struct usb_mixer_elem_info *cval;
3387 +- int unitid = 12; /* SamleRate ExtensionUnit ID */
3388 ++ int unitid = 12; /* SampleRate ExtensionUnit ID */
3389 +
3390 + list_for_each_entry(mixer, &chip->mixer_list, list) {
3391 +- cval = (struct usb_mixer_elem_info *)mixer->id_elems[unitid];
3392 +- if (cval) {
3393 ++ if (mixer->id_elems[unitid]) {
3394 ++ cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
3395 + snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
3396 + cval->control << 8,
3397 + samplerate_id);
3398 + snd_usb_mixer_notify_id(mixer, unitid);
3399 ++ break;
3400 + }
3401 +- break;
3402 + }
3403 + }
3404 +
3405 +diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
3406 +index 7438e7c4a842..2876cd9b35b3 100644
3407 +--- a/sound/usb/mixer_scarlett.c
3408 ++++ b/sound/usb/mixer_scarlett.c
3409 +@@ -287,8 +287,7 @@ static int scarlett_ctl_switch_put(struct snd_kcontrol *kctl,
3410 +
3411 + static int scarlett_ctl_resume(struct usb_mixer_elem_list *list)
3412 + {
3413 +- struct usb_mixer_elem_info *elem =
3414 +- container_of(list, struct usb_mixer_elem_info, head);
3415 ++ struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list);
3416 + int i;
3417 +
3418 + for (i = 0; i < elem->channels; i++)
3419 +@@ -447,8 +446,7 @@ static int scarlett_ctl_enum_put(struct snd_kcontrol *kctl,
3420 +
3421 + static int scarlett_ctl_enum_resume(struct usb_mixer_elem_list *list)
3422 + {
3423 +- struct usb_mixer_elem_info *elem =
3424 +- container_of(list, struct usb_mixer_elem_info, head);
3425 ++ struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list);
3426 +
3427 + if (elem->cached)
3428 + snd_usb_set_cur_mix_value(elem, 0, 0, *elem->cache_val);
3429 +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
3430 +index f84c55ecd0fb..53d91cae86f9 100644
3431 +--- a/sound/usb/pcm.c
3432 ++++ b/sound/usb/pcm.c
3433 +@@ -1473,6 +1473,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
3434 + for (i = 0; i < ctx->packets; i++) {
3435 + if (ctx->packet_size[i])
3436 + counts = ctx->packet_size[i];
3437 ++ else if (ep->sync_master)
3438 ++ counts = snd_usb_endpoint_slave_next_packet_size(ep);
3439 + else
3440 + counts = snd_usb_endpoint_next_packet_size(ep);
3441 +
3442 +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
3443 +index b7a7bf0e566c..47979c9c3e29 100644
3444 +--- a/sound/usb/quirks.c
3445 ++++ b/sound/usb/quirks.c
3446 +@@ -1162,6 +1162,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
3447 + static bool is_marantz_denon_dac(unsigned int id)
3448 + {
3449 + switch (id) {
3450 ++ case USB_ID(0x154e, 0x1002): /* Denon DCD-1500RE */
3451 + case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */
3452 + case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */
3453 + case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */
3454 +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
3455 +index f256fac1e722..74dd196acdac 100644
3456 +--- a/tools/perf/builtin-report.c
3457 ++++ b/tools/perf/builtin-report.c
3458 +@@ -334,8 +334,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
3459 + if (evname != NULL)
3460 + ret += fprintf(fp, " of event '%s'", evname);
3461 +
3462 +- if (symbol_conf.show_ref_callgraph &&
3463 +- strstr(evname, "call-graph=no")) {
3464 ++ if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) {
3465 + ret += fprintf(fp, ", show reference callgraph");
3466 + }
3467 +
3468 +diff --git a/tools/testing/selftests/networking/timestamping/timestamping.c b/tools/testing/selftests/networking/timestamping/timestamping.c
3469 +index 5cdfd743447b..900ed4b47899 100644
3470 +--- a/tools/testing/selftests/networking/timestamping/timestamping.c
3471 ++++ b/tools/testing/selftests/networking/timestamping/timestamping.c
3472 +@@ -332,10 +332,16 @@ int main(int argc, char **argv)
3473 + int val;
3474 + socklen_t len;
3475 + struct timeval next;
3476 ++ size_t if_len;
3477 +
3478 + if (argc < 2)
3479 + usage(0);
3480 + interface = argv[1];
3481 ++ if_len = strlen(interface);
3482 ++ if (if_len >= IFNAMSIZ) {
3483 ++ printf("interface name exceeds IFNAMSIZ\n");
3484 ++ exit(1);
3485 ++ }
3486 +
3487 + for (i = 2; i < argc; i++) {
3488 + if (!strcasecmp(argv[i], "SO_TIMESTAMP"))
3489 +@@ -369,12 +375,12 @@ int main(int argc, char **argv)
3490 + bail("socket");
3491 +
3492 + memset(&device, 0, sizeof(device));
3493 +- strncpy(device.ifr_name, interface, sizeof(device.ifr_name));
3494 ++ memcpy(device.ifr_name, interface, if_len + 1);
3495 + if (ioctl(sock, SIOCGIFADDR, &device) < 0)
3496 + bail("getting interface IP address");
3497 +
3498 + memset(&hwtstamp, 0, sizeof(hwtstamp));
3499 +- strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name));
3500 ++ memcpy(hwtstamp.ifr_name, interface, if_len + 1);
3501 + hwtstamp.ifr_data = (void *)&hwconfig;
3502 + memset(&hwconfig, 0, sizeof(hwconfig));
3503 + hwconfig.tx_type =