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: Sun, 25 Mar 2018 13:42:28
Message-Id: 1521985333.ad6b31bbab0b7a93579803783ecf73504bd7f9d0.mpagano@gentoo
1 commit: ad6b31bbab0b7a93579803783ecf73504bd7f9d0
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 25 13:42:13 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 25 13:42:13 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ad6b31bb
7
8 Linux patch 4.4.124
9
10 0000_README | 4 +
11 1123_linux-4.4.124.patch | 3143 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 3147 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 992f353..d9d85f6 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -535,6 +535,10 @@ Patch: 1122_linux-4.4.123.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.4.123
21
22 +Patch: 1123_linux-4.4.124.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.4.124
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1123_linux-4.4.124.patch b/1123_linux-4.4.124.patch
31 new file mode 100644
32 index 0000000..ead63d6
33 --- /dev/null
34 +++ b/1123_linux-4.4.124.patch
35 @@ -0,0 +1,3143 @@
36 +diff --git a/Makefile b/Makefile
37 +index cbcc04da790a..bbaf3fd0d1ef 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 4
43 +-SUBLEVEL = 123
44 ++SUBLEVEL = 124
45 + EXTRAVERSION =
46 + NAME = Blurry Fish Butt
47 +
48 +diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c
49 +index 6a61deed4a85..ab228ed45945 100644
50 +--- a/arch/alpha/kernel/console.c
51 ++++ b/arch/alpha/kernel/console.c
52 +@@ -20,6 +20,7 @@
53 + struct pci_controller *pci_vga_hose;
54 + static struct resource alpha_vga = {
55 + .name = "alpha-vga+",
56 ++ .flags = IORESOURCE_IO,
57 + .start = 0x3C0,
58 + .end = 0x3DF
59 + };
60 +diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
61 +index 709ee1d6d4df..faa9a905826e 100644
62 +--- a/arch/arm/kernel/ftrace.c
63 ++++ b/arch/arm/kernel/ftrace.c
64 +@@ -29,11 +29,6 @@
65 + #endif
66 +
67 + #ifdef CONFIG_DYNAMIC_FTRACE
68 +-#ifdef CONFIG_OLD_MCOUNT
69 +-#define OLD_MCOUNT_ADDR ((unsigned long) mcount)
70 +-#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old)
71 +-
72 +-#define OLD_NOP 0xe1a00000 /* mov r0, r0 */
73 +
74 + static int __ftrace_modify_code(void *data)
75 + {
76 +@@ -51,6 +46,12 @@ void arch_ftrace_update_code(int command)
77 + stop_machine(__ftrace_modify_code, &command, NULL);
78 + }
79 +
80 ++#ifdef CONFIG_OLD_MCOUNT
81 ++#define OLD_MCOUNT_ADDR ((unsigned long) mcount)
82 ++#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old)
83 ++
84 ++#define OLD_NOP 0xe1a00000 /* mov r0, r0 */
85 ++
86 + static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec)
87 + {
88 + return rec->arch.old_mcount ? OLD_NOP : NOP;
89 +diff --git a/arch/arm/mach-omap2/clockdomains7xx_data.c b/arch/arm/mach-omap2/clockdomains7xx_data.c
90 +index 7581e036bda6..70e3b711e79c 100644
91 +--- a/arch/arm/mach-omap2/clockdomains7xx_data.c
92 ++++ b/arch/arm/mach-omap2/clockdomains7xx_data.c
93 +@@ -524,7 +524,7 @@ static struct clockdomain pcie_7xx_clkdm = {
94 + .dep_bit = DRA7XX_PCIE_STATDEP_SHIFT,
95 + .wkdep_srcs = pcie_wkup_sleep_deps,
96 + .sleepdep_srcs = pcie_wkup_sleep_deps,
97 +- .flags = CLKDM_CAN_HWSUP_SWSUP,
98 ++ .flags = CLKDM_CAN_SWSUP,
99 + };
100 +
101 + static struct clockdomain atl_7xx_clkdm = {
102 +diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
103 +index b15933c31b2f..36b2c94a8eb5 100644
104 +--- a/arch/ia64/kernel/module.c
105 ++++ b/arch/ia64/kernel/module.c
106 +@@ -153,7 +153,7 @@ slot (const struct insn *insn)
107 + static int
108 + apply_imm64 (struct module *mod, struct insn *insn, uint64_t val)
109 + {
110 +- if (slot(insn) != 2) {
111 ++ if (slot(insn) != 1 && slot(insn) != 2) {
112 + printk(KERN_ERR "%s: invalid slot number %d for IMM64\n",
113 + mod->name, slot(insn));
114 + return 0;
115 +@@ -165,7 +165,7 @@ apply_imm64 (struct module *mod, struct insn *insn, uint64_t val)
116 + static int
117 + apply_imm60 (struct module *mod, struct insn *insn, uint64_t val)
118 + {
119 +- if (slot(insn) != 2) {
120 ++ if (slot(insn) != 1 && slot(insn) != 2) {
121 + printk(KERN_ERR "%s: invalid slot number %d for IMM60\n",
122 + mod->name, slot(insn));
123 + return 0;
124 +diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
125 +index 79ad35abd196..ddec22828673 100644
126 +--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
127 ++++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
128 +@@ -177,12 +177,15 @@ map_again:
129 + ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags,
130 + hpsize, hpsize, MMU_SEGSIZE_256M);
131 +
132 +- if (ret < 0) {
133 ++ if (ret == -1) {
134 + /* If we couldn't map a primary PTE, try a secondary */
135 + hash = ~hash;
136 + vflags ^= HPTE_V_SECONDARY;
137 + attempt++;
138 + goto map_again;
139 ++ } else if (ret < 0) {
140 ++ r = -EIO;
141 ++ goto out_unlock;
142 + } else {
143 + trace_kvm_book3s_64_mmu_map(rflags, hpteg,
144 + vpn, hpaddr, orig_pte);
145 +diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
146 +index 64891b081ad5..81313844d81c 100644
147 +--- a/arch/powerpc/kvm/book3s_pr.c
148 ++++ b/arch/powerpc/kvm/book3s_pr.c
149 +@@ -625,7 +625,11 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
150 + kvmppc_mmu_unmap_page(vcpu, &pte);
151 + }
152 + /* The guest's PTE is not mapped yet. Map on the host */
153 +- kvmppc_mmu_map_page(vcpu, &pte, iswrite);
154 ++ if (kvmppc_mmu_map_page(vcpu, &pte, iswrite) == -EIO) {
155 ++ /* Exit KVM if mapping failed */
156 ++ run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
157 ++ return RESUME_HOST;
158 ++ }
159 + if (data)
160 + vcpu->stat.sp_storage++;
161 + else if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
162 +diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
163 +index be22f5a2192e..4e3b8a587c88 100644
164 +--- a/arch/x86/kernel/i8259.c
165 ++++ b/arch/x86/kernel/i8259.c
166 +@@ -418,6 +418,7 @@ struct legacy_pic default_legacy_pic = {
167 + };
168 +
169 + struct legacy_pic *legacy_pic = &default_legacy_pic;
170 ++EXPORT_SYMBOL(legacy_pic);
171 +
172 + static int __init i8259A_init_ops(void)
173 + {
174 +diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c
175 +index 6a082d4de12c..24a793957bc0 100644
176 +--- a/drivers/acpi/pmic/intel_pmic_xpower.c
177 ++++ b/drivers/acpi/pmic/intel_pmic_xpower.c
178 +@@ -28,97 +28,97 @@ static struct pmic_table power_table[] = {
179 + .address = 0x00,
180 + .reg = 0x13,
181 + .bit = 0x05,
182 +- },
183 ++ }, /* ALD1 */
184 + {
185 + .address = 0x04,
186 + .reg = 0x13,
187 + .bit = 0x06,
188 +- },
189 ++ }, /* ALD2 */
190 + {
191 + .address = 0x08,
192 + .reg = 0x13,
193 + .bit = 0x07,
194 +- },
195 ++ }, /* ALD3 */
196 + {
197 + .address = 0x0c,
198 + .reg = 0x12,
199 + .bit = 0x03,
200 +- },
201 ++ }, /* DLD1 */
202 + {
203 + .address = 0x10,
204 + .reg = 0x12,
205 + .bit = 0x04,
206 +- },
207 ++ }, /* DLD2 */
208 + {
209 + .address = 0x14,
210 + .reg = 0x12,
211 + .bit = 0x05,
212 +- },
213 ++ }, /* DLD3 */
214 + {
215 + .address = 0x18,
216 + .reg = 0x12,
217 + .bit = 0x06,
218 +- },
219 ++ }, /* DLD4 */
220 + {
221 + .address = 0x1c,
222 + .reg = 0x12,
223 + .bit = 0x00,
224 +- },
225 ++ }, /* ELD1 */
226 + {
227 + .address = 0x20,
228 + .reg = 0x12,
229 + .bit = 0x01,
230 +- },
231 ++ }, /* ELD2 */
232 + {
233 + .address = 0x24,
234 + .reg = 0x12,
235 + .bit = 0x02,
236 +- },
237 ++ }, /* ELD3 */
238 + {
239 + .address = 0x28,
240 + .reg = 0x13,
241 + .bit = 0x02,
242 +- },
243 ++ }, /* FLD1 */
244 + {
245 + .address = 0x2c,
246 + .reg = 0x13,
247 + .bit = 0x03,
248 +- },
249 ++ }, /* FLD2 */
250 + {
251 + .address = 0x30,
252 + .reg = 0x13,
253 + .bit = 0x04,
254 +- },
255 ++ }, /* FLD3 */
256 + {
257 +- .address = 0x38,
258 ++ .address = 0x34,
259 + .reg = 0x10,
260 + .bit = 0x03,
261 +- },
262 ++ }, /* BUC1 */
263 + {
264 +- .address = 0x3c,
265 ++ .address = 0x38,
266 + .reg = 0x10,
267 + .bit = 0x06,
268 +- },
269 ++ }, /* BUC2 */
270 + {
271 +- .address = 0x40,
272 ++ .address = 0x3c,
273 + .reg = 0x10,
274 + .bit = 0x05,
275 +- },
276 ++ }, /* BUC3 */
277 + {
278 +- .address = 0x44,
279 ++ .address = 0x40,
280 + .reg = 0x10,
281 + .bit = 0x04,
282 +- },
283 ++ }, /* BUC4 */
284 + {
285 +- .address = 0x48,
286 ++ .address = 0x44,
287 + .reg = 0x10,
288 + .bit = 0x01,
289 +- },
290 ++ }, /* BUC5 */
291 + {
292 +- .address = 0x4c,
293 ++ .address = 0x48,
294 + .reg = 0x10,
295 + .bit = 0x00
296 +- },
297 ++ }, /* BUC6 */
298 + };
299 +
300 + /* TMP0 - TMP5 are the same, all from GPADC */
301 +diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
302 +index 11154a330f07..c9bf74982688 100644
303 +--- a/drivers/acpi/processor_driver.c
304 ++++ b/drivers/acpi/processor_driver.c
305 +@@ -259,6 +259,9 @@ static int __acpi_processor_start(struct acpi_device *device)
306 + if (ACPI_SUCCESS(status))
307 + return 0;
308 +
309 ++ result = -ENODEV;
310 ++ acpi_pss_perf_exit(pr, device);
311 ++
312 + err_power_exit:
313 + acpi_processor_power_exit(pr);
314 + return result;
315 +@@ -267,11 +270,16 @@ err_power_exit:
316 + static int acpi_processor_start(struct device *dev)
317 + {
318 + struct acpi_device *device = ACPI_COMPANION(dev);
319 ++ int ret;
320 +
321 + if (!device)
322 + return -ENODEV;
323 +
324 +- return __acpi_processor_start(device);
325 ++ /* Protect against concurrent CPU hotplug operations */
326 ++ get_online_cpus();
327 ++ ret = __acpi_processor_start(device);
328 ++ put_online_cpus();
329 ++ return ret;
330 + }
331 +
332 + static int acpi_processor_stop(struct device *dev)
333 +diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
334 +index c72e64893d03..93d72413d844 100644
335 +--- a/drivers/acpi/processor_throttling.c
336 ++++ b/drivers/acpi/processor_throttling.c
337 +@@ -62,8 +62,8 @@ struct acpi_processor_throttling_arg {
338 + #define THROTTLING_POSTCHANGE (2)
339 +
340 + static int acpi_processor_get_throttling(struct acpi_processor *pr);
341 +-int acpi_processor_set_throttling(struct acpi_processor *pr,
342 +- int state, bool force);
343 ++static int __acpi_processor_set_throttling(struct acpi_processor *pr,
344 ++ int state, bool force, bool direct);
345 +
346 + static int acpi_processor_update_tsd_coord(void)
347 + {
348 +@@ -891,7 +891,8 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
349 + ACPI_DEBUG_PRINT((ACPI_DB_INFO,
350 + "Invalid throttling state, reset\n"));
351 + state = 0;
352 +- ret = acpi_processor_set_throttling(pr, state, true);
353 ++ ret = __acpi_processor_set_throttling(pr, state, true,
354 ++ true);
355 + if (ret)
356 + return ret;
357 + }
358 +@@ -901,36 +902,31 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
359 + return 0;
360 + }
361 +
362 +-static int acpi_processor_get_throttling(struct acpi_processor *pr)
363 ++static long __acpi_processor_get_throttling(void *data)
364 + {
365 +- cpumask_var_t saved_mask;
366 +- int ret;
367 ++ struct acpi_processor *pr = data;
368 ++
369 ++ return pr->throttling.acpi_processor_get_throttling(pr);
370 ++}
371 +
372 ++static int acpi_processor_get_throttling(struct acpi_processor *pr)
373 ++{
374 + if (!pr)
375 + return -EINVAL;
376 +
377 + if (!pr->flags.throttling)
378 + return -ENODEV;
379 +
380 +- if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
381 +- return -ENOMEM;
382 +-
383 + /*
384 +- * Migrate task to the cpu pointed by pr.
385 ++ * This is either called from the CPU hotplug callback of
386 ++ * processor_driver or via the ACPI probe function. In the latter
387 ++ * case the CPU is not guaranteed to be online. Both call sites are
388 ++ * protected against CPU hotplug.
389 + */
390 +- cpumask_copy(saved_mask, &current->cpus_allowed);
391 +- /* FIXME: use work_on_cpu() */
392 +- if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) {
393 +- /* Can't migrate to the target pr->id CPU. Exit */
394 +- free_cpumask_var(saved_mask);
395 ++ if (!cpu_online(pr->id))
396 + return -ENODEV;
397 +- }
398 +- ret = pr->throttling.acpi_processor_get_throttling(pr);
399 +- /* restore the previous state */
400 +- set_cpus_allowed_ptr(current, saved_mask);
401 +- free_cpumask_var(saved_mask);
402 +
403 +- return ret;
404 ++ return work_on_cpu(pr->id, __acpi_processor_get_throttling, pr);
405 + }
406 +
407 + static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
408 +@@ -1080,8 +1076,15 @@ static long acpi_processor_throttling_fn(void *data)
409 + arg->target_state, arg->force);
410 + }
411 +
412 +-int acpi_processor_set_throttling(struct acpi_processor *pr,
413 +- int state, bool force)
414 ++static int call_on_cpu(int cpu, long (*fn)(void *), void *arg, bool direct)
415 ++{
416 ++ if (direct)
417 ++ return fn(arg);
418 ++ return work_on_cpu(cpu, fn, arg);
419 ++}
420 ++
421 ++static int __acpi_processor_set_throttling(struct acpi_processor *pr,
422 ++ int state, bool force, bool direct)
423 + {
424 + int ret = 0;
425 + unsigned int i;
426 +@@ -1130,7 +1133,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
427 + arg.pr = pr;
428 + arg.target_state = state;
429 + arg.force = force;
430 +- ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg);
431 ++ ret = call_on_cpu(pr->id, acpi_processor_throttling_fn, &arg,
432 ++ direct);
433 + } else {
434 + /*
435 + * When the T-state coordination is SW_ALL or HW_ALL,
436 +@@ -1163,8 +1167,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
437 + arg.pr = match_pr;
438 + arg.target_state = state;
439 + arg.force = force;
440 +- ret = work_on_cpu(pr->id, acpi_processor_throttling_fn,
441 +- &arg);
442 ++ ret = call_on_cpu(pr->id, acpi_processor_throttling_fn,
443 ++ &arg, direct);
444 + }
445 + }
446 + /*
447 +@@ -1182,6 +1186,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr,
448 + return ret;
449 + }
450 +
451 ++int acpi_processor_set_throttling(struct acpi_processor *pr, int state,
452 ++ bool force)
453 ++{
454 ++ return __acpi_processor_set_throttling(pr, state, force, false);
455 ++}
456 ++
457 + int acpi_processor_get_throttling_info(struct acpi_processor *pr)
458 + {
459 + int result = 0;
460 +diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
461 +index 55d3d1da72de..9ba89315dae1 100644
462 +--- a/drivers/block/mtip32xx/mtip32xx.c
463 ++++ b/drivers/block/mtip32xx/mtip32xx.c
464 +@@ -169,6 +169,25 @@ static bool mtip_check_surprise_removal(struct pci_dev *pdev)
465 + return false; /* device present */
466 + }
467 +
468 ++/* we have to use runtime tag to setup command header */
469 ++static void mtip_init_cmd_header(struct request *rq)
470 ++{
471 ++ struct driver_data *dd = rq->q->queuedata;
472 ++ struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq);
473 ++ u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64;
474 ++
475 ++ /* Point the command headers at the command tables. */
476 ++ cmd->command_header = dd->port->command_list +
477 ++ (sizeof(struct mtip_cmd_hdr) * rq->tag);
478 ++ cmd->command_header_dma = dd->port->command_list_dma +
479 ++ (sizeof(struct mtip_cmd_hdr) * rq->tag);
480 ++
481 ++ if (host_cap_64)
482 ++ cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16);
483 ++
484 ++ cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF);
485 ++}
486 ++
487 + static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd)
488 + {
489 + struct request *rq;
490 +@@ -180,6 +199,9 @@ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd)
491 + if (IS_ERR(rq))
492 + return NULL;
493 +
494 ++ /* Internal cmd isn't submitted via .queue_rq */
495 ++ mtip_init_cmd_header(rq);
496 ++
497 + return blk_mq_rq_to_pdu(rq);
498 + }
499 +
500 +@@ -3818,6 +3840,8 @@ static int mtip_queue_rq(struct blk_mq_hw_ctx *hctx,
501 + struct request *rq = bd->rq;
502 + int ret;
503 +
504 ++ mtip_init_cmd_header(rq);
505 ++
506 + if (unlikely(mtip_check_unal_depth(hctx, rq)))
507 + return BLK_MQ_RQ_QUEUE_BUSY;
508 +
509 +@@ -3849,7 +3873,6 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx,
510 + {
511 + struct driver_data *dd = data;
512 + struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq);
513 +- u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64;
514 +
515 + /*
516 + * For flush requests, request_idx starts at the end of the
517 +@@ -3866,17 +3889,6 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx,
518 +
519 + memset(cmd->command, 0, CMD_DMA_ALLOC_SZ);
520 +
521 +- /* Point the command headers at the command tables. */
522 +- cmd->command_header = dd->port->command_list +
523 +- (sizeof(struct mtip_cmd_hdr) * request_idx);
524 +- cmd->command_header_dma = dd->port->command_list_dma +
525 +- (sizeof(struct mtip_cmd_hdr) * request_idx);
526 +-
527 +- if (host_cap_64)
528 +- cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16);
529 +-
530 +- cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF);
531 +-
532 + sg_init_table(cmd->sg, MTIP_MAX_SG);
533 + return 0;
534 + }
535 +diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
536 +index 71325e443e46..8a3bf0a8c31d 100644
537 +--- a/drivers/bluetooth/hci_qca.c
538 ++++ b/drivers/bluetooth/hci_qca.c
539 +@@ -936,6 +936,9 @@ static int qca_setup(struct hci_uart *hu)
540 + if (!ret) {
541 + set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
542 + qca_debugfs_init(hdev);
543 ++ } else if (ret == -ENOENT) {
544 ++ /* No patch/nvm-config found, run with original fw/config */
545 ++ ret = 0;
546 + }
547 +
548 + /* Setup bdaddr */
549 +diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
550 +index 40d400fe5bb7..4ada103945f0 100644
551 +--- a/drivers/char/ipmi/ipmi_watchdog.c
552 ++++ b/drivers/char/ipmi/ipmi_watchdog.c
553 +@@ -515,7 +515,7 @@ static void panic_halt_ipmi_heartbeat(void)
554 + msg.cmd = IPMI_WDOG_RESET_TIMER;
555 + msg.data = NULL;
556 + msg.data_len = 0;
557 +- atomic_add(2, &panic_done_count);
558 ++ atomic_add(1, &panic_done_count);
559 + rv = ipmi_request_supply_msgs(watchdog_user,
560 + (struct ipmi_addr *) &addr,
561 + 0,
562 +@@ -525,7 +525,7 @@ static void panic_halt_ipmi_heartbeat(void)
563 + &panic_halt_heartbeat_recv_msg,
564 + 1);
565 + if (rv)
566 +- atomic_sub(2, &panic_done_count);
567 ++ atomic_sub(1, &panic_done_count);
568 + }
569 +
570 + static struct ipmi_smi_msg panic_halt_smi_msg = {
571 +@@ -549,12 +549,12 @@ static void panic_halt_ipmi_set_timeout(void)
572 + /* Wait for the messages to be free. */
573 + while (atomic_read(&panic_done_count) != 0)
574 + ipmi_poll_interface(watchdog_user);
575 +- atomic_add(2, &panic_done_count);
576 ++ atomic_add(1, &panic_done_count);
577 + rv = i_ipmi_set_timeout(&panic_halt_smi_msg,
578 + &panic_halt_recv_msg,
579 + &send_heartbeat_now);
580 + if (rv) {
581 +- atomic_sub(2, &panic_done_count);
582 ++ atomic_sub(1, &panic_done_count);
583 + printk(KERN_WARNING PFX
584 + "Unable to extend the watchdog timeout.");
585 + } else {
586 +diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
587 +index aaa5fa95dede..36afc1a21699 100644
588 +--- a/drivers/char/tpm/tpm-interface.c
589 ++++ b/drivers/char/tpm/tpm-interface.c
590 +@@ -1040,6 +1040,11 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max)
591 + break;
592 +
593 + recd = be32_to_cpu(tpm_cmd.params.getrandom_out.rng_data_len);
594 ++ if (recd > num_bytes) {
595 ++ total = -EFAULT;
596 ++ break;
597 ++ }
598 ++
599 + memcpy(dest, tpm_cmd.params.getrandom_out.rng_data, recd);
600 +
601 + dest += recd;
602 +diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
603 +index 286bd090a488..389a009b83f2 100644
604 +--- a/drivers/char/tpm/tpm2-cmd.c
605 ++++ b/drivers/char/tpm/tpm2-cmd.c
606 +@@ -622,6 +622,11 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip,
607 + if (!rc) {
608 + data_len = be16_to_cpup(
609 + (__be16 *) &buf.data[TPM_HEADER_SIZE + 4]);
610 ++ if (data_len < MIN_KEY_SIZE || data_len > MAX_KEY_SIZE + 1) {
611 ++ rc = -EFAULT;
612 ++ goto out;
613 ++ }
614 ++
615 + data = &buf.data[TPM_HEADER_SIZE + 6];
616 +
617 + memcpy(payload->key, data, data_len - 1);
618 +@@ -629,6 +634,7 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip,
619 + payload->migratable = data[data_len - 1];
620 + }
621 +
622 ++out:
623 + tpm_buf_destroy(&buf);
624 + return rc;
625 + }
626 +diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
627 +index 7f13221aeb30..9dd93a209ef2 100644
628 +--- a/drivers/char/tpm/tpm_tis.c
629 ++++ b/drivers/char/tpm/tpm_tis.c
630 +@@ -283,7 +283,8 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
631 + static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
632 + {
633 + int size = 0;
634 +- int expected, status;
635 ++ int status;
636 ++ u32 expected;
637 +
638 + if (count < TPM_HEADER_SIZE) {
639 + size = -EIO;
640 +@@ -298,7 +299,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
641 + }
642 +
643 + expected = be32_to_cpu(*(__be32 *) (buf + 2));
644 +- if (expected > count) {
645 ++ if (expected > count || expected < TPM_HEADER_SIZE) {
646 + size = -EIO;
647 + goto out;
648 + }
649 +diff --git a/drivers/clk/bcm/clk-ns2.c b/drivers/clk/bcm/clk-ns2.c
650 +index a564e9248814..adc14145861a 100644
651 +--- a/drivers/clk/bcm/clk-ns2.c
652 ++++ b/drivers/clk/bcm/clk-ns2.c
653 +@@ -103,7 +103,7 @@ CLK_OF_DECLARE(ns2_genpll_src_clk, "brcm,ns2-genpll-scr",
654 +
655 + static const struct iproc_pll_ctrl genpll_sw = {
656 + .flags = IPROC_CLK_AON | IPROC_CLK_PLL_SPLIT_STAT_CTRL,
657 +- .aon = AON_VAL(0x0, 2, 9, 8),
658 ++ .aon = AON_VAL(0x0, 1, 11, 10),
659 + .reset = RESET_VAL(0x4, 2, 1),
660 + .dig_filter = DF_VAL(0x0, 9, 3, 5, 4, 2, 3),
661 + .ndiv_int = REG_VAL(0x8, 4, 10),
662 +diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
663 +index e346b223199d..a01ee9a3ed6d 100644
664 +--- a/drivers/clk/clk-si5351.c
665 ++++ b/drivers/clk/clk-si5351.c
666 +@@ -72,7 +72,7 @@ static const char * const si5351_input_names[] = {
667 + "xtal", "clkin"
668 + };
669 + static const char * const si5351_pll_names[] = {
670 +- "plla", "pllb", "vxco"
671 ++ "si5351_plla", "si5351_pllb", "si5351_vxco"
672 + };
673 + static const char * const si5351_msynth_names[] = {
674 + "ms0", "ms1", "ms2", "ms3", "ms4", "ms5", "ms6", "ms7"
675 +diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c
676 +index 86628e22b2a3..719c3d9f07fb 100644
677 +--- a/drivers/cpufreq/sh-cpufreq.c
678 ++++ b/drivers/cpufreq/sh-cpufreq.c
679 +@@ -30,54 +30,63 @@
680 +
681 + static DEFINE_PER_CPU(struct clk, sh_cpuclk);
682 +
683 ++struct cpufreq_target {
684 ++ struct cpufreq_policy *policy;
685 ++ unsigned int freq;
686 ++};
687 ++
688 + static unsigned int sh_cpufreq_get(unsigned int cpu)
689 + {
690 + return (clk_get_rate(&per_cpu(sh_cpuclk, cpu)) + 500) / 1000;
691 + }
692 +
693 +-/*
694 +- * Here we notify other drivers of the proposed change and the final change.
695 +- */
696 +-static int sh_cpufreq_target(struct cpufreq_policy *policy,
697 +- unsigned int target_freq,
698 +- unsigned int relation)
699 ++static long __sh_cpufreq_target(void *arg)
700 + {
701 +- unsigned int cpu = policy->cpu;
702 ++ struct cpufreq_target *target = arg;
703 ++ struct cpufreq_policy *policy = target->policy;
704 ++ int cpu = policy->cpu;
705 + struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
706 +- cpumask_t cpus_allowed;
707 + struct cpufreq_freqs freqs;
708 + struct device *dev;
709 + long freq;
710 +
711 +- cpus_allowed = current->cpus_allowed;
712 +- set_cpus_allowed_ptr(current, cpumask_of(cpu));
713 +-
714 +- BUG_ON(smp_processor_id() != cpu);
715 ++ if (smp_processor_id() != cpu)
716 ++ return -ENODEV;
717 +
718 + dev = get_cpu_device(cpu);
719 +
720 + /* Convert target_freq from kHz to Hz */
721 +- freq = clk_round_rate(cpuclk, target_freq * 1000);
722 ++ freq = clk_round_rate(cpuclk, target->freq * 1000);
723 +
724 + if (freq < (policy->min * 1000) || freq > (policy->max * 1000))
725 + return -EINVAL;
726 +
727 +- dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000);
728 ++ dev_dbg(dev, "requested frequency %u Hz\n", target->freq * 1000);
729 +
730 + freqs.old = sh_cpufreq_get(cpu);
731 + freqs.new = (freq + 500) / 1000;
732 + freqs.flags = 0;
733 +
734 +- cpufreq_freq_transition_begin(policy, &freqs);
735 +- set_cpus_allowed_ptr(current, &cpus_allowed);
736 ++ cpufreq_freq_transition_begin(target->policy, &freqs);
737 + clk_set_rate(cpuclk, freq);
738 +- cpufreq_freq_transition_end(policy, &freqs, 0);
739 ++ cpufreq_freq_transition_end(target->policy, &freqs, 0);
740 +
741 + dev_dbg(dev, "set frequency %lu Hz\n", freq);
742 +-
743 + return 0;
744 + }
745 +
746 ++/*
747 ++ * Here we notify other drivers of the proposed change and the final change.
748 ++ */
749 ++static int sh_cpufreq_target(struct cpufreq_policy *policy,
750 ++ unsigned int target_freq,
751 ++ unsigned int relation)
752 ++{
753 ++ struct cpufreq_target data = { .policy = policy, .freq = target_freq };
754 ++
755 ++ return work_on_cpu(policy->cpu, __sh_cpufreq_target, &data);
756 ++}
757 ++
758 + static int sh_cpufreq_verify(struct cpufreq_policy *policy)
759 + {
760 + struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu);
761 +diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
762 +index 8100ede095d5..c7bd1c5315f4 100644
763 +--- a/drivers/dma/ti-dma-crossbar.c
764 ++++ b/drivers/dma/ti-dma-crossbar.c
765 +@@ -51,7 +51,15 @@ struct ti_am335x_xbar_map {
766 +
767 + static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u8 val)
768 + {
769 +- writeb_relaxed(val, iomem + event);
770 ++ /*
771 ++ * TPCC_EVT_MUX_60_63 register layout is different than the
772 ++ * rest, in the sense, that event 63 is mapped to lowest byte
773 ++ * and event 60 is mapped to highest, handle it separately.
774 ++ */
775 ++ if (event >= 60 && event <= 63)
776 ++ writeb_relaxed(val, iomem + (63 - event % 4));
777 ++ else
778 ++ writeb_relaxed(val, iomem + event);
779 + }
780 +
781 + static void ti_am335x_xbar_free(struct device *dev, void *route_data)
782 +diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
783 +index c76cc853b08a..644faf3ae93a 100644
784 +--- a/drivers/gpu/drm/msm/msm_gem.c
785 ++++ b/drivers/gpu/drm/msm/msm_gem.c
786 +@@ -89,14 +89,17 @@ static struct page **get_pages(struct drm_gem_object *obj)
787 + return p;
788 + }
789 +
790 ++ msm_obj->pages = p;
791 ++
792 + msm_obj->sgt = drm_prime_pages_to_sg(p, npages);
793 + if (IS_ERR(msm_obj->sgt)) {
794 ++ void *ptr = ERR_CAST(msm_obj->sgt);
795 ++
796 + dev_err(dev->dev, "failed to allocate sgt\n");
797 +- return ERR_CAST(msm_obj->sgt);
798 ++ msm_obj->sgt = NULL;
799 ++ return ptr;
800 + }
801 +
802 +- msm_obj->pages = p;
803 +-
804 + /* For non-cached buffers, ensure the new pages are clean
805 + * because display controller, GPU, etc. are not coherent:
806 + */
807 +@@ -119,7 +122,10 @@ static void put_pages(struct drm_gem_object *obj)
808 + if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED))
809 + dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl,
810 + msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
811 +- sg_free_table(msm_obj->sgt);
812 ++
813 ++ if (msm_obj->sgt)
814 ++ sg_free_table(msm_obj->sgt);
815 ++
816 + kfree(msm_obj->sgt);
817 +
818 + if (use_pages(obj))
819 +diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
820 +index 00de1bf81519..9dfc2471ea09 100644
821 +--- a/drivers/gpu/drm/nouveau/nouveau_display.c
822 ++++ b/drivers/gpu/drm/nouveau/nouveau_display.c
823 +@@ -104,7 +104,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
824 + };
825 + struct nouveau_display *disp = nouveau_display(crtc->dev);
826 + struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)];
827 +- int ret, retry = 1;
828 ++ int ret, retry = 20;
829 +
830 + do {
831 + ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args));
832 +diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
833 +index f516b5891932..083db3f5181f 100644
834 +--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
835 ++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
836 +@@ -288,7 +288,12 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait)
837 + msecs_to_jiffies(100))) {
838 + dev_err(dmm->dev, "timed out waiting for done\n");
839 + ret = -ETIMEDOUT;
840 ++ goto cleanup;
841 + }
842 ++
843 ++ /* Check the engine status before continue */
844 ++ ret = wait_status(engine, DMM_PATSTATUS_READY |
845 ++ DMM_PATSTATUS_VALID | DMM_PATSTATUS_DONE);
846 + }
847 +
848 + cleanup:
849 +diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
850 +index a38af68cf326..0a0628d11c0b 100644
851 +--- a/drivers/hsi/clients/ssi_protocol.c
852 ++++ b/drivers/hsi/clients/ssi_protocol.c
853 +@@ -976,7 +976,7 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev)
854 + goto drop;
855 + /* Pad to 32-bits - FIXME: Revisit*/
856 + if ((skb->len & 3) && skb_pad(skb, 4 - (skb->len & 3)))
857 +- goto drop;
858 ++ goto inc_dropped;
859 +
860 + /*
861 + * Modem sends Phonet messages over SSI with its own endianess...
862 +@@ -1028,8 +1028,9 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev)
863 + drop2:
864 + hsi_free_msg(msg);
865 + drop:
866 +- dev->stats.tx_dropped++;
867 + dev_kfree_skb(skb);
868 ++inc_dropped:
869 ++ dev->stats.tx_dropped++;
870 +
871 + return 0;
872 + }
873 +diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
874 +index 7214efd10db5..22e10b7d505d 100644
875 +--- a/drivers/hwtracing/coresight/coresight-tpiu.c
876 ++++ b/drivers/hwtracing/coresight/coresight-tpiu.c
877 +@@ -45,8 +45,11 @@
878 + #define TPIU_ITATBCTR0 0xef8
879 +
880 + /** register definition **/
881 ++/* FFSR - 0x300 */
882 ++#define FFSR_FT_STOPPED BIT(1)
883 + /* FFCR - 0x304 */
884 + #define FFCR_FON_MAN BIT(6)
885 ++#define FFCR_STOP_FI BIT(12)
886 +
887 + /**
888 + * @base: memory mapped base address for this component.
889 +@@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
890 + {
891 + CS_UNLOCK(drvdata->base);
892 +
893 +- /* Clear formatter controle reg. */
894 +- writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
895 ++ /* Clear formatter and stop on flush */
896 ++ writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
897 + /* Generate manual flush */
898 +- writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
899 ++ writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
900 ++ /* Wait for flush to complete */
901 ++ coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
902 ++ /* Wait for formatter to stop */
903 ++ coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
904 +
905 + CS_LOCK(drvdata->base);
906 + }
907 +diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
908 +index dfc98df7b1b6..7aa7b9cb6203 100644
909 +--- a/drivers/i2c/busses/i2c-scmi.c
910 ++++ b/drivers/i2c/busses/i2c-scmi.c
911 +@@ -18,6 +18,9 @@
912 + #define ACPI_SMBUS_HC_CLASS "smbus"
913 + #define ACPI_SMBUS_HC_DEVICE_NAME "cmi"
914 +
915 ++/* SMBUS HID definition as supported by Microsoft Windows */
916 ++#define ACPI_SMBUS_MS_HID "SMB0001"
917 ++
918 + ACPI_MODULE_NAME("smbus_cmi");
919 +
920 + struct smbus_methods_t {
921 +@@ -51,6 +54,7 @@ static const struct smbus_methods_t ibm_smbus_methods = {
922 + static const struct acpi_device_id acpi_smbus_cmi_ids[] = {
923 + {"SMBUS01", (kernel_ulong_t)&smbus_methods},
924 + {ACPI_SMBUS_IBM_HID, (kernel_ulong_t)&ibm_smbus_methods},
925 ++ {ACPI_SMBUS_MS_HID, (kernel_ulong_t)&smbus_methods},
926 + {"", 0}
927 + };
928 + MODULE_DEVICE_TABLE(acpi, acpi_smbus_cmi_ids);
929 +diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
930 +index 197a08b4e2f3..84ab20c6b389 100644
931 +--- a/drivers/iio/accel/st_accel_core.c
932 ++++ b/drivers/iio/accel/st_accel_core.c
933 +@@ -628,6 +628,8 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
934 + int st_accel_common_probe(struct iio_dev *indio_dev)
935 + {
936 + struct st_sensor_data *adata = iio_priv(indio_dev);
937 ++ struct st_sensors_platform_data *pdata =
938 ++ (struct st_sensors_platform_data *)adata->dev->platform_data;
939 + int irq = adata->get_irq_data_ready(indio_dev);
940 + int err;
941 +
942 +@@ -652,9 +654,8 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
943 + &adata->sensor_settings->fs.fs_avl[0];
944 + adata->odr = adata->sensor_settings->odr.odr_avl[0].hz;
945 +
946 +- if (!adata->dev->platform_data)
947 +- adata->dev->platform_data =
948 +- (struct st_sensors_platform_data *)&default_accel_pdata;
949 ++ if (!pdata)
950 ++ pdata = (struct st_sensors_platform_data *)&default_accel_pdata;
951 +
952 + err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data);
953 + if (err < 0)
954 +diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
955 +index 5056bd68573f..270eeac928bc 100644
956 +--- a/drivers/iio/pressure/st_pressure_core.c
957 ++++ b/drivers/iio/pressure/st_pressure_core.c
958 +@@ -436,6 +436,8 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
959 + int st_press_common_probe(struct iio_dev *indio_dev)
960 + {
961 + struct st_sensor_data *press_data = iio_priv(indio_dev);
962 ++ struct st_sensors_platform_data *pdata =
963 ++ (struct st_sensors_platform_data *)press_data->dev->platform_data;
964 + int irq = press_data->get_irq_data_ready(indio_dev);
965 + int err;
966 +
967 +@@ -464,10 +466,8 @@ int st_press_common_probe(struct iio_dev *indio_dev)
968 + press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz;
969 +
970 + /* Some devices don't support a data ready pin. */
971 +- if (!press_data->dev->platform_data &&
972 +- press_data->sensor_settings->drdy_irq.addr)
973 +- press_data->dev->platform_data =
974 +- (struct st_sensors_platform_data *)&default_press_pdata;
975 ++ if (!pdata && press_data->sensor_settings->drdy_irq.addr)
976 ++ pdata = (struct st_sensors_platform_data *)&default_press_pdata;
977 +
978 + err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
979 + if (err < 0)
980 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
981 +index b6c9a370a38b..d57a78ec7425 100644
982 +--- a/drivers/infiniband/core/cma.c
983 ++++ b/drivers/infiniband/core/cma.c
984 +@@ -3743,6 +3743,9 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
985 + struct cma_multicast *mc;
986 + int ret;
987 +
988 ++ if (!id->device)
989 ++ return -EINVAL;
990 ++
991 + id_priv = container_of(id, struct rdma_id_private, id);
992 + if (!cma_comp(id_priv, RDMA_CM_ADDR_BOUND) &&
993 + !cma_comp(id_priv, RDMA_CM_ADDR_RESOLVED))
994 +@@ -4007,7 +4010,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)
995 + RDMA_NL_RDMA_CM_ATTR_SRC_ADDR))
996 + goto out;
997 + if (ibnl_put_attr(skb, nlh,
998 +- rdma_addr_size(cma_src_addr(id_priv)),
999 ++ rdma_addr_size(cma_dst_addr(id_priv)),
1000 + cma_dst_addr(id_priv),
1001 + RDMA_NL_RDMA_CM_ATTR_DST_ADDR))
1002 + goto out;
1003 +diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
1004 +index fb43a242847b..8d7d110d0721 100644
1005 +--- a/drivers/infiniband/core/iwpm_util.c
1006 ++++ b/drivers/infiniband/core/iwpm_util.c
1007 +@@ -663,6 +663,7 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid)
1008 + }
1009 + skb_num++;
1010 + spin_lock_irqsave(&iwpm_mapinfo_lock, flags);
1011 ++ ret = -EINVAL;
1012 + for (i = 0; i < IWPM_MAPINFO_HASH_SIZE; i++) {
1013 + hlist_for_each_entry(map_info, &iwpm_hash_bucket[i],
1014 + hlist_node) {
1015 +diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
1016 +index 0ae337bec4f2..6790ebb366dd 100644
1017 +--- a/drivers/infiniband/core/umem.c
1018 ++++ b/drivers/infiniband/core/umem.c
1019 +@@ -354,7 +354,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset,
1020 + return -EINVAL;
1021 + }
1022 +
1023 +- ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->nmap, dst, length,
1024 ++ ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length,
1025 + offset + ib_umem_offset(umem));
1026 +
1027 + if (ret < 0)
1028 +diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
1029 +index b7a73f1a8beb..3eb967521917 100644
1030 +--- a/drivers/infiniband/core/uverbs_cmd.c
1031 ++++ b/drivers/infiniband/core/uverbs_cmd.c
1032 +@@ -2436,9 +2436,13 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file,
1033 +
1034 + static void *alloc_wr(size_t wr_size, __u32 num_sge)
1035 + {
1036 ++ if (num_sge >= (U32_MAX - ALIGN(wr_size, sizeof (struct ib_sge))) /
1037 ++ sizeof (struct ib_sge))
1038 ++ return NULL;
1039 ++
1040 + return kmalloc(ALIGN(wr_size, sizeof (struct ib_sge)) +
1041 + num_sge * sizeof (struct ib_sge), GFP_KERNEL);
1042 +-};
1043 ++}
1044 +
1045 + ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
1046 + struct ib_device *ib_dev,
1047 +@@ -2665,6 +2669,13 @@ static struct ib_recv_wr *ib_uverbs_unmarshall_recv(const char __user *buf,
1048 + goto err;
1049 + }
1050 +
1051 ++ if (user_wr->num_sge >=
1052 ++ (U32_MAX - ALIGN(sizeof *next, sizeof (struct ib_sge))) /
1053 ++ sizeof (struct ib_sge)) {
1054 ++ ret = -EINVAL;
1055 ++ goto err;
1056 ++ }
1057 ++
1058 + next = kmalloc(ALIGN(sizeof *next, sizeof (struct ib_sge)) +
1059 + user_wr->num_sge * sizeof (struct ib_sge),
1060 + GFP_KERNEL);
1061 +diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
1062 +index 5a2a0b5db938..67c4c73343d4 100644
1063 +--- a/drivers/infiniband/hw/mlx4/main.c
1064 ++++ b/drivers/infiniband/hw/mlx4/main.c
1065 +@@ -1041,7 +1041,7 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
1066 + /* need to protect from a race on closing the vma as part of
1067 + * mlx4_ib_vma_close().
1068 + */
1069 +- down_read(&owning_mm->mmap_sem);
1070 ++ down_write(&owning_mm->mmap_sem);
1071 + for (i = 0; i < HW_BAR_COUNT; i++) {
1072 + vma = context->hw_bar_info[i].vma;
1073 + if (!vma)
1074 +@@ -1055,11 +1055,13 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
1075 + BUG_ON(1);
1076 + }
1077 +
1078 ++ context->hw_bar_info[i].vma->vm_flags &=
1079 ++ ~(VM_SHARED | VM_MAYSHARE);
1080 + /* context going to be destroyed, should not access ops any more */
1081 + context->hw_bar_info[i].vma->vm_ops = NULL;
1082 + }
1083 +
1084 +- up_read(&owning_mm->mmap_sem);
1085 ++ up_write(&owning_mm->mmap_sem);
1086 + mmput(owning_mm);
1087 + put_task_struct(owning_process);
1088 + }
1089 +diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
1090 +index 86c303a620c1..748b63b86cbc 100644
1091 +--- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
1092 ++++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
1093 +@@ -834,7 +834,7 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev)
1094 +
1095 + dev->reset_stats.type = OCRDMA_RESET_STATS;
1096 + dev->reset_stats.dev = dev;
1097 +- if (!debugfs_create_file("reset_stats", S_IRUSR, dev->dir,
1098 ++ if (!debugfs_create_file("reset_stats", 0200, dev->dir,
1099 + &dev->reset_stats, &ocrdma_dbg_ops))
1100 + goto err;
1101 +
1102 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1103 +index d3f0a384faad..f6b06729f4ea 100644
1104 +--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1105 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1106 +@@ -945,6 +945,19 @@ static inline int update_parent_pkey(struct ipoib_dev_priv *priv)
1107 + */
1108 + priv->dev->broadcast[8] = priv->pkey >> 8;
1109 + priv->dev->broadcast[9] = priv->pkey & 0xff;
1110 ++
1111 ++ /*
1112 ++ * Update the broadcast address in the priv->broadcast object,
1113 ++ * in case it already exists, otherwise no one will do that.
1114 ++ */
1115 ++ if (priv->broadcast) {
1116 ++ spin_lock_irq(&priv->lock);
1117 ++ memcpy(priv->broadcast->mcmember.mgid.raw,
1118 ++ priv->dev->broadcast + 4,
1119 ++ sizeof(union ib_gid));
1120 ++ spin_unlock_irq(&priv->lock);
1121 ++ }
1122 ++
1123 + return 0;
1124 + }
1125 +
1126 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1127 +index 5c653669e736..37b42447045d 100644
1128 +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
1129 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1130 +@@ -724,6 +724,22 @@ static void path_rec_completion(int status,
1131 + spin_lock_irqsave(&priv->lock, flags);
1132 +
1133 + if (!IS_ERR_OR_NULL(ah)) {
1134 ++ /*
1135 ++ * pathrec.dgid is used as the database key from the LLADDR,
1136 ++ * it must remain unchanged even if the SA returns a different
1137 ++ * GID to use in the AH.
1138 ++ */
1139 ++ if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
1140 ++ sizeof(union ib_gid))) {
1141 ++ ipoib_dbg(
1142 ++ priv,
1143 ++ "%s got PathRec for gid %pI6 while asked for %pI6\n",
1144 ++ dev->name, pathrec->dgid.raw,
1145 ++ path->pathrec.dgid.raw);
1146 ++ memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
1147 ++ sizeof(union ib_gid));
1148 ++ }
1149 ++
1150 + path->pathrec = *pathrec;
1151 +
1152 + old_ah = path->ah;
1153 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
1154 +index 8bf48165f32c..21e688d55da6 100644
1155 +--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
1156 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
1157 +@@ -473,6 +473,9 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast)
1158 + !test_bit(IPOIB_FLAG_OPER_UP, &priv->flags))
1159 + return -EINVAL;
1160 +
1161 ++ init_completion(&mcast->done);
1162 ++ set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags);
1163 ++
1164 + ipoib_dbg_mcast(priv, "joining MGID %pI6\n", mcast->mcmember.mgid.raw);
1165 +
1166 + rec.mgid = mcast->mcmember.mgid;
1167 +@@ -631,8 +634,6 @@ void ipoib_mcast_join_task(struct work_struct *work)
1168 + if (mcast->backoff == 1 ||
1169 + time_after_eq(jiffies, mcast->delay_until)) {
1170 + /* Found the next unjoined group */
1171 +- init_completion(&mcast->done);
1172 +- set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags);
1173 + if (ipoib_mcast_join(dev, mcast)) {
1174 + spin_unlock_irq(&priv->lock);
1175 + return;
1176 +@@ -652,11 +653,9 @@ out:
1177 + queue_delayed_work(priv->wq, &priv->mcast_task,
1178 + delay_until - jiffies);
1179 + }
1180 +- if (mcast) {
1181 +- init_completion(&mcast->done);
1182 +- set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags);
1183 ++ if (mcast)
1184 + ipoib_mcast_join(dev, mcast);
1185 +- }
1186 ++
1187 + spin_unlock_irq(&priv->lock);
1188 + }
1189 +
1190 +diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
1191 +index 603fc2fadf05..12b20840fb74 100644
1192 +--- a/drivers/input/misc/twl4030-pwrbutton.c
1193 ++++ b/drivers/input/misc/twl4030-pwrbutton.c
1194 +@@ -70,7 +70,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
1195 + pwr->phys = "twl4030_pwrbutton/input0";
1196 + pwr->dev.parent = &pdev->dev;
1197 +
1198 +- err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
1199 ++ err = devm_request_threaded_irq(&pdev->dev, irq, NULL, powerbutton_irq,
1200 + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
1201 + IRQF_ONESHOT,
1202 + "twl4030_pwrbutton", pwr);
1203 +diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c
1204 +index 71b5a634cf6d..e7bb155911d0 100644
1205 +--- a/drivers/input/touchscreen/ar1021_i2c.c
1206 ++++ b/drivers/input/touchscreen/ar1021_i2c.c
1207 +@@ -152,7 +152,7 @@ static int __maybe_unused ar1021_i2c_resume(struct device *dev)
1208 + static SIMPLE_DEV_PM_OPS(ar1021_i2c_pm, ar1021_i2c_suspend, ar1021_i2c_resume);
1209 +
1210 + static const struct i2c_device_id ar1021_i2c_id[] = {
1211 +- { "MICROCHIP_AR1021_I2C", 0 },
1212 ++ { "ar1021", 0 },
1213 + { },
1214 + };
1215 + MODULE_DEVICE_TABLE(i2c, ar1021_i2c_id);
1216 +diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
1217 +index f929879ecae6..a7d516f973dd 100644
1218 +--- a/drivers/iommu/intel-svm.c
1219 ++++ b/drivers/iommu/intel-svm.c
1220 +@@ -127,6 +127,7 @@ int intel_svm_enable_prq(struct intel_iommu *iommu)
1221 + pr_err("IOMMU: %s: Failed to request IRQ for page request queue\n",
1222 + iommu->name);
1223 + dmar_free_hwirq(irq);
1224 ++ iommu->pr_irq = 0;
1225 + goto err;
1226 + }
1227 + dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL);
1228 +@@ -142,9 +143,11 @@ int intel_svm_finish_prq(struct intel_iommu *iommu)
1229 + dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL);
1230 + dmar_writeq(iommu->reg + DMAR_PQA_REG, 0ULL);
1231 +
1232 +- free_irq(iommu->pr_irq, iommu);
1233 +- dmar_free_hwirq(iommu->pr_irq);
1234 +- iommu->pr_irq = 0;
1235 ++ if (iommu->pr_irq) {
1236 ++ free_irq(iommu->pr_irq, iommu);
1237 ++ dmar_free_hwirq(iommu->pr_irq);
1238 ++ iommu->pr_irq = 0;
1239 ++ }
1240 +
1241 + free_pages((unsigned long)iommu->prq, PRQ_ORDER);
1242 + iommu->prq = NULL;
1243 +diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
1244 +index 3dc5b65f3990..b98d38f95237 100644
1245 +--- a/drivers/iommu/omap-iommu.c
1246 ++++ b/drivers/iommu/omap-iommu.c
1247 +@@ -1295,6 +1295,7 @@ static int __init omap_iommu_init(void)
1248 + const unsigned long flags = SLAB_HWCACHE_ALIGN;
1249 + size_t align = 1 << 10; /* L2 pagetable alignement */
1250 + struct device_node *np;
1251 ++ int ret;
1252 +
1253 + np = of_find_matching_node(NULL, omap_iommu_of_match);
1254 + if (!np)
1255 +@@ -1308,11 +1309,25 @@ static int __init omap_iommu_init(void)
1256 + return -ENOMEM;
1257 + iopte_cachep = p;
1258 +
1259 +- bus_set_iommu(&platform_bus_type, &omap_iommu_ops);
1260 +-
1261 + omap_iommu_debugfs_init();
1262 +
1263 +- return platform_driver_register(&omap_iommu_driver);
1264 ++ ret = platform_driver_register(&omap_iommu_driver);
1265 ++ if (ret) {
1266 ++ pr_err("%s: failed to register driver\n", __func__);
1267 ++ goto fail_driver;
1268 ++ }
1269 ++
1270 ++ ret = bus_set_iommu(&platform_bus_type, &omap_iommu_ops);
1271 ++ if (ret)
1272 ++ goto fail_bus;
1273 ++
1274 ++ return 0;
1275 ++
1276 ++fail_bus:
1277 ++ platform_driver_unregister(&omap_iommu_driver);
1278 ++fail_driver:
1279 ++ kmem_cache_destroy(iopte_cachep);
1280 ++ return ret;
1281 + }
1282 + subsys_initcall(omap_iommu_init);
1283 + /* must be ready before omap3isp is probed */
1284 +diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1285 +index a8a86d450d76..3a0d557146c7 100644
1286 +--- a/drivers/md/raid10.c
1287 ++++ b/drivers/md/raid10.c
1288 +@@ -2698,6 +2698,11 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio)
1289 + list_add(&r10_bio->retry_list, &conf->bio_end_io_list);
1290 + conf->nr_queued++;
1291 + spin_unlock_irq(&conf->device_lock);
1292 ++ /*
1293 ++ * In case freeze_array() is waiting for condition
1294 ++ * nr_pending == nr_queued + extra to be true.
1295 ++ */
1296 ++ wake_up(&conf->wait_barrier);
1297 + md_wakeup_thread(conf->mddev->thread);
1298 + } else {
1299 + if (test_bit(R10BIO_WriteError,
1300 +@@ -4039,6 +4044,7 @@ static int raid10_start_reshape(struct mddev *mddev)
1301 + diff = 0;
1302 + if (first || diff < min_offset_diff)
1303 + min_offset_diff = diff;
1304 ++ first = 0;
1305 + }
1306 + }
1307 +
1308 +diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
1309 +index fb66184dc9b6..77cf211e842e 100644
1310 +--- a/drivers/media/dvb-core/dvb_ca_en50221.c
1311 ++++ b/drivers/media/dvb-core/dvb_ca_en50221.c
1312 +@@ -750,6 +750,29 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * b
1313 + goto exit;
1314 + }
1315 +
1316 ++ /*
1317 ++ * It may need some time for the CAM to settle down, or there might
1318 ++ * be a race condition between the CAM, writing HC and our last
1319 ++ * check for DA. This happens, if the CAM asserts DA, just after
1320 ++ * checking DA before we are setting HC. In this case it might be
1321 ++ * a bug in the CAM to keep the FR bit, the lower layer/HW
1322 ++ * communication requires a longer timeout or the CAM needs more
1323 ++ * time internally. But this happens in reality!
1324 ++ * We need to read the status from the HW again and do the same
1325 ++ * we did for the previous check for DA
1326 ++ */
1327 ++ status = ca->pub->read_cam_control(ca->pub, slot, CTRLIF_STATUS);
1328 ++ if (status < 0)
1329 ++ goto exit;
1330 ++
1331 ++ if (status & (STATUSREG_DA | STATUSREG_RE)) {
1332 ++ if (status & STATUSREG_DA)
1333 ++ dvb_ca_en50221_thread_wakeup(ca);
1334 ++
1335 ++ status = -EAGAIN;
1336 ++ goto exit;
1337 ++ }
1338 ++
1339 + /* send the amount of data */
1340 + if ((status = ca->pub->write_cam_control(ca->pub, slot, CTRLIF_SIZE_HIGH, bytes_write >> 8)) != 0)
1341 + goto exit;
1342 +diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
1343 +index 821a8f481507..9d6270591858 100644
1344 +--- a/drivers/media/dvb-frontends/si2168.c
1345 ++++ b/drivers/media/dvb-frontends/si2168.c
1346 +@@ -14,6 +14,8 @@
1347 + * GNU General Public License for more details.
1348 + */
1349 +
1350 ++#include <linux/delay.h>
1351 ++
1352 + #include "si2168_priv.h"
1353 +
1354 + static const struct dvb_frontend_ops si2168_ops;
1355 +@@ -420,6 +422,7 @@ static int si2168_init(struct dvb_frontend *fe)
1356 + if (ret)
1357 + goto err;
1358 +
1359 ++ udelay(100);
1360 + memcpy(cmd.args, "\x85", 1);
1361 + cmd.wlen = 1;
1362 + cmd.rlen = 1;
1363 +diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
1364 +index 8aa726651630..90fcccc05b56 100644
1365 +--- a/drivers/media/pci/bt8xx/bt878.c
1366 ++++ b/drivers/media/pci/bt8xx/bt878.c
1367 +@@ -422,8 +422,7 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
1368 + bt878_num);
1369 + if (bt878_num >= BT878_MAX) {
1370 + printk(KERN_ERR "bt878: Too many devices inserted\n");
1371 +- result = -ENOMEM;
1372 +- goto fail0;
1373 ++ return -ENOMEM;
1374 + }
1375 + if (pci_enable_device(dev))
1376 + return -EIO;
1377 +diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
1378 +index 8490a65ae1c6..a43404cad3e3 100644
1379 +--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
1380 ++++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
1381 +@@ -83,7 +83,7 @@ static void c8sectpfe_timer_interrupt(unsigned long ac8sectpfei)
1382 + static void channel_swdemux_tsklet(unsigned long data)
1383 + {
1384 + struct channel_info *channel = (struct channel_info *)data;
1385 +- struct c8sectpfei *fei = channel->fei;
1386 ++ struct c8sectpfei *fei;
1387 + unsigned long wp, rp;
1388 + int pos, num_packets, n, size;
1389 + u8 *buf;
1390 +@@ -91,6 +91,8 @@ static void channel_swdemux_tsklet(unsigned long data)
1391 + if (unlikely(!channel || !channel->irec))
1392 + return;
1393 +
1394 ++ fei = channel->fei;
1395 ++
1396 + wp = readl(channel->irec + DMA_PRDS_BUSWP_TP(0));
1397 + rp = readl(channel->irec + DMA_PRDS_BUSRP_TP(0));
1398 +
1399 +diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
1400 +index 8f8bacb67a15..a6b5259ffbdd 100644
1401 +--- a/drivers/mfd/palmas.c
1402 ++++ b/drivers/mfd/palmas.c
1403 +@@ -430,6 +430,20 @@ static void palmas_power_off(void)
1404 + {
1405 + unsigned int addr;
1406 + int ret, slave;
1407 ++ struct device_node *np = palmas_dev->dev->of_node;
1408 ++
1409 ++ if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
1410 ++ addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE,
1411 ++ PALMAS_PRIMARY_SECONDARY_PAD2);
1412 ++ slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
1413 ++
1414 ++ ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
1415 ++ PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
1416 ++ if (ret)
1417 ++ dev_err(palmas_dev->dev,
1418 ++ "Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
1419 ++ ret);
1420 ++ }
1421 +
1422 + if (!palmas_dev)
1423 + return;
1424 +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
1425 +index 5f7d10ba498a..299a83f1ad38 100644
1426 +--- a/drivers/mmc/core/core.c
1427 ++++ b/drivers/mmc/core/core.c
1428 +@@ -2791,6 +2791,14 @@ int mmc_pm_notify(struct notifier_block *notify_block,
1429 + if (!err)
1430 + break;
1431 +
1432 ++ if (!mmc_card_is_removable(host)) {
1433 ++ dev_warn(mmc_dev(host),
1434 ++ "pre_suspend failed for non-removable host: "
1435 ++ "%d\n", err);
1436 ++ /* Avoid removing non-removable hosts */
1437 ++ break;
1438 ++ }
1439 ++
1440 + /* Calling bus_ops->remove() with a claimed host can deadlock */
1441 + host->bus_ops->remove(host);
1442 + mmc_claim_host(host);
1443 +diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
1444 +index 7fb0753abe30..6b814d7d6560 100644
1445 +--- a/drivers/mmc/host/omap_hsmmc.c
1446 ++++ b/drivers/mmc/host/omap_hsmmc.c
1447 +@@ -1776,8 +1776,8 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
1448 + */
1449 + if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) {
1450 + struct pinctrl *p = devm_pinctrl_get(host->dev);
1451 +- if (!p) {
1452 +- ret = -ENODEV;
1453 ++ if (IS_ERR(p)) {
1454 ++ ret = PTR_ERR(p);
1455 + goto err_free_irq;
1456 + }
1457 + if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) {
1458 +diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
1459 +index 83b1226471c1..ac66c61d9433 100644
1460 +--- a/drivers/mmc/host/sdhci-of-esdhc.c
1461 ++++ b/drivers/mmc/host/sdhci-of-esdhc.c
1462 +@@ -418,6 +418,20 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
1463 + if (esdhc->vendor_ver < VENDOR_V_23)
1464 + pre_div = 2;
1465 +
1466 ++ /*
1467 ++ * Limit SD clock to 167MHz for ls1046a according to its datasheet
1468 ++ */
1469 ++ if (clock > 167000000 &&
1470 ++ of_find_compatible_node(NULL, NULL, "fsl,ls1046a-esdhc"))
1471 ++ clock = 167000000;
1472 ++
1473 ++ /*
1474 ++ * Limit SD clock to 125MHz for ls1012a according to its datasheet
1475 ++ */
1476 ++ if (clock > 125000000 &&
1477 ++ of_find_compatible_node(NULL, NULL, "fsl,ls1012a-esdhc"))
1478 ++ clock = 125000000;
1479 ++
1480 + /* Workaround to reduce the clock frequency for p1010 esdhc */
1481 + if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
1482 + if (clock > 20000000)
1483 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1484 +index 74bece5897c9..d1103d612d8b 100644
1485 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1486 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1487 +@@ -2044,6 +2044,7 @@ static void bnx2x_set_rx_buf_size(struct bnx2x *bp)
1488 + ETH_OVREHEAD +
1489 + mtu +
1490 + BNX2X_FW_RX_ALIGN_END;
1491 ++ fp->rx_buf_size = SKB_DATA_ALIGN(fp->rx_buf_size);
1492 + /* Note : rx_buf_size doesn't take into account NET_SKB_PAD */
1493 + if (fp->rx_buf_size + NET_SKB_PAD <= PAGE_SIZE)
1494 + fp->rx_frag_size = fp->rx_buf_size + NET_SKB_PAD;
1495 +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
1496 +index b8517b00e706..a20bd8362712 100644
1497 +--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
1498 ++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
1499 +@@ -648,7 +648,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data)
1500 +
1501 + static int hns_gmac_get_sset_count(int stringset)
1502 + {
1503 +- if (stringset == ETH_SS_STATS)
1504 ++ if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1505 + return ARRAY_SIZE(g_gmac_stats_string);
1506 +
1507 + return 0;
1508 +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
1509 +index 67f33f185a44..6634aef0e841 100644
1510 +--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
1511 ++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
1512 +@@ -384,7 +384,7 @@ void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb)
1513 +
1514 + int hns_ppe_get_sset_count(int stringset)
1515 + {
1516 +- if (stringset == ETH_SS_STATS)
1517 ++ if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1518 + return ETH_PPE_STATIC_NUM;
1519 + return 0;
1520 + }
1521 +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
1522 +index 4db32c62f062..1d5b18d7a1d7 100644
1523 +--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
1524 ++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
1525 +@@ -807,7 +807,7 @@ void hns_rcb_get_stats(struct hnae_queue *queue, u64 *data)
1526 + */
1527 + int hns_rcb_get_ring_sset_count(int stringset)
1528 + {
1529 +- if (stringset == ETH_SS_STATS)
1530 ++ if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1531 + return HNS_RING_STATIC_REG_NUM;
1532 +
1533 + return 0;
1534 +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
1535 +index 802d55457f19..b1a27aef4425 100644
1536 +--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
1537 ++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
1538 +@@ -776,7 +776,7 @@ static void hns_xgmac_get_strings(u32 stringset, u8 *data)
1539 + */
1540 + static int hns_xgmac_get_sset_count(int stringset)
1541 + {
1542 +- if (stringset == ETH_SS_STATS)
1543 ++ if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
1544 + return ARRAY_SIZE(g_xgmac_stats_string);
1545 +
1546 + return 0;
1547 +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
1548 +index 5205f1ebe381..e356e9187e84 100644
1549 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c
1550 ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
1551 +@@ -3526,6 +3526,12 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
1552 +
1553 + switch (hw->mac.type) {
1554 + case e1000_pch2lan:
1555 ++ /* Stable 96MHz frequency */
1556 ++ incperiod = INCPERIOD_96MHz;
1557 ++ incvalue = INCVALUE_96MHz;
1558 ++ shift = INCVALUE_SHIFT_96MHz;
1559 ++ adapter->cc.shift = shift + INCPERIOD_SHIFT_96MHz;
1560 ++ break;
1561 + case e1000_pch_lpt:
1562 + if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) {
1563 + /* Stable 96MHz frequency */
1564 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
1565 +index 7327b729ba2e..ffa6885acfc8 100644
1566 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
1567 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
1568 +@@ -127,6 +127,8 @@ static int qlcnic_sriov_virtid_fn(struct qlcnic_adapter *adapter, int vf_id)
1569 + return 0;
1570 +
1571 + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV);
1572 ++ if (!pos)
1573 ++ return 0;
1574 + pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, &offset);
1575 + pci_read_config_word(dev, pos + PCI_SRIOV_VF_STRIDE, &stride);
1576 +
1577 +diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
1578 +index db363856e0b5..2b064998915f 100644
1579 +--- a/drivers/net/wan/pc300too.c
1580 ++++ b/drivers/net/wan/pc300too.c
1581 +@@ -347,6 +347,7 @@ static int pc300_pci_init_one(struct pci_dev *pdev,
1582 + card->rambase == NULL) {
1583 + pr_err("ioremap() failed\n");
1584 + pc300_pci_remove_one(pdev);
1585 ++ return -ENOMEM;
1586 + }
1587 +
1588 + /* PLX PCI 9050 workaround for local configuration register read bug */
1589 +diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
1590 +index 06ea6cc9e30a..62077bda8dde 100644
1591 +--- a/drivers/net/wireless/ath/regd.c
1592 ++++ b/drivers/net/wireless/ath/regd.c
1593 +@@ -254,8 +254,12 @@ bool ath_is_49ghz_allowed(u16 regdomain)
1594 + EXPORT_SYMBOL(ath_is_49ghz_allowed);
1595 +
1596 + /* Frequency is one where radar detection is required */
1597 +-static bool ath_is_radar_freq(u16 center_freq)
1598 ++static bool ath_is_radar_freq(u16 center_freq,
1599 ++ struct ath_regulatory *reg)
1600 ++
1601 + {
1602 ++ if (reg->country_code == CTRY_INDIA)
1603 ++ return (center_freq >= 5500 && center_freq <= 5700);
1604 + return (center_freq >= 5260 && center_freq <= 5700);
1605 + }
1606 +
1607 +@@ -306,7 +310,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
1608 + enum nl80211_reg_initiator initiator,
1609 + struct ieee80211_channel *ch)
1610 + {
1611 +- if (ath_is_radar_freq(ch->center_freq) ||
1612 ++ if (ath_is_radar_freq(ch->center_freq, reg) ||
1613 + (ch->flags & IEEE80211_CHAN_RADAR))
1614 + return;
1615 +
1616 +@@ -395,8 +399,9 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
1617 + }
1618 + }
1619 +
1620 +-/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */
1621 +-static void ath_reg_apply_radar_flags(struct wiphy *wiphy)
1622 ++/* Always apply Radar/DFS rules on freq range 5500 MHz - 5700 MHz */
1623 ++static void ath_reg_apply_radar_flags(struct wiphy *wiphy,
1624 ++ struct ath_regulatory *reg)
1625 + {
1626 + struct ieee80211_supported_band *sband;
1627 + struct ieee80211_channel *ch;
1628 +@@ -409,7 +414,7 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy)
1629 +
1630 + for (i = 0; i < sband->n_channels; i++) {
1631 + ch = &sband->channels[i];
1632 +- if (!ath_is_radar_freq(ch->center_freq))
1633 ++ if (!ath_is_radar_freq(ch->center_freq, reg))
1634 + continue;
1635 + /* We always enable radar detection/DFS on this
1636 + * frequency range. Additionally we also apply on
1637 +@@ -505,7 +510,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
1638 + struct ath_common *common = container_of(reg, struct ath_common,
1639 + regulatory);
1640 + /* We always apply this */
1641 +- ath_reg_apply_radar_flags(wiphy);
1642 ++ ath_reg_apply_radar_flags(wiphy, reg);
1643 +
1644 + /*
1645 + * This would happen when we have sent a custom regulatory request
1646 +@@ -653,7 +658,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
1647 + }
1648 +
1649 + wiphy_apply_custom_regulatory(wiphy, regd);
1650 +- ath_reg_apply_radar_flags(wiphy);
1651 ++ ath_reg_apply_radar_flags(wiphy, reg);
1652 + ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
1653 + return 0;
1654 + }
1655 +diff --git a/drivers/net/wireless/mediatek/mt7601u/mcu.c b/drivers/net/wireless/mediatek/mt7601u/mcu.c
1656 +index fbb1986eda3c..686b1b5dd394 100644
1657 +--- a/drivers/net/wireless/mediatek/mt7601u/mcu.c
1658 ++++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c
1659 +@@ -66,8 +66,10 @@ mt7601u_mcu_msg_alloc(struct mt7601u_dev *dev, const void *data, int len)
1660 + WARN_ON(len % 4); /* if length is not divisible by 4 we need to pad */
1661 +
1662 + skb = alloc_skb(len + MT_DMA_HDR_LEN + 4, GFP_KERNEL);
1663 +- skb_reserve(skb, MT_DMA_HDR_LEN);
1664 +- memcpy(skb_put(skb, len), data, len);
1665 ++ if (skb) {
1666 ++ skb_reserve(skb, MT_DMA_HDR_LEN);
1667 ++ memcpy(skb_put(skb, len), data, len);
1668 ++ }
1669 +
1670 + return skb;
1671 + }
1672 +@@ -170,6 +172,8 @@ static int mt7601u_mcu_function_select(struct mt7601u_dev *dev,
1673 + };
1674 +
1675 + skb = mt7601u_mcu_msg_alloc(dev, &msg, sizeof(msg));
1676 ++ if (!skb)
1677 ++ return -ENOMEM;
1678 + return mt7601u_mcu_msg_send(dev, skb, CMD_FUN_SET_OP, func == 5);
1679 + }
1680 +
1681 +@@ -205,6 +209,8 @@ mt7601u_mcu_calibrate(struct mt7601u_dev *dev, enum mcu_calibrate cal, u32 val)
1682 + };
1683 +
1684 + skb = mt7601u_mcu_msg_alloc(dev, &msg, sizeof(msg));
1685 ++ if (!skb)
1686 ++ return -ENOMEM;
1687 + return mt7601u_mcu_msg_send(dev, skb, CMD_CALIBRATION_OP, true);
1688 + }
1689 +
1690 +diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
1691 +index c48b7e8ee0d6..b51815eccdb3 100644
1692 +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
1693 ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
1694 +@@ -1572,7 +1572,14 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1695 + dev_kfree_skb_irq(skb);
1696 + ring->idx = (ring->idx + 1) % ring->entries;
1697 + }
1698 ++
1699 ++ if (rtlpriv->use_new_trx_flow) {
1700 ++ rtlpci->tx_ring[i].cur_tx_rp = 0;
1701 ++ rtlpci->tx_ring[i].cur_tx_wp = 0;
1702 ++ }
1703 ++
1704 + ring->idx = 0;
1705 ++ ring->entries = rtlpci->txringcount[i];
1706 + }
1707 + }
1708 + spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
1709 +diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
1710 +index a13d1f2b5912..259590013382 100644
1711 +--- a/drivers/net/wireless/rndis_wlan.c
1712 ++++ b/drivers/net/wireless/rndis_wlan.c
1713 +@@ -3425,6 +3425,10 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
1714 +
1715 + /* because rndis_command() sleeps we need to use workqueue */
1716 + priv->workqueue = create_singlethread_workqueue("rndis_wlan");
1717 ++ if (!priv->workqueue) {
1718 ++ wiphy_free(wiphy);
1719 ++ return -ENOMEM;
1720 ++ }
1721 + INIT_WORK(&priv->work, rndis_wlan_worker);
1722 + INIT_DELAYED_WORK(&priv->dev_poller_work, rndis_device_poller);
1723 + INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results);
1724 +diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
1725 +index 2686a4450dfc..f4639a9f1e48 100644
1726 +--- a/drivers/pinctrl/core.c
1727 ++++ b/drivers/pinctrl/core.c
1728 +@@ -979,19 +979,16 @@ struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p,
1729 + EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
1730 +
1731 + /**
1732 +- * pinctrl_select_state() - select/activate/program a pinctrl state to HW
1733 ++ * pinctrl_commit_state() - select/activate/program a pinctrl state to HW
1734 + * @p: the pinctrl handle for the device that requests configuration
1735 + * @state: the state handle to select/activate/program
1736 + */
1737 +-int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
1738 ++static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
1739 + {
1740 + struct pinctrl_setting *setting, *setting2;
1741 + struct pinctrl_state *old_state = p->state;
1742 + int ret;
1743 +
1744 +- if (p->state == state)
1745 +- return 0;
1746 +-
1747 + if (p->state) {
1748 + /*
1749 + * For each pinmux setting in the old state, forget SW's record
1750 +@@ -1055,6 +1052,19 @@ unapply_new_state:
1751 +
1752 + return ret;
1753 + }
1754 ++
1755 ++/**
1756 ++ * pinctrl_select_state() - select/activate/program a pinctrl state to HW
1757 ++ * @p: the pinctrl handle for the device that requests configuration
1758 ++ * @state: the state handle to select/activate/program
1759 ++ */
1760 ++int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
1761 ++{
1762 ++ if (p->state == state)
1763 ++ return 0;
1764 ++
1765 ++ return pinctrl_commit_state(p, state);
1766 ++}
1767 + EXPORT_SYMBOL_GPL(pinctrl_select_state);
1768 +
1769 + static void devm_pinctrl_release(struct device *dev, void *res)
1770 +@@ -1223,7 +1233,7 @@ void pinctrl_unregister_map(struct pinctrl_map const *map)
1771 + int pinctrl_force_sleep(struct pinctrl_dev *pctldev)
1772 + {
1773 + if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_sleep))
1774 +- return pinctrl_select_state(pctldev->p, pctldev->hog_sleep);
1775 ++ return pinctrl_commit_state(pctldev->p, pctldev->hog_sleep);
1776 + return 0;
1777 + }
1778 + EXPORT_SYMBOL_GPL(pinctrl_force_sleep);
1779 +@@ -1235,7 +1245,7 @@ EXPORT_SYMBOL_GPL(pinctrl_force_sleep);
1780 + int pinctrl_force_default(struct pinctrl_dev *pctldev)
1781 + {
1782 + if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_default))
1783 +- return pinctrl_select_state(pctldev->p, pctldev->hog_default);
1784 ++ return pinctrl_commit_state(pctldev->p, pctldev->hog_default);
1785 + return 0;
1786 + }
1787 + EXPORT_SYMBOL_GPL(pinctrl_force_default);
1788 +diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
1789 +index 92430f781eb7..a0b8c8a8c323 100644
1790 +--- a/drivers/platform/chrome/cros_ec_proto.c
1791 ++++ b/drivers/platform/chrome/cros_ec_proto.c
1792 +@@ -59,12 +59,14 @@ static int send_command(struct cros_ec_device *ec_dev,
1793 + struct cros_ec_command *msg)
1794 + {
1795 + int ret;
1796 ++ int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
1797 +
1798 + if (ec_dev->proto_version > 2)
1799 +- ret = ec_dev->pkt_xfer(ec_dev, msg);
1800 ++ xfer_fxn = ec_dev->pkt_xfer;
1801 + else
1802 +- ret = ec_dev->cmd_xfer(ec_dev, msg);
1803 ++ xfer_fxn = ec_dev->cmd_xfer;
1804 +
1805 ++ ret = (*xfer_fxn)(ec_dev, msg);
1806 + if (msg->result == EC_RES_IN_PROGRESS) {
1807 + int i;
1808 + struct cros_ec_command *status_msg;
1809 +@@ -87,7 +89,7 @@ static int send_command(struct cros_ec_device *ec_dev,
1810 + for (i = 0; i < EC_COMMAND_RETRIES; i++) {
1811 + usleep_range(10000, 11000);
1812 +
1813 +- ret = ec_dev->cmd_xfer(ec_dev, status_msg);
1814 ++ ret = (*xfer_fxn)(ec_dev, status_msg);
1815 + if (ret < 0)
1816 + break;
1817 +
1818 +diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c
1819 +index f3baf9973989..24f1630a8b3f 100644
1820 +--- a/drivers/platform/chrome/cros_ec_sysfs.c
1821 ++++ b/drivers/platform/chrome/cros_ec_sysfs.c
1822 +@@ -187,7 +187,7 @@ static ssize_t show_ec_version(struct device *dev,
1823 + count += scnprintf(buf + count, PAGE_SIZE - count,
1824 + "Build info: EC error %d\n", msg->result);
1825 + else {
1826 +- msg->data[sizeof(msg->data) - 1] = '\0';
1827 ++ msg->data[EC_HOST_PARAM_SIZE - 1] = '\0';
1828 + count += scnprintf(buf + count, PAGE_SIZE - count,
1829 + "Build info: %s\n", msg->data);
1830 + }
1831 +diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
1832 +index a3661cc44f86..0e0403e024c5 100644
1833 +--- a/drivers/platform/x86/asus-nb-wmi.c
1834 ++++ b/drivers/platform/x86/asus-nb-wmi.c
1835 +@@ -99,6 +99,15 @@ static const struct dmi_system_id asus_quirks[] = {
1836 + */
1837 + .driver_data = &quirk_asus_wapf4,
1838 + },
1839 ++ {
1840 ++ .callback = dmi_matched,
1841 ++ .ident = "ASUSTeK COMPUTER INC. X302UA",
1842 ++ .matches = {
1843 ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1844 ++ DMI_MATCH(DMI_PRODUCT_NAME, "X302UA"),
1845 ++ },
1846 ++ .driver_data = &quirk_asus_wapf4,
1847 ++ },
1848 + {
1849 + .callback = dmi_matched,
1850 + .ident = "ASUSTeK COMPUTER INC. X401U",
1851 +diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
1852 +index dfe1ee89f7c7..922a86787c5c 100644
1853 +--- a/drivers/power/pda_power.c
1854 ++++ b/drivers/power/pda_power.c
1855 +@@ -30,9 +30,9 @@ static inline unsigned int get_irq_flags(struct resource *res)
1856 + static struct device *dev;
1857 + static struct pda_power_pdata *pdata;
1858 + static struct resource *ac_irq, *usb_irq;
1859 +-static struct timer_list charger_timer;
1860 +-static struct timer_list supply_timer;
1861 +-static struct timer_list polling_timer;
1862 ++static struct delayed_work charger_work;
1863 ++static struct delayed_work polling_work;
1864 ++static struct delayed_work supply_work;
1865 + static int polling;
1866 + static struct power_supply *pda_psy_ac, *pda_psy_usb;
1867 +
1868 +@@ -140,7 +140,7 @@ static void update_charger(void)
1869 + }
1870 + }
1871 +
1872 +-static void supply_timer_func(unsigned long unused)
1873 ++static void supply_work_func(struct work_struct *work)
1874 + {
1875 + if (ac_status == PDA_PSY_TO_CHANGE) {
1876 + ac_status = new_ac_status;
1877 +@@ -161,11 +161,12 @@ static void psy_changed(void)
1878 + * Okay, charger set. Now wait a bit before notifying supplicants,
1879 + * charge power should stabilize.
1880 + */
1881 +- mod_timer(&supply_timer,
1882 +- jiffies + msecs_to_jiffies(pdata->wait_for_charger));
1883 ++ cancel_delayed_work(&supply_work);
1884 ++ schedule_delayed_work(&supply_work,
1885 ++ msecs_to_jiffies(pdata->wait_for_charger));
1886 + }
1887 +
1888 +-static void charger_timer_func(unsigned long unused)
1889 ++static void charger_work_func(struct work_struct *work)
1890 + {
1891 + update_status();
1892 + psy_changed();
1893 +@@ -184,13 +185,14 @@ static irqreturn_t power_changed_isr(int irq, void *power_supply)
1894 + * Wait a bit before reading ac/usb line status and setting charger,
1895 + * because ac/usb status readings may lag from irq.
1896 + */
1897 +- mod_timer(&charger_timer,
1898 +- jiffies + msecs_to_jiffies(pdata->wait_for_status));
1899 ++ cancel_delayed_work(&charger_work);
1900 ++ schedule_delayed_work(&charger_work,
1901 ++ msecs_to_jiffies(pdata->wait_for_status));
1902 +
1903 + return IRQ_HANDLED;
1904 + }
1905 +
1906 +-static void polling_timer_func(unsigned long unused)
1907 ++static void polling_work_func(struct work_struct *work)
1908 + {
1909 + int changed = 0;
1910 +
1911 +@@ -211,8 +213,9 @@ static void polling_timer_func(unsigned long unused)
1912 + if (changed)
1913 + psy_changed();
1914 +
1915 +- mod_timer(&polling_timer,
1916 +- jiffies + msecs_to_jiffies(pdata->polling_interval));
1917 ++ cancel_delayed_work(&polling_work);
1918 ++ schedule_delayed_work(&polling_work,
1919 ++ msecs_to_jiffies(pdata->polling_interval));
1920 + }
1921 +
1922 + #if IS_ENABLED(CONFIG_USB_PHY)
1923 +@@ -250,8 +253,9 @@ static int otg_handle_notification(struct notifier_block *nb,
1924 + * Wait a bit before reading ac/usb line status and setting charger,
1925 + * because ac/usb status readings may lag from irq.
1926 + */
1927 +- mod_timer(&charger_timer,
1928 +- jiffies + msecs_to_jiffies(pdata->wait_for_status));
1929 ++ cancel_delayed_work(&charger_work);
1930 ++ schedule_delayed_work(&charger_work,
1931 ++ msecs_to_jiffies(pdata->wait_for_status));
1932 +
1933 + return NOTIFY_OK;
1934 + }
1935 +@@ -300,8 +304,8 @@ static int pda_power_probe(struct platform_device *pdev)
1936 + if (!pdata->ac_max_uA)
1937 + pdata->ac_max_uA = 500000;
1938 +
1939 +- setup_timer(&charger_timer, charger_timer_func, 0);
1940 +- setup_timer(&supply_timer, supply_timer_func, 0);
1941 ++ INIT_DELAYED_WORK(&charger_work, charger_work_func);
1942 ++ INIT_DELAYED_WORK(&supply_work, supply_work_func);
1943 +
1944 + ac_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ac");
1945 + usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb");
1946 +@@ -385,9 +389,10 @@ static int pda_power_probe(struct platform_device *pdev)
1947 +
1948 + if (polling) {
1949 + dev_dbg(dev, "will poll for status\n");
1950 +- setup_timer(&polling_timer, polling_timer_func, 0);
1951 +- mod_timer(&polling_timer,
1952 +- jiffies + msecs_to_jiffies(pdata->polling_interval));
1953 ++ INIT_DELAYED_WORK(&polling_work, polling_work_func);
1954 ++ cancel_delayed_work(&polling_work);
1955 ++ schedule_delayed_work(&polling_work,
1956 ++ msecs_to_jiffies(pdata->polling_interval));
1957 + }
1958 +
1959 + if (ac_irq || usb_irq)
1960 +@@ -433,9 +438,9 @@ static int pda_power_remove(struct platform_device *pdev)
1961 + free_irq(ac_irq->start, pda_psy_ac);
1962 +
1963 + if (polling)
1964 +- del_timer_sync(&polling_timer);
1965 +- del_timer_sync(&charger_timer);
1966 +- del_timer_sync(&supply_timer);
1967 ++ cancel_delayed_work_sync(&polling_work);
1968 ++ cancel_delayed_work_sync(&charger_work);
1969 ++ cancel_delayed_work_sync(&supply_work);
1970 +
1971 + if (pdata->is_usb_online)
1972 + power_supply_unregister(pda_psy_usb);
1973 +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
1974 +index 2e481b9e8ea5..60a5e0c63a13 100644
1975 +--- a/drivers/ptp/ptp_clock.c
1976 ++++ b/drivers/ptp/ptp_clock.c
1977 +@@ -97,30 +97,26 @@ static s32 scaled_ppm_to_ppb(long ppm)
1978 +
1979 + /* posix clock implementation */
1980 +
1981 +-static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
1982 ++static int ptp_clock_getres(struct posix_clock *pc, struct timespec64 *tp)
1983 + {
1984 + tp->tv_sec = 0;
1985 + tp->tv_nsec = 1;
1986 + return 0;
1987 + }
1988 +
1989 +-static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)
1990 ++static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp)
1991 + {
1992 + struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
1993 +- struct timespec64 ts = timespec_to_timespec64(*tp);
1994 +
1995 +- return ptp->info->settime64(ptp->info, &ts);
1996 ++ return ptp->info->settime64(ptp->info, tp);
1997 + }
1998 +
1999 +-static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp)
2000 ++static int ptp_clock_gettime(struct posix_clock *pc, struct timespec64 *tp)
2001 + {
2002 + struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
2003 +- struct timespec64 ts;
2004 + int err;
2005 +
2006 +- err = ptp->info->gettime64(ptp->info, &ts);
2007 +- if (!err)
2008 +- *tp = timespec64_to_timespec(ts);
2009 ++ err = ptp->info->gettime64(ptp->info, tp);
2010 + return err;
2011 + }
2012 +
2013 +@@ -133,7 +129,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
2014 + ops = ptp->info;
2015 +
2016 + if (tx->modes & ADJ_SETOFFSET) {
2017 +- struct timespec ts;
2018 ++ struct timespec64 ts;
2019 + ktime_t kt;
2020 + s64 delta;
2021 +
2022 +@@ -146,7 +142,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
2023 + if ((unsigned long) ts.tv_nsec >= NSEC_PER_SEC)
2024 + return -EINVAL;
2025 +
2026 +- kt = timespec_to_ktime(ts);
2027 ++ kt = timespec64_to_ktime(ts);
2028 + delta = ktime_to_ns(kt);
2029 + err = ops->adjtime(ops, delta);
2030 + } else if (tx->modes & ADJ_FREQUENCY) {
2031 +diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
2032 +index 3a6d0290c54c..c5e272ea4372 100644
2033 +--- a/drivers/regulator/anatop-regulator.c
2034 ++++ b/drivers/regulator/anatop-regulator.c
2035 +@@ -296,6 +296,11 @@ static int anatop_regulator_probe(struct platform_device *pdev)
2036 + if (!sreg->sel && !strcmp(sreg->name, "vddpu"))
2037 + sreg->sel = 22;
2038 +
2039 ++ /* set the default voltage of the pcie phy to be 1.100v */
2040 ++ if (!sreg->sel && rdesc->name &&
2041 ++ !strcmp(rdesc->name, "vddpcie"))
2042 ++ sreg->sel = 0x10;
2043 ++
2044 + if (!sreg->bypass && !sreg->sel) {
2045 + dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
2046 + return -EINVAL;
2047 +diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
2048 +index 8f7034ba7d9e..86015b393dd5 100644
2049 +--- a/drivers/rtc/rtc-cmos.c
2050 ++++ b/drivers/rtc/rtc-cmos.c
2051 +@@ -41,6 +41,9 @@
2052 + #include <linux/pm.h>
2053 + #include <linux/of.h>
2054 + #include <linux/of_platform.h>
2055 ++#ifdef CONFIG_X86
2056 ++#include <asm/i8259.h>
2057 ++#endif
2058 +
2059 + /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
2060 + #include <asm-generic/rtc.h>
2061 +@@ -1058,17 +1061,23 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
2062 + {
2063 + cmos_wake_setup(&pnp->dev);
2064 +
2065 +- if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0))
2066 ++ if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) {
2067 ++ unsigned int irq = 0;
2068 ++#ifdef CONFIG_X86
2069 + /* Some machines contain a PNP entry for the RTC, but
2070 + * don't define the IRQ. It should always be safe to
2071 +- * hardcode it in these cases
2072 ++ * hardcode it on systems with a legacy PIC.
2073 + */
2074 ++ if (nr_legacy_irqs())
2075 ++ irq = 8;
2076 ++#endif
2077 + return cmos_do_probe(&pnp->dev,
2078 +- pnp_get_resource(pnp, IORESOURCE_IO, 0), 8);
2079 +- else
2080 ++ pnp_get_resource(pnp, IORESOURCE_IO, 0), irq);
2081 ++ } else {
2082 + return cmos_do_probe(&pnp->dev,
2083 + pnp_get_resource(pnp, IORESOURCE_IO, 0),
2084 + pnp_irq(pnp, 0));
2085 ++ }
2086 + }
2087 +
2088 + static void __exit cmos_pnp_remove(struct pnp_dev *pnp)
2089 +diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
2090 +index 3b3049c8c9e0..c0eb113588ff 100644
2091 +--- a/drivers/rtc/rtc-ds1374.c
2092 ++++ b/drivers/rtc/rtc-ds1374.c
2093 +@@ -527,6 +527,10 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd,
2094 + if (get_user(new_margin, (int __user *)arg))
2095 + return -EFAULT;
2096 +
2097 ++ /* the hardware's tick rate is 4096 Hz, so
2098 ++ * the counter value needs to be scaled accordingly
2099 ++ */
2100 ++ new_margin <<= 12;
2101 + if (new_margin < 1 || new_margin > 16777216)
2102 + return -EINVAL;
2103 +
2104 +@@ -535,7 +539,8 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd,
2105 + ds1374_wdt_ping();
2106 + /* fallthrough */
2107 + case WDIOC_GETTIMEOUT:
2108 +- return put_user(wdt_margin, (int __user *)arg);
2109 ++ /* when returning ... inverse is true */
2110 ++ return put_user((wdt_margin >> 12), (int __user *)arg);
2111 + case WDIOC_SETOPTIONS:
2112 + if (copy_from_user(&options, (int __user *)arg, sizeof(int)))
2113 + return -EFAULT;
2114 +@@ -543,14 +548,15 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd,
2115 + if (options & WDIOS_DISABLECARD) {
2116 + pr_info("disable watchdog\n");
2117 + ds1374_wdt_disable();
2118 ++ return 0;
2119 + }
2120 +
2121 + if (options & WDIOS_ENABLECARD) {
2122 + pr_info("enable watchdog\n");
2123 + ds1374_wdt_settimeout(wdt_margin);
2124 + ds1374_wdt_ping();
2125 ++ return 0;
2126 + }
2127 +-
2128 + return -EINVAL;
2129 + }
2130 + return -ENOTTY;
2131 +diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
2132 +index 8379fbbc60db..ef43847153ea 100644
2133 +--- a/drivers/scsi/lpfc/lpfc_sli.c
2134 ++++ b/drivers/scsi/lpfc/lpfc_sli.c
2135 +@@ -13493,6 +13493,9 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
2136 + case LPFC_Q_CREATE_VERSION_1:
2137 + bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1,
2138 + wq->entry_count);
2139 ++ bf_set(lpfc_mbox_hdr_version, &shdr->request,
2140 ++ LPFC_Q_CREATE_VERSION_1);
2141 ++
2142 + switch (wq->entry_size) {
2143 + default:
2144 + case 64:
2145 +diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
2146 +index 14c0334f41e4..26c67c42985c 100644
2147 +--- a/drivers/scsi/mac_esp.c
2148 ++++ b/drivers/scsi/mac_esp.c
2149 +@@ -55,6 +55,7 @@ struct mac_esp_priv {
2150 + int error;
2151 + };
2152 + static struct esp *esp_chips[2];
2153 ++static DEFINE_SPINLOCK(esp_chips_lock);
2154 +
2155 + #define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \
2156 + platform_get_drvdata((struct platform_device *) \
2157 +@@ -562,15 +563,18 @@ static int esp_mac_probe(struct platform_device *dev)
2158 + }
2159 +
2160 + host->irq = IRQ_MAC_SCSI;
2161 +- esp_chips[dev->id] = esp;
2162 +- mb();
2163 +- if (esp_chips[!dev->id] == NULL) {
2164 +- err = request_irq(host->irq, mac_scsi_esp_intr, 0, "ESP", NULL);
2165 +- if (err < 0) {
2166 +- esp_chips[dev->id] = NULL;
2167 +- goto fail_free_priv;
2168 +- }
2169 ++
2170 ++ /* The request_irq() call is intended to succeed for the first device
2171 ++ * and fail for the second device.
2172 ++ */
2173 ++ err = request_irq(host->irq, mac_scsi_esp_intr, 0, "ESP", NULL);
2174 ++ spin_lock(&esp_chips_lock);
2175 ++ if (err < 0 && esp_chips[!dev->id] == NULL) {
2176 ++ spin_unlock(&esp_chips_lock);
2177 ++ goto fail_free_priv;
2178 + }
2179 ++ esp_chips[dev->id] = esp;
2180 ++ spin_unlock(&esp_chips_lock);
2181 +
2182 + err = scsi_esp_register(esp, &dev->dev);
2183 + if (err)
2184 +@@ -579,8 +583,13 @@ static int esp_mac_probe(struct platform_device *dev)
2185 + return 0;
2186 +
2187 + fail_free_irq:
2188 +- if (esp_chips[!dev->id] == NULL)
2189 ++ spin_lock(&esp_chips_lock);
2190 ++ esp_chips[dev->id] = NULL;
2191 ++ if (esp_chips[!dev->id] == NULL) {
2192 ++ spin_unlock(&esp_chips_lock);
2193 + free_irq(host->irq, esp);
2194 ++ } else
2195 ++ spin_unlock(&esp_chips_lock);
2196 + fail_free_priv:
2197 + kfree(mep);
2198 + fail_free_command_block:
2199 +@@ -599,9 +608,13 @@ static int esp_mac_remove(struct platform_device *dev)
2200 +
2201 + scsi_esp_unregister(esp);
2202 +
2203 ++ spin_lock(&esp_chips_lock);
2204 + esp_chips[dev->id] = NULL;
2205 +- if (!(esp_chips[0] || esp_chips[1]))
2206 ++ if (esp_chips[!dev->id] == NULL) {
2207 ++ spin_unlock(&esp_chips_lock);
2208 + free_irq(irq, NULL);
2209 ++ } else
2210 ++ spin_unlock(&esp_chips_lock);
2211 +
2212 + kfree(mep);
2213 +
2214 +diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
2215 +index 03a2aadf0d3c..578fae4d474f 100644
2216 +--- a/drivers/scsi/virtio_scsi.c
2217 ++++ b/drivers/scsi/virtio_scsi.c
2218 +@@ -28,6 +28,7 @@
2219 + #include <scsi/scsi_device.h>
2220 + #include <scsi/scsi_cmnd.h>
2221 + #include <scsi/scsi_tcq.h>
2222 ++#include <scsi/scsi_devinfo.h>
2223 + #include <linux/seqlock.h>
2224 +
2225 + #define VIRTIO_SCSI_MEMPOOL_SZ 64
2226 +@@ -704,6 +705,28 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc)
2227 + return virtscsi_tmf(vscsi, cmd);
2228 + }
2229 +
2230 ++static int virtscsi_device_alloc(struct scsi_device *sdevice)
2231 ++{
2232 ++ /*
2233 ++ * Passed through SCSI targets (e.g. with qemu's 'scsi-block')
2234 ++ * may have transfer limits which come from the host SCSI
2235 ++ * controller or something on the host side other than the
2236 ++ * target itself.
2237 ++ *
2238 ++ * To make this work properly, the hypervisor can adjust the
2239 ++ * target's VPD information to advertise these limits. But
2240 ++ * for that to work, the guest has to look at the VPD pages,
2241 ++ * which we won't do by default if it is an SPC-2 device, even
2242 ++ * if it does actually support it.
2243 ++ *
2244 ++ * So, set the blist to always try to read the VPD pages.
2245 ++ */
2246 ++ sdevice->sdev_bflags = BLIST_TRY_VPD_PAGES;
2247 ++
2248 ++ return 0;
2249 ++}
2250 ++
2251 ++
2252 + /**
2253 + * virtscsi_change_queue_depth() - Change a virtscsi target's queue depth
2254 + * @sdev: Virtscsi target whose queue depth to change
2255 +@@ -775,6 +798,7 @@ static struct scsi_host_template virtscsi_host_template_single = {
2256 + .change_queue_depth = virtscsi_change_queue_depth,
2257 + .eh_abort_handler = virtscsi_abort,
2258 + .eh_device_reset_handler = virtscsi_device_reset,
2259 ++ .slave_alloc = virtscsi_device_alloc,
2260 +
2261 + .can_queue = 1024,
2262 + .dma_boundary = UINT_MAX,
2263 +diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
2264 +index a6d7029a85ac..581df3ebfc88 100644
2265 +--- a/drivers/spi/spi-dw-mmio.c
2266 ++++ b/drivers/spi/spi-dw-mmio.c
2267 +@@ -120,8 +120,8 @@ static int dw_spi_mmio_remove(struct platform_device *pdev)
2268 + {
2269 + struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev);
2270 +
2271 +- clk_disable_unprepare(dwsmmio->clk);
2272 + dw_spi_remove_host(&dwsmmio->dws);
2273 ++ clk_disable_unprepare(dwsmmio->clk);
2274 +
2275 + return 0;
2276 + }
2277 +diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
2278 +index f5b5bec6f3c1..013b33760639 100644
2279 +--- a/drivers/staging/android/ashmem.c
2280 ++++ b/drivers/staging/android/ashmem.c
2281 +@@ -703,16 +703,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
2282 + size_t pgstart, pgend;
2283 + int ret = -EINVAL;
2284 +
2285 ++ if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
2286 ++ return -EFAULT;
2287 ++
2288 + mutex_lock(&ashmem_mutex);
2289 +
2290 + if (unlikely(!asma->file))
2291 + goto out_unlock;
2292 +
2293 +- if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) {
2294 +- ret = -EFAULT;
2295 +- goto out_unlock;
2296 +- }
2297 +-
2298 + /* per custom, you can pass zero for len to mean "everything onward" */
2299 + if (!pin.len)
2300 + pin.len = PAGE_ALIGN(asma->size) - pin.offset;
2301 +diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
2302 +index c119f20dfd44..3f2ccf9d7358 100644
2303 +--- a/drivers/staging/unisys/visorhba/visorhba_main.c
2304 ++++ b/drivers/staging/unisys/visorhba/visorhba_main.c
2305 +@@ -792,7 +792,7 @@ static void
2306 + do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
2307 + {
2308 + struct scsi_device *scsidev;
2309 +- unsigned char buf[36];
2310 ++ unsigned char *buf;
2311 + struct scatterlist *sg;
2312 + unsigned int i;
2313 + char *this_page;
2314 +@@ -807,6 +807,10 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
2315 + if (cmdrsp->scsi.no_disk_result == 0)
2316 + return;
2317 +
2318 ++ buf = kzalloc(sizeof(char) * 36, GFP_KERNEL);
2319 ++ if (!buf)
2320 ++ return;
2321 ++
2322 + /* Linux scsi code wants a device at Lun 0
2323 + * to issue report luns, but we don't want
2324 + * a disk there so we'll present a processor
2325 +@@ -820,6 +824,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
2326 + if (scsi_sg_count(scsicmd) == 0) {
2327 + memcpy(scsi_sglist(scsicmd), buf,
2328 + cmdrsp->scsi.bufflen);
2329 ++ kfree(buf);
2330 + return;
2331 + }
2332 +
2333 +@@ -831,6 +836,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
2334 + memcpy(this_page, buf + bufind, sg[i].length);
2335 + kunmap_atomic(this_page_orig);
2336 + }
2337 ++ kfree(buf);
2338 + } else {
2339 + devdata = (struct visorhba_devdata *)scsidev->host->hostdata;
2340 + for_each_vdisk_match(vdisk, devdata, scsidev) {
2341 +diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
2342 +index 450af1b77f99..b2092c5ec7f3 100644
2343 +--- a/drivers/staging/wilc1000/linux_mon.c
2344 ++++ b/drivers/staging/wilc1000/linux_mon.c
2345 +@@ -251,6 +251,8 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
2346 +
2347 + if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6)))) {
2348 + skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr));
2349 ++ if (!skb2)
2350 ++ return -ENOMEM;
2351 +
2352 + memcpy(skb_put(skb2, skb->len), skb->data, skb->len);
2353 +
2354 +diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
2355 +index 2e35db7f4aac..c15af2fcf2ba 100644
2356 +--- a/drivers/target/target_core_file.c
2357 ++++ b/drivers/target/target_core_file.c
2358 +@@ -276,12 +276,11 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd,
2359 + else
2360 + ret = vfs_iter_read(fd, &iter, &pos);
2361 +
2362 +- kfree(bvec);
2363 +-
2364 + if (is_write) {
2365 + if (ret < 0 || ret != data_length) {
2366 + pr_err("%s() write returned %d\n", __func__, ret);
2367 +- return (ret < 0 ? ret : -EINVAL);
2368 ++ if (ret >= 0)
2369 ++ ret = -EINVAL;
2370 + }
2371 + } else {
2372 + /*
2373 +@@ -294,17 +293,29 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd,
2374 + pr_err("%s() returned %d, expecting %u for "
2375 + "S_ISBLK\n", __func__, ret,
2376 + data_length);
2377 +- return (ret < 0 ? ret : -EINVAL);
2378 ++ if (ret >= 0)
2379 ++ ret = -EINVAL;
2380 + }
2381 + } else {
2382 + if (ret < 0) {
2383 + pr_err("%s() returned %d for non S_ISBLK\n",
2384 + __func__, ret);
2385 +- return ret;
2386 ++ } else if (ret != data_length) {
2387 ++ /*
2388 ++ * Short read case:
2389 ++ * Probably some one truncate file under us.
2390 ++ * We must explicitly zero sg-pages to prevent
2391 ++ * expose uninizialized pages to userspace.
2392 ++ */
2393 ++ if (ret < data_length)
2394 ++ ret += iov_iter_zero(data_length - ret, &iter);
2395 ++ else
2396 ++ ret = -EINVAL;
2397 + }
2398 + }
2399 + }
2400 +- return 1;
2401 ++ kfree(bvec);
2402 ++ return ret;
2403 + }
2404 +
2405 + static sense_reason_t
2406 +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
2407 +index 1bb629ab8ecc..a638c1738547 100644
2408 +--- a/drivers/tty/tty_io.c
2409 ++++ b/drivers/tty/tty_io.c
2410 +@@ -1694,6 +1694,8 @@ static void release_tty(struct tty_struct *tty, int idx)
2411 + if (tty->link)
2412 + tty->link->port->itty = NULL;
2413 + tty_buffer_cancel_work(tty->port);
2414 ++ if (tty->link)
2415 ++ tty_buffer_cancel_work(tty->link->port);
2416 +
2417 + tty_kref_put(tty->link);
2418 + tty_kref_put(tty);
2419 +diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
2420 +index 517f565b65d7..598ec7545e84 100644
2421 +--- a/drivers/video/console/vgacon.c
2422 ++++ b/drivers/video/console/vgacon.c
2423 +@@ -409,7 +409,10 @@ static const char *vgacon_startup(void)
2424 + vga_video_port_val = VGA_CRT_DM;
2425 + if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
2426 + static struct resource ega_console_resource =
2427 +- { .name = "ega", .start = 0x3B0, .end = 0x3BF };
2428 ++ { .name = "ega",
2429 ++ .flags = IORESOURCE_IO,
2430 ++ .start = 0x3B0,
2431 ++ .end = 0x3BF };
2432 + vga_video_type = VIDEO_TYPE_EGAM;
2433 + vga_vram_size = 0x8000;
2434 + display_desc = "EGA+";
2435 +@@ -417,9 +420,15 @@ static const char *vgacon_startup(void)
2436 + &ega_console_resource);
2437 + } else {
2438 + static struct resource mda1_console_resource =
2439 +- { .name = "mda", .start = 0x3B0, .end = 0x3BB };
2440 ++ { .name = "mda",
2441 ++ .flags = IORESOURCE_IO,
2442 ++ .start = 0x3B0,
2443 ++ .end = 0x3BB };
2444 + static struct resource mda2_console_resource =
2445 +- { .name = "mda", .start = 0x3BF, .end = 0x3BF };
2446 ++ { .name = "mda",
2447 ++ .flags = IORESOURCE_IO,
2448 ++ .start = 0x3BF,
2449 ++ .end = 0x3BF };
2450 + vga_video_type = VIDEO_TYPE_MDA;
2451 + vga_vram_size = 0x2000;
2452 + display_desc = "*MDA";
2453 +@@ -441,15 +450,21 @@ static const char *vgacon_startup(void)
2454 + vga_vram_size = 0x8000;
2455 +
2456 + if (!screen_info.orig_video_isVGA) {
2457 +- static struct resource ega_console_resource
2458 +- = { .name = "ega", .start = 0x3C0, .end = 0x3DF };
2459 ++ static struct resource ega_console_resource =
2460 ++ { .name = "ega",
2461 ++ .flags = IORESOURCE_IO,
2462 ++ .start = 0x3C0,
2463 ++ .end = 0x3DF };
2464 + vga_video_type = VIDEO_TYPE_EGAC;
2465 + display_desc = "EGA";
2466 + request_resource(&ioport_resource,
2467 + &ega_console_resource);
2468 + } else {
2469 +- static struct resource vga_console_resource
2470 +- = { .name = "vga+", .start = 0x3C0, .end = 0x3DF };
2471 ++ static struct resource vga_console_resource =
2472 ++ { .name = "vga+",
2473 ++ .flags = IORESOURCE_IO,
2474 ++ .start = 0x3C0,
2475 ++ .end = 0x3DF };
2476 + vga_video_type = VIDEO_TYPE_VGAC;
2477 + display_desc = "VGA+";
2478 + request_resource(&ioport_resource,
2479 +@@ -493,7 +508,10 @@ static const char *vgacon_startup(void)
2480 + }
2481 + } else {
2482 + static struct resource cga_console_resource =
2483 +- { .name = "cga", .start = 0x3D4, .end = 0x3D5 };
2484 ++ { .name = "cga",
2485 ++ .flags = IORESOURCE_IO,
2486 ++ .start = 0x3D4,
2487 ++ .end = 0x3D5 };
2488 + vga_video_type = VIDEO_TYPE_CGA;
2489 + vga_vram_size = 0x2000;
2490 + display_desc = "*CGA";
2491 +diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
2492 +index d0a4e2f79a57..d215faacce04 100644
2493 +--- a/drivers/video/fbdev/sm501fb.c
2494 ++++ b/drivers/video/fbdev/sm501fb.c
2495 +@@ -1600,6 +1600,7 @@ static int sm501fb_start(struct sm501fb_info *info,
2496 + info->fbmem = ioremap(res->start, resource_size(res));
2497 + if (info->fbmem == NULL) {
2498 + dev_err(dev, "cannot remap framebuffer\n");
2499 ++ ret = -ENXIO;
2500 + goto err_mem_res;
2501 + }
2502 +
2503 +diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
2504 +index 53326badfb61..2add8def83be 100644
2505 +--- a/drivers/video/fbdev/udlfb.c
2506 ++++ b/drivers/video/fbdev/udlfb.c
2507 +@@ -1487,15 +1487,25 @@ static struct device_attribute fb_device_attrs[] = {
2508 + static int dlfb_select_std_channel(struct dlfb_data *dev)
2509 + {
2510 + int ret;
2511 +- u8 set_def_chn[] = { 0x57, 0xCD, 0xDC, 0xA7,
2512 ++ void *buf;
2513 ++ static const u8 set_def_chn[] = {
2514 ++ 0x57, 0xCD, 0xDC, 0xA7,
2515 + 0x1C, 0x88, 0x5E, 0x15,
2516 + 0x60, 0xFE, 0xC6, 0x97,
2517 + 0x16, 0x3D, 0x47, 0xF2 };
2518 +
2519 ++ buf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL);
2520 ++
2521 ++ if (!buf)
2522 ++ return -ENOMEM;
2523 ++
2524 + ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
2525 + NR_USB_REQUEST_CHANNEL,
2526 + (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0,
2527 +- set_def_chn, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT);
2528 ++ buf, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT);
2529 ++
2530 ++ kfree(buf);
2531 ++
2532 + return ret;
2533 + }
2534 +
2535 +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
2536 +index c5bbb5300658..19b56873b797 100644
2537 +--- a/fs/btrfs/send.c
2538 ++++ b/fs/btrfs/send.c
2539 +@@ -5008,13 +5008,19 @@ static int is_extent_unchanged(struct send_ctx *sctx,
2540 + while (key.offset < ekey->offset + left_len) {
2541 + ei = btrfs_item_ptr(eb, slot, struct btrfs_file_extent_item);
2542 + right_type = btrfs_file_extent_type(eb, ei);
2543 +- if (right_type != BTRFS_FILE_EXTENT_REG) {
2544 ++ if (right_type != BTRFS_FILE_EXTENT_REG &&
2545 ++ right_type != BTRFS_FILE_EXTENT_INLINE) {
2546 + ret = 0;
2547 + goto out;
2548 + }
2549 +
2550 + right_disknr = btrfs_file_extent_disk_bytenr(eb, ei);
2551 +- right_len = btrfs_file_extent_num_bytes(eb, ei);
2552 ++ if (right_type == BTRFS_FILE_EXTENT_INLINE) {
2553 ++ right_len = btrfs_file_extent_inline_len(eb, slot, ei);
2554 ++ right_len = PAGE_ALIGN(right_len);
2555 ++ } else {
2556 ++ right_len = btrfs_file_extent_num_bytes(eb, ei);
2557 ++ }
2558 + right_offset = btrfs_file_extent_offset(eb, ei);
2559 + right_gen = btrfs_file_extent_generation(eb, ei);
2560 +
2561 +@@ -5028,6 +5034,19 @@ static int is_extent_unchanged(struct send_ctx *sctx,
2562 + goto out;
2563 + }
2564 +
2565 ++ /*
2566 ++ * We just wanted to see if when we have an inline extent, what
2567 ++ * follows it is a regular extent (wanted to check the above
2568 ++ * condition for inline extents too). This should normally not
2569 ++ * happen but it's possible for example when we have an inline
2570 ++ * compressed extent representing data with a size matching
2571 ++ * the page size (currently the same as sector size).
2572 ++ */
2573 ++ if (right_type == BTRFS_FILE_EXTENT_INLINE) {
2574 ++ ret = 0;
2575 ++ goto out;
2576 ++ }
2577 ++
2578 + left_offset_fixed = left_offset;
2579 + if (key.offset < ekey->offset) {
2580 + /* Fix the right offset for 2a and 7. */
2581 +diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
2582 +index abae6dd2c6b9..cc88f4f0325e 100644
2583 +--- a/fs/cifs/netmisc.c
2584 ++++ b/fs/cifs/netmisc.c
2585 +@@ -980,10 +980,10 @@ struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)
2586 + cifs_dbg(VFS, "illegal hours %d\n", st->Hours);
2587 + days = sd->Day;
2588 + month = sd->Month;
2589 +- if ((days > 31) || (month > 12)) {
2590 ++ if (days < 1 || days > 31 || month < 1 || month > 12) {
2591 + cifs_dbg(VFS, "illegal date, month %d day: %d\n", month, days);
2592 +- if (month > 12)
2593 +- month = 12;
2594 ++ days = clamp(days, 1, 31);
2595 ++ month = clamp(month, 1, 12);
2596 + }
2597 + month -= 1;
2598 + days += total_days_of_prev_months[month];
2599 +diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
2600 +index e88ffe1da045..a035d1a95882 100644
2601 +--- a/fs/cifs/sess.c
2602 ++++ b/fs/cifs/sess.c
2603 +@@ -344,13 +344,12 @@ void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
2604 + /* BB is NTLMV2 session security format easier to use here? */
2605 + flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET |
2606 + NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
2607 +- NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
2608 +- if (ses->server->sign) {
2609 ++ NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC |
2610 ++ NTLMSSP_NEGOTIATE_SEAL;
2611 ++ if (ses->server->sign)
2612 + flags |= NTLMSSP_NEGOTIATE_SIGN;
2613 +- if (!ses->server->session_estab ||
2614 +- ses->ntlmssp->sesskey_per_smbsess)
2615 +- flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
2616 +- }
2617 ++ if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess)
2618 ++ flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
2619 +
2620 + sec_blob->NegotiateFlags = cpu_to_le32(flags);
2621 +
2622 +@@ -407,13 +406,12 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
2623 + flags = NTLMSSP_NEGOTIATE_56 |
2624 + NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO |
2625 + NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
2626 +- NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
2627 +- if (ses->server->sign) {
2628 ++ NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC |
2629 ++ NTLMSSP_NEGOTIATE_SEAL;
2630 ++ if (ses->server->sign)
2631 + flags |= NTLMSSP_NEGOTIATE_SIGN;
2632 +- if (!ses->server->session_estab ||
2633 +- ses->ntlmssp->sesskey_per_smbsess)
2634 +- flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
2635 +- }
2636 ++ if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess)
2637 ++ flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
2638 +
2639 + tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE);
2640 + sec_blob->NegotiateFlags = cpu_to_le32(flags);
2641 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
2642 +index 84614a5edb87..33b1bc21a120 100644
2643 +--- a/fs/cifs/smb2pdu.c
2644 ++++ b/fs/cifs/smb2pdu.c
2645 +@@ -832,10 +832,8 @@ ssetup_exit:
2646 +
2647 + if (!rc) {
2648 + mutex_lock(&server->srv_mutex);
2649 +- if (server->sign && server->ops->generate_signingkey) {
2650 ++ if (server->ops->generate_signingkey) {
2651 + rc = server->ops->generate_signingkey(ses);
2652 +- kfree(ses->auth_key.response);
2653 +- ses->auth_key.response = NULL;
2654 + if (rc) {
2655 + cifs_dbg(FYI,
2656 + "SMB3 session key generation failed\n");
2657 +@@ -857,10 +855,6 @@ ssetup_exit:
2658 + }
2659 +
2660 + keygen_exit:
2661 +- if (!server->sign) {
2662 +- kfree(ses->auth_key.response);
2663 +- ses->auth_key.response = NULL;
2664 +- }
2665 + if (spnego_key) {
2666 + key_invalidate(spnego_key);
2667 + key_put(spnego_key);
2668 +@@ -1558,6 +1552,9 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
2669 + } else
2670 + iov[0].iov_len = get_rfc1002_length(req) + 4;
2671 +
2672 ++ /* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */
2673 ++ if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO)
2674 ++ req->hdr.Flags |= SMB2_FLAGS_SIGNED;
2675 +
2676 + rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buftype, 0);
2677 + rsp = (struct smb2_ioctl_rsp *)iov[0].iov_base;
2678 +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
2679 +index 8ebfdd00044b..4bdc2fc86280 100644
2680 +--- a/fs/nfs/pagelist.c
2681 ++++ b/fs/nfs/pagelist.c
2682 +@@ -1273,8 +1273,10 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
2683 + mirror = &desc->pg_mirrors[midx];
2684 + if (!list_empty(&mirror->pg_list)) {
2685 + prev = nfs_list_entry(mirror->pg_list.prev);
2686 +- if (index != prev->wb_index + 1)
2687 +- nfs_pageio_complete_mirror(desc, midx);
2688 ++ if (index != prev->wb_index + 1) {
2689 ++ nfs_pageio_complete(desc);
2690 ++ break;
2691 ++ }
2692 + }
2693 + }
2694 + }
2695 +diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
2696 +index 209dbfc50cd4..bfbee8ddf978 100644
2697 +--- a/fs/nfsd/nfs4proc.c
2698 ++++ b/fs/nfsd/nfs4proc.c
2699 +@@ -1245,14 +1245,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
2700 + const struct nfsd4_layout_ops *ops;
2701 + struct nfs4_layout_stateid *ls;
2702 + __be32 nfserr;
2703 +- int accmode;
2704 ++ int accmode = NFSD_MAY_READ_IF_EXEC;
2705 +
2706 + switch (lgp->lg_seg.iomode) {
2707 + case IOMODE_READ:
2708 +- accmode = NFSD_MAY_READ;
2709 ++ accmode |= NFSD_MAY_READ;
2710 + break;
2711 + case IOMODE_RW:
2712 +- accmode = NFSD_MAY_READ | NFSD_MAY_WRITE;
2713 ++ accmode |= NFSD_MAY_READ | NFSD_MAY_WRITE;
2714 + break;
2715 + default:
2716 + dprintk("%s: invalid iomode %d\n",
2717 +diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
2718 +index 91e0c5429b4d..17138a97f306 100644
2719 +--- a/fs/nfsd/vfs.c
2720 ++++ b/fs/nfsd/vfs.c
2721 +@@ -92,6 +92,12 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
2722 + err = follow_down(&path);
2723 + if (err < 0)
2724 + goto out;
2725 ++ if (path.mnt == exp->ex_path.mnt && path.dentry == dentry &&
2726 ++ nfsd_mountpoint(dentry, exp) == 2) {
2727 ++ /* This is only a mountpoint in some other namespace */
2728 ++ path_put(&path);
2729 ++ goto out;
2730 ++ }
2731 +
2732 + exp2 = rqst_exp_get_by_name(rqstp, &path);
2733 + if (IS_ERR(exp2)) {
2734 +@@ -165,16 +171,26 @@ static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, st
2735 + /*
2736 + * For nfsd purposes, we treat V4ROOT exports as though there was an
2737 + * export at *every* directory.
2738 ++ * We return:
2739 ++ * '1' if this dentry *must* be an export point,
2740 ++ * '2' if it might be, if there is really a mount here, and
2741 ++ * '0' if there is no chance of an export point here.
2742 + */
2743 + int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
2744 + {
2745 +- if (d_mountpoint(dentry))
2746 ++ if (!d_inode(dentry))
2747 ++ return 0;
2748 ++ if (exp->ex_flags & NFSEXP_V4ROOT)
2749 + return 1;
2750 + if (nfsd4_is_junction(dentry))
2751 + return 1;
2752 +- if (!(exp->ex_flags & NFSEXP_V4ROOT))
2753 +- return 0;
2754 +- return d_inode(dentry) != NULL;
2755 ++ if (d_mountpoint(dentry))
2756 ++ /*
2757 ++ * Might only be a mountpoint in a different namespace,
2758 ++ * but we need to check.
2759 ++ */
2760 ++ return 2;
2761 ++ return 0;
2762 + }
2763 +
2764 + __be32
2765 +diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
2766 +index 34c4498b800f..83b22ae9ae12 100644
2767 +--- a/include/linux/posix-clock.h
2768 ++++ b/include/linux/posix-clock.h
2769 +@@ -59,23 +59,23 @@ struct posix_clock_operations {
2770 +
2771 + int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
2772 +
2773 +- int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts);
2774 ++ int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);
2775 +
2776 +- int (*clock_getres) (struct posix_clock *pc, struct timespec *ts);
2777 ++ int (*clock_getres) (struct posix_clock *pc, struct timespec64 *ts);
2778 +
2779 + int (*clock_settime)(struct posix_clock *pc,
2780 +- const struct timespec *ts);
2781 ++ const struct timespec64 *ts);
2782 +
2783 + int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
2784 +
2785 + int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
2786 +
2787 + void (*timer_gettime)(struct posix_clock *pc,
2788 +- struct k_itimer *kit, struct itimerspec *tsp);
2789 ++ struct k_itimer *kit, struct itimerspec64 *tsp);
2790 +
2791 + int (*timer_settime)(struct posix_clock *pc,
2792 + struct k_itimer *kit, int flags,
2793 +- struct itimerspec *tsp, struct itimerspec *old);
2794 ++ struct itimerspec64 *tsp, struct itimerspec64 *old);
2795 + /*
2796 + * Optional character device methods:
2797 + */
2798 +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
2799 +index a079ed14f230..4889a8ab77ce 100644
2800 +--- a/kernel/irq/manage.c
2801 ++++ b/kernel/irq/manage.c
2802 +@@ -1189,8 +1189,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
2803 + * set the trigger type must match. Also all must
2804 + * agree on ONESHOT.
2805 + */
2806 ++ unsigned int oldtype = irqd_get_trigger_type(&desc->irq_data);
2807 ++
2808 + if (!((old->flags & new->flags) & IRQF_SHARED) ||
2809 +- ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
2810 ++ (oldtype != (new->flags & IRQF_TRIGGER_MASK)) ||
2811 + ((old->flags ^ new->flags) & IRQF_ONESHOT))
2812 + goto mismatch;
2813 +
2814 +diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
2815 +index 9cff0ab82b63..e24008c098c6 100644
2816 +--- a/kernel/time/posix-clock.c
2817 ++++ b/kernel/time/posix-clock.c
2818 +@@ -300,14 +300,17 @@ out:
2819 + static int pc_clock_gettime(clockid_t id, struct timespec *ts)
2820 + {
2821 + struct posix_clock_desc cd;
2822 ++ struct timespec64 ts64;
2823 + int err;
2824 +
2825 + err = get_clock_desc(id, &cd);
2826 + if (err)
2827 + return err;
2828 +
2829 +- if (cd.clk->ops.clock_gettime)
2830 +- err = cd.clk->ops.clock_gettime(cd.clk, ts);
2831 ++ if (cd.clk->ops.clock_gettime) {
2832 ++ err = cd.clk->ops.clock_gettime(cd.clk, &ts64);
2833 ++ *ts = timespec64_to_timespec(ts64);
2834 ++ }
2835 + else
2836 + err = -EOPNOTSUPP;
2837 +
2838 +@@ -319,14 +322,17 @@ static int pc_clock_gettime(clockid_t id, struct timespec *ts)
2839 + static int pc_clock_getres(clockid_t id, struct timespec *ts)
2840 + {
2841 + struct posix_clock_desc cd;
2842 ++ struct timespec64 ts64;
2843 + int err;
2844 +
2845 + err = get_clock_desc(id, &cd);
2846 + if (err)
2847 + return err;
2848 +
2849 +- if (cd.clk->ops.clock_getres)
2850 +- err = cd.clk->ops.clock_getres(cd.clk, ts);
2851 ++ if (cd.clk->ops.clock_getres) {
2852 ++ err = cd.clk->ops.clock_getres(cd.clk, &ts64);
2853 ++ *ts = timespec64_to_timespec(ts64);
2854 ++ }
2855 + else
2856 + err = -EOPNOTSUPP;
2857 +
2858 +@@ -337,6 +343,7 @@ static int pc_clock_getres(clockid_t id, struct timespec *ts)
2859 +
2860 + static int pc_clock_settime(clockid_t id, const struct timespec *ts)
2861 + {
2862 ++ struct timespec64 ts64 = timespec_to_timespec64(*ts);
2863 + struct posix_clock_desc cd;
2864 + int err;
2865 +
2866 +@@ -350,7 +357,7 @@ static int pc_clock_settime(clockid_t id, const struct timespec *ts)
2867 + }
2868 +
2869 + if (cd.clk->ops.clock_settime)
2870 +- err = cd.clk->ops.clock_settime(cd.clk, ts);
2871 ++ err = cd.clk->ops.clock_settime(cd.clk, &ts64);
2872 + else
2873 + err = -EOPNOTSUPP;
2874 + out:
2875 +@@ -403,29 +410,36 @@ static void pc_timer_gettime(struct k_itimer *kit, struct itimerspec *ts)
2876 + {
2877 + clockid_t id = kit->it_clock;
2878 + struct posix_clock_desc cd;
2879 ++ struct itimerspec64 ts64;
2880 +
2881 + if (get_clock_desc(id, &cd))
2882 + return;
2883 +
2884 +- if (cd.clk->ops.timer_gettime)
2885 +- cd.clk->ops.timer_gettime(cd.clk, kit, ts);
2886 +-
2887 ++ if (cd.clk->ops.timer_gettime) {
2888 ++ cd.clk->ops.timer_gettime(cd.clk, kit, &ts64);
2889 ++ *ts = itimerspec64_to_itimerspec(&ts64);
2890 ++ }
2891 + put_clock_desc(&cd);
2892 + }
2893 +
2894 + static int pc_timer_settime(struct k_itimer *kit, int flags,
2895 + struct itimerspec *ts, struct itimerspec *old)
2896 + {
2897 ++ struct itimerspec64 ts64 = itimerspec_to_itimerspec64(ts);
2898 + clockid_t id = kit->it_clock;
2899 + struct posix_clock_desc cd;
2900 ++ struct itimerspec64 old64;
2901 + int err;
2902 +
2903 + err = get_clock_desc(id, &cd);
2904 + if (err)
2905 + return err;
2906 +
2907 +- if (cd.clk->ops.timer_settime)
2908 +- err = cd.clk->ops.timer_settime(cd.clk, kit, flags, ts, old);
2909 ++ if (cd.clk->ops.timer_settime) {
2910 ++ err = cd.clk->ops.timer_settime(cd.clk, kit, flags, &ts64, &old64);
2911 ++ if (old)
2912 ++ *old = itimerspec64_to_itimerspec(&old64);
2913 ++ }
2914 + else
2915 + err = -EOPNOTSUPP;
2916 +
2917 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2918 +index 71290fb7d500..75433ed6714b 100644
2919 +--- a/net/ipv4/tcp_input.c
2920 ++++ b/net/ipv4/tcp_input.c
2921 +@@ -5464,10 +5464,6 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
2922 + else
2923 + tp->pred_flags = 0;
2924 +
2925 +- if (!sock_flag(sk, SOCK_DEAD)) {
2926 +- sk->sk_state_change(sk);
2927 +- sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
2928 +- }
2929 + }
2930 +
2931 + static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
2932 +@@ -5531,6 +5527,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
2933 + struct tcp_sock *tp = tcp_sk(sk);
2934 + struct tcp_fastopen_cookie foc = { .len = -1 };
2935 + int saved_clamp = tp->rx_opt.mss_clamp;
2936 ++ bool fastopen_fail;
2937 +
2938 + tcp_parse_options(skb, &tp->rx_opt, 0, &foc);
2939 + if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
2940 +@@ -5633,10 +5630,15 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
2941 +
2942 + tcp_finish_connect(sk, skb);
2943 +
2944 +- if ((tp->syn_fastopen || tp->syn_data) &&
2945 +- tcp_rcv_fastopen_synack(sk, skb, &foc))
2946 +- return -1;
2947 ++ fastopen_fail = (tp->syn_fastopen || tp->syn_data) &&
2948 ++ tcp_rcv_fastopen_synack(sk, skb, &foc);
2949 +
2950 ++ if (!sock_flag(sk, SOCK_DEAD)) {
2951 ++ sk->sk_state_change(sk);
2952 ++ sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
2953 ++ }
2954 ++ if (fastopen_fail)
2955 ++ return -1;
2956 + if (sk->sk_write_pending ||
2957 + icsk->icsk_accept_queue.rskq_defer_accept ||
2958 + icsk->icsk_ack.pingpong) {
2959 +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
2960 +index d7105422bc63..e4b0fb2f06a3 100644
2961 +--- a/net/ipv6/ip6_vti.c
2962 ++++ b/net/ipv6/ip6_vti.c
2963 +@@ -614,6 +614,7 @@ static void vti6_link_config(struct ip6_tnl *t)
2964 + {
2965 + struct net_device *dev = t->dev;
2966 + struct __ip6_tnl_parm *p = &t->parms;
2967 ++ struct net_device *tdev = NULL;
2968 +
2969 + memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
2970 + memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
2971 +@@ -626,6 +627,25 @@ static void vti6_link_config(struct ip6_tnl *t)
2972 + dev->flags |= IFF_POINTOPOINT;
2973 + else
2974 + dev->flags &= ~IFF_POINTOPOINT;
2975 ++
2976 ++ if (p->flags & IP6_TNL_F_CAP_XMIT) {
2977 ++ int strict = (ipv6_addr_type(&p->raddr) &
2978 ++ (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
2979 ++ struct rt6_info *rt = rt6_lookup(t->net,
2980 ++ &p->raddr, &p->laddr,
2981 ++ p->link, strict);
2982 ++
2983 ++ if (rt)
2984 ++ tdev = rt->dst.dev;
2985 ++ ip6_rt_put(rt);
2986 ++ }
2987 ++
2988 ++ if (!tdev && p->link)
2989 ++ tdev = __dev_get_by_index(t->net, p->link);
2990 ++
2991 ++ if (tdev)
2992 ++ dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len,
2993 ++ IPV6_MIN_MTU);
2994 + }
2995 +
2996 + /**
2997 +diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
2998 +index 84afb9a77278..55810e4899f1 100644
2999 +--- a/net/ipv6/ndisc.c
3000 ++++ b/net/ipv6/ndisc.c
3001 +@@ -1686,6 +1686,8 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
3002 + case NETDEV_CHANGEADDR:
3003 + neigh_changeaddr(&nd_tbl, dev);
3004 + fib6_run_gc(0, net, false);
3005 ++ /* fallthrough */
3006 ++ case NETDEV_UP:
3007 + idev = in6_dev_get(dev);
3008 + if (!idev)
3009 + break;
3010 +diff --git a/net/mac80211/status.c b/net/mac80211/status.c
3011 +index 5bad05e9af90..45fb1abdb265 100644
3012 +--- a/net/mac80211/status.c
3013 ++++ b/net/mac80211/status.c
3014 +@@ -194,6 +194,7 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
3015 + }
3016 +
3017 + if (ieee80211_is_action(mgmt->frame_control) &&
3018 ++ !ieee80211_has_protected(mgmt->frame_control) &&
3019 + mgmt->u.action.category == WLAN_CATEGORY_HT &&
3020 + mgmt->u.action.u.ht_smps.action == WLAN_HT_ACTION_SMPS &&
3021 + ieee80211_sdata_running(sdata)) {
3022 +diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
3023 +index e7ac07e53b59..febcfac7e3df 100644
3024 +--- a/net/netfilter/xt_CT.c
3025 ++++ b/net/netfilter/xt_CT.c
3026 +@@ -168,8 +168,10 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
3027 + goto err_put_timeout;
3028 + }
3029 + timeout_ext = nf_ct_timeout_ext_add(ct, timeout, GFP_ATOMIC);
3030 +- if (timeout_ext == NULL)
3031 ++ if (!timeout_ext) {
3032 + ret = -ENOMEM;
3033 ++ goto err_put_timeout;
3034 ++ }
3035 +
3036 + rcu_read_unlock();
3037 + return ret;
3038 +@@ -201,6 +203,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
3039 + struct xt_ct_target_info_v1 *info)
3040 + {
3041 + struct nf_conntrack_zone zone;
3042 ++ struct nf_conn_help *help;
3043 + struct nf_conn *ct;
3044 + int ret = -EOPNOTSUPP;
3045 +
3046 +@@ -249,7 +252,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
3047 + if (info->timeout[0]) {
3048 + ret = xt_ct_set_timeout(ct, par, info->timeout);
3049 + if (ret < 0)
3050 +- goto err3;
3051 ++ goto err4;
3052 + }
3053 + __set_bit(IPS_CONFIRMED_BIT, &ct->status);
3054 + nf_conntrack_get(&ct->ct_general);
3055 +@@ -257,6 +260,10 @@ out:
3056 + info->ct = ct;
3057 + return 0;
3058 +
3059 ++err4:
3060 ++ help = nfct_help(ct);
3061 ++ if (help)
3062 ++ module_put(help->helper->me);
3063 + err3:
3064 + nf_ct_tmpl_free(ct);
3065 + err2:
3066 +diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
3067 +index 6a2507f24b0f..1829adb23505 100644
3068 +--- a/net/openvswitch/conntrack.c
3069 ++++ b/net/openvswitch/conntrack.c
3070 +@@ -361,10 +361,38 @@ ovs_ct_expect_find(struct net *net, const struct nf_conntrack_zone *zone,
3071 + u16 proto, const struct sk_buff *skb)
3072 + {
3073 + struct nf_conntrack_tuple tuple;
3074 ++ struct nf_conntrack_expect *exp;
3075 +
3076 + if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb), proto, net, &tuple))
3077 + return NULL;
3078 +- return __nf_ct_expect_find(net, zone, &tuple);
3079 ++
3080 ++ exp = __nf_ct_expect_find(net, zone, &tuple);
3081 ++ if (exp) {
3082 ++ struct nf_conntrack_tuple_hash *h;
3083 ++
3084 ++ /* Delete existing conntrack entry, if it clashes with the
3085 ++ * expectation. This can happen since conntrack ALGs do not
3086 ++ * check for clashes between (new) expectations and existing
3087 ++ * conntrack entries. nf_conntrack_in() will check the
3088 ++ * expectations only if a conntrack entry can not be found,
3089 ++ * which can lead to OVS finding the expectation (here) in the
3090 ++ * init direction, but which will not be removed by the
3091 ++ * nf_conntrack_in() call, if a matching conntrack entry is
3092 ++ * found instead. In this case all init direction packets
3093 ++ * would be reported as new related packets, while reply
3094 ++ * direction packets would be reported as un-related
3095 ++ * established packets.
3096 ++ */
3097 ++ h = nf_conntrack_find_get(net, zone, &tuple);
3098 ++ if (h) {
3099 ++ struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h);
3100 ++
3101 ++ nf_ct_delete(ct, 0, 0);
3102 ++ nf_conntrack_put(&ct->ct_general);
3103 ++ }
3104 ++ }
3105 ++
3106 ++ return exp;
3107 + }
3108 +
3109 + /* Determine whether skb->nfct is equal to the result of conntrack lookup. */
3110 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3111 +index 11305a4baf7b..8e33360ae2e5 100644
3112 +--- a/sound/pci/hda/patch_realtek.c
3113 ++++ b/sound/pci/hda/patch_realtek.c
3114 +@@ -6717,6 +6717,7 @@ enum {
3115 + ALC668_FIXUP_DELL_DISABLE_AAMIX,
3116 + ALC668_FIXUP_DELL_XPS13,
3117 + ALC662_FIXUP_ASUS_Nx50,
3118 ++ ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3119 + ALC668_FIXUP_ASUS_Nx51,
3120 + };
3121 +
3122 +@@ -6964,14 +6965,21 @@ static const struct hda_fixup alc662_fixups[] = {
3123 + .chained = true,
3124 + .chain_id = ALC662_FIXUP_BASS_1A
3125 + },
3126 ++ [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
3127 ++ .type = HDA_FIXUP_FUNC,
3128 ++ .v.func = alc_fixup_headset_mode_alc668,
3129 ++ .chain_id = ALC662_FIXUP_BASS_CHMAP
3130 ++ },
3131 + [ALC668_FIXUP_ASUS_Nx51] = {
3132 + .type = HDA_FIXUP_PINS,
3133 + .v.pins = (const struct hda_pintbl[]) {
3134 +- {0x1a, 0x90170151}, /* bass speaker */
3135 ++ { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
3136 ++ { 0x1a, 0x90170151 }, /* bass speaker */
3137 ++ { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3138 + {}
3139 + },
3140 + .chained = true,
3141 +- .chain_id = ALC662_FIXUP_BASS_CHMAP,
3142 ++ .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3143 + },
3144 + };
3145 +
3146 +diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
3147 +index b4844f78266f..f6c3be192cc9 100644
3148 +--- a/sound/soc/intel/skylake/skl.c
3149 ++++ b/sound/soc/intel/skylake/skl.c
3150 +@@ -280,7 +280,7 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr)
3151 + struct hdac_bus *bus = ebus_to_hbus(ebus);
3152 + unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
3153 + (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
3154 +- unsigned int res;
3155 ++ unsigned int res = -1;
3156 +
3157 + mutex_lock(&bus->cmd_mutex);
3158 + snd_hdac_bus_send_cmd(bus, cmd);
3159 +diff --git a/tools/perf/tests/kmod-path.c b/tools/perf/tests/kmod-path.c
3160 +index 08c433b4bf4f..25e80c02230b 100644
3161 +--- a/tools/perf/tests/kmod-path.c
3162 ++++ b/tools/perf/tests/kmod-path.c
3163 +@@ -60,6 +60,7 @@ int test__kmod_path__parse(void)
3164 + M("/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_KERNEL, true);
3165 + M("/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_USER, false);
3166 +
3167 ++#ifdef HAVE_ZLIB_SUPPORT
3168 + /* path alloc_name alloc_ext kmod comp name ext */
3169 + T("/xxxx/xxxx/x.ko.gz", true , true , true, true, "[x]", "gz");
3170 + T("/xxxx/xxxx/x.ko.gz", false , true , true, true, NULL , "gz");
3171 +@@ -95,6 +96,7 @@ int test__kmod_path__parse(void)
3172 + M("x.ko.gz", PERF_RECORD_MISC_CPUMODE_UNKNOWN, true);
3173 + M("x.ko.gz", PERF_RECORD_MISC_KERNEL, true);
3174 + M("x.ko.gz", PERF_RECORD_MISC_USER, false);
3175 ++#endif
3176 +
3177 + /* path alloc_name alloc_ext kmod comp name ext */
3178 + T("[test_module]", true , true , true, false, "[test_module]", NULL);