Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Sun, 12 Jan 2020 14:48:30
Message-Id: 1578840488.0812ef6d0b5a80efdc7df31e00e42d86a883c2ef.mpagano@gentoo
1 commit: 0812ef6d0b5a80efdc7df31e00e42d86a883c2ef
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 12 14:48:08 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 12 14:48:08 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0812ef6d
7
8 Linux patch 4.4.209
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1208_linux-4.4.209.patch | 1715 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1719 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 9a294a8..f96d37d 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -875,6 +875,10 @@ Patch: 1207_linux-4.4.208.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.208
23
24 +Patch: 1208_linux-4.4.209.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.209
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1208_linux-4.4.209.patch b/1208_linux-4.4.209.patch
33 new file mode 100644
34 index 0000000..eca7d9a
35 --- /dev/null
36 +++ b/1208_linux-4.4.209.patch
37 @@ -0,0 +1,1715 @@
38 +diff --git a/Makefile b/Makefile
39 +index 84d74ea25d70..762f77777e62 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 208
46 ++SUBLEVEL = 209
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
51 +index d2450ab0a380..3293484028ad 100644
52 +--- a/arch/arm/boot/dts/am437x-gp-evm.dts
53 ++++ b/arch/arm/boot/dts/am437x-gp-evm.dts
54 +@@ -79,7 +79,7 @@
55 + };
56 +
57 + lcd0: display {
58 +- compatible = "osddisplays,osd057T0559-34ts", "panel-dpi";
59 ++ compatible = "osddisplays,osd070t1718-19ts", "panel-dpi";
60 + label = "lcd";
61 +
62 + panel-timing {
63 +diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
64 +index 00707aac72fc..a74b09f17a1a 100644
65 +--- a/arch/arm/boot/dts/am43x-epos-evm.dts
66 ++++ b/arch/arm/boot/dts/am43x-epos-evm.dts
67 +@@ -41,7 +41,7 @@
68 + };
69 +
70 + lcd0: display {
71 +- compatible = "osddisplays,osd057T0559-34ts", "panel-dpi";
72 ++ compatible = "osddisplays,osd070t1718-19ts", "panel-dpi";
73 + label = "lcd";
74 +
75 + panel-timing {
76 +diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
77 +index 5766ce2be32b..29eb945075e3 100644
78 +--- a/arch/arm/mach-vexpress/spc.c
79 ++++ b/arch/arm/mach-vexpress/spc.c
80 +@@ -555,8 +555,9 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev)
81 +
82 + static int __init ve_spc_clk_init(void)
83 + {
84 +- int cpu;
85 ++ int cpu, cluster;
86 + struct clk *clk;
87 ++ bool init_opp_table[MAX_CLUSTERS] = { false };
88 +
89 + if (!info)
90 + return 0; /* Continue only if SPC is initialised */
91 +@@ -582,8 +583,17 @@ static int __init ve_spc_clk_init(void)
92 + continue;
93 + }
94 +
95 ++ cluster = topology_physical_package_id(cpu_dev->id);
96 ++ if (init_opp_table[cluster])
97 ++ continue;
98 ++
99 + if (ve_init_opp_table(cpu_dev))
100 + pr_warn("failed to initialise cpu%d opp table\n", cpu);
101 ++ else if (dev_pm_opp_set_sharing_cpus(cpu_dev,
102 ++ topology_core_cpumask(cpu_dev->id)))
103 ++ pr_warn("failed to mark OPPs shared for cpu%d\n", cpu);
104 ++ else
105 ++ init_opp_table[cluster] = true;
106 + }
107 +
108 + platform_device_register_simple("vexpress-spc-cpufreq", -1, NULL, 0);
109 +diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
110 +index e309d8fcb516..da1cb0499d6c 100644
111 +--- a/arch/mips/include/asm/thread_info.h
112 ++++ b/arch/mips/include/asm/thread_info.h
113 +@@ -52,8 +52,26 @@ struct thread_info {
114 + #define init_thread_info (init_thread_union.thread_info)
115 + #define init_stack (init_thread_union.stack)
116 +
117 +-/* How to get the thread information struct from C. */
118 ++/*
119 ++ * A pointer to the struct thread_info for the currently executing thread is
120 ++ * held in register $28/$gp.
121 ++ *
122 ++ * We declare __current_thread_info as a global register variable rather than a
123 ++ * local register variable within current_thread_info() because clang doesn't
124 ++ * support explicit local register variables.
125 ++ *
126 ++ * When building the VDSO we take care not to declare the global register
127 ++ * variable because this causes GCC to not preserve the value of $28/$gp in
128 ++ * functions that change its value (which is common in the PIC VDSO when
129 ++ * accessing the GOT). Since the VDSO shouldn't be accessing
130 ++ * __current_thread_info anyway we declare it extern in order to cause a link
131 ++ * failure if it's referenced.
132 ++ */
133 ++#ifdef __VDSO__
134 ++extern struct thread_info *__current_thread_info;
135 ++#else
136 + register struct thread_info *__current_thread_info __asm__("$28");
137 ++#endif
138 +
139 + static inline struct thread_info *current_thread_info(void)
140 + {
141 +diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h
142 +index 0a90b965cccb..9849bef2a766 100644
143 +--- a/arch/parisc/include/asm/cmpxchg.h
144 ++++ b/arch/parisc/include/asm/cmpxchg.h
145 +@@ -43,8 +43,14 @@ __xchg(unsigned long x, __volatile__ void *ptr, int size)
146 + ** if (((unsigned long)p & 0xf) == 0)
147 + ** return __ldcw(p);
148 + */
149 +-#define xchg(ptr, x) \
150 +- ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
151 ++#define xchg(ptr, x) \
152 ++({ \
153 ++ __typeof__(*(ptr)) __ret; \
154 ++ __typeof__(*(ptr)) _x_ = (x); \
155 ++ __ret = (__typeof__(*(ptr))) \
156 ++ __xchg((unsigned long)_x_, (ptr), sizeof(*(ptr))); \
157 ++ __ret; \
158 ++})
159 +
160 + /* bug catcher for when unsupported size is used - won't link */
161 + extern void __cmpxchg_called_with_bad_pointer(void);
162 +diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
163 +index 1efe5ca5c3bc..5bb2c89d55c8 100644
164 +--- a/arch/powerpc/mm/mem.c
165 ++++ b/arch/powerpc/mm/mem.c
166 +@@ -330,6 +330,14 @@ void __init mem_init(void)
167 + BUILD_BUG_ON(MMU_PAGE_COUNT > 16);
168 +
169 + #ifdef CONFIG_SWIOTLB
170 ++ /*
171 ++ * Some platforms (e.g. 85xx) limit DMA-able memory way below
172 ++ * 4G. We force memblock to bottom-up mode to ensure that the
173 ++ * memory allocated in swiotlb_init() is DMA-able.
174 ++ * As it's the last memblock allocation, no need to reset it
175 ++ * back to to-down.
176 ++ */
177 ++ memblock_set_bottom_up(true);
178 + swiotlb_init(0);
179 + #endif
180 +
181 +diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c
182 +index 849b29b3e9ae..954ef27128f2 100644
183 +--- a/arch/powerpc/platforms/pseries/hvconsole.c
184 ++++ b/arch/powerpc/platforms/pseries/hvconsole.c
185 +@@ -62,7 +62,7 @@ EXPORT_SYMBOL(hvc_get_chars);
186 + * @vtermno: The vtermno or unit_address of the adapter from which the data
187 + * originated.
188 + * @buf: The character buffer that contains the character data to send to
189 +- * firmware.
190 ++ * firmware. Must be at least 16 bytes, even if count is less than 16.
191 + * @count: Send this number of characters.
192 + */
193 + int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
194 +diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
195 +index 7490c52b2715..4a76b381d25a 100644
196 +--- a/arch/s390/kernel/perf_cpum_sf.c
197 ++++ b/arch/s390/kernel/perf_cpum_sf.c
198 +@@ -1294,18 +1294,28 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
199 + */
200 + if (flush_all && done)
201 + break;
202 +-
203 +- /* If an event overflow happened, discard samples by
204 +- * processing any remaining sample-data-blocks.
205 +- */
206 +- if (event_overflow)
207 +- flush_all = 1;
208 + }
209 +
210 + /* Account sample overflows in the event hardware structure */
211 + if (sampl_overflow)
212 + OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) +
213 + sampl_overflow, 1 + num_sdb);
214 ++
215 ++ /* Perf_event_overflow() and perf_event_account_interrupt() limit
216 ++ * the interrupt rate to an upper limit. Roughly 1000 samples per
217 ++ * task tick.
218 ++ * Hitting this limit results in a large number
219 ++ * of throttled REF_REPORT_THROTTLE entries and the samples
220 ++ * are dropped.
221 ++ * Slightly increase the interval to avoid hitting this limit.
222 ++ */
223 ++ if (event_overflow) {
224 ++ SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10);
225 ++ debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n",
226 ++ __func__,
227 ++ DIV_ROUND_UP(SAMPL_RATE(hwc), 10));
228 ++ }
229 ++
230 + if (sampl_overflow || event_overflow)
231 + debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: "
232 + "overflow stats: sample=%llu event=%llu\n",
233 +diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
234 +index 29e5409c0d48..f113fcd781d8 100644
235 +--- a/arch/s390/kernel/smp.c
236 ++++ b/arch/s390/kernel/smp.c
237 +@@ -702,39 +702,67 @@ static struct sclp_core_info *smp_get_core_info(void)
238 +
239 + static int smp_add_present_cpu(int cpu);
240 +
241 +-static int __smp_rescan_cpus(struct sclp_core_info *info, int sysfs_add)
242 ++static int smp_add_core(struct sclp_core_entry *core, cpumask_t *avail,
243 ++ bool configured, bool early)
244 + {
245 + struct pcpu *pcpu;
246 +- cpumask_t avail;
247 +- int cpu, nr, i, j;
248 ++ int cpu, nr, i;
249 + u16 address;
250 +
251 + nr = 0;
252 +- cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
253 +- cpu = cpumask_first(&avail);
254 +- for (i = 0; (i < info->combined) && (cpu < nr_cpu_ids); i++) {
255 +- if (sclp.has_core_type && info->core[i].type != boot_core_type)
256 ++ if (sclp.has_core_type && core->type != boot_core_type)
257 ++ return nr;
258 ++ cpu = cpumask_first(avail);
259 ++ address = core->core_id << smp_cpu_mt_shift;
260 ++ for (i = 0; (i <= smp_cpu_mtid) && (cpu < nr_cpu_ids); i++) {
261 ++ if (pcpu_find_address(cpu_present_mask, address + i))
262 + continue;
263 +- address = info->core[i].core_id << smp_cpu_mt_shift;
264 +- for (j = 0; j <= smp_cpu_mtid; j++) {
265 +- if (pcpu_find_address(cpu_present_mask, address + j))
266 +- continue;
267 +- pcpu = pcpu_devices + cpu;
268 +- pcpu->address = address + j;
269 +- pcpu->state =
270 +- (cpu >= info->configured*(smp_cpu_mtid + 1)) ?
271 +- CPU_STATE_STANDBY : CPU_STATE_CONFIGURED;
272 +- smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN);
273 +- set_cpu_present(cpu, true);
274 +- if (sysfs_add && smp_add_present_cpu(cpu) != 0)
275 +- set_cpu_present(cpu, false);
276 +- else
277 +- nr++;
278 +- cpu = cpumask_next(cpu, &avail);
279 +- if (cpu >= nr_cpu_ids)
280 ++ pcpu = pcpu_devices + cpu;
281 ++ pcpu->address = address + i;
282 ++ if (configured)
283 ++ pcpu->state = CPU_STATE_CONFIGURED;
284 ++ else
285 ++ pcpu->state = CPU_STATE_STANDBY;
286 ++ smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN);
287 ++ set_cpu_present(cpu, true);
288 ++ if (!early && smp_add_present_cpu(cpu) != 0)
289 ++ set_cpu_present(cpu, false);
290 ++ else
291 ++ nr++;
292 ++ cpumask_clear_cpu(cpu, avail);
293 ++ cpu = cpumask_next(cpu, avail);
294 ++ }
295 ++ return nr;
296 ++}
297 ++
298 ++static int __smp_rescan_cpus(struct sclp_core_info *info, bool early)
299 ++{
300 ++ struct sclp_core_entry *core;
301 ++ cpumask_t avail;
302 ++ bool configured;
303 ++ u16 core_id;
304 ++ int nr, i;
305 ++
306 ++ nr = 0;
307 ++ cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
308 ++ /*
309 ++ * Add IPL core first (which got logical CPU number 0) to make sure
310 ++ * that all SMT threads get subsequent logical CPU numbers.
311 ++ */
312 ++ if (early) {
313 ++ core_id = pcpu_devices[0].address >> smp_cpu_mt_shift;
314 ++ for (i = 0; i < info->configured; i++) {
315 ++ core = &info->core[i];
316 ++ if (core->core_id == core_id) {
317 ++ nr += smp_add_core(core, &avail, true, early);
318 + break;
319 ++ }
320 + }
321 + }
322 ++ for (i = 0; i < info->combined; i++) {
323 ++ configured = i < info->configured;
324 ++ nr += smp_add_core(&info->core[i], &avail, configured, early);
325 ++ }
326 + return nr;
327 + }
328 +
329 +@@ -782,7 +810,7 @@ static void __init smp_detect_cpus(void)
330 +
331 + /* Add CPUs present at boot */
332 + get_online_cpus();
333 +- __smp_rescan_cpus(info, 0);
334 ++ __smp_rescan_cpus(info, true);
335 + put_online_cpus();
336 + kfree(info);
337 + }
338 +@@ -1140,7 +1168,7 @@ int __ref smp_rescan_cpus(void)
339 + return -ENOMEM;
340 + get_online_cpus();
341 + mutex_lock(&smp_cpu_state_mutex);
342 +- nr = __smp_rescan_cpus(info, 1);
343 ++ nr = __smp_rescan_cpus(info, false);
344 + mutex_unlock(&smp_cpu_state_mutex);
345 + put_online_cpus();
346 + kfree(info);
347 +diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S
348 +index f611265633d6..6d6c2fecb0c1 100644
349 +--- a/arch/tile/lib/atomic_asm_32.S
350 ++++ b/arch/tile/lib/atomic_asm_32.S
351 +@@ -24,8 +24,7 @@
352 + * has an opportunity to return -EFAULT to the user if needed.
353 + * The 64-bit routines just return a "long long" with the value,
354 + * since they are only used from kernel space and don't expect to fault.
355 +- * Support for 16-bit ops is included in the framework but we don't provide
356 +- * any (x86_64 has an atomic_inc_short(), so we might want to some day).
357 ++ * Support for 16-bit ops is included in the framework but we don't provide any.
358 + *
359 + * Note that the caller is advised to issue a suitable L1 or L2
360 + * prefetch on the address being manipulated to avoid extra stalls.
361 +diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
362 +index 249fa6b27557..afc2387323c9 100644
363 +--- a/arch/x86/include/asm/atomic.h
364 ++++ b/arch/x86/include/asm/atomic.h
365 +@@ -220,19 +220,6 @@ static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
366 + return c;
367 + }
368 +
369 +-/**
370 +- * atomic_inc_short - increment of a short integer
371 +- * @v: pointer to type int
372 +- *
373 +- * Atomically adds 1 to @v
374 +- * Returns the new value of @u
375 +- */
376 +-static __always_inline short int atomic_inc_short(short int *v)
377 +-{
378 +- asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
379 +- return *v;
380 +-}
381 +-
382 + #ifdef CONFIG_X86_32
383 + # include <asm/atomic64_32.h>
384 + #else
385 +diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
386 +index d2c46454ffa8..a8814df03bd1 100644
387 +--- a/block/compat_ioctl.c
388 ++++ b/block/compat_ioctl.c
389 +@@ -5,6 +5,7 @@
390 + #include <linux/compat.h>
391 + #include <linux/elevator.h>
392 + #include <linux/hdreg.h>
393 ++#include <linux/pr.h>
394 + #include <linux/slab.h>
395 + #include <linux/syscalls.h>
396 + #include <linux/types.h>
397 +@@ -406,6 +407,14 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
398 + case BLKTRACETEARDOWN: /* compatible */
399 + ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg));
400 + return ret;
401 ++ case IOC_PR_REGISTER:
402 ++ case IOC_PR_RESERVE:
403 ++ case IOC_PR_RELEASE:
404 ++ case IOC_PR_PREEMPT:
405 ++ case IOC_PR_PREEMPT_ABORT:
406 ++ case IOC_PR_CLEAR:
407 ++ return blkdev_ioctl(bdev, mode, cmd,
408 ++ (unsigned long)compat_ptr(arg));
409 + default:
410 + if (disk->fops->compat_ioctl)
411 + ret = disk->fops->compat_ioctl(bdev, mode, cmd, arg);
412 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
413 +index fcc12c879659..7039a58a6a4e 100644
414 +--- a/drivers/bluetooth/btusb.c
415 ++++ b/drivers/bluetooth/btusb.c
416 +@@ -1056,7 +1056,7 @@ static int btusb_open(struct hci_dev *hdev)
417 + if (data->setup_on_usb) {
418 + err = data->setup_on_usb(hdev);
419 + if (err < 0)
420 +- return err;
421 ++ goto setup_fail;
422 + }
423 +
424 + err = usb_autopm_get_interface(data->intf);
425 +@@ -1092,6 +1092,7 @@ done:
426 +
427 + failed:
428 + clear_bit(BTUSB_INTR_RUNNING, &data->flags);
429 ++setup_fail:
430 + usb_autopm_put_interface(data->intf);
431 + return err;
432 + }
433 +diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
434 +index 4f6fc1cfd7da..f01f7434df8e 100644
435 +--- a/drivers/devfreq/devfreq.c
436 ++++ b/drivers/devfreq/devfreq.c
437 +@@ -396,11 +396,6 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type,
438 + static void _remove_devfreq(struct devfreq *devfreq)
439 + {
440 + mutex_lock(&devfreq_list_lock);
441 +- if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) {
442 +- mutex_unlock(&devfreq_list_lock);
443 +- dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n");
444 +- return;
445 +- }
446 + list_del(&devfreq->node);
447 + mutex_unlock(&devfreq_list_lock);
448 +
449 +@@ -472,6 +467,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
450 + devfreq->dev.parent = dev;
451 + devfreq->dev.class = devfreq_class;
452 + devfreq->dev.release = devfreq_dev_release;
453 ++ INIT_LIST_HEAD(&devfreq->node);
454 + devfreq->profile = profile;
455 + strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN);
456 + devfreq->previous_freq = profile->initial_freq;
457 +diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
458 +index b9d2f76a0cf7..117d16a455fd 100644
459 +--- a/drivers/firewire/net.c
460 ++++ b/drivers/firewire/net.c
461 +@@ -249,7 +249,11 @@ static int fwnet_header_cache(const struct neighbour *neigh,
462 + h = (struct fwnet_header *)((u8 *)hh->hh_data + HH_DATA_OFF(sizeof(*h)));
463 + h->h_proto = type;
464 + memcpy(h->h_dest, neigh->ha, net->addr_len);
465 +- hh->hh_len = FWNET_HLEN;
466 ++
467 ++ /* Pairs with the READ_ONCE() in neigh_resolve_output(),
468 ++ * neigh_hh_output() and neigh_update_hhs().
469 ++ */
470 ++ smp_store_release(&hh->hh_len, FWNET_HLEN);
471 +
472 + return 0;
473 + }
474 +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
475 +index fe89fd56eabf..db0801c7bb8e 100644
476 +--- a/drivers/gpio/gpiolib.c
477 ++++ b/drivers/gpio/gpiolib.c
478 +@@ -163,6 +163,14 @@ int gpiod_get_direction(struct gpio_desc *desc)
479 + chip = gpiod_to_chip(desc);
480 + offset = gpio_chip_hwgpio(desc);
481 +
482 ++ /*
483 ++ * Open drain emulation using input mode may incorrectly report
484 ++ * input here, fix that up.
485 ++ */
486 ++ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) &&
487 ++ test_bit(FLAG_IS_OUT, &desc->flags))
488 ++ return 0;
489 ++
490 + if (!chip->get_direction)
491 + return status;
492 +
493 +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
494 +index ff12d926eb65..cd707b401b10 100644
495 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c
496 ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c
497 +@@ -1538,7 +1538,11 @@ static void process_single_up_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
498 + if (ret != 1)
499 + DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
500 +
501 +- txmsg->dst->tx_slots[txmsg->seqno] = NULL;
502 ++ if (txmsg->seqno != -1) {
503 ++ WARN_ON((unsigned int)txmsg->seqno >
504 ++ ARRAY_SIZE(txmsg->dst->tx_slots));
505 ++ txmsg->dst->tx_slots[txmsg->seqno] = NULL;
506 ++ }
507 + }
508 +
509 + static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
510 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
511 +index 8ad9c6b04769..5ed9b5f8a037 100644
512 +--- a/drivers/infiniband/core/cma.c
513 ++++ b/drivers/infiniband/core/cma.c
514 +@@ -4109,6 +4109,7 @@ err:
515 + unregister_netdevice_notifier(&cma_nb);
516 + rdma_addr_unregister_client(&addr_client);
517 + ib_sa_unregister_client(&sa_client);
518 ++ unregister_pernet_subsys(&cma_pernet_operations);
519 + err_wq:
520 + destroy_workqueue(cma_wq);
521 + return ret;
522 +diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
523 +index abb99515068b..096f3a2ba524 100644
524 +--- a/drivers/md/raid1.c
525 ++++ b/drivers/md/raid1.c
526 +@@ -2630,7 +2630,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
527 + write_targets++;
528 + }
529 + }
530 +- if (bio->bi_end_io) {
531 ++ if (rdev && bio->bi_end_io) {
532 + atomic_inc(&rdev->nr_pending);
533 + bio->bi_iter.bi_sector = sector_nr + rdev->data_offset;
534 + bio->bi_bdev = rdev->bdev;
535 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
536 +index b7d32e8412f1..ec2122acc3c1 100644
537 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
538 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
539 +@@ -1107,7 +1107,7 @@ static inline u8 bnx2x_get_path_func_num(struct bnx2x *bp)
540 + for (i = 0; i < E1H_FUNC_MAX / 2; i++) {
541 + u32 func_config =
542 + MF_CFG_RD(bp,
543 +- func_mf_config[BP_PORT(bp) + 2 * i].
544 ++ func_mf_config[BP_PATH(bp) + 2 * i].
545 + config);
546 + func_num +=
547 + ((func_config & FUNC_MF_CFG_FUNC_HIDE) ? 0 : 1);
548 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
549 +index 82960603da33..026c72e62c18 100644
550 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
551 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
552 +@@ -9942,10 +9942,18 @@ static void bnx2x_recovery_failed(struct bnx2x *bp)
553 + */
554 + static void bnx2x_parity_recover(struct bnx2x *bp)
555 + {
556 +- bool global = false;
557 + u32 error_recovered, error_unrecovered;
558 +- bool is_parity;
559 ++ bool is_parity, global = false;
560 ++#ifdef CONFIG_BNX2X_SRIOV
561 ++ int vf_idx;
562 ++
563 ++ for (vf_idx = 0; vf_idx < bp->requested_nr_virtfn; vf_idx++) {
564 ++ struct bnx2x_virtf *vf = BP_VF(bp, vf_idx);
565 +
566 ++ if (vf)
567 ++ vf->state = VF_LOST;
568 ++ }
569 ++#endif
570 + DP(NETIF_MSG_HW, "Handling parity\n");
571 + while (1) {
572 + switch (bp->recovery_state) {
573 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
574 +index 6f6f13dc2be3..ab8339594cd3 100644
575 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
576 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
577 +@@ -139,6 +139,7 @@ struct bnx2x_virtf {
578 + #define VF_ACQUIRED 1 /* VF acquired, but not initialized */
579 + #define VF_ENABLED 2 /* VF Enabled */
580 + #define VF_RESET 3 /* VF FLR'd, pending cleanup */
581 ++#define VF_LOST 4 /* Recovery while VFs are loaded */
582 +
583 + bool flr_clnup_stage; /* true during flr cleanup */
584 +
585 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
586 +index a12a4236b143..e9fc3b09dba8 100644
587 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
588 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
589 +@@ -2095,6 +2095,18 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf,
590 + {
591 + int i;
592 +
593 ++ if (vf->state == VF_LOST) {
594 ++ /* Just ack the FW and return if VFs are lost
595 ++ * in case of parity error. VFs are supposed to be timedout
596 ++ * on waiting for PF response.
597 ++ */
598 ++ DP(BNX2X_MSG_IOV,
599 ++ "VF 0x%x lost, not handling the request\n", vf->abs_vfid);
600 ++
601 ++ storm_memset_vf_mbx_ack(bp, vf->abs_vfid);
602 ++ return;
603 ++ }
604 ++
605 + /* check if tlv type is known */
606 + if (bnx2x_tlv_supported(mbx->first_tlv.tl.type)) {
607 + /* Lock the per vf op mutex and note the locker's identity.
608 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
609 +index 6e56c4e5ecec..31ab5e749e66 100644
610 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
611 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
612 +@@ -53,7 +53,7 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv)
613 + * rate, which then uses the auto-reparenting feature of the
614 + * clock driver, and enabling/disabling the clock.
615 + */
616 +- if (gmac->interface == PHY_INTERFACE_MODE_RGMII) {
617 ++ if (phy_interface_mode_is_rgmii(gmac->interface)) {
618 + clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE);
619 + clk_prepare_enable(gmac->tx_clk);
620 + gmac->clk_enabled = 1;
621 +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
622 +index 4002bd90201f..eb825ea52d6b 100644
623 +--- a/drivers/net/macvlan.c
624 ++++ b/drivers/net/macvlan.c
625 +@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
626 + struct net_device *src,
627 + enum macvlan_mode mode)
628 + {
629 +- const struct ethhdr *eth = eth_hdr(skb);
630 ++ const struct ethhdr *eth = skb_eth_hdr(skb);
631 + const struct macvlan_dev *vlan;
632 + struct sk_buff *nskb;
633 + unsigned int i;
634 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
635 +index c813c5345a52..0d138bc60b18 100644
636 +--- a/drivers/net/usb/lan78xx.c
637 ++++ b/drivers/net/usb/lan78xx.c
638 +@@ -370,7 +370,7 @@ static int lan78xx_read_stats(struct lan78xx_net *dev,
639 + }
640 + } else {
641 + netdev_warn(dev->net,
642 +- "Failed to read stat ret = 0x%x", ret);
643 ++ "Failed to read stat ret = %d", ret);
644 + }
645 +
646 + kfree(stats);
647 +@@ -2036,11 +2036,6 @@ int lan78xx_stop(struct net_device *net)
648 + return 0;
649 + }
650 +
651 +-static int lan78xx_linearize(struct sk_buff *skb)
652 +-{
653 +- return skb_linearize(skb);
654 +-}
655 +-
656 + static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev,
657 + struct sk_buff *skb, gfp_t flags)
658 + {
659 +@@ -2051,8 +2046,10 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev,
660 + return NULL;
661 + }
662 +
663 +- if (lan78xx_linearize(skb) < 0)
664 ++ if (skb_linearize(skb)) {
665 ++ dev_kfree_skb_any(skb);
666 + return NULL;
667 ++ }
668 +
669 + tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN_MASK_) | TX_CMD_A_FCS_;
670 +
671 +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
672 +index 536fee1e4b70..133b144ec1aa 100644
673 +--- a/drivers/net/vxlan.c
674 ++++ b/drivers/net/vxlan.c
675 +@@ -2068,7 +2068,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
676 + return;
677 + }
678 +
679 +- tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
680 ++ tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
681 + ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
682 + err = vxlan_xmit_skb(rt, sk, skb, fl4.saddr,
683 + dst->sin.sin_addr.s_addr, tos, ttl, df,
684 +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
685 +index cc9648f844ae..0d757ced49ba 100644
686 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
687 ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
688 +@@ -972,6 +972,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
689 + struct ath_htc_rx_status *rxstatus;
690 + struct ath_rx_status rx_stats;
691 + bool decrypt_error = false;
692 ++ __be16 rs_datalen;
693 ++ bool is_phyerr;
694 +
695 + if (skb->len < HTC_RX_FRAME_HEADER_SIZE) {
696 + ath_err(common, "Corrupted RX frame, dropping (len: %d)\n",
697 +@@ -981,11 +983,24 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
698 +
699 + rxstatus = (struct ath_htc_rx_status *)skb->data;
700 +
701 +- if (be16_to_cpu(rxstatus->rs_datalen) -
702 +- (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) {
703 ++ rs_datalen = be16_to_cpu(rxstatus->rs_datalen);
704 ++ if (unlikely(rs_datalen -
705 ++ (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0)) {
706 + ath_err(common,
707 + "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n",
708 +- rxstatus->rs_datalen, skb->len);
709 ++ rs_datalen, skb->len);
710 ++ goto rx_next;
711 ++ }
712 ++
713 ++ is_phyerr = rxstatus->rs_status & ATH9K_RXERR_PHY;
714 ++ /*
715 ++ * Discard zero-length packets and packets smaller than an ACK
716 ++ * which are not PHY_ERROR (short radar pulses have a length of 3)
717 ++ */
718 ++ if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) {
719 ++ ath_warn(common,
720 ++ "Short RX data len, dropping (dlen: %d)\n",
721 ++ rs_datalen);
722 + goto rx_next;
723 + }
724 +
725 +@@ -1010,7 +1025,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
726 + * Process PHY errors and return so that the packet
727 + * can be dropped.
728 + */
729 +- if (rx_stats.rs_status & ATH9K_RXERR_PHY) {
730 ++ if (unlikely(is_phyerr)) {
731 + /* TODO: Not using DFS processing now. */
732 + if (ath_cmn_process_fft(&priv->spec_priv, hdr,
733 + &rx_stats, rx_status->mactime)) {
734 +diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c
735 +index b85ceb8ff911..eccdddcf5315 100644
736 +--- a/drivers/regulator/rn5t618-regulator.c
737 ++++ b/drivers/regulator/rn5t618-regulator.c
738 +@@ -95,6 +95,7 @@ static struct platform_driver rn5t618_regulator_driver = {
739 +
740 + module_platform_driver(rn5t618_regulator_driver);
741 +
742 ++MODULE_ALIAS("platform:rn5t618-regulator");
743 + MODULE_AUTHOR("Beniamino Galvani <b.galvani@×××××.com>");
744 + MODULE_DESCRIPTION("RN5T618 regulator driver");
745 + MODULE_LICENSE("GPL v2");
746 +diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
747 +index 60de66252fa2..b200edc665a5 100644
748 +--- a/drivers/scsi/libsas/sas_discover.c
749 ++++ b/drivers/scsi/libsas/sas_discover.c
750 +@@ -97,12 +97,21 @@ static int sas_get_port_device(struct asd_sas_port *port)
751 + else
752 + dev->dev_type = SAS_SATA_DEV;
753 + dev->tproto = SAS_PROTOCOL_SATA;
754 +- } else {
755 ++ } else if (port->oob_mode == SAS_OOB_MODE) {
756 + struct sas_identify_frame *id =
757 + (struct sas_identify_frame *) dev->frame_rcvd;
758 + dev->dev_type = id->dev_type;
759 + dev->iproto = id->initiator_bits;
760 + dev->tproto = id->target_bits;
761 ++ } else {
762 ++ /* If the oob mode is OOB_NOT_CONNECTED, the port is
763 ++ * disconnected due to race with PHY down. We cannot
764 ++ * continue to discover this port
765 ++ */
766 ++ sas_put_device(dev);
767 ++ pr_warn("Port %016llx is disconnected when discovering\n",
768 ++ SAS_ADDR(port->attached_sas_addr));
769 ++ return -ENODEV;
770 + }
771 +
772 + sas_init_dev(dev);
773 +diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
774 +index 05dcc2abd541..99f06ac7bf4c 100644
775 +--- a/drivers/scsi/lpfc/lpfc_bsg.c
776 ++++ b/drivers/scsi/lpfc/lpfc_bsg.c
777 +@@ -4352,12 +4352,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,
778 + phba->mbox_ext_buf_ctx.seqNum++;
779 + nemb_tp = phba->mbox_ext_buf_ctx.nembType;
780 +
781 +- dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
782 +- if (!dd_data) {
783 +- rc = -ENOMEM;
784 +- goto job_error;
785 +- }
786 +-
787 + pbuf = (uint8_t *)dmabuf->virt;
788 + size = job->request_payload.payload_len;
789 + sg_copy_to_buffer(job->request_payload.sg_list,
790 +@@ -4394,6 +4388,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,
791 + "2968 SLI_CONFIG ext-buffer wr all %d "
792 + "ebuffers received\n",
793 + phba->mbox_ext_buf_ctx.numBuf);
794 ++
795 ++ dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
796 ++ if (!dd_data) {
797 ++ rc = -ENOMEM;
798 ++ goto job_error;
799 ++ }
800 ++
801 + /* mailbox command structure for base driver */
802 + pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
803 + if (!pmboxq) {
804 +@@ -4441,6 +4442,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job,
805 + return SLI_CONFIG_HANDLED;
806 +
807 + job_error:
808 ++ if (pmboxq)
809 ++ mempool_free(pmboxq, phba->mbox_mem_pool);
810 + lpfc_bsg_dma_page_free(phba, dmabuf);
811 + kfree(dd_data);
812 +
813 +diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
814 +index 440d79e6aea5..dc7cef6ff829 100644
815 +--- a/drivers/scsi/qla2xxx/qla_isr.c
816 ++++ b/drivers/scsi/qla2xxx/qla_isr.c
817 +@@ -966,8 +966,6 @@ global_port_update:
818 + ql_dbg(ql_dbg_async, vha, 0x5011,
819 + "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n",
820 + mb[1], mb[2], mb[3]);
821 +-
822 +- qlt_async_event(mb[0], vha, mb);
823 + break;
824 + }
825 +
826 +@@ -988,8 +986,6 @@ global_port_update:
827 + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
828 + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
829 + set_bit(VP_CONFIG_OK, &vha->vp_flags);
830 +-
831 +- qlt_async_event(mb[0], vha, mb);
832 + break;
833 +
834 + case MBA_RSCN_UPDATE: /* State Change Registration */
835 +diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
836 +index d220b4f691c7..f714d5f917d1 100644
837 +--- a/drivers/scsi/qla4xxx/ql4_os.c
838 ++++ b/drivers/scsi/qla4xxx/ql4_os.c
839 +@@ -4285,7 +4285,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha)
840 + return QLA_SUCCESS;
841 +
842 + mem_alloc_error_exit:
843 +- qla4xxx_mem_free(ha);
844 + return QLA_ERROR;
845 + }
846 +
847 +diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
848 +index f575a9b5ede7..1d671d058dcb 100644
849 +--- a/drivers/tty/hvc/hvc_vio.c
850 ++++ b/drivers/tty/hvc/hvc_vio.c
851 +@@ -122,6 +122,14 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count)
852 + return got;
853 + }
854 +
855 ++/**
856 ++ * hvterm_raw_put_chars: send characters to firmware for given vterm adapter
857 ++ * @vtermno: The virtual terminal number.
858 ++ * @buf: The characters to send. Because of the underlying hypercall in
859 ++ * hvc_put_chars(), this buffer must be at least 16 bytes long, even if
860 ++ * you are sending fewer chars.
861 ++ * @count: number of chars to send.
862 ++ */
863 + static int hvterm_raw_put_chars(uint32_t vtermno, const char *buf, int count)
864 + {
865 + struct hvterm_priv *pv = hvterm_privs[vtermno];
866 +@@ -234,6 +242,7 @@ static const struct hv_ops hvterm_hvsi_ops = {
867 + static void udbg_hvc_putc(char c)
868 + {
869 + int count = -1;
870 ++ unsigned char bounce_buffer[16];
871 +
872 + if (!hvterm_privs[0])
873 + return;
874 +@@ -244,7 +253,12 @@ static void udbg_hvc_putc(char c)
875 + do {
876 + switch(hvterm_privs[0]->proto) {
877 + case HV_PROTOCOL_RAW:
878 +- count = hvterm_raw_put_chars(0, &c, 1);
879 ++ /*
880 ++ * hvterm_raw_put_chars requires at least a 16-byte
881 ++ * buffer, so go via the bounce buffer
882 ++ */
883 ++ bounce_buffer[0] = c;
884 ++ count = hvterm_raw_put_chars(0, bounce_buffer, 1);
885 + break;
886 + case HV_PROTOCOL_HVSI:
887 + count = hvterm_hvsi_put_chars(0, &c, 1);
888 +diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
889 +index 03cac2183579..1a4df5005aec 100644
890 +--- a/drivers/tty/serial/msm_serial.c
891 ++++ b/drivers/tty/serial/msm_serial.c
892 +@@ -1381,6 +1381,7 @@ static void __msm_console_write(struct uart_port *port, const char *s,
893 + int num_newlines = 0;
894 + bool replaced = false;
895 + void __iomem *tf;
896 ++ int locked = 1;
897 +
898 + if (is_uartdm)
899 + tf = port->membase + UARTDM_TF;
900 +@@ -1393,7 +1394,13 @@ static void __msm_console_write(struct uart_port *port, const char *s,
901 + num_newlines++;
902 + count += num_newlines;
903 +
904 +- spin_lock(&port->lock);
905 ++ if (port->sysrq)
906 ++ locked = 0;
907 ++ else if (oops_in_progress)
908 ++ locked = spin_trylock(&port->lock);
909 ++ else
910 ++ spin_lock(&port->lock);
911 ++
912 + if (is_uartdm)
913 + msm_reset_dm_count(port, count);
914 +
915 +@@ -1429,7 +1436,9 @@ static void __msm_console_write(struct uart_port *port, const char *s,
916 + iowrite32_rep(tf, buf, 1);
917 + i += num_chars;
918 + }
919 +- spin_unlock(&port->lock);
920 ++
921 ++ if (locked)
922 ++ spin_unlock(&port->lock);
923 + }
924 +
925 + static void msm_console_write(struct console *co, const char *s,
926 +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
927 +index cbd064fae23b..d650ce3bc556 100644
928 +--- a/drivers/usb/core/config.c
929 ++++ b/drivers/usb/core/config.c
930 +@@ -169,9 +169,58 @@ static const unsigned short super_speed_maxpacket_maxes[4] = {
931 + [USB_ENDPOINT_XFER_INT] = 1024,
932 + };
933 +
934 +-static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
935 +- int asnum, struct usb_host_interface *ifp, int num_ep,
936 +- unsigned char *buffer, int size)
937 ++static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1,
938 ++ struct usb_endpoint_descriptor *e2)
939 ++{
940 ++ if (e1->bEndpointAddress == e2->bEndpointAddress)
941 ++ return true;
942 ++
943 ++ if (usb_endpoint_xfer_control(e1) || usb_endpoint_xfer_control(e2)) {
944 ++ if (usb_endpoint_num(e1) == usb_endpoint_num(e2))
945 ++ return true;
946 ++ }
947 ++
948 ++ return false;
949 ++}
950 ++
951 ++/*
952 ++ * Check for duplicate endpoint addresses in other interfaces and in the
953 ++ * altsetting currently being parsed.
954 ++ */
955 ++static bool config_endpoint_is_duplicate(struct usb_host_config *config,
956 ++ int inum, int asnum, struct usb_endpoint_descriptor *d)
957 ++{
958 ++ struct usb_endpoint_descriptor *epd;
959 ++ struct usb_interface_cache *intfc;
960 ++ struct usb_host_interface *alt;
961 ++ int i, j, k;
962 ++
963 ++ for (i = 0; i < config->desc.bNumInterfaces; ++i) {
964 ++ intfc = config->intf_cache[i];
965 ++
966 ++ for (j = 0; j < intfc->num_altsetting; ++j) {
967 ++ alt = &intfc->altsetting[j];
968 ++
969 ++ if (alt->desc.bInterfaceNumber == inum &&
970 ++ alt->desc.bAlternateSetting != asnum)
971 ++ continue;
972 ++
973 ++ for (k = 0; k < alt->desc.bNumEndpoints; ++k) {
974 ++ epd = &alt->endpoint[k].desc;
975 ++
976 ++ if (endpoint_is_duplicate(epd, d))
977 ++ return true;
978 ++ }
979 ++ }
980 ++ }
981 ++
982 ++ return false;
983 ++}
984 ++
985 ++static int usb_parse_endpoint(struct device *ddev, int cfgno,
986 ++ struct usb_host_config *config, int inum, int asnum,
987 ++ struct usb_host_interface *ifp, int num_ep,
988 ++ unsigned char *buffer, int size)
989 + {
990 + unsigned char *buffer0 = buffer;
991 + struct usb_endpoint_descriptor *d;
992 +@@ -208,13 +257,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
993 + goto skip_to_next_endpoint_or_interface_descriptor;
994 +
995 + /* Check for duplicate endpoint addresses */
996 +- for (i = 0; i < ifp->desc.bNumEndpoints; ++i) {
997 +- if (ifp->endpoint[i].desc.bEndpointAddress ==
998 +- d->bEndpointAddress) {
999 +- dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
1000 +- cfgno, inum, asnum, d->bEndpointAddress);
1001 +- goto skip_to_next_endpoint_or_interface_descriptor;
1002 +- }
1003 ++ if (config_endpoint_is_duplicate(config, inum, asnum, d)) {
1004 ++ dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
1005 ++ cfgno, inum, asnum, d->bEndpointAddress);
1006 ++ goto skip_to_next_endpoint_or_interface_descriptor;
1007 + }
1008 +
1009 + endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
1010 +@@ -488,8 +534,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
1011 + if (((struct usb_descriptor_header *) buffer)->bDescriptorType
1012 + == USB_DT_INTERFACE)
1013 + break;
1014 +- retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt,
1015 +- num_ep, buffer, size);
1016 ++ retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum,
1017 ++ alt, num_ep, buffer, size);
1018 + if (retval < 0)
1019 + return retval;
1020 + ++n;
1021 +diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
1022 +index 7ad60ee41914..4ce19b860289 100644
1023 +--- a/drivers/usb/gadget/function/f_ecm.c
1024 ++++ b/drivers/usb/gadget/function/f_ecm.c
1025 +@@ -625,8 +625,12 @@ static void ecm_disable(struct usb_function *f)
1026 +
1027 + DBG(cdev, "ecm deactivated\n");
1028 +
1029 +- if (ecm->port.in_ep->enabled)
1030 ++ if (ecm->port.in_ep->enabled) {
1031 + gether_disconnect(&ecm->port);
1032 ++ } else {
1033 ++ ecm->port.in_ep->desc = NULL;
1034 ++ ecm->port.out_ep->desc = NULL;
1035 ++ }
1036 +
1037 + usb_ep_disable(ecm->notify);
1038 + ecm->notify->desc = NULL;
1039 +diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
1040 +index e587767e374c..e281af92e084 100644
1041 +--- a/drivers/usb/gadget/function/f_rndis.c
1042 ++++ b/drivers/usb/gadget/function/f_rndis.c
1043 +@@ -619,6 +619,7 @@ static void rndis_disable(struct usb_function *f)
1044 + gether_disconnect(&rndis->port);
1045 +
1046 + usb_ep_disable(rndis->notify);
1047 ++ rndis->notify->desc = NULL;
1048 + }
1049 +
1050 + /*-------------------------------------------------------------------------*/
1051 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1052 +index 084332a5855e..2d302ff62cc1 100644
1053 +--- a/drivers/usb/serial/option.c
1054 ++++ b/drivers/usb/serial/option.c
1055 +@@ -1167,6 +1167,8 @@ static const struct usb_device_id option_ids[] = {
1056 + .driver_info = NCTRL(0) | RSVD(3) },
1057 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */
1058 + .driver_info = NCTRL(0) },
1059 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */
1060 ++ .driver_info = NCTRL(0) | RSVD(3) },
1061 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
1062 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1063 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
1064 +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
1065 +index cfab1d24e4bc..1c789056e7e8 100644
1066 +--- a/drivers/xen/balloon.c
1067 ++++ b/drivers/xen/balloon.c
1068 +@@ -392,7 +392,8 @@ static struct notifier_block xen_memory_nb = {
1069 + #else
1070 + static enum bp_state reserve_additional_memory(void)
1071 + {
1072 +- balloon_stats.target_pages = balloon_stats.current_pages;
1073 ++ balloon_stats.target_pages = balloon_stats.current_pages +
1074 ++ balloon_stats.target_unpopulated;
1075 + return BP_ECANCELED;
1076 + }
1077 + #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */
1078 +diff --git a/fs/locks.c b/fs/locks.c
1079 +index b515e65f1376..2c8e1e429cf7 100644
1080 +--- a/fs/locks.c
1081 ++++ b/fs/locks.c
1082 +@@ -2599,7 +2599,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
1083 + }
1084 + if (inode) {
1085 + /* userspace relies on this representation of dev_t */
1086 +- seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
1087 ++ seq_printf(f, "%d %02x:%02x:%lu ", fl_pid,
1088 + MAJOR(inode->i_sb->s_dev),
1089 + MINOR(inode->i_sb->s_dev), inode->i_ino);
1090 + } else {
1091 +diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
1092 +index 59d93acc29c7..fa0e89edb62d 100644
1093 +--- a/fs/pstore/ram.c
1094 ++++ b/fs/pstore/ram.c
1095 +@@ -319,6 +319,17 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
1096 +
1097 + prz = cxt->przs[cxt->dump_write_cnt];
1098 +
1099 ++ /*
1100 ++ * Since this is a new crash dump, we need to reset the buffer in
1101 ++ * case it still has an old dump present. Without this, the new dump
1102 ++ * will get appended, which would seriously confuse anything trying
1103 ++ * to check dump file contents. Specifically, ramoops_read_kmsg_hdr()
1104 ++ * expects to find a dump header in the beginning of buffer data, so
1105 ++ * we must to reset the buffer values, in order to ensure that the
1106 ++ * header will be written to the beginning of the buffer.
1107 ++ */
1108 ++ persistent_ram_zap(prz);
1109 ++
1110 + hlen = ramoops_write_kmsg_hdr(prz, compressed);
1111 + if (size + hlen > prz->buffer_size)
1112 + size = prz->buffer_size - hlen;
1113 +diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
1114 +index 73b725f965eb..065aa4752607 100644
1115 +--- a/fs/xfs/xfs_log.c
1116 ++++ b/fs/xfs/xfs_log.c
1117 +@@ -1503,6 +1503,8 @@ out_free_iclog:
1118 + if (iclog->ic_bp)
1119 + xfs_buf_free(iclog->ic_bp);
1120 + kmem_free(iclog);
1121 ++ if (prev_iclog == log->l_iclog)
1122 ++ break;
1123 + }
1124 + spinlock_destroy(&log->l_icloglock);
1125 + xfs_buf_free(log->l_xbuf);
1126 +diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
1127 +index a16d1851cfb1..f1bd19c69fec 100644
1128 +--- a/include/linux/dmaengine.h
1129 ++++ b/include/linux/dmaengine.h
1130 +@@ -1207,8 +1207,11 @@ static inline int dma_get_slave_caps(struct dma_chan *chan,
1131 + static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
1132 + {
1133 + struct dma_slave_caps caps;
1134 ++ int ret;
1135 +
1136 +- dma_get_slave_caps(tx->chan, &caps);
1137 ++ ret = dma_get_slave_caps(tx->chan, &caps);
1138 ++ if (ret)
1139 ++ return ret;
1140 +
1141 + if (caps.descriptor_reuse) {
1142 + tx->flags |= DMA_CTRL_REUSE;
1143 +diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
1144 +index d5569734f672..676cf8d0acca 100644
1145 +--- a/include/linux/if_ether.h
1146 ++++ b/include/linux/if_ether.h
1147 +@@ -28,6 +28,14 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
1148 + return (struct ethhdr *)skb_mac_header(skb);
1149 + }
1150 +
1151 ++/* Prefer this version in TX path, instead of
1152 ++ * skb_reset_mac_header() + eth_hdr()
1153 ++ */
1154 ++static inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb)
1155 ++{
1156 ++ return (struct ethhdr *)skb->data;
1157 ++}
1158 ++
1159 + int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
1160 +
1161 + extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
1162 +diff --git a/include/net/neighbour.h b/include/net/neighbour.h
1163 +index 1c0d07376125..a68a460fa4f3 100644
1164 +--- a/include/net/neighbour.h
1165 ++++ b/include/net/neighbour.h
1166 +@@ -454,7 +454,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb
1167 +
1168 + do {
1169 + seq = read_seqbegin(&hh->hh_lock);
1170 +- hh_len = hh->hh_len;
1171 ++ hh_len = READ_ONCE(hh->hh_len);
1172 + if (likely(hh_len <= HH_DATA_MOD)) {
1173 + hh_alen = HH_DATA_MOD;
1174 +
1175 +diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h
1176 +index 29287be696a2..788b77c347a0 100644
1177 +--- a/include/uapi/linux/netfilter/xt_sctp.h
1178 ++++ b/include/uapi/linux/netfilter/xt_sctp.h
1179 +@@ -40,19 +40,19 @@ struct xt_sctp_info {
1180 + #define SCTP_CHUNKMAP_SET(chunkmap, type) \
1181 + do { \
1182 + (chunkmap)[type / bytes(__u32)] |= \
1183 +- 1 << (type % bytes(__u32)); \
1184 ++ 1u << (type % bytes(__u32)); \
1185 + } while (0)
1186 +
1187 + #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
1188 + do { \
1189 + (chunkmap)[type / bytes(__u32)] &= \
1190 +- ~(1 << (type % bytes(__u32))); \
1191 ++ ~(1u << (type % bytes(__u32))); \
1192 + } while (0)
1193 +
1194 + #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
1195 + ({ \
1196 + ((chunkmap)[type / bytes (__u32)] & \
1197 +- (1 << (type % bytes (__u32)))) ? 1: 0; \
1198 ++ (1u << (type % bytes (__u32)))) ? 1: 0; \
1199 + })
1200 +
1201 + #define SCTP_CHUNKMAP_RESET(chunkmap) \
1202 +diff --git a/kernel/locking/spinlock_debug.c b/kernel/locking/spinlock_debug.c
1203 +index 0374a596cffa..95e610e3f7ef 100644
1204 +--- a/kernel/locking/spinlock_debug.c
1205 ++++ b/kernel/locking/spinlock_debug.c
1206 +@@ -51,19 +51,19 @@ EXPORT_SYMBOL(__rwlock_init);
1207 +
1208 + static void spin_dump(raw_spinlock_t *lock, const char *msg)
1209 + {
1210 +- struct task_struct *owner = NULL;
1211 ++ struct task_struct *owner = READ_ONCE(lock->owner);
1212 +
1213 +- if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
1214 +- owner = lock->owner;
1215 ++ if (owner == SPINLOCK_OWNER_INIT)
1216 ++ owner = NULL;
1217 + printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
1218 + msg, raw_smp_processor_id(),
1219 + current->comm, task_pid_nr(current));
1220 + printk(KERN_EMERG " lock: %pS, .magic: %08x, .owner: %s/%d, "
1221 + ".owner_cpu: %d\n",
1222 +- lock, lock->magic,
1223 ++ lock, READ_ONCE(lock->magic),
1224 + owner ? owner->comm : "<none>",
1225 + owner ? task_pid_nr(owner) : -1,
1226 +- lock->owner_cpu);
1227 ++ READ_ONCE(lock->owner_cpu));
1228 + dump_stack();
1229 + }
1230 +
1231 +@@ -80,16 +80,16 @@ static void spin_bug(raw_spinlock_t *lock, const char *msg)
1232 + static inline void
1233 + debug_spin_lock_before(raw_spinlock_t *lock)
1234 + {
1235 +- SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic");
1236 +- SPIN_BUG_ON(lock->owner == current, lock, "recursion");
1237 +- SPIN_BUG_ON(lock->owner_cpu == raw_smp_processor_id(),
1238 ++ SPIN_BUG_ON(READ_ONCE(lock->magic) != SPINLOCK_MAGIC, lock, "bad magic");
1239 ++ SPIN_BUG_ON(READ_ONCE(lock->owner) == current, lock, "recursion");
1240 ++ SPIN_BUG_ON(READ_ONCE(lock->owner_cpu) == raw_smp_processor_id(),
1241 + lock, "cpu recursion");
1242 + }
1243 +
1244 + static inline void debug_spin_lock_after(raw_spinlock_t *lock)
1245 + {
1246 +- lock->owner_cpu = raw_smp_processor_id();
1247 +- lock->owner = current;
1248 ++ WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id());
1249 ++ WRITE_ONCE(lock->owner, current);
1250 + }
1251 +
1252 + static inline void debug_spin_unlock(raw_spinlock_t *lock)
1253 +@@ -99,8 +99,8 @@ static inline void debug_spin_unlock(raw_spinlock_t *lock)
1254 + SPIN_BUG_ON(lock->owner != current, lock, "wrong owner");
1255 + SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(),
1256 + lock, "wrong CPU");
1257 +- lock->owner = SPINLOCK_OWNER_INIT;
1258 +- lock->owner_cpu = -1;
1259 ++ WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT);
1260 ++ WRITE_ONCE(lock->owner_cpu, -1);
1261 + }
1262 +
1263 + static void __spin_lock_debug(raw_spinlock_t *lock)
1264 +@@ -233,8 +233,8 @@ static inline void debug_write_lock_before(rwlock_t *lock)
1265 +
1266 + static inline void debug_write_lock_after(rwlock_t *lock)
1267 + {
1268 +- lock->owner_cpu = raw_smp_processor_id();
1269 +- lock->owner = current;
1270 ++ WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id());
1271 ++ WRITE_ONCE(lock->owner, current);
1272 + }
1273 +
1274 + static inline void debug_write_unlock(rwlock_t *lock)
1275 +@@ -243,8 +243,8 @@ static inline void debug_write_unlock(rwlock_t *lock)
1276 + RWLOCK_BUG_ON(lock->owner != current, lock, "wrong owner");
1277 + RWLOCK_BUG_ON(lock->owner_cpu != raw_smp_processor_id(),
1278 + lock, "wrong CPU");
1279 +- lock->owner = SPINLOCK_OWNER_INIT;
1280 +- lock->owner_cpu = -1;
1281 ++ WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT);
1282 ++ WRITE_ONCE(lock->owner_cpu, -1);
1283 + }
1284 +
1285 + #if 0 /* This can cause lockups */
1286 +diff --git a/kernel/taskstats.c b/kernel/taskstats.c
1287 +index 21f82c29c914..0737a50380d7 100644
1288 +--- a/kernel/taskstats.c
1289 ++++ b/kernel/taskstats.c
1290 +@@ -582,25 +582,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
1291 + static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk)
1292 + {
1293 + struct signal_struct *sig = tsk->signal;
1294 +- struct taskstats *stats;
1295 ++ struct taskstats *stats_new, *stats;
1296 +
1297 +- if (sig->stats || thread_group_empty(tsk))
1298 +- goto ret;
1299 ++ /* Pairs with smp_store_release() below. */
1300 ++ stats = smp_load_acquire(&sig->stats);
1301 ++ if (stats || thread_group_empty(tsk))
1302 ++ return stats;
1303 +
1304 + /* No problem if kmem_cache_zalloc() fails */
1305 +- stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);
1306 ++ stats_new = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);
1307 +
1308 + spin_lock_irq(&tsk->sighand->siglock);
1309 +- if (!sig->stats) {
1310 +- sig->stats = stats;
1311 +- stats = NULL;
1312 ++ stats = sig->stats;
1313 ++ if (!stats) {
1314 ++ /*
1315 ++ * Pairs with smp_store_release() above and order the
1316 ++ * kmem_cache_zalloc().
1317 ++ */
1318 ++ smp_store_release(&sig->stats, stats_new);
1319 ++ stats = stats_new;
1320 ++ stats_new = NULL;
1321 + }
1322 + spin_unlock_irq(&tsk->sighand->siglock);
1323 +
1324 +- if (stats)
1325 +- kmem_cache_free(taskstats_cache, stats);
1326 +-ret:
1327 +- return sig->stats;
1328 ++ if (stats_new)
1329 ++ kmem_cache_free(taskstats_cache, stats_new);
1330 ++
1331 ++ return stats;
1332 + }
1333 +
1334 + /* Send pid data out on exit */
1335 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1336 +index 6380ec0453e0..e4c6f89b6b11 100644
1337 +--- a/kernel/trace/ftrace.c
1338 ++++ b/kernel/trace/ftrace.c
1339 +@@ -637,8 +637,7 @@ static int function_stat_show(struct seq_file *m, void *v)
1340 + }
1341 +
1342 + #ifdef CONFIG_FUNCTION_GRAPH_TRACER
1343 +- avg = rec->time;
1344 +- do_div(avg, rec->counter);
1345 ++ avg = div64_ul(rec->time, rec->counter);
1346 + if (tracing_thresh && (avg < tracing_thresh))
1347 + goto out;
1348 + #endif
1349 +@@ -664,7 +663,8 @@ static int function_stat_show(struct seq_file *m, void *v)
1350 + * Divide only 1000 for ns^2 -> us^2 conversion.
1351 + * trace_print_graph_duration will divide 1000 again.
1352 + */
1353 +- do_div(stddev, rec->counter * (rec->counter - 1) * 1000);
1354 ++ stddev = div64_ul(stddev,
1355 ++ rec->counter * (rec->counter - 1) * 1000);
1356 + }
1357 +
1358 + trace_seq_init(&s);
1359 +diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
1360 +index cc1557978066..ecdfeaafba9c 100644
1361 +--- a/net/8021q/vlan.h
1362 ++++ b/net/8021q/vlan.h
1363 +@@ -109,6 +109,7 @@ int vlan_check_real_dev(struct net_device *real_dev,
1364 + void vlan_setup(struct net_device *dev);
1365 + int register_vlan_dev(struct net_device *dev);
1366 + void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
1367 ++void vlan_dev_uninit(struct net_device *dev);
1368 + bool vlan_dev_inherit_address(struct net_device *dev,
1369 + struct net_device *real_dev);
1370 +
1371 +diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
1372 +index 5139c4ebb96b..22f4e5292278 100644
1373 +--- a/net/8021q/vlan_dev.c
1374 ++++ b/net/8021q/vlan_dev.c
1375 +@@ -606,7 +606,8 @@ static int vlan_dev_init(struct net_device *dev)
1376 + return 0;
1377 + }
1378 +
1379 +-static void vlan_dev_uninit(struct net_device *dev)
1380 ++/* Note: this function might be called multiple times for the same device. */
1381 ++void vlan_dev_uninit(struct net_device *dev)
1382 + {
1383 + struct vlan_priority_tci_mapping *pm;
1384 + struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
1385 +diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
1386 +index c92b52f37d38..7c95a16c1cef 100644
1387 +--- a/net/8021q/vlan_netlink.c
1388 ++++ b/net/8021q/vlan_netlink.c
1389 +@@ -92,11 +92,13 @@ static int vlan_changelink(struct net_device *dev,
1390 + struct ifla_vlan_flags *flags;
1391 + struct ifla_vlan_qos_mapping *m;
1392 + struct nlattr *attr;
1393 +- int rem;
1394 ++ int rem, err;
1395 +
1396 + if (data[IFLA_VLAN_FLAGS]) {
1397 + flags = nla_data(data[IFLA_VLAN_FLAGS]);
1398 +- vlan_dev_change_flags(dev, flags->flags, flags->mask);
1399 ++ err = vlan_dev_change_flags(dev, flags->flags, flags->mask);
1400 ++ if (err)
1401 ++ return err;
1402 + }
1403 + if (data[IFLA_VLAN_INGRESS_QOS]) {
1404 + nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) {
1405 +@@ -107,7 +109,9 @@ static int vlan_changelink(struct net_device *dev,
1406 + if (data[IFLA_VLAN_EGRESS_QOS]) {
1407 + nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) {
1408 + m = nla_data(attr);
1409 +- vlan_dev_set_egress_priority(dev, m->from, m->to);
1410 ++ err = vlan_dev_set_egress_priority(dev, m->from, m->to);
1411 ++ if (err)
1412 ++ return err;
1413 + }
1414 + }
1415 + return 0;
1416 +@@ -150,10 +154,11 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
1417 + return -EINVAL;
1418 +
1419 + err = vlan_changelink(dev, tb, data);
1420 +- if (err < 0)
1421 +- return err;
1422 +-
1423 +- return register_vlan_dev(dev);
1424 ++ if (!err)
1425 ++ err = register_vlan_dev(dev);
1426 ++ if (err)
1427 ++ vlan_dev_uninit(dev);
1428 ++ return err;
1429 + }
1430 +
1431 + static inline size_t vlan_qos_map_size(unsigned int n)
1432 +diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
1433 +index 302c3bacb024..0e31bbe1256c 100644
1434 +--- a/net/bluetooth/l2cap_core.c
1435 ++++ b/net/bluetooth/l2cap_core.c
1436 +@@ -4897,10 +4897,8 @@ void __l2cap_physical_cfm(struct l2cap_chan *chan, int result)
1437 + BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d",
1438 + chan, result, local_amp_id, remote_amp_id);
1439 +
1440 +- if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) {
1441 +- l2cap_chan_unlock(chan);
1442 ++ if (chan->state == BT_DISCONN || chan->state == BT_CLOSED)
1443 + return;
1444 +- }
1445 +
1446 + if (chan->state != BT_CONNECTED) {
1447 + l2cap_do_create(chan, result, local_amp_id, remote_amp_id);
1448 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
1449 +index 8aef689b8f32..af1ecd0e7b07 100644
1450 +--- a/net/core/neighbour.c
1451 ++++ b/net/core/neighbour.c
1452 +@@ -1058,7 +1058,7 @@ static void neigh_update_hhs(struct neighbour *neigh)
1453 +
1454 + if (update) {
1455 + hh = &neigh->hh;
1456 +- if (hh->hh_len) {
1457 ++ if (READ_ONCE(hh->hh_len)) {
1458 + write_seqlock_bh(&hh->hh_lock);
1459 + update(hh, neigh->dev, neigh->ha);
1460 + write_sequnlock_bh(&hh->hh_lock);
1461 +@@ -1323,7 +1323,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
1462 + struct net_device *dev = neigh->dev;
1463 + unsigned int seq;
1464 +
1465 +- if (dev->header_ops->cache && !neigh->hh.hh_len)
1466 ++ if (dev->header_ops->cache && !READ_ONCE(neigh->hh.hh_len))
1467 + neigh_hh_init(neigh);
1468 +
1469 + do {
1470 +diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
1471 +index 52dcd414c2af..3f51b4e590b1 100644
1472 +--- a/net/ethernet/eth.c
1473 ++++ b/net/ethernet/eth.c
1474 +@@ -235,7 +235,12 @@ int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16
1475 + eth->h_proto = type;
1476 + memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
1477 + memcpy(eth->h_dest, neigh->ha, ETH_ALEN);
1478 +- hh->hh_len = ETH_HLEN;
1479 ++
1480 ++ /* Pairs with READ_ONCE() in neigh_resolve_output(),
1481 ++ * neigh_hh_output() and neigh_update_hhs().
1482 ++ */
1483 ++ smp_store_release(&hh->hh_len, ETH_HLEN);
1484 ++
1485 + return 0;
1486 + }
1487 + EXPORT_SYMBOL(eth_header_cache);
1488 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
1489 +index b0677b265b48..1abf88aec19d 100644
1490 +--- a/net/ipv4/tcp_input.c
1491 ++++ b/net/ipv4/tcp_input.c
1492 +@@ -1685,8 +1685,11 @@ tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb,
1493 + }
1494 +
1495 + /* Ignore very old stuff early */
1496 +- if (!after(sp[used_sacks].end_seq, prior_snd_una))
1497 ++ if (!after(sp[used_sacks].end_seq, prior_snd_una)) {
1498 ++ if (i == 0)
1499 ++ first_sack_index = -1;
1500 + continue;
1501 ++ }
1502 +
1503 + used_sacks++;
1504 + }
1505 +diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c
1506 +index 204a8351efff..c29170e767a8 100644
1507 +--- a/net/llc/llc_station.c
1508 ++++ b/net/llc/llc_station.c
1509 +@@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)
1510 + return LLC_PDU_IS_CMD(pdu) && /* command PDU */
1511 + LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */
1512 + LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID &&
1513 +- !pdu->dsap ? 0 : 1; /* NULL DSAP value */
1514 ++ !pdu->dsap; /* NULL DSAP value */
1515 + }
1516 +
1517 + static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb)
1518 +@@ -42,7 +42,7 @@ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb)
1519 + return LLC_PDU_IS_CMD(pdu) && /* command PDU */
1520 + LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */
1521 + LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST &&
1522 +- !pdu->dsap ? 0 : 1; /* NULL DSAP */
1523 ++ !pdu->dsap; /* NULL DSAP */
1524 + }
1525 +
1526 + static int llc_station_ac_send_xid_r(struct sk_buff *skb)
1527 +diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
1528 +index 3a24c01cb909..f324a1124418 100644
1529 +--- a/net/netfilter/nf_conntrack_netlink.c
1530 ++++ b/net/netfilter/nf_conntrack_netlink.c
1531 +@@ -3390,6 +3390,9 @@ static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list)
1532 +
1533 + list_for_each_entry(net, net_exit_list, exit_list)
1534 + ctnetlink_net_exit(net);
1535 ++
1536 ++ /* wait for other cpus until they are done with ctnl_notifiers */
1537 ++ synchronize_rcu();
1538 + }
1539 +
1540 + static struct pernet_operations ctnetlink_net_ops = {
1541 +diff --git a/net/rfkill/core.c b/net/rfkill/core.c
1542 +index cf5b69ab1829..ad927a6ca2a1 100644
1543 +--- a/net/rfkill/core.c
1544 ++++ b/net/rfkill/core.c
1545 +@@ -941,10 +941,13 @@ static void rfkill_sync_work(struct work_struct *work)
1546 + int __must_check rfkill_register(struct rfkill *rfkill)
1547 + {
1548 + static unsigned long rfkill_no;
1549 +- struct device *dev = &rfkill->dev;
1550 ++ struct device *dev;
1551 + int error;
1552 +
1553 +- BUG_ON(!rfkill);
1554 ++ if (!rfkill)
1555 ++ return -EINVAL;
1556 ++
1557 ++ dev = &rfkill->dev;
1558 +
1559 + mutex_lock(&rfkill_global_mutex);
1560 +
1561 +diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
1562 +index 117ed90c5f21..fb99872ef426 100644
1563 +--- a/net/sched/sch_fq.c
1564 ++++ b/net/sched/sch_fq.c
1565 +@@ -706,7 +706,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt)
1566 + if (tb[TCA_FQ_QUANTUM]) {
1567 + u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]);
1568 +
1569 +- if (quantum > 0)
1570 ++ if (quantum > 0 && quantum <= (1 << 20))
1571 + q->quantum = quantum;
1572 + else
1573 + err = -EINVAL;
1574 +diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
1575 +index 7c220e905168..8e2e10d12728 100644
1576 +--- a/net/sctp/sm_sideeffect.c
1577 ++++ b/net/sctp/sm_sideeffect.c
1578 +@@ -1333,8 +1333,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1579 + /* Generate an INIT ACK chunk. */
1580 + new_obj = sctp_make_init_ack(asoc, chunk, GFP_ATOMIC,
1581 + 0);
1582 +- if (!new_obj)
1583 +- goto nomem;
1584 ++ if (!new_obj) {
1585 ++ error = -ENOMEM;
1586 ++ break;
1587 ++ }
1588 +
1589 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
1590 + SCTP_CHUNK(new_obj));
1591 +@@ -1356,7 +1358,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1592 + if (!new_obj) {
1593 + if (cmd->obj.chunk)
1594 + sctp_chunk_free(cmd->obj.chunk);
1595 +- goto nomem;
1596 ++ error = -ENOMEM;
1597 ++ break;
1598 + }
1599 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
1600 + SCTP_CHUNK(new_obj));
1601 +@@ -1403,8 +1406,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1602 +
1603 + /* Generate a SHUTDOWN chunk. */
1604 + new_obj = sctp_make_shutdown(asoc, chunk);
1605 +- if (!new_obj)
1606 +- goto nomem;
1607 ++ if (!new_obj) {
1608 ++ error = -ENOMEM;
1609 ++ break;
1610 ++ }
1611 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
1612 + SCTP_CHUNK(new_obj));
1613 + break;
1614 +@@ -1733,11 +1738,17 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1615 + break;
1616 + }
1617 +
1618 +- if (error)
1619 ++ if (error) {
1620 ++ cmd = sctp_next_cmd(commands);
1621 ++ while (cmd) {
1622 ++ if (cmd->verb == SCTP_CMD_REPLY)
1623 ++ sctp_chunk_free(cmd->obj.chunk);
1624 ++ cmd = sctp_next_cmd(commands);
1625 ++ }
1626 + break;
1627 ++ }
1628 + }
1629 +
1630 +-out:
1631 + /* If this is in response to a received chunk, wait until
1632 + * we are done with the packet to open the queue so that we don't
1633 + * send multiple packets in response to a single request.
1634 +@@ -1748,8 +1759,5 @@ out:
1635 + } else if (local_cork)
1636 + error = sctp_outq_uncork(&asoc->outqueue);
1637 + return error;
1638 +-nomem:
1639 +- error = -ENOMEM;
1640 +- goto out;
1641 + }
1642 +
1643 +diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
1644 +index ed29bad1f03a..96420b620963 100644
1645 +--- a/scripts/kconfig/expr.c
1646 ++++ b/scripts/kconfig/expr.c
1647 +@@ -201,6 +201,13 @@ static int expr_eq(struct expr *e1, struct expr *e2)
1648 + {
1649 + int res, old_count;
1650 +
1651 ++ /*
1652 ++ * A NULL expr is taken to be yes, but there's also a different way to
1653 ++ * represent yes. expr_is_yes() checks for either representation.
1654 ++ */
1655 ++ if (!e1 || !e2)
1656 ++ return expr_is_yes(e1) && expr_is_yes(e2);
1657 ++
1658 + if (e1->type != e2->type)
1659 + return 0;
1660 + switch (e1->type) {
1661 +diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
1662 +index 9d7582c90a95..c67d379cb6d6 100644
1663 +--- a/sound/isa/cs423x/cs4236.c
1664 ++++ b/sound/isa/cs423x/cs4236.c
1665 +@@ -293,7 +293,8 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
1666 + } else {
1667 + mpu_port[dev] = pnp_port_start(pdev, 0);
1668 + if (mpu_irq[dev] >= 0 &&
1669 +- pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
1670 ++ pnp_irq_valid(pdev, 0) &&
1671 ++ pnp_irq(pdev, 0) != (resource_size_t)-1) {
1672 + mpu_irq[dev] = pnp_irq(pdev, 0);
1673 + } else {
1674 + mpu_irq[dev] = -1; /* disable interrupt */
1675 +diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
1676 +index 0b22c00642bb..6a1de2cd27bf 100644
1677 +--- a/sound/pci/ice1712/ice1724.c
1678 ++++ b/sound/pci/ice1712/ice1724.c
1679 +@@ -663,6 +663,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
1680 + unsigned long flags;
1681 + unsigned char mclk_change;
1682 + unsigned int i, old_rate;
1683 ++ bool call_set_rate = false;
1684 +
1685 + if (rate > ice->hw_rates->list[ice->hw_rates->count - 1])
1686 + return -EINVAL;
1687 +@@ -686,7 +687,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
1688 + * setting clock rate for internal clock mode */
1689 + old_rate = ice->get_rate(ice);
1690 + if (force || (old_rate != rate))
1691 +- ice->set_rate(ice, rate);
1692 ++ call_set_rate = true;
1693 + else if (rate == ice->cur_rate) {
1694 + spin_unlock_irqrestore(&ice->reg_lock, flags);
1695 + return 0;
1696 +@@ -694,12 +695,14 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
1697 + }
1698 +
1699 + ice->cur_rate = rate;
1700 ++ spin_unlock_irqrestore(&ice->reg_lock, flags);
1701 ++
1702 ++ if (call_set_rate)
1703 ++ ice->set_rate(ice, rate);
1704 +
1705 + /* setting master clock */
1706 + mclk_change = ice->set_mclk(ice, rate);
1707 +
1708 +- spin_unlock_irqrestore(&ice->reg_lock, flags);
1709 +-
1710 + if (mclk_change && ice->gpio.i2s_mclk_changed)
1711 + ice->gpio.i2s_mclk_changed(ice);
1712 + if (ice->gpio.set_pro_rate)
1713 +diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
1714 +index a7e79784fc16..4a3ce9b85253 100644
1715 +--- a/sound/soc/codecs/wm8962.c
1716 ++++ b/sound/soc/codecs/wm8962.c
1717 +@@ -2792,7 +2792,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
1718 +
1719 + if (target % Fref == 0) {
1720 + fll_div->theta = 0;
1721 +- fll_div->lambda = 0;
1722 ++ fll_div->lambda = 1;
1723 + } else {
1724 + gcd_fll = gcd(target, fratio * Fref);
1725 +
1726 +@@ -2862,7 +2862,7 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
1727 + return -EINVAL;
1728 + }
1729 +
1730 +- if (fll_div.theta || fll_div.lambda)
1731 ++ if (fll_div.theta)
1732 + fll1 |= WM8962_FLL_FRAC;
1733 +
1734 + /* Stop the FLL while we reconfigure */
1735 +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
1736 +index 0f7ebac1846b..f256fac1e722 100644
1737 +--- a/tools/perf/builtin-report.c
1738 ++++ b/tools/perf/builtin-report.c
1739 +@@ -285,13 +285,6 @@ static int report__setup_sample_type(struct report *rep)
1740 + PERF_SAMPLE_BRANCH_ANY))
1741 + rep->nonany_branch_mode = true;
1742 +
1743 +-#ifndef HAVE_LIBUNWIND_SUPPORT
1744 +- if (dwarf_callchain_users) {
1745 +- ui__warning("Please install libunwind development packages "
1746 +- "during the perf build.\n");
1747 +- }
1748 +-#endif
1749 +-
1750 + return 0;
1751 + }
1752 +