Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 04 Jul 2018 14:26:23
Message-Id: 1530714342.c27afe57028d860bce3ad7f30ae6ddf36929d03c.mpagano@gentoo
1 commit: c27afe57028d860bce3ad7f30ae6ddf36929d03c
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 4 14:25:42 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 4 14:25:42 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=c27afe57
7
8 Linux patch 4.4.139
9
10 0000_README | 4 +
11 1138_linux-4.4.139.patch | 2867 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 2871 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 3ada367..cfb7ea3 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -595,6 +595,10 @@ Patch: 1137_linux-4.4.138.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.4.138
21
22 +Patch: 1138_linux-4.4.139.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.4.139
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/1138_linux-4.4.139.patch b/1138_linux-4.4.139.patch
31 new file mode 100644
32 index 0000000..a5150e7
33 --- /dev/null
34 +++ b/1138_linux-4.4.139.patch
35 @@ -0,0 +1,2867 @@
36 +diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
37 +index b784c270105f..ed6f6abaad57 100644
38 +--- a/Documentation/printk-formats.txt
39 ++++ b/Documentation/printk-formats.txt
40 +@@ -273,11 +273,10 @@ struct clk:
41 +
42 + %pC pll1
43 + %pCn pll1
44 +- %pCr 1560000000
45 +
46 + For printing struct clk structures. '%pC' and '%pCn' print the name
47 + (Common Clock Framework) or address (legacy clock framework) of the
48 +- structure; '%pCr' prints the current clock rate.
49 ++ structure.
50 +
51 + Passed by reference.
52 +
53 +diff --git a/Makefile b/Makefile
54 +index 1a8c0fc6b997..20a11fd36656 100644
55 +--- a/Makefile
56 ++++ b/Makefile
57 +@@ -1,6 +1,6 @@
58 + VERSION = 4
59 + PATCHLEVEL = 4
60 +-SUBLEVEL = 138
61 ++SUBLEVEL = 139
62 + EXTRAVERSION =
63 + NAME = Blurry Fish Butt
64 +
65 +diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
66 +index 0a9d5dd93294..6949c7d4481c 100644
67 +--- a/arch/arm/include/asm/kgdb.h
68 ++++ b/arch/arm/include/asm/kgdb.h
69 +@@ -76,7 +76,7 @@ extern int kgdb_fault_expected;
70 +
71 + #define KGDB_MAX_NO_CPUS 1
72 + #define BUFMAX 400
73 +-#define NUMREGBYTES (DBG_MAX_REG_NUM << 2)
74 ++#define NUMREGBYTES (GDB_MAX_REGS << 2)
75 + #define NUMCRITREGBYTES (32 << 2)
76 +
77 + #define _R0 0
78 +diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
79 +index 6e4955bc542b..fcd52cefee29 100644
80 +--- a/arch/m68k/mm/kmap.c
81 ++++ b/arch/m68k/mm/kmap.c
82 +@@ -88,7 +88,8 @@ static inline void free_io_area(void *addr)
83 + for (p = &iolist ; (tmp = *p) ; p = &tmp->next) {
84 + if (tmp->addr == addr) {
85 + *p = tmp->next;
86 +- __iounmap(tmp->addr, tmp->size);
87 ++ /* remove gap added in get_io_area() */
88 ++ __iounmap(tmp->addr, tmp->size - IO_SIZE);
89 + kfree(tmp);
90 + return;
91 + }
92 +diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
93 +index 6d38948f0f1e..4ca33175ec05 100644
94 +--- a/arch/mips/bcm47xx/setup.c
95 ++++ b/arch/mips/bcm47xx/setup.c
96 +@@ -249,6 +249,12 @@ static int __init bcm47xx_cpu_fixes(void)
97 + */
98 + if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706)
99 + cpu_wait = NULL;
100 ++
101 ++ /*
102 ++ * BCM47XX Erratum "R10: PCIe Transactions Periodically Fail"
103 ++ * Enable ExternalSync for sync instruction to take effect
104 ++ */
105 ++ set_c0_config7(MIPS_CONF7_ES);
106 + break;
107 + #endif
108 + }
109 +diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
110 +index d10fd80dbb7e..75fa296836fc 100644
111 +--- a/arch/mips/include/asm/io.h
112 ++++ b/arch/mips/include/asm/io.h
113 +@@ -411,6 +411,8 @@ static inline type pfx##in##bwlq##p(unsigned long port) \
114 + __val = *__addr; \
115 + slow; \
116 + \
117 ++ /* prevent prefetching of coherent DMA data prematurely */ \
118 ++ rmb(); \
119 + return pfx##ioswab##bwlq(__addr, __val); \
120 + }
121 +
122 +diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
123 +index e43aca183c99..15c183ce9d4f 100644
124 +--- a/arch/mips/include/asm/mipsregs.h
125 ++++ b/arch/mips/include/asm/mipsregs.h
126 +@@ -605,6 +605,8 @@
127 + #define MIPS_CONF7_WII (_ULCAST_(1) << 31)
128 +
129 + #define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
130 ++/* ExternalSync */
131 ++#define MIPS_CONF7_ES (_ULCAST_(1) << 8)
132 +
133 + #define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
134 + #define MIPS_CONF7_AR (_ULCAST_(1) << 16)
135 +@@ -2012,6 +2014,7 @@ __BUILD_SET_C0(status)
136 + __BUILD_SET_C0(cause)
137 + __BUILD_SET_C0(config)
138 + __BUILD_SET_C0(config5)
139 ++__BUILD_SET_C0(config7)
140 + __BUILD_SET_C0(intcontrol)
141 + __BUILD_SET_C0(intctl)
142 + __BUILD_SET_C0(srsmap)
143 +diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
144 +index 2f7c734771f4..0df911e772ae 100644
145 +--- a/arch/mips/kernel/mcount.S
146 ++++ b/arch/mips/kernel/mcount.S
147 +@@ -116,10 +116,20 @@ ftrace_stub:
148 + NESTED(_mcount, PT_SIZE, ra)
149 + PTR_LA t1, ftrace_stub
150 + PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */
151 +- bne t1, t2, static_trace
152 ++ beq t1, t2, fgraph_trace
153 + nop
154 +
155 ++ MCOUNT_SAVE_REGS
156 ++
157 ++ move a0, ra /* arg1: self return address */
158 ++ jalr t2 /* (1) call *ftrace_trace_function */
159 ++ move a1, AT /* arg2: parent's return address */
160 ++
161 ++ MCOUNT_RESTORE_REGS
162 ++
163 ++fgraph_trace:
164 + #ifdef CONFIG_FUNCTION_GRAPH_TRACER
165 ++ PTR_LA t1, ftrace_stub
166 + PTR_L t3, ftrace_graph_return
167 + bne t1, t3, ftrace_graph_caller
168 + nop
169 +@@ -128,24 +138,11 @@ NESTED(_mcount, PT_SIZE, ra)
170 + bne t1, t3, ftrace_graph_caller
171 + nop
172 + #endif
173 +- b ftrace_stub
174 +-#ifdef CONFIG_32BIT
175 +- addiu sp, sp, 8
176 +-#else
177 +- nop
178 +-#endif
179 +
180 +-static_trace:
181 +- MCOUNT_SAVE_REGS
182 +-
183 +- move a0, ra /* arg1: self return address */
184 +- jalr t2 /* (1) call *ftrace_trace_function */
185 +- move a1, AT /* arg2: parent's return address */
186 +-
187 +- MCOUNT_RESTORE_REGS
188 + #ifdef CONFIG_32BIT
189 + addiu sp, sp, 8
190 + #endif
191 ++
192 + .globl ftrace_stub
193 + ftrace_stub:
194 + RETURN_BACK
195 +diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
196 +index 2837232bbffb..59be96917369 100644
197 +--- a/arch/powerpc/kernel/entry_64.S
198 ++++ b/arch/powerpc/kernel/entry_64.S
199 +@@ -574,6 +574,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
200 + * actually hit this code path.
201 + */
202 +
203 ++ isync
204 + slbie r6
205 + slbie r6 /* Workaround POWER5 < DD2.1 issue */
206 + slbmte r7,r0
207 +diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
208 +index 26d091a1a54c..791d4c3329c3 100644
209 +--- a/arch/powerpc/kernel/fadump.c
210 ++++ b/arch/powerpc/kernel/fadump.c
211 +@@ -1025,6 +1025,9 @@ void fadump_cleanup(void)
212 + init_fadump_mem_struct(&fdm,
213 + be64_to_cpu(fdm_active->cpu_state_data.destination_address));
214 + fadump_invalidate_dump(&fdm);
215 ++ } else if (fw_dump.dump_registered) {
216 ++ /* Un-register Firmware-assisted dump if it was registered. */
217 ++ fadump_unregister_dump(&fdm);
218 + }
219 + }
220 +
221 +diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
222 +index fdf48785d3e9..56e4571e3a02 100644
223 +--- a/arch/powerpc/kernel/hw_breakpoint.c
224 ++++ b/arch/powerpc/kernel/hw_breakpoint.c
225 +@@ -174,8 +174,8 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
226 + if (cpu_has_feature(CPU_FTR_DAWR)) {
227 + length_max = 512 ; /* 64 doublewords */
228 + /* DAWR region can't cross 512 boundary */
229 +- if ((bp->attr.bp_addr >> 10) !=
230 +- ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 10))
231 ++ if ((bp->attr.bp_addr >> 9) !=
232 ++ ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 9))
233 + return -EINVAL;
234 + }
235 + if (info->len >
236 +diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
237 +index b38fd081b222..3b63655efa3c 100644
238 +--- a/arch/powerpc/kernel/ptrace.c
239 ++++ b/arch/powerpc/kernel/ptrace.c
240 +@@ -1004,6 +1004,7 @@ static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
241 + /* Create a new breakpoint request if one doesn't exist already */
242 + hw_breakpoint_init(&attr);
243 + attr.bp_addr = hw_brk.address;
244 ++ attr.bp_len = 8;
245 + arch_bp_generic_fields(hw_brk.type,
246 + &attr.bp_type);
247 +
248 +diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
249 +index 814ef83c6720..e3a6f66d288c 100644
250 +--- a/arch/x86/include/asm/barrier.h
251 ++++ b/arch/x86/include/asm/barrier.h
252 +@@ -38,7 +38,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
253 + {
254 + unsigned long mask;
255 +
256 +- asm ("cmp %1,%2; sbb %0,%0;"
257 ++ asm volatile ("cmp %1,%2; sbb %0,%0;"
258 + :"=r" (mask)
259 + :"r"(size),"r" (index)
260 + :"cc");
261 +diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
262 +index 42d441f7898b..1edce040f470 100644
263 +--- a/arch/xtensa/kernel/traps.c
264 ++++ b/arch/xtensa/kernel/traps.c
265 +@@ -309,7 +309,7 @@ do_unaligned_user (struct pt_regs *regs)
266 + info.si_errno = 0;
267 + info.si_code = BUS_ADRALN;
268 + info.si_addr = (void *) regs->excvaddr;
269 +- force_sig_info(SIGSEGV, &info, current);
270 ++ force_sig_info(SIGBUS, &info, current);
271 +
272 + }
273 + #endif
274 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
275 +index f9b86a1d922d..9afd06ee5b30 100644
276 +--- a/drivers/ata/libata-core.c
277 ++++ b/drivers/ata/libata-core.c
278 +@@ -4247,9 +4247,6 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
279 + ATA_HORKAGE_ZERO_AFTER_TRIM |
280 + ATA_HORKAGE_NOLPM, },
281 +
282 +- /* Sandisk devices which are known to not handle LPM well */
283 +- { "SanDisk SD7UB3Q*G1001", NULL, ATA_HORKAGE_NOLPM, },
284 +-
285 + /* devices that don't properly handle queued TRIM commands */
286 + { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
287 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
288 +diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
289 +index f3a65a3140d3..0ad96c647541 100644
290 +--- a/drivers/ata/libata-zpodd.c
291 ++++ b/drivers/ata/libata-zpodd.c
292 +@@ -34,7 +34,7 @@ struct zpodd {
293 + static int eject_tray(struct ata_device *dev)
294 + {
295 + struct ata_taskfile tf;
296 +- const char cdb[] = { GPCMD_START_STOP_UNIT,
297 ++ static const char cdb[ATAPI_CDB_LEN] = { GPCMD_START_STOP_UNIT,
298 + 0, 0, 0,
299 + 0x02, /* LoEj */
300 + 0, 0, 0, 0, 0, 0, 0,
301 +@@ -55,7 +55,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
302 + unsigned int ret;
303 + struct rm_feature_desc *desc = (void *)(buf + 8);
304 + struct ata_taskfile tf;
305 +- char cdb[] = { GPCMD_GET_CONFIGURATION,
306 ++ static const char cdb[] = { GPCMD_GET_CONFIGURATION,
307 + 2, /* only 1 feature descriptor requested */
308 + 0, 3, /* 3, removable medium feature */
309 + 0, 0, 0,/* reserved */
310 +diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
311 +index 6eab52b92e01..c302f47f6323 100644
312 +--- a/drivers/atm/zatm.c
313 ++++ b/drivers/atm/zatm.c
314 +@@ -1149,8 +1149,8 @@ static void eprom_get_byte(struct zatm_dev *zatm_dev, unsigned char *byte,
315 + }
316 +
317 +
318 +-static unsigned char eprom_try_esi(struct atm_dev *dev, unsigned short cmd,
319 +- int offset, int swap)
320 ++static int eprom_try_esi(struct atm_dev *dev, unsigned short cmd, int offset,
321 ++ int swap)
322 + {
323 + unsigned char buf[ZEPROM_SIZE];
324 + struct zatm_dev *zatm_dev;
325 +diff --git a/drivers/base/core.c b/drivers/base/core.c
326 +index afe045792796..049ccc070ce5 100644
327 +--- a/drivers/base/core.c
328 ++++ b/drivers/base/core.c
329 +@@ -759,7 +759,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
330 +
331 + dir = kzalloc(sizeof(*dir), GFP_KERNEL);
332 + if (!dir)
333 +- return NULL;
334 ++ return ERR_PTR(-ENOMEM);
335 +
336 + dir->class = class;
337 + kobject_init(&dir->kobj, &class_dir_ktype);
338 +@@ -769,7 +769,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
339 + retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name);
340 + if (retval < 0) {
341 + kobject_put(&dir->kobj);
342 +- return NULL;
343 ++ return ERR_PTR(retval);
344 + }
345 + return &dir->kobj;
346 + }
347 +@@ -1076,6 +1076,10 @@ int device_add(struct device *dev)
348 +
349 + parent = get_device(dev->parent);
350 + kobj = get_device_parent(dev, parent);
351 ++ if (IS_ERR(kobj)) {
352 ++ error = PTR_ERR(kobj);
353 ++ goto parent_error;
354 ++ }
355 + if (kobj)
356 + dev->kobj.parent = kobj;
357 +
358 +@@ -1174,6 +1178,7 @@ done:
359 + kobject_del(&dev->kobj);
360 + Error:
361 + cleanup_glue_dir(dev, glue_dir);
362 ++parent_error:
363 + put_device(parent);
364 + name_error:
365 + kfree(dev->p);
366 +@@ -1990,6 +1995,11 @@ int device_move(struct device *dev, struct device *new_parent,
367 + device_pm_lock();
368 + new_parent = get_device(new_parent);
369 + new_parent_kobj = get_device_parent(dev, new_parent);
370 ++ if (IS_ERR(new_parent_kobj)) {
371 ++ error = PTR_ERR(new_parent_kobj);
372 ++ put_device(new_parent);
373 ++ goto out;
374 ++ }
375 +
376 + pr_debug("device: '%s': %s: moving to '%s'\n", dev_name(dev),
377 + __func__, new_parent ? dev_name(new_parent) : "<NULL>");
378 +diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
379 +index 8a3bf0a8c31d..476d39c7ba20 100644
380 +--- a/drivers/bluetooth/hci_qca.c
381 ++++ b/drivers/bluetooth/hci_qca.c
382 +@@ -939,6 +939,12 @@ static int qca_setup(struct hci_uart *hu)
383 + } else if (ret == -ENOENT) {
384 + /* No patch/nvm-config found, run with original fw/config */
385 + ret = 0;
386 ++ } else if (ret == -EAGAIN) {
387 ++ /*
388 ++ * Userspace firmware loader will return -EAGAIN in case no
389 ++ * patch/nvm-config is found, so run with original fw/config.
390 ++ */
391 ++ ret = 0;
392 + }
393 +
394 + /* Setup bdaddr */
395 +diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
396 +index feafdab734ae..4835b588b783 100644
397 +--- a/drivers/char/ipmi/ipmi_bt_sm.c
398 ++++ b/drivers/char/ipmi/ipmi_bt_sm.c
399 +@@ -522,11 +522,12 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
400 + if (status & BT_H_BUSY) /* clear a leftover H_BUSY */
401 + BT_CONTROL(BT_H_BUSY);
402 +
403 ++ bt->timeout = bt->BT_CAP_req2rsp;
404 ++
405 + /* Read BT capabilities if it hasn't been done yet */
406 + if (!bt->BT_CAP_outreqs)
407 + BT_STATE_CHANGE(BT_STATE_CAPABILITIES_BEGIN,
408 + SI_SM_CALL_WITHOUT_DELAY);
409 +- bt->timeout = bt->BT_CAP_req2rsp;
410 + BT_SI_SM_RETURN(SI_SM_IDLE);
411 +
412 + case BT_STATE_XACTION_START:
413 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
414 +index ebed319657e7..68b604ad8413 100644
415 +--- a/drivers/cpufreq/cpufreq.c
416 ++++ b/drivers/cpufreq/cpufreq.c
417 +@@ -603,6 +603,8 @@ static ssize_t store_##file_name \
418 + struct cpufreq_policy new_policy; \
419 + \
420 + memcpy(&new_policy, policy, sizeof(*policy)); \
421 ++ new_policy.min = policy->user_policy.min; \
422 ++ new_policy.max = policy->user_policy.max; \
423 + \
424 + ret = sscanf(buf, "%u", &new_policy.object); \
425 + if (ret != 1) \
426 +diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
427 +index c44a843cb405..44ebda8bbc84 100644
428 +--- a/drivers/cpuidle/cpuidle-powernv.c
429 ++++ b/drivers/cpuidle/cpuidle-powernv.c
430 +@@ -29,9 +29,31 @@ struct cpuidle_driver powernv_idle_driver = {
431 +
432 + static int max_idle_state;
433 + static struct cpuidle_state *cpuidle_state_table;
434 +-static u64 snooze_timeout;
435 ++static u64 default_snooze_timeout;
436 + static bool snooze_timeout_en;
437 +
438 ++static u64 get_snooze_timeout(struct cpuidle_device *dev,
439 ++ struct cpuidle_driver *drv,
440 ++ int index)
441 ++{
442 ++ int i;
443 ++
444 ++ if (unlikely(!snooze_timeout_en))
445 ++ return default_snooze_timeout;
446 ++
447 ++ for (i = index + 1; i < drv->state_count; i++) {
448 ++ struct cpuidle_state *s = &drv->states[i];
449 ++ struct cpuidle_state_usage *su = &dev->states_usage[i];
450 ++
451 ++ if (s->disabled || su->disable)
452 ++ continue;
453 ++
454 ++ return s->target_residency * tb_ticks_per_usec;
455 ++ }
456 ++
457 ++ return default_snooze_timeout;
458 ++}
459 ++
460 + static int snooze_loop(struct cpuidle_device *dev,
461 + struct cpuidle_driver *drv,
462 + int index)
463 +@@ -41,7 +63,7 @@ static int snooze_loop(struct cpuidle_device *dev,
464 + local_irq_enable();
465 + set_thread_flag(TIF_POLLING_NRFLAG);
466 +
467 +- snooze_exit_time = get_tb() + snooze_timeout;
468 ++ snooze_exit_time = get_tb() + get_snooze_timeout(dev, drv, index);
469 + ppc64_runlatch_off();
470 + while (!need_resched()) {
471 + HMT_low();
472 +@@ -286,11 +308,9 @@ static int powernv_idle_probe(void)
473 + cpuidle_state_table = powernv_states;
474 + /* Device tree can indicate more idle states */
475 + max_idle_state = powernv_add_idle_states();
476 +- if (max_idle_state > 1) {
477 ++ default_snooze_timeout = TICK_USEC * tb_ticks_per_usec;
478 ++ if (max_idle_state > 1)
479 + snooze_timeout_en = true;
480 +- snooze_timeout = powernv_states[1].target_residency *
481 +- tb_ticks_per_usec;
482 +- }
483 + } else
484 + return -ENODEV;
485 +
486 +diff --git a/drivers/iio/buffer/kfifo_buf.c b/drivers/iio/buffer/kfifo_buf.c
487 +index 7ef9b13262a8..e44181f9eb36 100644
488 +--- a/drivers/iio/buffer/kfifo_buf.c
489 ++++ b/drivers/iio/buffer/kfifo_buf.c
490 +@@ -19,7 +19,7 @@ struct iio_kfifo {
491 + #define iio_to_kfifo(r) container_of(r, struct iio_kfifo, buffer)
492 +
493 + static inline int __iio_allocate_kfifo(struct iio_kfifo *buf,
494 +- int bytes_per_datum, int length)
495 ++ size_t bytes_per_datum, unsigned int length)
496 + {
497 + if ((length == 0) || (bytes_per_datum == 0))
498 + return -EINVAL;
499 +@@ -71,7 +71,7 @@ static int iio_set_bytes_per_datum_kfifo(struct iio_buffer *r, size_t bpd)
500 + return 0;
501 + }
502 +
503 +-static int iio_set_length_kfifo(struct iio_buffer *r, int length)
504 ++static int iio_set_length_kfifo(struct iio_buffer *r, unsigned int length)
505 + {
506 + /* Avoid an invalid state */
507 + if (length < 2)
508 +diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
509 +index d862b9b7910e..199a9cdd0d12 100644
510 +--- a/drivers/infiniband/hw/mlx4/mad.c
511 ++++ b/drivers/infiniband/hw/mlx4/mad.c
512 +@@ -1780,7 +1780,6 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work)
513 + "buf:%lld\n", wc.wr_id);
514 + break;
515 + default:
516 +- BUG_ON(1);
517 + break;
518 + }
519 + } else {
520 +diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
521 +index 7df16f74bb45..c6c75b99cf2c 100644
522 +--- a/drivers/infiniband/hw/qib/qib.h
523 ++++ b/drivers/infiniband/hw/qib/qib.h
524 +@@ -1451,8 +1451,7 @@ u64 qib_sps_ints(void);
525 + /*
526 + * dma_addr wrappers - all 0's invalid for hw
527 + */
528 +-dma_addr_t qib_map_page(struct pci_dev *, struct page *, unsigned long,
529 +- size_t, int);
530 ++int qib_map_page(struct pci_dev *d, struct page *p, dma_addr_t *daddr);
531 + const char *qib_get_unit_name(int unit);
532 +
533 + /*
534 +diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
535 +index 24f4a782e0f4..5908fd3af00d 100644
536 +--- a/drivers/infiniband/hw/qib/qib_file_ops.c
537 ++++ b/drivers/infiniband/hw/qib/qib_file_ops.c
538 +@@ -364,6 +364,8 @@ static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp,
539 + goto done;
540 + }
541 + for (i = 0; i < cnt; i++, vaddr += PAGE_SIZE) {
542 ++ dma_addr_t daddr;
543 ++
544 + for (; ntids--; tid++) {
545 + if (tid == tidcnt)
546 + tid = 0;
547 +@@ -380,12 +382,14 @@ static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp,
548 + ret = -ENOMEM;
549 + break;
550 + }
551 ++ ret = qib_map_page(dd->pcidev, pagep[i], &daddr);
552 ++ if (ret)
553 ++ break;
554 ++
555 + tidlist[i] = tid + tidoff;
556 + /* we "know" system pages and TID pages are same size */
557 + dd->pageshadow[ctxttid + tid] = pagep[i];
558 +- dd->physshadow[ctxttid + tid] =
559 +- qib_map_page(dd->pcidev, pagep[i], 0, PAGE_SIZE,
560 +- PCI_DMA_FROMDEVICE);
561 ++ dd->physshadow[ctxttid + tid] = daddr;
562 + /*
563 + * don't need atomic or it's overhead
564 + */
565 +diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c
566 +index 74f90b2619f6..ab1588ae1c85 100644
567 +--- a/drivers/infiniband/hw/qib/qib_user_pages.c
568 ++++ b/drivers/infiniband/hw/qib/qib_user_pages.c
569 +@@ -98,23 +98,27 @@ bail:
570 + *
571 + * I'm sure we won't be so lucky with other iommu's, so FIXME.
572 + */
573 +-dma_addr_t qib_map_page(struct pci_dev *hwdev, struct page *page,
574 +- unsigned long offset, size_t size, int direction)
575 ++int qib_map_page(struct pci_dev *hwdev, struct page *page, dma_addr_t *daddr)
576 + {
577 + dma_addr_t phys;
578 +
579 +- phys = pci_map_page(hwdev, page, offset, size, direction);
580 ++ phys = pci_map_page(hwdev, page, 0, PAGE_SIZE, PCI_DMA_FROMDEVICE);
581 ++ if (pci_dma_mapping_error(hwdev, phys))
582 ++ return -ENOMEM;
583 +
584 +- if (phys == 0) {
585 +- pci_unmap_page(hwdev, phys, size, direction);
586 +- phys = pci_map_page(hwdev, page, offset, size, direction);
587 ++ if (!phys) {
588 ++ pci_unmap_page(hwdev, phys, PAGE_SIZE, PCI_DMA_FROMDEVICE);
589 ++ phys = pci_map_page(hwdev, page, 0, PAGE_SIZE,
590 ++ PCI_DMA_FROMDEVICE);
591 ++ if (pci_dma_mapping_error(hwdev, phys))
592 ++ return -ENOMEM;
593 + /*
594 + * FIXME: If we get 0 again, we should keep this page,
595 + * map another, then free the 0 page.
596 + */
597 + }
598 +-
599 +- return phys;
600 ++ *daddr = phys;
601 ++ return 0;
602 + }
603 +
604 + /**
605 +diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
606 +index c0ec26118732..83dd0ce3ad2a 100644
607 +--- a/drivers/input/mouse/elan_i2c.h
608 ++++ b/drivers/input/mouse/elan_i2c.h
609 +@@ -27,6 +27,8 @@
610 + #define ETP_DISABLE_POWER 0x0001
611 + #define ETP_PRESSURE_OFFSET 25
612 +
613 ++#define ETP_CALIBRATE_MAX_LEN 3
614 ++
615 + /* IAP Firmware handling */
616 + #define ETP_PRODUCT_ID_FORMAT_STRING "%d.0"
617 + #define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin"
618 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
619 +index aeb8250ab079..97f6e05cffce 100644
620 +--- a/drivers/input/mouse/elan_i2c_core.c
621 ++++ b/drivers/input/mouse/elan_i2c_core.c
622 +@@ -595,7 +595,7 @@ static ssize_t calibrate_store(struct device *dev,
623 + int tries = 20;
624 + int retval;
625 + int error;
626 +- u8 val[3];
627 ++ u8 val[ETP_CALIBRATE_MAX_LEN];
628 +
629 + retval = mutex_lock_interruptible(&data->sysfs_mutex);
630 + if (retval)
631 +@@ -1250,6 +1250,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
632 + { "ELAN060C", 0 },
633 + { "ELAN0611", 0 },
634 + { "ELAN0612", 0 },
635 ++ { "ELAN0618", 0 },
636 + { "ELAN1000", 0 },
637 + { }
638 + };
639 +diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
640 +index 25dba1d7aa57..2ac85f5cbf31 100644
641 +--- a/drivers/input/mouse/elan_i2c_smbus.c
642 ++++ b/drivers/input/mouse/elan_i2c_smbus.c
643 +@@ -56,7 +56,7 @@
644 + static int elan_smbus_initialize(struct i2c_client *client)
645 + {
646 + u8 check[ETP_SMBUS_HELLOPACKET_LEN] = { 0x55, 0x55, 0x55, 0x55, 0x55 };
647 +- u8 values[ETP_SMBUS_HELLOPACKET_LEN] = { 0, 0, 0, 0, 0 };
648 ++ u8 values[I2C_SMBUS_BLOCK_MAX] = {0};
649 + int len, error;
650 +
651 + /* Get hello packet */
652 +@@ -117,12 +117,16 @@ static int elan_smbus_calibrate(struct i2c_client *client)
653 + static int elan_smbus_calibrate_result(struct i2c_client *client, u8 *val)
654 + {
655 + int error;
656 ++ u8 buf[I2C_SMBUS_BLOCK_MAX] = {0};
657 ++
658 ++ BUILD_BUG_ON(ETP_CALIBRATE_MAX_LEN > sizeof(buf));
659 +
660 + error = i2c_smbus_read_block_data(client,
661 +- ETP_SMBUS_CALIBRATE_QUERY, val);
662 ++ ETP_SMBUS_CALIBRATE_QUERY, buf);
663 + if (error < 0)
664 + return error;
665 +
666 ++ memcpy(val, buf, ETP_CALIBRATE_MAX_LEN);
667 + return 0;
668 + }
669 +
670 +@@ -466,6 +470,8 @@ static int elan_smbus_get_report(struct i2c_client *client, u8 *report)
671 + {
672 + int len;
673 +
674 ++ BUILD_BUG_ON(I2C_SMBUS_BLOCK_MAX > ETP_SMBUS_REPORT_LEN);
675 ++
676 + len = i2c_smbus_read_block_data(client,
677 + ETP_SMBUS_PACKET_QUERY,
678 + &report[ETP_SMBUS_REPORT_OFFSET]);
679 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
680 +index 06ea28e5d7b4..174bb52c578b 100644
681 +--- a/drivers/input/mouse/elantech.c
682 ++++ b/drivers/input/mouse/elantech.c
683 +@@ -804,7 +804,7 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
684 + else if (ic_version == 7 && etd->samples[1] == 0x2A)
685 + sanity_check = ((packet[3] & 0x1c) == 0x10);
686 + else
687 +- sanity_check = ((packet[0] & 0x0c) == 0x04 &&
688 ++ sanity_check = ((packet[0] & 0x08) == 0x00 &&
689 + (packet[3] & 0x1c) == 0x10);
690 +
691 + if (!sanity_check)
692 +@@ -1177,6 +1177,12 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = {
693 + { }
694 + };
695 +
696 ++static const char * const middle_button_pnp_ids[] = {
697 ++ "LEN2131", /* ThinkPad P52 w/ NFC */
698 ++ "LEN2132", /* ThinkPad P52 */
699 ++ NULL
700 ++};
701 ++
702 + /*
703 + * Set the appropriate event bits for the input subsystem
704 + */
705 +@@ -1196,7 +1202,8 @@ static int elantech_set_input_params(struct psmouse *psmouse)
706 + __clear_bit(EV_REL, dev->evbit);
707 +
708 + __set_bit(BTN_LEFT, dev->keybit);
709 +- if (dmi_check_system(elantech_dmi_has_middle_button))
710 ++ if (dmi_check_system(elantech_dmi_has_middle_button) ||
711 ++ psmouse_matches_pnp_id(psmouse, middle_button_pnp_ids))
712 + __set_bit(BTN_MIDDLE, dev->keybit);
713 + __set_bit(BTN_RIGHT, dev->keybit);
714 +
715 +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
716 +index a1cc797fe88f..315767e8ae4d 100644
717 +--- a/drivers/md/dm-thin.c
718 ++++ b/drivers/md/dm-thin.c
719 +@@ -1299,6 +1299,8 @@ static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block,
720 +
721 + static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
722 +
723 ++static void requeue_bios(struct pool *pool);
724 ++
725 + static void check_for_space(struct pool *pool)
726 + {
727 + int r;
728 +@@ -1311,8 +1313,10 @@ static void check_for_space(struct pool *pool)
729 + if (r)
730 + return;
731 +
732 +- if (nr_free)
733 ++ if (nr_free) {
734 + set_pool_mode(pool, PM_WRITE);
735 ++ requeue_bios(pool);
736 ++ }
737 + }
738 +
739 + /*
740 +@@ -1389,7 +1393,10 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result)
741 +
742 + r = dm_pool_alloc_data_block(pool->pmd, result);
743 + if (r) {
744 +- metadata_operation_failed(pool, "dm_pool_alloc_data_block", r);
745 ++ if (r == -ENOSPC)
746 ++ set_pool_mode(pool, PM_OUT_OF_DATA_SPACE);
747 ++ else
748 ++ metadata_operation_failed(pool, "dm_pool_alloc_data_block", r);
749 + return r;
750 + }
751 +
752 +diff --git a/drivers/md/md.c b/drivers/md/md.c
753 +index 62c3328e2a1d..0663463df2f7 100644
754 +--- a/drivers/md/md.c
755 ++++ b/drivers/md/md.c
756 +@@ -2690,7 +2690,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
757 + err = 0;
758 + }
759 + } else if (cmd_match(buf, "re-add")) {
760 +- if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1)) {
761 ++ if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) &&
762 ++ rdev->saved_raid_disk >= 0) {
763 + /* clear_bit is performed _after_ all the devices
764 + * have their local Faulty bit cleared. If any writes
765 + * happen in the meantime in the local node, they
766 +@@ -8153,6 +8154,7 @@ static int remove_and_add_spares(struct mddev *mddev,
767 + if (mddev->pers->hot_remove_disk(
768 + mddev, rdev) == 0) {
769 + sysfs_unlink_rdev(mddev, rdev);
770 ++ rdev->saved_raid_disk = rdev->raid_disk;
771 + rdev->raid_disk = -1;
772 + removed++;
773 + }
774 +diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
775 +index e2a3833170e3..2c835e69c4df 100644
776 +--- a/drivers/media/dvb-core/dvb_frontend.c
777 ++++ b/drivers/media/dvb-core/dvb_frontend.c
778 +@@ -230,8 +230,20 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe,
779 + wake_up_interruptible (&events->wait_queue);
780 + }
781 +
782 ++static int dvb_frontend_test_event(struct dvb_frontend_private *fepriv,
783 ++ struct dvb_fe_events *events)
784 ++{
785 ++ int ret;
786 ++
787 ++ up(&fepriv->sem);
788 ++ ret = events->eventw != events->eventr;
789 ++ down(&fepriv->sem);
790 ++
791 ++ return ret;
792 ++}
793 ++
794 + static int dvb_frontend_get_event(struct dvb_frontend *fe,
795 +- struct dvb_frontend_event *event, int flags)
796 ++ struct dvb_frontend_event *event, int flags)
797 + {
798 + struct dvb_frontend_private *fepriv = fe->frontend_priv;
799 + struct dvb_fe_events *events = &fepriv->events;
800 +@@ -249,13 +261,8 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe,
801 + if (flags & O_NONBLOCK)
802 + return -EWOULDBLOCK;
803 +
804 +- up(&fepriv->sem);
805 +-
806 +- ret = wait_event_interruptible (events->wait_queue,
807 +- events->eventw != events->eventr);
808 +-
809 +- if (down_interruptible (&fepriv->sem))
810 +- return -ERESTARTSYS;
811 ++ ret = wait_event_interruptible(events->wait_queue,
812 ++ dvb_frontend_test_event(fepriv, events));
813 +
814 + if (ret < 0)
815 + return ret;
816 +diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
817 +index 04ae21278440..77f54e4198d3 100644
818 +--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
819 ++++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
820 +@@ -864,6 +864,9 @@ struct usb_device_id cx231xx_id_table[] = {
821 + .driver_info = CX231XX_BOARD_CNXT_RDE_250},
822 + {USB_DEVICE(0x0572, 0x58A0),
823 + .driver_info = CX231XX_BOARD_CNXT_RDU_250},
824 ++ /* AverMedia DVD EZMaker 7 */
825 ++ {USB_DEVICE(0x07ca, 0xc039),
826 ++ .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
827 + {USB_DEVICE(0x2040, 0xb110),
828 + .driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL},
829 + {USB_DEVICE(0x2040, 0xb111),
830 +diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
831 +index e0ae2f34623a..9292e35aef06 100644
832 +--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
833 ++++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
834 +@@ -864,7 +864,7 @@ static int put_v4l2_ext_controls32(struct file *file,
835 + get_user(kcontrols, &kp->controls))
836 + return -EFAULT;
837 +
838 +- if (!count)
839 ++ if (!count || count > (U32_MAX/sizeof(*ucontrols)))
840 + return 0;
841 + if (get_user(p, &up->controls))
842 + return -EFAULT;
843 +diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
844 +index fe89e5e337d5..ac867489b5a9 100644
845 +--- a/drivers/mfd/intel-lpss.c
846 ++++ b/drivers/mfd/intel-lpss.c
847 +@@ -269,11 +269,11 @@ static void intel_lpss_init_dev(const struct intel_lpss *lpss)
848 +
849 + intel_lpss_deassert_reset(lpss);
850 +
851 ++ intel_lpss_set_remap_addr(lpss);
852 ++
853 + if (!intel_lpss_has_idma(lpss))
854 + return;
855 +
856 +- intel_lpss_set_remap_addr(lpss);
857 +-
858 + /* Make sure that SPI multiblock DMA transfers are re-enabled */
859 + if (lpss->type == LPSS_DEV_SPI)
860 + writel(value, lpss->priv + LPSS_PRIV_SSP_REG);
861 +diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
862 +index 31448a2b39ae..c484ca8c909c 100644
863 +--- a/drivers/mtd/chips/cfi_cmdset_0002.c
864 ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c
865 +@@ -1878,7 +1878,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
866 + if (time_after(jiffies, timeo) && !chip_ready(map, adr))
867 + break;
868 +
869 +- if (chip_ready(map, adr)) {
870 ++ if (chip_good(map, adr, datum)) {
871 + xip_enable(map, chip, adr);
872 + goto op_done;
873 + }
874 +@@ -2533,7 +2533,7 @@ static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
875 +
876 + struct ppb_lock {
877 + struct flchip *chip;
878 +- loff_t offset;
879 ++ unsigned long adr;
880 + int locked;
881 + };
882 +
883 +@@ -2551,8 +2551,9 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map,
884 + unsigned long timeo;
885 + int ret;
886 +
887 ++ adr += chip->start;
888 + mutex_lock(&chip->mutex);
889 +- ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
890 ++ ret = get_chip(map, chip, adr, FL_LOCKING);
891 + if (ret) {
892 + mutex_unlock(&chip->mutex);
893 + return ret;
894 +@@ -2570,8 +2571,8 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map,
895 +
896 + if (thunk == DO_XXLOCK_ONEBLOCK_LOCK) {
897 + chip->state = FL_LOCKING;
898 +- map_write(map, CMD(0xA0), chip->start + adr);
899 +- map_write(map, CMD(0x00), chip->start + adr);
900 ++ map_write(map, CMD(0xA0), adr);
901 ++ map_write(map, CMD(0x00), adr);
902 + } else if (thunk == DO_XXLOCK_ONEBLOCK_UNLOCK) {
903 + /*
904 + * Unlocking of one specific sector is not supported, so we
905 +@@ -2609,7 +2610,7 @@ static int __maybe_unused do_ppb_xxlock(struct map_info *map,
906 + map_write(map, CMD(0x00), chip->start);
907 +
908 + chip->state = FL_READY;
909 +- put_chip(map, chip, adr + chip->start);
910 ++ put_chip(map, chip, adr);
911 + mutex_unlock(&chip->mutex);
912 +
913 + return ret;
914 +@@ -2666,9 +2667,9 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
915 + * sectors shall be unlocked, so lets keep their locking
916 + * status at "unlocked" (locked=0) for the final re-locking.
917 + */
918 +- if ((adr < ofs) || (adr >= (ofs + len))) {
919 ++ if ((offset < ofs) || (offset >= (ofs + len))) {
920 + sect[sectors].chip = &cfi->chips[chipnum];
921 +- sect[sectors].offset = offset;
922 ++ sect[sectors].adr = adr;
923 + sect[sectors].locked = do_ppb_xxlock(
924 + map, &cfi->chips[chipnum], adr, 0,
925 + DO_XXLOCK_ONEBLOCK_GETLOCK);
926 +@@ -2682,6 +2683,8 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
927 + i++;
928 +
929 + if (adr >> cfi->chipshift) {
930 ++ if (offset >= (ofs + len))
931 ++ break;
932 + adr = 0;
933 + chipnum++;
934 +
935 +@@ -2712,7 +2715,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
936 + */
937 + for (i = 0; i < sectors; i++) {
938 + if (sect[i].locked)
939 +- do_ppb_xxlock(map, sect[i].chip, sect[i].offset, 0,
940 ++ do_ppb_xxlock(map, sect[i].chip, sect[i].adr, 0,
941 + DO_XXLOCK_ONEBLOCK_LOCK);
942 + }
943 +
944 +diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
945 +index a2e6c7848b0a..c9f5ae424af7 100644
946 +--- a/drivers/mtd/ubi/build.c
947 ++++ b/drivers/mtd/ubi/build.c
948 +@@ -1132,6 +1132,9 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
949 + */
950 + get_device(&ubi->dev);
951 +
952 ++#ifdef CONFIG_MTD_UBI_FASTMAP
953 ++ cancel_work_sync(&ubi->fm_work);
954 ++#endif
955 + ubi_debugfs_exit_dev(ubi);
956 + uif_close(ubi);
957 +
958 +diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
959 +index 75286588b823..ca9746f41ff1 100644
960 +--- a/drivers/mtd/ubi/wl.c
961 ++++ b/drivers/mtd/ubi/wl.c
962 +@@ -1479,6 +1479,7 @@ int ubi_thread(void *u)
963 + }
964 +
965 + dbg_wl("background thread \"%s\" is killed", ubi->bgt_name);
966 ++ ubi->thread_enabled = 0;
967 + return 0;
968 + }
969 +
970 +@@ -1488,9 +1489,6 @@ int ubi_thread(void *u)
971 + */
972 + static void shutdown_work(struct ubi_device *ubi)
973 + {
974 +-#ifdef CONFIG_MTD_UBI_FASTMAP
975 +- flush_work(&ubi->fm_work);
976 +-#endif
977 + while (!list_empty(&ubi->works)) {
978 + struct ubi_work *wrk;
979 +
980 +diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
981 +index 55e93b6b6d21..66560a8fcfa2 100644
982 +--- a/drivers/net/bonding/bond_options.c
983 ++++ b/drivers/net/bonding/bond_options.c
984 +@@ -1115,6 +1115,7 @@ static int bond_option_primary_set(struct bonding *bond,
985 + slave->dev->name);
986 + rcu_assign_pointer(bond->primary_slave, slave);
987 + strcpy(bond->params.primary, slave->dev->name);
988 ++ bond->force_primary = true;
989 + bond_select_active_slave(bond);
990 + goto out;
991 + }
992 +diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c
993 +index 1bd419dbda6d..0798b4adb039 100644
994 +--- a/drivers/net/ethernet/natsemi/sonic.c
995 ++++ b/drivers/net/ethernet/natsemi/sonic.c
996 +@@ -71,7 +71,7 @@ static int sonic_open(struct net_device *dev)
997 + for (i = 0; i < SONIC_NUM_RRS; i++) {
998 + dma_addr_t laddr = dma_map_single(lp->device, skb_put(lp->rx_skb[i], SONIC_RBSIZE),
999 + SONIC_RBSIZE, DMA_FROM_DEVICE);
1000 +- if (!laddr) {
1001 ++ if (dma_mapping_error(lp->device, laddr)) {
1002 + while(i > 0) { /* free any that were mapped successfully */
1003 + i--;
1004 + dma_unmap_single(lp->device, lp->rx_laddr[i], SONIC_RBSIZE, DMA_FROM_DEVICE);
1005 +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
1006 +index c8e98c8e29fa..36e1377fc954 100644
1007 +--- a/drivers/net/usb/cdc_ncm.c
1008 ++++ b/drivers/net/usb/cdc_ncm.c
1009 +@@ -1075,7 +1075,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1010 + * accordingly. Otherwise, we should check here.
1011 + */
1012 + if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
1013 +- delayed_ndp_size = ctx->max_ndp_size;
1014 ++ delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus);
1015 + else
1016 + delayed_ndp_size = 0;
1017 +
1018 +@@ -1208,7 +1208,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1019 + /* If requested, put NDP at end of frame. */
1020 + if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
1021 + nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data;
1022 +- cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max);
1023 ++ cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max - ctx->max_ndp_size);
1024 + nth16->wNdpIndex = cpu_to_le16(skb_out->len);
1025 + memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size);
1026 +
1027 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1028 +index d72205f06a1d..3b67140eed73 100644
1029 +--- a/drivers/net/usb/qmi_wwan.c
1030 ++++ b/drivers/net/usb/qmi_wwan.c
1031 +@@ -635,6 +635,7 @@ static const struct usb_device_id products[] = {
1032 + {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
1033 + {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
1034 + {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
1035 ++ {QMI_FIXED_INTF(0x0846, 0x68d3, 8)}, /* Netgear Aircard 779S */
1036 + {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
1037 + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
1038 + {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */
1039 +diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
1040 +index 254b0ee37039..a71187c783b7 100644
1041 +--- a/drivers/nvdimm/bus.c
1042 ++++ b/drivers/nvdimm/bus.c
1043 +@@ -237,14 +237,18 @@ int nvdimm_revalidate_disk(struct gendisk *disk)
1044 + {
1045 + struct device *dev = disk->driverfs_dev;
1046 + struct nd_region *nd_region = to_nd_region(dev->parent);
1047 +- const char *pol = nd_region->ro ? "only" : "write";
1048 ++ int disk_ro = get_disk_ro(disk);
1049 +
1050 +- if (nd_region->ro == get_disk_ro(disk))
1051 ++ /*
1052 ++ * Upgrade to read-only if the region is read-only preserve as
1053 ++ * read-only if the disk is already read-only.
1054 ++ */
1055 ++ if (disk_ro || nd_region->ro == disk_ro)
1056 + return 0;
1057 +
1058 +- dev_info(dev, "%s read-%s, marking %s read-%s\n",
1059 +- dev_name(&nd_region->dev), pol, disk->disk_name, pol);
1060 +- set_disk_ro(disk, nd_region->ro);
1061 ++ dev_info(dev, "%s read-only, marking %s read-only\n",
1062 ++ dev_name(&nd_region->dev), disk->disk_name);
1063 ++ set_disk_ro(disk, 1);
1064 +
1065 + return 0;
1066 +
1067 +diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
1068 +index e16ea5717b7f..2a547ca3d443 100644
1069 +--- a/drivers/of/unittest.c
1070 ++++ b/drivers/of/unittest.c
1071 +@@ -156,20 +156,20 @@ static void __init of_unittest_dynamic(void)
1072 + /* Add a new property - should pass*/
1073 + prop->name = "new-property";
1074 + prop->value = "new-property-data";
1075 +- prop->length = strlen(prop->value);
1076 ++ prop->length = strlen(prop->value) + 1;
1077 + unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n");
1078 +
1079 + /* Try to add an existing property - should fail */
1080 + prop++;
1081 + prop->name = "new-property";
1082 + prop->value = "new-property-data-should-fail";
1083 +- prop->length = strlen(prop->value);
1084 ++ prop->length = strlen(prop->value) + 1;
1085 + unittest(of_add_property(np, prop) != 0,
1086 + "Adding an existing property should have failed\n");
1087 +
1088 + /* Try to modify an existing property - should pass */
1089 + prop->value = "modify-property-data-should-pass";
1090 +- prop->length = strlen(prop->value);
1091 ++ prop->length = strlen(prop->value) + 1;
1092 + unittest(of_update_property(np, prop) == 0,
1093 + "Updating an existing property should have passed\n");
1094 +
1095 +@@ -177,7 +177,7 @@ static void __init of_unittest_dynamic(void)
1096 + prop++;
1097 + prop->name = "modify-property";
1098 + prop->value = "modify-missing-property-data-should-pass";
1099 +- prop->length = strlen(prop->value);
1100 ++ prop->length = strlen(prop->value) + 1;
1101 + unittest(of_update_property(np, prop) == 0,
1102 + "Updating a missing property should have passed\n");
1103 +
1104 +diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
1105 +index 62d6fe6c3714..cbe58480b474 100644
1106 +--- a/drivers/pci/hotplug/pciehp.h
1107 ++++ b/drivers/pci/hotplug/pciehp.h
1108 +@@ -134,7 +134,7 @@ struct controller *pcie_init(struct pcie_device *dev);
1109 + int pcie_init_notification(struct controller *ctrl);
1110 + int pciehp_enable_slot(struct slot *p_slot);
1111 + int pciehp_disable_slot(struct slot *p_slot);
1112 +-void pcie_enable_notification(struct controller *ctrl);
1113 ++void pcie_reenable_notification(struct controller *ctrl);
1114 + int pciehp_power_on_slot(struct slot *slot);
1115 + void pciehp_power_off_slot(struct slot *slot);
1116 + void pciehp_get_power_status(struct slot *slot, u8 *status);
1117 +diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
1118 +index 612b21a14df5..8f6ded43760a 100644
1119 +--- a/drivers/pci/hotplug/pciehp_core.c
1120 ++++ b/drivers/pci/hotplug/pciehp_core.c
1121 +@@ -295,7 +295,7 @@ static int pciehp_resume(struct pcie_device *dev)
1122 + ctrl = get_service_data(dev);
1123 +
1124 + /* reinitialize the chipset's event detection logic */
1125 +- pcie_enable_notification(ctrl);
1126 ++ pcie_reenable_notification(ctrl);
1127 +
1128 + slot = ctrl->slot;
1129 +
1130 +diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
1131 +index 5c24e938042f..63c6c7fce3eb 100644
1132 +--- a/drivers/pci/hotplug/pciehp_hpc.c
1133 ++++ b/drivers/pci/hotplug/pciehp_hpc.c
1134 +@@ -628,7 +628,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
1135 + return IRQ_HANDLED;
1136 + }
1137 +
1138 +-void pcie_enable_notification(struct controller *ctrl)
1139 ++static void pcie_enable_notification(struct controller *ctrl)
1140 + {
1141 + u16 cmd, mask;
1142 +
1143 +@@ -666,6 +666,17 @@ void pcie_enable_notification(struct controller *ctrl)
1144 + pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, cmd);
1145 + }
1146 +
1147 ++void pcie_reenable_notification(struct controller *ctrl)
1148 ++{
1149 ++ /*
1150 ++ * Clear both Presence and Data Link Layer Changed to make sure
1151 ++ * those events still fire after we have re-enabled them.
1152 ++ */
1153 ++ pcie_capability_write_word(ctrl->pcie->port, PCI_EXP_SLTSTA,
1154 ++ PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC);
1155 ++ pcie_enable_notification(ctrl);
1156 ++}
1157 ++
1158 + static void pcie_disable_notification(struct controller *ctrl)
1159 + {
1160 + u16 mask;
1161 +diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
1162 +index 4534a7ce77b8..b6caad0fee24 100644
1163 +--- a/drivers/s390/scsi/zfcp_dbf.c
1164 ++++ b/drivers/s390/scsi/zfcp_dbf.c
1165 +@@ -625,6 +625,46 @@ void zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *sc,
1166 + spin_unlock_irqrestore(&dbf->scsi_lock, flags);
1167 + }
1168 +
1169 ++/**
1170 ++ * zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks.
1171 ++ * @tag: Identifier for event.
1172 ++ * @adapter: Pointer to zfcp adapter as context for this event.
1173 ++ * @scsi_id: SCSI ID/target to indicate scope of task management function (TMF).
1174 ++ * @ret: Return value of calling function.
1175 ++ *
1176 ++ * This SCSI trace variant does not depend on any of:
1177 ++ * scsi_cmnd, zfcp_fsf_req, scsi_device.
1178 ++ */
1179 ++void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
1180 ++ unsigned int scsi_id, int ret)
1181 ++{
1182 ++ struct zfcp_dbf *dbf = adapter->dbf;
1183 ++ struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;
1184 ++ unsigned long flags;
1185 ++ static int const level = 1;
1186 ++
1187 ++ if (unlikely(!debug_level_enabled(adapter->dbf->scsi, level)))
1188 ++ return;
1189 ++
1190 ++ spin_lock_irqsave(&dbf->scsi_lock, flags);
1191 ++ memset(rec, 0, sizeof(*rec));
1192 ++
1193 ++ memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
1194 ++ rec->id = ZFCP_DBF_SCSI_CMND;
1195 ++ rec->scsi_result = ret; /* re-use field, int is 4 bytes and fits */
1196 ++ rec->scsi_retries = ~0;
1197 ++ rec->scsi_allowed = ~0;
1198 ++ rec->fcp_rsp_info = ~0;
1199 ++ rec->scsi_id = scsi_id;
1200 ++ rec->scsi_lun = (u32)ZFCP_DBF_INVALID_LUN;
1201 ++ rec->scsi_lun_64_hi = (u32)(ZFCP_DBF_INVALID_LUN >> 32);
1202 ++ rec->host_scribble = ~0;
1203 ++ memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE);
1204 ++
1205 ++ debug_event(dbf->scsi, level, rec, sizeof(*rec));
1206 ++ spin_unlock_irqrestore(&dbf->scsi_lock, flags);
1207 ++}
1208 ++
1209 + static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size)
1210 + {
1211 + struct debug_info *d;
1212 +diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
1213 +index 3b23d6754598..2abcd331b05d 100644
1214 +--- a/drivers/s390/scsi/zfcp_erp.c
1215 ++++ b/drivers/s390/scsi/zfcp_erp.c
1216 +@@ -34,11 +34,28 @@ enum zfcp_erp_steps {
1217 + ZFCP_ERP_STEP_LUN_OPENING = 0x2000,
1218 + };
1219 +
1220 ++/**
1221 ++ * enum zfcp_erp_act_type - Type of ERP action object.
1222 ++ * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery.
1223 ++ * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery.
1224 ++ * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
1225 ++ * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
1226 ++ * @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with
1227 ++ * either of the first four enum values.
1228 ++ * Used to indicate that an ERP action could not be
1229 ++ * set up despite a detected need for some recovery.
1230 ++ * @ZFCP_ERP_ACTION_FAILED: Eyecatcher pseudo flag to bitwise or-combine with
1231 ++ * either of the first four enum values.
1232 ++ * Used to indicate that ERP not needed because
1233 ++ * the object has ZFCP_STATUS_COMMON_ERP_FAILED.
1234 ++ */
1235 + enum zfcp_erp_act_type {
1236 + ZFCP_ERP_ACTION_REOPEN_LUN = 1,
1237 + ZFCP_ERP_ACTION_REOPEN_PORT = 2,
1238 + ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
1239 + ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
1240 ++ ZFCP_ERP_ACTION_NONE = 0xc0,
1241 ++ ZFCP_ERP_ACTION_FAILED = 0xe0,
1242 + };
1243 +
1244 + enum zfcp_erp_act_state {
1245 +@@ -125,6 +142,49 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
1246 + }
1247 + }
1248 +
1249 ++static int zfcp_erp_handle_failed(int want, struct zfcp_adapter *adapter,
1250 ++ struct zfcp_port *port,
1251 ++ struct scsi_device *sdev)
1252 ++{
1253 ++ int need = want;
1254 ++ struct zfcp_scsi_dev *zsdev;
1255 ++
1256 ++ switch (want) {
1257 ++ case ZFCP_ERP_ACTION_REOPEN_LUN:
1258 ++ zsdev = sdev_to_zfcp(sdev);
1259 ++ if (atomic_read(&zsdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
1260 ++ need = 0;
1261 ++ break;
1262 ++ case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
1263 ++ if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
1264 ++ need = 0;
1265 ++ break;
1266 ++ case ZFCP_ERP_ACTION_REOPEN_PORT:
1267 ++ if (atomic_read(&port->status) &
1268 ++ ZFCP_STATUS_COMMON_ERP_FAILED) {
1269 ++ need = 0;
1270 ++ /* ensure propagation of failed status to new devices */
1271 ++ zfcp_erp_set_port_status(
1272 ++ port, ZFCP_STATUS_COMMON_ERP_FAILED);
1273 ++ }
1274 ++ break;
1275 ++ case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
1276 ++ if (atomic_read(&adapter->status) &
1277 ++ ZFCP_STATUS_COMMON_ERP_FAILED) {
1278 ++ need = 0;
1279 ++ /* ensure propagation of failed status to new devices */
1280 ++ zfcp_erp_set_adapter_status(
1281 ++ adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
1282 ++ }
1283 ++ break;
1284 ++ default:
1285 ++ need = 0;
1286 ++ break;
1287 ++ }
1288 ++
1289 ++ return need;
1290 ++}
1291 ++
1292 + static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter,
1293 + struct zfcp_port *port,
1294 + struct scsi_device *sdev)
1295 +@@ -248,16 +308,27 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
1296 + int retval = 1, need;
1297 + struct zfcp_erp_action *act;
1298 +
1299 +- if (!adapter->erp_thread)
1300 +- return -EIO;
1301 ++ need = zfcp_erp_handle_failed(want, adapter, port, sdev);
1302 ++ if (!need) {
1303 ++ need = ZFCP_ERP_ACTION_FAILED; /* marker for trace */
1304 ++ goto out;
1305 ++ }
1306 ++
1307 ++ if (!adapter->erp_thread) {
1308 ++ need = ZFCP_ERP_ACTION_NONE; /* marker for trace */
1309 ++ retval = -EIO;
1310 ++ goto out;
1311 ++ }
1312 +
1313 + need = zfcp_erp_required_act(want, adapter, port, sdev);
1314 + if (!need)
1315 + goto out;
1316 +
1317 + act = zfcp_erp_setup_act(need, act_status, adapter, port, sdev);
1318 +- if (!act)
1319 ++ if (!act) {
1320 ++ need |= ZFCP_ERP_ACTION_NONE; /* marker for trace */
1321 + goto out;
1322 ++ }
1323 + atomic_or(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
1324 + ++adapter->erp_total_count;
1325 + list_add_tail(&act->list, &adapter->erp_ready_head);
1326 +@@ -268,18 +339,32 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
1327 + return retval;
1328 + }
1329 +
1330 ++void zfcp_erp_port_forced_no_port_dbf(char *id, struct zfcp_adapter *adapter,
1331 ++ u64 port_name, u32 port_id)
1332 ++{
1333 ++ unsigned long flags;
1334 ++ static /* don't waste stack */ struct zfcp_port tmpport;
1335 ++
1336 ++ write_lock_irqsave(&adapter->erp_lock, flags);
1337 ++ /* Stand-in zfcp port with fields just good enough for
1338 ++ * zfcp_dbf_rec_trig() and zfcp_dbf_set_common().
1339 ++ * Under lock because tmpport is static.
1340 ++ */
1341 ++ atomic_set(&tmpport.status, -1); /* unknown */
1342 ++ tmpport.wwpn = port_name;
1343 ++ tmpport.d_id = port_id;
1344 ++ zfcp_dbf_rec_trig(id, adapter, &tmpport, NULL,
1345 ++ ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
1346 ++ ZFCP_ERP_ACTION_NONE);
1347 ++ write_unlock_irqrestore(&adapter->erp_lock, flags);
1348 ++}
1349 ++
1350 + static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
1351 + int clear_mask, char *id)
1352 + {
1353 + zfcp_erp_adapter_block(adapter, clear_mask);
1354 + zfcp_scsi_schedule_rports_block(adapter);
1355 +
1356 +- /* ensure propagation of failed status to new devices */
1357 +- if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
1358 +- zfcp_erp_set_adapter_status(adapter,
1359 +- ZFCP_STATUS_COMMON_ERP_FAILED);
1360 +- return -EIO;
1361 +- }
1362 + return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
1363 + adapter, NULL, NULL, id, 0);
1364 + }
1365 +@@ -298,12 +383,8 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear, char *id)
1366 + zfcp_scsi_schedule_rports_block(adapter);
1367 +
1368 + write_lock_irqsave(&adapter->erp_lock, flags);
1369 +- if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
1370 +- zfcp_erp_set_adapter_status(adapter,
1371 +- ZFCP_STATUS_COMMON_ERP_FAILED);
1372 +- else
1373 +- zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
1374 +- NULL, NULL, id, 0);
1375 ++ zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
1376 ++ NULL, NULL, id, 0);
1377 + write_unlock_irqrestore(&adapter->erp_lock, flags);
1378 + }
1379 +
1380 +@@ -344,9 +425,6 @@ static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear,
1381 + zfcp_erp_port_block(port, clear);
1382 + zfcp_scsi_schedule_rport_block(port);
1383 +
1384 +- if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
1385 +- return;
1386 +-
1387 + zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
1388 + port->adapter, port, NULL, id, 0);
1389 + }
1390 +@@ -372,12 +450,6 @@ static int _zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id)
1391 + zfcp_erp_port_block(port, clear);
1392 + zfcp_scsi_schedule_rport_block(port);
1393 +
1394 +- if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
1395 +- /* ensure propagation of failed status to new devices */
1396 +- zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
1397 +- return -EIO;
1398 +- }
1399 +-
1400 + return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT,
1401 + port->adapter, port, NULL, id, 0);
1402 + }
1403 +@@ -417,9 +489,6 @@ static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id,
1404 +
1405 + zfcp_erp_lun_block(sdev, clear);
1406 +
1407 +- if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
1408 +- return;
1409 +-
1410 + zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_LUN, adapter,
1411 + zfcp_sdev->port, sdev, id, act_status);
1412 + }
1413 +diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
1414 +index 7a7984a50683..b326f05c7f89 100644
1415 +--- a/drivers/s390/scsi/zfcp_ext.h
1416 ++++ b/drivers/s390/scsi/zfcp_ext.h
1417 +@@ -52,10 +52,15 @@ extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *);
1418 + extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *);
1419 + extern void zfcp_dbf_scsi(char *, int, struct scsi_cmnd *,
1420 + struct zfcp_fsf_req *);
1421 ++extern void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
1422 ++ unsigned int scsi_id, int ret);
1423 +
1424 + /* zfcp_erp.c */
1425 + extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
1426 + extern void zfcp_erp_clear_adapter_status(struct zfcp_adapter *, u32);
1427 ++extern void zfcp_erp_port_forced_no_port_dbf(char *id,
1428 ++ struct zfcp_adapter *adapter,
1429 ++ u64 port_name, u32 port_id);
1430 + extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *);
1431 + extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *);
1432 + extern void zfcp_erp_set_port_status(struct zfcp_port *, u32);
1433 +diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
1434 +index bb99db2948ab..3afb200b2829 100644
1435 +--- a/drivers/s390/scsi/zfcp_scsi.c
1436 ++++ b/drivers/s390/scsi/zfcp_scsi.c
1437 +@@ -180,6 +180,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
1438 + if (abrt_req)
1439 + break;
1440 +
1441 ++ zfcp_dbf_scsi_abort("abrt_wt", scpnt, NULL);
1442 + zfcp_erp_wait(adapter);
1443 + ret = fc_block_scsi_eh(scpnt);
1444 + if (ret) {
1445 +@@ -276,6 +277,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
1446 + if (fsf_req)
1447 + break;
1448 +
1449 ++ zfcp_dbf_scsi_devreset("wait", scpnt, tm_flags, NULL);
1450 + zfcp_erp_wait(adapter);
1451 + ret = fc_block_scsi_eh(scpnt);
1452 + if (ret) {
1453 +@@ -322,15 +324,16 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
1454 + {
1455 + struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
1456 + struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
1457 +- int ret;
1458 ++ int ret = SUCCESS, fc_ret;
1459 +
1460 + zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
1461 + zfcp_erp_wait(adapter);
1462 +- ret = fc_block_scsi_eh(scpnt);
1463 +- if (ret)
1464 +- return ret;
1465 ++ fc_ret = fc_block_scsi_eh(scpnt);
1466 ++ if (fc_ret)
1467 ++ ret = fc_ret;
1468 +
1469 +- return SUCCESS;
1470 ++ zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret);
1471 ++ return ret;
1472 + }
1473 +
1474 + struct scsi_transport_template *zfcp_scsi_transport_template;
1475 +@@ -600,6 +603,11 @@ static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport)
1476 + if (port) {
1477 + zfcp_erp_port_forced_reopen(port, 0, "sctrpi1");
1478 + put_device(&port->dev);
1479 ++ } else {
1480 ++ zfcp_erp_port_forced_no_port_dbf(
1481 ++ "sctrpin", adapter,
1482 ++ rport->port_name /* zfcp_scsi_rport_register */,
1483 ++ rport->port_id /* zfcp_scsi_rport_register */);
1484 + }
1485 + }
1486 +
1487 +diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
1488 +index aa18c729d23a..a9eb3cd453be 100644
1489 +--- a/drivers/scsi/qla2xxx/qla_init.c
1490 ++++ b/drivers/scsi/qla2xxx/qla_init.c
1491 +@@ -3261,7 +3261,8 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
1492 + return;
1493 +
1494 + if (fcport->fp_speed == PORT_SPEED_UNKNOWN ||
1495 +- fcport->fp_speed > ha->link_data_rate)
1496 ++ fcport->fp_speed > ha->link_data_rate ||
1497 ++ !ha->flags.gpsc_supported)
1498 + return;
1499 +
1500 + rval = qla2x00_set_idma_speed(vha, fcport->loop_id, fcport->fp_speed,
1501 +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
1502 +index dee1cb87d24f..04fd651f9e3e 100644
1503 +--- a/drivers/spi/spi.c
1504 ++++ b/drivers/spi/spi.c
1505 +@@ -707,8 +707,14 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
1506 + for (i = 0; i < sgs; i++) {
1507 +
1508 + if (vmalloced_buf) {
1509 +- min = min_t(size_t,
1510 +- len, desc_len - offset_in_page(buf));
1511 ++ /*
1512 ++ * Next scatterlist entry size is the minimum between
1513 ++ * the desc_len and the remaining buffer length that
1514 ++ * fits in a page.
1515 ++ */
1516 ++ min = min_t(size_t, desc_len,
1517 ++ min_t(size_t, len,
1518 ++ PAGE_SIZE - offset_in_page(buf)));
1519 + vm_page = vmalloc_to_page(buf);
1520 + if (!vm_page) {
1521 + sg_free_table(sgt);
1522 +diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
1523 +index 8dd822feb972..b63920481b1d 100644
1524 +--- a/drivers/tty/serial/sh-sci.c
1525 ++++ b/drivers/tty/serial/sh-sci.c
1526 +@@ -2419,13 +2419,12 @@ static void serial_console_write(struct console *co, const char *s,
1527 + unsigned long flags;
1528 + int locked = 1;
1529 +
1530 +- local_irq_save(flags);
1531 + if (port->sysrq)
1532 + locked = 0;
1533 + else if (oops_in_progress)
1534 +- locked = spin_trylock(&port->lock);
1535 ++ locked = spin_trylock_irqsave(&port->lock, flags);
1536 + else
1537 +- spin_lock(&port->lock);
1538 ++ spin_lock_irqsave(&port->lock, flags);
1539 +
1540 + /* first save the SCSCR then disable the interrupts */
1541 + ctrl = serial_port_in(port, SCSCR);
1542 +@@ -2442,8 +2441,7 @@ static void serial_console_write(struct console *co, const char *s,
1543 + serial_port_out(port, SCSCR, ctrl);
1544 +
1545 + if (locked)
1546 +- spin_unlock(&port->lock);
1547 +- local_irq_restore(flags);
1548 ++ spin_unlock_irqrestore(&port->lock, flags);
1549 + }
1550 +
1551 + static int serial_console_setup(struct console *co, char *options)
1552 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1553 +index 6d84f6c8fbe6..4d86da0df131 100644
1554 +--- a/drivers/usb/core/hub.c
1555 ++++ b/drivers/usb/core/hub.c
1556 +@@ -4442,7 +4442,9 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
1557 + * reset. But only on the first attempt,
1558 + * lest we get into a time out/reset loop
1559 + */
1560 +- if (r == 0 || (r == -ETIMEDOUT && retries == 0))
1561 ++ if (r == 0 || (r == -ETIMEDOUT &&
1562 ++ retries == 0 &&
1563 ++ udev->speed > USB_SPEED_FULL))
1564 + break;
1565 + }
1566 + udev->descriptor.bMaxPacketSize0 =
1567 +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
1568 +index 494823f21c28..7ec66f1db418 100644
1569 +--- a/drivers/usb/musb/musb_host.c
1570 ++++ b/drivers/usb/musb/musb_host.c
1571 +@@ -2580,8 +2580,11 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
1572 + {
1573 + struct musb *musb = hcd_to_musb(hcd);
1574 + u8 devctl;
1575 ++ int ret;
1576 +
1577 +- musb_port_suspend(musb, true);
1578 ++ ret = musb_port_suspend(musb, true);
1579 ++ if (ret)
1580 ++ return ret;
1581 +
1582 + if (!is_host_active(musb))
1583 + return 0;
1584 +diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h
1585 +index 7bbf01bf4bb0..54d02ed032df 100644
1586 +--- a/drivers/usb/musb/musb_host.h
1587 ++++ b/drivers/usb/musb/musb_host.h
1588 +@@ -92,7 +92,7 @@ extern void musb_host_rx(struct musb *, u8);
1589 + extern void musb_root_disconnect(struct musb *musb);
1590 + extern void musb_host_resume_root_hub(struct musb *musb);
1591 + extern void musb_host_poke_root_hub(struct musb *musb);
1592 +-extern void musb_port_suspend(struct musb *musb, bool do_suspend);
1593 ++extern int musb_port_suspend(struct musb *musb, bool do_suspend);
1594 + extern void musb_port_reset(struct musb *musb, bool do_reset);
1595 + extern void musb_host_finish_resume(struct work_struct *work);
1596 + #else
1597 +@@ -124,7 +124,10 @@ static inline void musb_root_disconnect(struct musb *musb) {}
1598 + static inline void musb_host_resume_root_hub(struct musb *musb) {}
1599 + static inline void musb_host_poll_rh_status(struct musb *musb) {}
1600 + static inline void musb_host_poke_root_hub(struct musb *musb) {}
1601 +-static inline void musb_port_suspend(struct musb *musb, bool do_suspend) {}
1602 ++static inline int musb_port_suspend(struct musb *musb, bool do_suspend)
1603 ++{
1604 ++ return 0;
1605 ++}
1606 + static inline void musb_port_reset(struct musb *musb, bool do_reset) {}
1607 + static inline void musb_host_finish_resume(struct work_struct *work) {}
1608 + #endif
1609 +diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
1610 +index 92d5f718659b..ac5458a69de5 100644
1611 +--- a/drivers/usb/musb/musb_virthub.c
1612 ++++ b/drivers/usb/musb/musb_virthub.c
1613 +@@ -74,14 +74,14 @@ void musb_host_finish_resume(struct work_struct *work)
1614 + spin_unlock_irqrestore(&musb->lock, flags);
1615 + }
1616 +
1617 +-void musb_port_suspend(struct musb *musb, bool do_suspend)
1618 ++int musb_port_suspend(struct musb *musb, bool do_suspend)
1619 + {
1620 + struct usb_otg *otg = musb->xceiv->otg;
1621 + u8 power;
1622 + void __iomem *mbase = musb->mregs;
1623 +
1624 + if (!is_host_active(musb))
1625 +- return;
1626 ++ return 0;
1627 +
1628 + /* NOTE: this doesn't necessarily put PHY into low power mode,
1629 + * turning off its clock; that's a function of PHY integration and
1630 +@@ -92,16 +92,20 @@ void musb_port_suspend(struct musb *musb, bool do_suspend)
1631 + if (do_suspend) {
1632 + int retries = 10000;
1633 +
1634 +- power &= ~MUSB_POWER_RESUME;
1635 +- power |= MUSB_POWER_SUSPENDM;
1636 +- musb_writeb(mbase, MUSB_POWER, power);
1637 ++ if (power & MUSB_POWER_RESUME)
1638 ++ return -EBUSY;
1639 +
1640 +- /* Needed for OPT A tests */
1641 +- power = musb_readb(mbase, MUSB_POWER);
1642 +- while (power & MUSB_POWER_SUSPENDM) {
1643 ++ if (!(power & MUSB_POWER_SUSPENDM)) {
1644 ++ power |= MUSB_POWER_SUSPENDM;
1645 ++ musb_writeb(mbase, MUSB_POWER, power);
1646 ++
1647 ++ /* Needed for OPT A tests */
1648 + power = musb_readb(mbase, MUSB_POWER);
1649 +- if (retries-- < 1)
1650 +- break;
1651 ++ while (power & MUSB_POWER_SUSPENDM) {
1652 ++ power = musb_readb(mbase, MUSB_POWER);
1653 ++ if (retries-- < 1)
1654 ++ break;
1655 ++ }
1656 + }
1657 +
1658 + dev_dbg(musb->controller, "Root port suspended, power %02x\n", power);
1659 +@@ -138,6 +142,7 @@ void musb_port_suspend(struct musb *musb, bool do_suspend)
1660 + schedule_delayed_work(&musb->finish_resume_work,
1661 + msecs_to_jiffies(USB_RESUME_TIMEOUT));
1662 + }
1663 ++ return 0;
1664 + }
1665 +
1666 + void musb_port_reset(struct musb *musb, bool do_reset)
1667 +diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c
1668 +index 734a9158946b..e55304d5cf07 100644
1669 +--- a/drivers/video/backlight/as3711_bl.c
1670 ++++ b/drivers/video/backlight/as3711_bl.c
1671 +@@ -262,10 +262,10 @@ static int as3711_bl_register(struct platform_device *pdev,
1672 + static int as3711_backlight_parse_dt(struct device *dev)
1673 + {
1674 + struct as3711_bl_pdata *pdata = dev_get_platdata(dev);
1675 +- struct device_node *bl =
1676 +- of_find_node_by_name(dev->parent->of_node, "backlight"), *fb;
1677 ++ struct device_node *bl, *fb;
1678 + int ret;
1679 +
1680 ++ bl = of_get_child_by_name(dev->parent->of_node, "backlight");
1681 + if (!bl) {
1682 + dev_dbg(dev, "backlight node not found\n");
1683 + return -ENODEV;
1684 +@@ -279,7 +279,7 @@ static int as3711_backlight_parse_dt(struct device *dev)
1685 + if (pdata->su1_max_uA <= 0)
1686 + ret = -EINVAL;
1687 + if (ret < 0)
1688 +- return ret;
1689 ++ goto err_put_bl;
1690 + }
1691 +
1692 + fb = of_parse_phandle(bl, "su2-dev", 0);
1693 +@@ -292,7 +292,7 @@ static int as3711_backlight_parse_dt(struct device *dev)
1694 + if (pdata->su2_max_uA <= 0)
1695 + ret = -EINVAL;
1696 + if (ret < 0)
1697 +- return ret;
1698 ++ goto err_put_bl;
1699 +
1700 + if (of_find_property(bl, "su2-feedback-voltage", NULL)) {
1701 + pdata->su2_feedback = AS3711_SU2_VOLTAGE;
1702 +@@ -314,8 +314,10 @@ static int as3711_backlight_parse_dt(struct device *dev)
1703 + pdata->su2_feedback = AS3711_SU2_CURR_AUTO;
1704 + count++;
1705 + }
1706 +- if (count != 1)
1707 +- return -EINVAL;
1708 ++ if (count != 1) {
1709 ++ ret = -EINVAL;
1710 ++ goto err_put_bl;
1711 ++ }
1712 +
1713 + count = 0;
1714 + if (of_find_property(bl, "su2-fbprot-lx-sd4", NULL)) {
1715 +@@ -334,8 +336,10 @@ static int as3711_backlight_parse_dt(struct device *dev)
1716 + pdata->su2_fbprot = AS3711_SU2_GPIO4;
1717 + count++;
1718 + }
1719 +- if (count != 1)
1720 +- return -EINVAL;
1721 ++ if (count != 1) {
1722 ++ ret = -EINVAL;
1723 ++ goto err_put_bl;
1724 ++ }
1725 +
1726 + count = 0;
1727 + if (of_find_property(bl, "su2-auto-curr1", NULL)) {
1728 +@@ -355,11 +359,20 @@ static int as3711_backlight_parse_dt(struct device *dev)
1729 + * At least one su2-auto-curr* must be specified iff
1730 + * AS3711_SU2_CURR_AUTO is used
1731 + */
1732 +- if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO))
1733 +- return -EINVAL;
1734 ++ if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) {
1735 ++ ret = -EINVAL;
1736 ++ goto err_put_bl;
1737 ++ }
1738 + }
1739 +
1740 ++ of_node_put(bl);
1741 ++
1742 + return 0;
1743 ++
1744 ++err_put_bl:
1745 ++ of_node_put(bl);
1746 ++
1747 ++ return ret;
1748 + }
1749 +
1750 + static int as3711_backlight_probe(struct platform_device *pdev)
1751 +diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c
1752 +index 7b738d60ecc2..f3aa6088f1d9 100644
1753 +--- a/drivers/video/backlight/max8925_bl.c
1754 ++++ b/drivers/video/backlight/max8925_bl.c
1755 +@@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(struct platform_device *pdev)
1756 + if (!pdata)
1757 + return;
1758 +
1759 +- np = of_find_node_by_name(nproot, "backlight");
1760 ++ np = of_get_child_by_name(nproot, "backlight");
1761 + if (!np) {
1762 + dev_err(&pdev->dev, "failed to find backlight node\n");
1763 + return;
1764 +@@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(struct platform_device *pdev)
1765 + if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val))
1766 + pdata->dual_string = val;
1767 +
1768 ++ of_node_put(np);
1769 ++
1770 + pdev->dev.platform_data = pdata;
1771 + }
1772 +
1773 +diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c
1774 +index 61d72bffd402..dc920e2aa094 100644
1775 +--- a/drivers/video/backlight/tps65217_bl.c
1776 ++++ b/drivers/video/backlight/tps65217_bl.c
1777 +@@ -184,11 +184,11 @@ static struct tps65217_bl_pdata *
1778 + tps65217_bl_parse_dt(struct platform_device *pdev)
1779 + {
1780 + struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
1781 +- struct device_node *node = of_node_get(tps->dev->of_node);
1782 ++ struct device_node *node;
1783 + struct tps65217_bl_pdata *pdata, *err;
1784 + u32 val;
1785 +
1786 +- node = of_find_node_by_name(node, "backlight");
1787 ++ node = of_get_child_by_name(tps->dev->of_node, "backlight");
1788 + if (!node)
1789 + return ERR_PTR(-ENODEV);
1790 +
1791 +diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
1792 +index 178ae93b7ebd..381236ff34d9 100644
1793 +--- a/drivers/video/fbdev/uvesafb.c
1794 ++++ b/drivers/video/fbdev/uvesafb.c
1795 +@@ -1059,7 +1059,8 @@ static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
1796 + info->cmap.len || cmap->start < info->cmap.start)
1797 + return -EINVAL;
1798 +
1799 +- entries = kmalloc(sizeof(*entries) * cmap->len, GFP_KERNEL);
1800 ++ entries = kmalloc_array(cmap->len, sizeof(*entries),
1801 ++ GFP_KERNEL);
1802 + if (!entries)
1803 + return -ENOMEM;
1804 +
1805 +diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
1806 +index a4621757a47f..dacb5919970c 100644
1807 +--- a/drivers/w1/masters/mxc_w1.c
1808 ++++ b/drivers/w1/masters/mxc_w1.c
1809 +@@ -113,6 +113,10 @@ static int mxc_w1_probe(struct platform_device *pdev)
1810 + if (IS_ERR(mdev->clk))
1811 + return PTR_ERR(mdev->clk);
1812 +
1813 ++ err = clk_prepare_enable(mdev->clk);
1814 ++ if (err)
1815 ++ return err;
1816 ++
1817 + clkrate = clk_get_rate(mdev->clk);
1818 + if (clkrate < 10000000)
1819 + dev_warn(&pdev->dev,
1820 +@@ -126,12 +130,10 @@ static int mxc_w1_probe(struct platform_device *pdev)
1821 +
1822 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1823 + mdev->regs = devm_ioremap_resource(&pdev->dev, res);
1824 +- if (IS_ERR(mdev->regs))
1825 +- return PTR_ERR(mdev->regs);
1826 +-
1827 +- err = clk_prepare_enable(mdev->clk);
1828 +- if (err)
1829 +- return err;
1830 ++ if (IS_ERR(mdev->regs)) {
1831 ++ err = PTR_ERR(mdev->regs);
1832 ++ goto out_disable_clk;
1833 ++ }
1834 +
1835 + /* Software reset 1-Wire module */
1836 + writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
1837 +@@ -147,8 +149,12 @@ static int mxc_w1_probe(struct platform_device *pdev)
1838 +
1839 + err = w1_add_master_device(&mdev->bus_master);
1840 + if (err)
1841 +- clk_disable_unprepare(mdev->clk);
1842 ++ goto out_disable_clk;
1843 +
1844 ++ return 0;
1845 ++
1846 ++out_disable_clk:
1847 ++ clk_disable_unprepare(mdev->clk);
1848 + return err;
1849 + }
1850 +
1851 +diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
1852 +index 39886edfa222..88c1b8c01473 100644
1853 +--- a/drivers/w1/w1.c
1854 ++++ b/drivers/w1/w1.c
1855 +@@ -741,7 +741,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
1856 +
1857 + /* slave modules need to be loaded in a context with unlocked mutex */
1858 + mutex_unlock(&dev->mutex);
1859 +- request_module("w1-family-0x%02x", rn->family);
1860 ++ request_module("w1-family-0x%02X", rn->family);
1861 + mutex_lock(&dev->mutex);
1862 +
1863 + spin_lock(&w1_flock);
1864 +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
1865 +index 468961c59fa5..21d679f88dfa 100644
1866 +--- a/drivers/xen/events/events_base.c
1867 ++++ b/drivers/xen/events/events_base.c
1868 +@@ -637,8 +637,6 @@ static void __unbind_from_irq(unsigned int irq)
1869 + xen_irq_info_cleanup(info);
1870 + }
1871 +
1872 +- BUG_ON(info_for_irq(irq)->type == IRQT_UNBOUND);
1873 +-
1874 + xen_free_irq(irq);
1875 + }
1876 +
1877 +diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
1878 +index 78f005f37847..dd784bcf7c96 100644
1879 +--- a/fs/binfmt_misc.c
1880 ++++ b/fs/binfmt_misc.c
1881 +@@ -369,8 +369,13 @@ static Node *create_entry(const char __user *buffer, size_t count)
1882 + s = strchr(p, del);
1883 + if (!s)
1884 + goto einval;
1885 +- *s++ = '\0';
1886 +- e->offset = simple_strtoul(p, &p, 10);
1887 ++ *s = '\0';
1888 ++ if (p != s) {
1889 ++ int r = kstrtoint(p, 10, &e->offset);
1890 ++ if (r != 0 || e->offset < 0)
1891 ++ goto einval;
1892 ++ }
1893 ++ p = s;
1894 + if (*p++)
1895 + goto einval;
1896 + pr_debug("register: offset: %#x\n", e->offset);
1897 +@@ -410,7 +415,8 @@ static Node *create_entry(const char __user *buffer, size_t count)
1898 + if (e->mask &&
1899 + string_unescape_inplace(e->mask, UNESCAPE_HEX) != e->size)
1900 + goto einval;
1901 +- if (e->size + e->offset > BINPRM_BUF_SIZE)
1902 ++ if (e->size > BINPRM_BUF_SIZE ||
1903 ++ BINPRM_BUF_SIZE - e->size < e->offset)
1904 + goto einval;
1905 + pr_debug("register: magic/mask length: %i\n", e->size);
1906 + if (USE_DEBUG) {
1907 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1908 +index 1f01a8172308..b895be3d4311 100644
1909 +--- a/fs/btrfs/inode.c
1910 ++++ b/fs/btrfs/inode.c
1911 +@@ -1202,6 +1202,8 @@ static noinline int csum_exist_in_range(struct btrfs_root *root,
1912 + list_del(&sums->list);
1913 + kfree(sums);
1914 + }
1915 ++ if (ret < 0)
1916 ++ return ret;
1917 + return 1;
1918 + }
1919 +
1920 +@@ -1351,10 +1353,23 @@ next_slot:
1921 + goto out_check;
1922 + if (btrfs_extent_readonly(root, disk_bytenr))
1923 + goto out_check;
1924 +- if (btrfs_cross_ref_exist(trans, root, ino,
1925 ++ ret = btrfs_cross_ref_exist(trans, root, ino,
1926 + found_key.offset -
1927 +- extent_offset, disk_bytenr))
1928 ++ extent_offset, disk_bytenr);
1929 ++ if (ret) {
1930 ++ /*
1931 ++ * ret could be -EIO if the above fails to read
1932 ++ * metadata.
1933 ++ */
1934 ++ if (ret < 0) {
1935 ++ if (cow_start != (u64)-1)
1936 ++ cur_offset = cow_start;
1937 ++ goto error;
1938 ++ }
1939 ++
1940 ++ WARN_ON_ONCE(nolock);
1941 + goto out_check;
1942 ++ }
1943 + disk_bytenr += extent_offset;
1944 + disk_bytenr += cur_offset - found_key.offset;
1945 + num_bytes = min(end + 1, extent_end) - cur_offset;
1946 +@@ -1372,8 +1387,20 @@ next_slot:
1947 + * this ensure that csum for a given extent are
1948 + * either valid or do not exist.
1949 + */
1950 +- if (csum_exist_in_range(root, disk_bytenr, num_bytes))
1951 ++ ret = csum_exist_in_range(root, disk_bytenr, num_bytes);
1952 ++ if (ret) {
1953 ++ /*
1954 ++ * ret could be -EIO if the above fails to read
1955 ++ * metadata.
1956 ++ */
1957 ++ if (ret < 0) {
1958 ++ if (cow_start != (u64)-1)
1959 ++ cur_offset = cow_start;
1960 ++ goto error;
1961 ++ }
1962 ++ WARN_ON_ONCE(nolock);
1963 + goto out_check;
1964 ++ }
1965 + nocow = 1;
1966 + } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
1967 + extent_end = found_key.offset +
1968 +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
1969 +index 4e3c889c1876..6caeb946fc1d 100644
1970 +--- a/fs/btrfs/ioctl.c
1971 ++++ b/fs/btrfs/ioctl.c
1972 +@@ -3923,11 +3923,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1973 + if (!(src_file.file->f_mode & FMODE_READ))
1974 + goto out_fput;
1975 +
1976 +- /* don't make the dst file partly checksummed */
1977 +- if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) !=
1978 +- (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM))
1979 +- goto out_fput;
1980 +-
1981 + ret = -EISDIR;
1982 + if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode))
1983 + goto out_fput;
1984 +@@ -3942,6 +3937,13 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1985 + mutex_lock(&src->i_mutex);
1986 + }
1987 +
1988 ++ /* don't make the dst file partly checksummed */
1989 ++ if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) !=
1990 ++ (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) {
1991 ++ ret = -EINVAL;
1992 ++ goto out_unlock;
1993 ++ }
1994 ++
1995 + /* determine range to clone */
1996 + ret = -EINVAL;
1997 + if (off + len > src->i_size || off + len < off)
1998 +diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
1999 +index b091d94ceef6..6dca9f937bf6 100644
2000 +--- a/fs/btrfs/scrub.c
2001 ++++ b/fs/btrfs/scrub.c
2002 +@@ -2513,7 +2513,7 @@ static int scrub_extent(struct scrub_ctx *sctx, u64 logical, u64 len,
2003 + have_csum = scrub_find_csum(sctx, logical, csum);
2004 + if (have_csum == 0)
2005 + ++sctx->stat.no_csum;
2006 +- if (sctx->is_dev_replace && !have_csum) {
2007 ++ if (0 && sctx->is_dev_replace && !have_csum) {
2008 + ret = copy_nocow_pages(sctx, logical, l,
2009 + mirror_num,
2010 + physical_for_dev_replace);
2011 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2012 +index 56ce7fd0f0d0..30efeb656c1e 100644
2013 +--- a/fs/ext4/inode.c
2014 ++++ b/fs/ext4/inode.c
2015 +@@ -3787,28 +3787,28 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
2016 + EXT4_BLOCK_SIZE_BITS(sb);
2017 + stop_block = (offset + length) >> EXT4_BLOCK_SIZE_BITS(sb);
2018 +
2019 +- /* If there are no blocks to remove, return now */
2020 +- if (first_block >= stop_block)
2021 +- goto out_stop;
2022 ++ /* If there are blocks to remove, do it */
2023 ++ if (stop_block > first_block) {
2024 +
2025 +- down_write(&EXT4_I(inode)->i_data_sem);
2026 +- ext4_discard_preallocations(inode);
2027 ++ down_write(&EXT4_I(inode)->i_data_sem);
2028 ++ ext4_discard_preallocations(inode);
2029 +
2030 +- ret = ext4_es_remove_extent(inode, first_block,
2031 +- stop_block - first_block);
2032 +- if (ret) {
2033 +- up_write(&EXT4_I(inode)->i_data_sem);
2034 +- goto out_stop;
2035 +- }
2036 ++ ret = ext4_es_remove_extent(inode, first_block,
2037 ++ stop_block - first_block);
2038 ++ if (ret) {
2039 ++ up_write(&EXT4_I(inode)->i_data_sem);
2040 ++ goto out_stop;
2041 ++ }
2042 +
2043 +- if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
2044 +- ret = ext4_ext_remove_space(inode, first_block,
2045 +- stop_block - 1);
2046 +- else
2047 +- ret = ext4_ind_remove_space(handle, inode, first_block,
2048 +- stop_block);
2049 ++ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
2050 ++ ret = ext4_ext_remove_space(inode, first_block,
2051 ++ stop_block - 1);
2052 ++ else
2053 ++ ret = ext4_ind_remove_space(handle, inode, first_block,
2054 ++ stop_block);
2055 +
2056 +- up_write(&EXT4_I(inode)->i_data_sem);
2057 ++ up_write(&EXT4_I(inode)->i_data_sem);
2058 ++ }
2059 + if (IS_SYNC(inode))
2060 + ext4_handle_sync(handle);
2061 +
2062 +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
2063 +index 74516efd874c..d2421fd38833 100644
2064 +--- a/fs/ext4/resize.c
2065 ++++ b/fs/ext4/resize.c
2066 +@@ -1903,7 +1903,7 @@ retry:
2067 + return 0;
2068 +
2069 + n_group = ext4_get_group_number(sb, n_blocks_count - 1);
2070 +- if (n_group > (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) {
2071 ++ if (n_group >= (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) {
2072 + ext4_warning(sb, "resize would cause inodes_count overflow");
2073 + return -EINVAL;
2074 + }
2075 +diff --git a/fs/fuse/control.c b/fs/fuse/control.c
2076 +index f863ac6647ac..89a4b231e79c 100644
2077 +--- a/fs/fuse/control.c
2078 ++++ b/fs/fuse/control.c
2079 +@@ -211,10 +211,11 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
2080 + if (!dentry)
2081 + return NULL;
2082 +
2083 +- fc->ctl_dentry[fc->ctl_ndents++] = dentry;
2084 + inode = new_inode(fuse_control_sb);
2085 +- if (!inode)
2086 ++ if (!inode) {
2087 ++ dput(dentry);
2088 + return NULL;
2089 ++ }
2090 +
2091 + inode->i_ino = get_next_ino();
2092 + inode->i_mode = mode;
2093 +@@ -228,6 +229,9 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
2094 + set_nlink(inode, nlink);
2095 + inode->i_private = fc;
2096 + d_add(dentry, inode);
2097 ++
2098 ++ fc->ctl_dentry[fc->ctl_ndents++] = dentry;
2099 ++
2100 + return dentry;
2101 + }
2102 +
2103 +@@ -284,7 +288,10 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc)
2104 + for (i = fc->ctl_ndents - 1; i >= 0; i--) {
2105 + struct dentry *dentry = fc->ctl_dentry[i];
2106 + d_inode(dentry)->i_private = NULL;
2107 +- d_drop(dentry);
2108 ++ if (!i) {
2109 ++ /* Get rid of submounts: */
2110 ++ d_invalidate(dentry);
2111 ++ }
2112 + dput(dentry);
2113 + }
2114 + drop_nlink(d_inode(fuse_control_sb->s_root));
2115 +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
2116 +index 5068dbf80ff8..49b7b40f7598 100644
2117 +--- a/fs/fuse/dir.c
2118 ++++ b/fs/fuse/dir.c
2119 +@@ -1609,8 +1609,19 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr,
2120 + return err;
2121 +
2122 + if (attr->ia_valid & ATTR_OPEN) {
2123 +- if (fc->atomic_o_trunc)
2124 ++ /* This is coming from open(..., ... | O_TRUNC); */
2125 ++ WARN_ON(!(attr->ia_valid & ATTR_SIZE));
2126 ++ WARN_ON(attr->ia_size != 0);
2127 ++ if (fc->atomic_o_trunc) {
2128 ++ /*
2129 ++ * No need to send request to userspace, since actual
2130 ++ * truncation has already been done by OPEN. But still
2131 ++ * need to truncate page cache.
2132 ++ */
2133 ++ i_size_write(inode, 0);
2134 ++ truncate_pagecache(inode, 0);
2135 + return 0;
2136 ++ }
2137 + file = NULL;
2138 + }
2139 +
2140 +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
2141 +index 0d5e8e59b390..f0b73e0c6d48 100644
2142 +--- a/fs/fuse/inode.c
2143 ++++ b/fs/fuse/inode.c
2144 +@@ -1158,6 +1158,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
2145 + err_put_conn:
2146 + fuse_bdi_destroy(fc);
2147 + fuse_conn_put(fc);
2148 ++ sb->s_fs_info = NULL;
2149 + err_fput:
2150 + fput(file);
2151 + err:
2152 +diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
2153 +index 1ee62e62ea76..c99a887100db 100644
2154 +--- a/fs/nfs/nfs4idmap.c
2155 ++++ b/fs/nfs/nfs4idmap.c
2156 +@@ -343,7 +343,7 @@ static ssize_t nfs_idmap_lookup_name(__u32 id, const char *type, char *buf,
2157 + int id_len;
2158 + ssize_t ret;
2159 +
2160 +- id_len = snprintf(id_str, sizeof(id_str), "%u", id);
2161 ++ id_len = nfs_map_numeric_to_string(id, id_str, sizeof(id_str));
2162 + ret = nfs_idmap_get_key(id_str, id_len, type, buf, buflen, idmap);
2163 + if (ret < 0)
2164 + return -EINVAL;
2165 +@@ -626,7 +626,8 @@ static int nfs_idmap_read_and_verify_message(struct idmap_msg *im,
2166 + if (strcmp(upcall->im_name, im->im_name) != 0)
2167 + break;
2168 + /* Note: here we store the NUL terminator too */
2169 +- len = sprintf(id_str, "%d", im->im_id) + 1;
2170 ++ len = 1 + nfs_map_numeric_to_string(im->im_id, id_str,
2171 ++ sizeof(id_str));
2172 + ret = nfs_idmap_instantiate(key, authkey, id_str, len);
2173 + break;
2174 + case IDMAP_CONV_IDTONAME:
2175 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
2176 +index 544672b440de..57e3262ec57a 100644
2177 +--- a/fs/nfsd/nfs4xdr.c
2178 ++++ b/fs/nfsd/nfs4xdr.c
2179 +@@ -3595,7 +3595,8 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2180 + nfserr = nfserr_resource;
2181 + goto err_no_verf;
2182 + }
2183 +- maxcount = min_t(u32, readdir->rd_maxcount, INT_MAX);
2184 ++ maxcount = svc_max_payload(resp->rqstp);
2185 ++ maxcount = min_t(u32, readdir->rd_maxcount, maxcount);
2186 + /*
2187 + * Note the rfc defines rd_maxcount as the size of the
2188 + * READDIR4resok structure, which includes the verifier above
2189 +@@ -3609,7 +3610,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2190 +
2191 + /* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */
2192 + if (!readdir->rd_dircount)
2193 +- readdir->rd_dircount = INT_MAX;
2194 ++ readdir->rd_dircount = svc_max_payload(resp->rqstp);
2195 +
2196 + readdir->xdr = xdr;
2197 + readdir->rd_maxcount = maxcount;
2198 +diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
2199 +index 0b9da5b6e0f9..22dba8837a86 100644
2200 +--- a/fs/ubifs/journal.c
2201 ++++ b/fs/ubifs/journal.c
2202 +@@ -1107,7 +1107,7 @@ static int recomp_data_node(const struct ubifs_info *c,
2203 + int err, len, compr_type, out_len;
2204 +
2205 + out_len = le32_to_cpu(dn->size);
2206 +- buf = kmalloc(out_len * WORST_COMPR_FACTOR, GFP_NOFS);
2207 ++ buf = kmalloc_array(out_len, WORST_COMPR_FACTOR, GFP_NOFS);
2208 + if (!buf)
2209 + return -ENOMEM;
2210 +
2211 +diff --git a/fs/udf/directory.c b/fs/udf/directory.c
2212 +index c763fda257bf..637114e8c7fd 100644
2213 +--- a/fs/udf/directory.c
2214 ++++ b/fs/udf/directory.c
2215 +@@ -150,6 +150,9 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
2216 + sizeof(struct fileIdentDesc));
2217 + }
2218 + }
2219 ++ /* Got last entry outside of dir size - fs is corrupted! */
2220 ++ if (*nf_pos > dir->i_size)
2221 ++ return NULL;
2222 + return fi;
2223 + }
2224 +
2225 +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
2226 +index fe14382f9664..1383e1c03ff2 100644
2227 +--- a/include/linux/blkdev.h
2228 ++++ b/include/linux/blkdev.h
2229 +@@ -882,8 +882,8 @@ static inline unsigned int blk_max_size_offset(struct request_queue *q,
2230 + if (!q->limits.chunk_sectors)
2231 + return q->limits.max_sectors;
2232 +
2233 +- return q->limits.chunk_sectors -
2234 +- (offset & (q->limits.chunk_sectors - 1));
2235 ++ return min(q->limits.max_sectors, (unsigned int)(q->limits.chunk_sectors -
2236 ++ (offset & (q->limits.chunk_sectors - 1))));
2237 + }
2238 +
2239 + static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
2240 +diff --git a/include/linux/compiler.h b/include/linux/compiler.h
2241 +index 6fc9a6dd5ed2..0db1fa621d8a 100644
2242 +--- a/include/linux/compiler.h
2243 ++++ b/include/linux/compiler.h
2244 +@@ -111,7 +111,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
2245 + #define unlikely_notrace(x) __builtin_expect(!!(x), 0)
2246 +
2247 + #define __branch_check__(x, expect) ({ \
2248 +- int ______r; \
2249 ++ long ______r; \
2250 + static struct ftrace_branch_data \
2251 + __attribute__((__aligned__(4))) \
2252 + __attribute__((section("_ftrace_annotated_branch"))) \
2253 +diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
2254 +index 1600c55828e0..93a774ce4922 100644
2255 +--- a/include/linux/iio/buffer.h
2256 ++++ b/include/linux/iio/buffer.h
2257 +@@ -49,7 +49,7 @@ struct iio_buffer_access_funcs {
2258 + int (*request_update)(struct iio_buffer *buffer);
2259 +
2260 + int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
2261 +- int (*set_length)(struct iio_buffer *buffer, int length);
2262 ++ int (*set_length)(struct iio_buffer *buffer, unsigned int length);
2263 +
2264 + void (*release)(struct iio_buffer *buffer);
2265 +
2266 +@@ -78,8 +78,8 @@ struct iio_buffer_access_funcs {
2267 + * @watermark: [INTERN] number of datums to wait for poll/read.
2268 + */
2269 + struct iio_buffer {
2270 +- int length;
2271 +- int bytes_per_datum;
2272 ++ unsigned int length;
2273 ++ size_t bytes_per_datum;
2274 + struct attribute_group *scan_el_attrs;
2275 + long *scan_mask;
2276 + bool scan_timestamp;
2277 +diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
2278 +index 1878d0a96333..876688b5a356 100644
2279 +--- a/include/net/bluetooth/hci_core.h
2280 ++++ b/include/net/bluetooth/hci_core.h
2281 +@@ -878,7 +878,7 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst,
2282 + u16 conn_timeout, u8 role);
2283 + struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
2284 + u8 dst_type, u8 sec_level, u16 conn_timeout,
2285 +- u8 role);
2286 ++ u8 role, bdaddr_t *direct_rpa);
2287 + struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
2288 + u8 sec_level, u8 auth_type);
2289 + struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
2290 +diff --git a/kernel/time/time.c b/kernel/time/time.c
2291 +index 86751c68e08d..de70ac1f84d0 100644
2292 +--- a/kernel/time/time.c
2293 ++++ b/kernel/time/time.c
2294 +@@ -28,6 +28,7 @@
2295 + */
2296 +
2297 + #include <linux/export.h>
2298 ++#include <linux/kernel.h>
2299 + #include <linux/timex.h>
2300 + #include <linux/capability.h>
2301 + #include <linux/timekeeper_internal.h>
2302 +@@ -258,9 +259,10 @@ unsigned int jiffies_to_msecs(const unsigned long j)
2303 + return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
2304 + #else
2305 + # if BITS_PER_LONG == 32
2306 +- return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32;
2307 ++ return (HZ_TO_MSEC_MUL32 * j + (1ULL << HZ_TO_MSEC_SHR32) - 1) >>
2308 ++ HZ_TO_MSEC_SHR32;
2309 + # else
2310 +- return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN;
2311 ++ return DIV_ROUND_UP(j * HZ_TO_MSEC_NUM, HZ_TO_MSEC_DEN);
2312 + # endif
2313 + #endif
2314 + }
2315 +diff --git a/lib/vsprintf.c b/lib/vsprintf.c
2316 +index f9cee8e1233c..646009db4198 100644
2317 +--- a/lib/vsprintf.c
2318 ++++ b/lib/vsprintf.c
2319 +@@ -1345,9 +1345,6 @@ char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec,
2320 + return string(buf, end, NULL, spec);
2321 +
2322 + switch (fmt[1]) {
2323 +- case 'r':
2324 +- return number(buf, end, clk_get_rate(clk), spec);
2325 +-
2326 + case 'n':
2327 + default:
2328 + #ifdef CONFIG_COMMON_CLK
2329 +diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
2330 +index 24e9410923d0..80be0ee17ff3 100644
2331 +--- a/net/bluetooth/hci_conn.c
2332 ++++ b/net/bluetooth/hci_conn.c
2333 +@@ -708,7 +708,8 @@ done:
2334 + }
2335 +
2336 + static void hci_req_add_le_create_conn(struct hci_request *req,
2337 +- struct hci_conn *conn)
2338 ++ struct hci_conn *conn,
2339 ++ bdaddr_t *direct_rpa)
2340 + {
2341 + struct hci_cp_le_create_conn cp;
2342 + struct hci_dev *hdev = conn->hdev;
2343 +@@ -716,11 +717,23 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
2344 +
2345 + memset(&cp, 0, sizeof(cp));
2346 +
2347 +- /* Update random address, but set require_privacy to false so
2348 +- * that we never connect with an non-resolvable address.
2349 ++ /* If direct address was provided we use it instead of current
2350 ++ * address.
2351 + */
2352 +- if (hci_update_random_address(req, false, &own_addr_type))
2353 +- return;
2354 ++ if (direct_rpa) {
2355 ++ if (bacmp(&req->hdev->random_addr, direct_rpa))
2356 ++ hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6,
2357 ++ direct_rpa);
2358 ++
2359 ++ /* direct address is always RPA */
2360 ++ own_addr_type = ADDR_LE_DEV_RANDOM;
2361 ++ } else {
2362 ++ /* Update random address, but set require_privacy to false so
2363 ++ * that we never connect with an non-resolvable address.
2364 ++ */
2365 ++ if (hci_update_random_address(req, false, &own_addr_type))
2366 ++ return;
2367 ++ }
2368 +
2369 + /* Set window to be the same value as the interval to enable
2370 + * continuous scanning.
2371 +@@ -782,7 +795,7 @@ static void hci_req_directed_advertising(struct hci_request *req,
2372 +
2373 + struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
2374 + u8 dst_type, u8 sec_level, u16 conn_timeout,
2375 +- u8 role)
2376 ++ u8 role, bdaddr_t *direct_rpa)
2377 + {
2378 + struct hci_conn_params *params;
2379 + struct hci_conn *conn, *conn_unfinished;
2380 +@@ -913,7 +926,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
2381 + hci_dev_set_flag(hdev, HCI_LE_SCAN_INTERRUPTED);
2382 + }
2383 +
2384 +- hci_req_add_le_create_conn(&req, conn);
2385 ++ hci_req_add_le_create_conn(&req, conn, direct_rpa);
2386 +
2387 + create_conn:
2388 + err = hci_req_run(&req, create_le_conn_complete);
2389 +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
2390 +index d57c11c1c6b5..d40d32a2c12d 100644
2391 +--- a/net/bluetooth/hci_event.c
2392 ++++ b/net/bluetooth/hci_event.c
2393 +@@ -4632,7 +4632,8 @@ static void hci_le_conn_update_complete_evt(struct hci_dev *hdev,
2394 + /* This function requires the caller holds hdev->lock */
2395 + static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
2396 + bdaddr_t *addr,
2397 +- u8 addr_type, u8 adv_type)
2398 ++ u8 addr_type, u8 adv_type,
2399 ++ bdaddr_t *direct_rpa)
2400 + {
2401 + struct hci_conn *conn;
2402 + struct hci_conn_params *params;
2403 +@@ -4683,7 +4684,8 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
2404 + }
2405 +
2406 + conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW,
2407 +- HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER);
2408 ++ HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER,
2409 ++ direct_rpa);
2410 + if (!IS_ERR(conn)) {
2411 + /* If HCI_AUTO_CONN_EXPLICIT is set, conn is already owned
2412 + * by higher layer that tried to connect, if no then
2413 +@@ -4780,8 +4782,13 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
2414 + bdaddr_type = irk->addr_type;
2415 + }
2416 +
2417 +- /* Check if we have been requested to connect to this device */
2418 +- conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type);
2419 ++ /* Check if we have been requested to connect to this device.
2420 ++ *
2421 ++ * direct_addr is set only for directed advertising reports (it is NULL
2422 ++ * for advertising reports) and is already verified to be RPA above.
2423 ++ */
2424 ++ conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type,
2425 ++ direct_addr);
2426 + if (conn && type == LE_ADV_IND) {
2427 + /* Store report for later inclusion by
2428 + * mgmt_device_connected
2429 +diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
2430 +index 51eab9b5baa1..9f70c267a7a5 100644
2431 +--- a/net/bridge/netfilter/ebtables.c
2432 ++++ b/net/bridge/netfilter/ebtables.c
2433 +@@ -1912,7 +1912,8 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
2434 + int off, pad = 0;
2435 + unsigned int size_kern, match_size = mwt->match_size;
2436 +
2437 +- strlcpy(name, mwt->u.name, sizeof(name));
2438 ++ if (strscpy(name, mwt->u.name, sizeof(name)) < 0)
2439 ++ return -EINVAL;
2440 +
2441 + if (state->buf_kern_start)
2442 + dst = state->buf_kern_start + state->buf_kern_offset;
2443 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2444 +index 23b95aead897..a9041915afc0 100644
2445 +--- a/net/ipv4/tcp_input.c
2446 ++++ b/net/ipv4/tcp_input.c
2447 +@@ -612,7 +612,7 @@ void tcp_rcv_space_adjust(struct sock *sk)
2448 + sk->sk_rcvbuf = rcvbuf;
2449 +
2450 + /* Make the window clamp follow along. */
2451 +- tp->window_clamp = rcvwin;
2452 ++ tp->window_clamp = tcp_win_from_space(rcvbuf);
2453 + }
2454 + }
2455 + tp->rcvq_space.space = copied;
2456 +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
2457 +index 61c93a93f228..eeda67c3dd11 100644
2458 +--- a/net/ipv4/tcp_ipv4.c
2459 ++++ b/net/ipv4/tcp_ipv4.c
2460 +@@ -1627,6 +1627,10 @@ process:
2461 + reqsk_put(req);
2462 + goto discard_it;
2463 + }
2464 ++ if (tcp_checksum_complete(skb)) {
2465 ++ reqsk_put(req);
2466 ++ goto csum_error;
2467 ++ }
2468 + if (unlikely(sk->sk_state != TCP_LISTEN)) {
2469 + inet_csk_reqsk_queue_drop_and_put(sk, req);
2470 + goto lookup;
2471 +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
2472 +index 74cbcc4b399c..90abe88e1b40 100644
2473 +--- a/net/ipv6/tcp_ipv6.c
2474 ++++ b/net/ipv6/tcp_ipv6.c
2475 +@@ -1415,6 +1415,10 @@ process:
2476 + reqsk_put(req);
2477 + goto discard_it;
2478 + }
2479 ++ if (tcp_checksum_complete(skb)) {
2480 ++ reqsk_put(req);
2481 ++ goto csum_error;
2482 ++ }
2483 + if (unlikely(sk->sk_state != TCP_LISTEN)) {
2484 + inet_csk_reqsk_queue_drop_and_put(sk, req);
2485 + goto lookup;
2486 +diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
2487 +index c074771a10f7..1ca0c2f3d92b 100644
2488 +--- a/net/ipv6/xfrm6_policy.c
2489 ++++ b/net/ipv6/xfrm6_policy.c
2490 +@@ -121,7 +121,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
2491 + struct flowi6 *fl6 = &fl->u.ip6;
2492 + int onlyproto = 0;
2493 + const struct ipv6hdr *hdr = ipv6_hdr(skb);
2494 +- u16 offset = sizeof(*hdr);
2495 ++ u32 offset = sizeof(*hdr);
2496 + struct ipv6_opt_hdr *exthdr;
2497 + const unsigned char *nh = skb_network_header(skb);
2498 + u16 nhoff = IP6CB(skb)->nhoff;
2499 +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
2500 +index c0656510c4dc..3167ec76903a 100644
2501 +--- a/net/netfilter/ipvs/ip_vs_ctl.c
2502 ++++ b/net/netfilter/ipvs/ip_vs_ctl.c
2503 +@@ -2349,8 +2349,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2504 + struct ipvs_sync_daemon_cfg cfg;
2505 +
2506 + memset(&cfg, 0, sizeof(cfg));
2507 +- strlcpy(cfg.mcast_ifn, dm->mcast_ifn,
2508 +- sizeof(cfg.mcast_ifn));
2509 ++ ret = -EINVAL;
2510 ++ if (strscpy(cfg.mcast_ifn, dm->mcast_ifn,
2511 ++ sizeof(cfg.mcast_ifn)) <= 0)
2512 ++ goto out_dec;
2513 + cfg.syncid = dm->syncid;
2514 + ret = start_sync_thread(ipvs, &cfg, dm->state);
2515 + } else {
2516 +@@ -2388,12 +2390,19 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2517 + }
2518 + }
2519 +
2520 ++ if ((cmd == IP_VS_SO_SET_ADD || cmd == IP_VS_SO_SET_EDIT) &&
2521 ++ strnlen(usvc.sched_name, IP_VS_SCHEDNAME_MAXLEN) ==
2522 ++ IP_VS_SCHEDNAME_MAXLEN) {
2523 ++ ret = -EINVAL;
2524 ++ goto out_unlock;
2525 ++ }
2526 ++
2527 + /* Check for valid protocol: TCP or UDP or SCTP, even for fwmark!=0 */
2528 + if (usvc.protocol != IPPROTO_TCP && usvc.protocol != IPPROTO_UDP &&
2529 + usvc.protocol != IPPROTO_SCTP) {
2530 +- pr_err("set_ctl: invalid protocol: %d %pI4:%d %s\n",
2531 ++ pr_err("set_ctl: invalid protocol: %d %pI4:%d\n",
2532 + usvc.protocol, &usvc.addr.ip,
2533 +- ntohs(usvc.port), usvc.sched_name);
2534 ++ ntohs(usvc.port));
2535 + ret = -EFAULT;
2536 + goto out_unlock;
2537 + }
2538 +@@ -2822,7 +2831,7 @@ static const struct nla_policy ip_vs_cmd_policy[IPVS_CMD_ATTR_MAX + 1] = {
2539 + static const struct nla_policy ip_vs_daemon_policy[IPVS_DAEMON_ATTR_MAX + 1] = {
2540 + [IPVS_DAEMON_ATTR_STATE] = { .type = NLA_U32 },
2541 + [IPVS_DAEMON_ATTR_MCAST_IFN] = { .type = NLA_NUL_STRING,
2542 +- .len = IP_VS_IFNAME_MAXLEN },
2543 ++ .len = IP_VS_IFNAME_MAXLEN - 1 },
2544 + [IPVS_DAEMON_ATTR_SYNC_ID] = { .type = NLA_U32 },
2545 + [IPVS_DAEMON_ATTR_SYNC_MAXLEN] = { .type = NLA_U16 },
2546 + [IPVS_DAEMON_ATTR_MCAST_GROUP] = { .type = NLA_U32 },
2547 +@@ -2840,7 +2849,7 @@ static const struct nla_policy ip_vs_svc_policy[IPVS_SVC_ATTR_MAX + 1] = {
2548 + [IPVS_SVC_ATTR_PORT] = { .type = NLA_U16 },
2549 + [IPVS_SVC_ATTR_FWMARK] = { .type = NLA_U32 },
2550 + [IPVS_SVC_ATTR_SCHED_NAME] = { .type = NLA_NUL_STRING,
2551 +- .len = IP_VS_SCHEDNAME_MAXLEN },
2552 ++ .len = IP_VS_SCHEDNAME_MAXLEN - 1 },
2553 + [IPVS_SVC_ATTR_PE_NAME] = { .type = NLA_NUL_STRING,
2554 + .len = IP_VS_PENAME_MAXLEN },
2555 + [IPVS_SVC_ATTR_FLAGS] = { .type = NLA_BINARY,
2556 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
2557 +index d95cb69460f0..f9a13b67df5e 100644
2558 +--- a/net/xfrm/xfrm_policy.c
2559 ++++ b/net/xfrm/xfrm_policy.c
2560 +@@ -626,6 +626,11 @@ static void xfrm_hash_rebuild(struct work_struct *work)
2561 +
2562 + /* re-insert all policies by order of creation */
2563 + list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) {
2564 ++ if (policy->walk.dead ||
2565 ++ xfrm_policy_id2dir(policy->index) >= XFRM_POLICY_MAX) {
2566 ++ /* skip socket policies */
2567 ++ continue;
2568 ++ }
2569 + newpos = NULL;
2570 + chain = policy_hash_bysel(net, &policy->selector,
2571 + policy->family,
2572 +diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
2573 +index 9c6e10fb479f..273364c39171 100644
2574 +--- a/sound/pci/hda/hda_controller.c
2575 ++++ b/sound/pci/hda/hda_controller.c
2576 +@@ -547,8 +547,10 @@ int snd_hda_attach_pcm_stream(struct hda_bus *_bus, struct hda_codec *codec,
2577 + return err;
2578 + strlcpy(pcm->name, cpcm->name, sizeof(pcm->name));
2579 + apcm = kzalloc(sizeof(*apcm), GFP_KERNEL);
2580 +- if (apcm == NULL)
2581 ++ if (apcm == NULL) {
2582 ++ snd_device_free(chip->card, pcm);
2583 + return -ENOMEM;
2584 ++ }
2585 + apcm->chip = chip;
2586 + apcm->pcm = pcm;
2587 + apcm->codec = codec;
2588 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
2589 +index 9fae1d248318..cb19af145f46 100644
2590 +--- a/sound/pci/hda/patch_conexant.c
2591 ++++ b/sound/pci/hda/patch_conexant.c
2592 +@@ -851,6 +851,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
2593 + SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
2594 + SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK),
2595 + SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK),
2596 ++ SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK),
2597 ++ SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK),
2598 + SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
2599 + SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
2600 + SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
2601 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2602 +index 580b8943b965..d706a416b587 100644
2603 +--- a/sound/pci/hda/patch_realtek.c
2604 ++++ b/sound/pci/hda/patch_realtek.c
2605 +@@ -2447,6 +2447,7 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2606 + SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2607 + SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2608 + SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2609 ++ SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2610 + SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2611 + SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2612 + SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2613 +diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c
2614 +index 85962657aabe..517963ef4847 100644
2615 +--- a/sound/soc/cirrus/edb93xx.c
2616 ++++ b/sound/soc/cirrus/edb93xx.c
2617 +@@ -67,7 +67,7 @@ static struct snd_soc_dai_link edb93xx_dai = {
2618 + .cpu_dai_name = "ep93xx-i2s",
2619 + .codec_name = "spi0.0",
2620 + .codec_dai_name = "cs4271-hifi",
2621 +- .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
2622 ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
2623 + SND_SOC_DAIFMT_CBS_CFS,
2624 + .ops = &edb93xx_ops,
2625 + };
2626 +diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
2627 +index 934f8aefdd90..0dc3852c4621 100644
2628 +--- a/sound/soc/cirrus/ep93xx-i2s.c
2629 ++++ b/sound/soc/cirrus/ep93xx-i2s.c
2630 +@@ -51,7 +51,9 @@
2631 + #define EP93XX_I2S_WRDLEN_24 (1 << 0)
2632 + #define EP93XX_I2S_WRDLEN_32 (2 << 0)
2633 +
2634 +-#define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2) /* Right justify */
2635 ++#define EP93XX_I2S_RXLINCTRLDATA_R_JUST BIT(1) /* Right justify */
2636 ++
2637 ++#define EP93XX_I2S_TXLINCTRLDATA_R_JUST BIT(2) /* Right justify */
2638 +
2639 + #define EP93XX_I2S_CLKCFG_LRS (1 << 0) /* lrclk polarity */
2640 + #define EP93XX_I2S_CLKCFG_CKP (1 << 1) /* Bit clock polarity */
2641 +@@ -170,25 +172,25 @@ static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
2642 + unsigned int fmt)
2643 + {
2644 + struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai);
2645 +- unsigned int clk_cfg, lin_ctrl;
2646 ++ unsigned int clk_cfg;
2647 ++ unsigned int txlin_ctrl = 0;
2648 ++ unsigned int rxlin_ctrl = 0;
2649 +
2650 + clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG);
2651 +- lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA);
2652 +
2653 + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
2654 + case SND_SOC_DAIFMT_I2S:
2655 + clk_cfg |= EP93XX_I2S_CLKCFG_REL;
2656 +- lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST;
2657 + break;
2658 +
2659 + case SND_SOC_DAIFMT_LEFT_J:
2660 + clk_cfg &= ~EP93XX_I2S_CLKCFG_REL;
2661 +- lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST;
2662 + break;
2663 +
2664 + case SND_SOC_DAIFMT_RIGHT_J:
2665 + clk_cfg &= ~EP93XX_I2S_CLKCFG_REL;
2666 +- lin_ctrl |= EP93XX_I2S_LINCTRLDATA_R_JUST;
2667 ++ rxlin_ctrl |= EP93XX_I2S_RXLINCTRLDATA_R_JUST;
2668 ++ txlin_ctrl |= EP93XX_I2S_TXLINCTRLDATA_R_JUST;
2669 + break;
2670 +
2671 + default:
2672 +@@ -213,32 +215,32 @@ static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
2673 + switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
2674 + case SND_SOC_DAIFMT_NB_NF:
2675 + /* Negative bit clock, lrclk low on left word */
2676 +- clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL);
2677 ++ clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_LRS);
2678 + break;
2679 +
2680 + case SND_SOC_DAIFMT_NB_IF:
2681 + /* Negative bit clock, lrclk low on right word */
2682 + clk_cfg &= ~EP93XX_I2S_CLKCFG_CKP;
2683 +- clk_cfg |= EP93XX_I2S_CLKCFG_REL;
2684 ++ clk_cfg |= EP93XX_I2S_CLKCFG_LRS;
2685 + break;
2686 +
2687 + case SND_SOC_DAIFMT_IB_NF:
2688 + /* Positive bit clock, lrclk low on left word */
2689 + clk_cfg |= EP93XX_I2S_CLKCFG_CKP;
2690 +- clk_cfg &= ~EP93XX_I2S_CLKCFG_REL;
2691 ++ clk_cfg &= ~EP93XX_I2S_CLKCFG_LRS;
2692 + break;
2693 +
2694 + case SND_SOC_DAIFMT_IB_IF:
2695 + /* Positive bit clock, lrclk low on right word */
2696 +- clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL;
2697 ++ clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_LRS;
2698 + break;
2699 + }
2700 +
2701 + /* Write new register values */
2702 + ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg);
2703 + ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg);
2704 +- ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl);
2705 +- ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl);
2706 ++ ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, rxlin_ctrl);
2707 ++ ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, txlin_ctrl);
2708 + return 0;
2709 + }
2710 +
2711 +diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c
2712 +index 98089df08df6..c6737a573bc0 100644
2713 +--- a/sound/soc/cirrus/snappercl15.c
2714 ++++ b/sound/soc/cirrus/snappercl15.c
2715 +@@ -72,7 +72,7 @@ static struct snd_soc_dai_link snappercl15_dai = {
2716 + .codec_dai_name = "tlv320aic23-hifi",
2717 + .codec_name = "tlv320aic23-codec.0-001a",
2718 + .platform_name = "ep93xx-i2s",
2719 +- .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
2720 ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
2721 + SND_SOC_DAIFMT_CBS_CFS,
2722 + .ops = &snappercl15_ops,
2723 + };
2724 +diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
2725 +index 6a438a361592..9e784cc3e5d2 100644
2726 +--- a/sound/soc/soc-dapm.c
2727 ++++ b/sound/soc/soc-dapm.c
2728 +@@ -425,6 +425,8 @@ err_data:
2729 + static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
2730 + {
2731 + struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl);
2732 ++
2733 ++ list_del(&data->paths);
2734 + kfree(data->wlist);
2735 + kfree(data);
2736 + }
2737 +diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
2738 +index 425df5c86c9c..425597186677 100644
2739 +--- a/tools/perf/util/dso.c
2740 ++++ b/tools/perf/util/dso.c
2741 +@@ -249,6 +249,8 @@ int __kmod_path__parse(struct kmod_path *m, const char *path,
2742 + if ((strncmp(name, "[kernel.kallsyms]", 17) == 0) ||
2743 + (strncmp(name, "[guest.kernel.kallsyms", 22) == 0) ||
2744 + (strncmp(name, "[vdso]", 6) == 0) ||
2745 ++ (strncmp(name, "[vdso32]", 8) == 0) ||
2746 ++ (strncmp(name, "[vdsox32]", 9) == 0) ||
2747 + (strncmp(name, "[vsyscall]", 10) == 0)) {
2748 + m->kmod = false;
2749 +
2750 +diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
2751 +index 0b540b84f8b7..dc17c881275d 100644
2752 +--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
2753 ++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
2754 +@@ -111,6 +111,7 @@ struct intel_pt_decoder {
2755 + bool have_cyc;
2756 + bool fixup_last_mtc;
2757 + bool have_last_ip;
2758 ++ enum intel_pt_param_flags flags;
2759 + uint64_t pos;
2760 + uint64_t last_ip;
2761 + uint64_t ip;
2762 +@@ -213,6 +214,8 @@ struct intel_pt_decoder *intel_pt_decoder_new(struct intel_pt_params *params)
2763 + decoder->data = params->data;
2764 + decoder->return_compression = params->return_compression;
2765 +
2766 ++ decoder->flags = params->flags;
2767 ++
2768 + decoder->period = params->period;
2769 + decoder->period_type = params->period_type;
2770 +
2771 +@@ -1010,6 +1013,15 @@ out_no_progress:
2772 + return err;
2773 + }
2774 +
2775 ++static inline bool intel_pt_fup_with_nlip(struct intel_pt_decoder *decoder,
2776 ++ struct intel_pt_insn *intel_pt_insn,
2777 ++ uint64_t ip, int err)
2778 ++{
2779 ++ return decoder->flags & INTEL_PT_FUP_WITH_NLIP && !err &&
2780 ++ intel_pt_insn->branch == INTEL_PT_BR_INDIRECT &&
2781 ++ ip == decoder->ip + intel_pt_insn->length;
2782 ++}
2783 ++
2784 + static int intel_pt_walk_fup(struct intel_pt_decoder *decoder)
2785 + {
2786 + struct intel_pt_insn intel_pt_insn;
2787 +@@ -1022,7 +1034,8 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder)
2788 + err = intel_pt_walk_insn(decoder, &intel_pt_insn, ip);
2789 + if (err == INTEL_PT_RETURN)
2790 + return 0;
2791 +- if (err == -EAGAIN) {
2792 ++ if (err == -EAGAIN ||
2793 ++ intel_pt_fup_with_nlip(decoder, &intel_pt_insn, ip, err)) {
2794 + if (decoder->set_fup_tx_flags) {
2795 + decoder->set_fup_tx_flags = false;
2796 + decoder->tx_flags = decoder->fup_tx_flags;
2797 +@@ -1032,7 +1045,7 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder)
2798 + decoder->state.flags = decoder->fup_tx_flags;
2799 + return 0;
2800 + }
2801 +- return err;
2802 ++ return -EAGAIN;
2803 + }
2804 + decoder->set_fup_tx_flags = false;
2805 + if (err)
2806 +@@ -1268,7 +1281,6 @@ static int intel_pt_overflow(struct intel_pt_decoder *decoder)
2807 + {
2808 + intel_pt_log("ERROR: Buffer overflow\n");
2809 + intel_pt_clear_tx_flags(decoder);
2810 +- decoder->have_tma = false;
2811 + decoder->cbr = 0;
2812 + decoder->timestamp_insn_cnt = 0;
2813 + decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC;
2814 +@@ -1487,7 +1499,6 @@ static int intel_pt_walk_fup_tip(struct intel_pt_decoder *decoder)
2815 + case INTEL_PT_PSB:
2816 + case INTEL_PT_TSC:
2817 + case INTEL_PT_TMA:
2818 +- case INTEL_PT_CBR:
2819 + case INTEL_PT_MODE_TSX:
2820 + case INTEL_PT_BAD:
2821 + case INTEL_PT_PSBEND:
2822 +@@ -1496,6 +1507,10 @@ static int intel_pt_walk_fup_tip(struct intel_pt_decoder *decoder)
2823 + decoder->pkt_step = 0;
2824 + return -ENOENT;
2825 +
2826 ++ case INTEL_PT_CBR:
2827 ++ intel_pt_calc_cbr(decoder);
2828 ++ break;
2829 ++
2830 + case INTEL_PT_OVF:
2831 + return intel_pt_overflow(decoder);
2832 +
2833 +diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
2834 +index 89a3eda6a318..e420bd3be159 100644
2835 +--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
2836 ++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
2837 +@@ -53,6 +53,14 @@ enum {
2838 + INTEL_PT_ERR_MAX,
2839 + };
2840 +
2841 ++enum intel_pt_param_flags {
2842 ++ /*
2843 ++ * FUP packet can contain next linear instruction pointer instead of
2844 ++ * current linear instruction pointer.
2845 ++ */
2846 ++ INTEL_PT_FUP_WITH_NLIP = 1 << 0,
2847 ++};
2848 ++
2849 + struct intel_pt_state {
2850 + enum intel_pt_sample_type type;
2851 + int err;
2852 +@@ -91,6 +99,7 @@ struct intel_pt_params {
2853 + unsigned int mtc_period;
2854 + uint32_t tsc_ctc_ratio_n;
2855 + uint32_t tsc_ctc_ratio_d;
2856 ++ enum intel_pt_param_flags flags;
2857 + };
2858 +
2859 + struct intel_pt_decoder;
2860 +diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
2861 +index 7528ae4f7e28..e5c6caf913f3 100644
2862 +--- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
2863 ++++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
2864 +@@ -281,7 +281,7 @@ static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf,
2865 + if (len < offs)
2866 + return INTEL_PT_NEED_MORE_BYTES;
2867 + byte = buf[offs++];
2868 +- payload |= (byte >> 1) << shift;
2869 ++ payload |= ((uint64_t)byte >> 1) << shift;
2870 + }
2871 +
2872 + packet->type = INTEL_PT_CYC;
2873 +diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
2874 +index 3693cb26ec66..c8f2d084a8ce 100644
2875 +--- a/tools/perf/util/intel-pt.c
2876 ++++ b/tools/perf/util/intel-pt.c
2877 +@@ -676,6 +676,7 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt,
2878 + unsigned int queue_nr)
2879 + {
2880 + struct intel_pt_params params = { .get_trace = 0, };
2881 ++ struct perf_env *env = pt->machine->env;
2882 + struct intel_pt_queue *ptq;
2883 +
2884 + ptq = zalloc(sizeof(struct intel_pt_queue));
2885 +@@ -753,6 +754,9 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt,
2886 + }
2887 + }
2888 +
2889 ++ if (env->cpuid && !strncmp(env->cpuid, "GenuineIntel,6,92,", 18))
2890 ++ params.flags |= INTEL_PT_FUP_WITH_NLIP;
2891 ++
2892 + ptq->decoder = intel_pt_decoder_new(&params);
2893 + if (!ptq->decoder)
2894 + goto out_free;
2895 +@@ -1246,6 +1250,7 @@ static int intel_pt_sample(struct intel_pt_queue *ptq)
2896 +
2897 + if (intel_pt_is_switch_ip(ptq, state->to_ip)) {
2898 + switch (ptq->switch_state) {
2899 ++ case INTEL_PT_SS_NOT_TRACING:
2900 + case INTEL_PT_SS_UNKNOWN:
2901 + case INTEL_PT_SS_EXPECTING_SWITCH_IP:
2902 + err = intel_pt_next_tid(pt, ptq);