Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Wed, 05 Aug 2020 14:51:52
Message-Id: 1596639093.0d53102c63ad653cc05e1f84cfa532b49dc52ac3.whissi@gentoo
1 commit: 0d53102c63ad653cc05e1f84cfa532b49dc52ac3
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 5 14:51:33 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 5 14:51:33 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0d53102c
7
8 Linux patch 4.19.137
9
10 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
11
12 0000_README | 4 +
13 1136_linux-4.19.137.patch | 1486 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1490 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index b50ea6d..d6fa27c 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -583,6 +583,10 @@ Patch: 1135_linux-4.19.136.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.136
23
24 +Patch: 1136_linux-4.19.137.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.137
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/1136_linux-4.19.137.patch b/1136_linux-4.19.137.patch
33 new file mode 100644
34 index 0000000..6f2e949
35 --- /dev/null
36 +++ b/1136_linux-4.19.137.patch
37 @@ -0,0 +1,1486 @@
38 +diff --git a/Makefile b/Makefile
39 +index a76c159bb605..edf1799c08d2 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 136
47 ++SUBLEVEL = 137
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
52 +index 1d5fbf1d1c67..8a8470d36c65 100644
53 +--- a/arch/arm/kernel/hw_breakpoint.c
54 ++++ b/arch/arm/kernel/hw_breakpoint.c
55 +@@ -688,6 +688,12 @@ static void disable_single_step(struct perf_event *bp)
56 + arch_install_hw_breakpoint(bp);
57 + }
58 +
59 ++static int watchpoint_fault_on_uaccess(struct pt_regs *regs,
60 ++ struct arch_hw_breakpoint *info)
61 ++{
62 ++ return !user_mode(regs) && info->ctrl.privilege == ARM_BREAKPOINT_USER;
63 ++}
64 ++
65 + static void watchpoint_handler(unsigned long addr, unsigned int fsr,
66 + struct pt_regs *regs)
67 + {
68 +@@ -747,16 +753,27 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
69 + }
70 +
71 + pr_debug("watchpoint fired: address = 0x%x\n", info->trigger);
72 ++
73 ++ /*
74 ++ * If we triggered a user watchpoint from a uaccess routine,
75 ++ * then handle the stepping ourselves since userspace really
76 ++ * can't help us with this.
77 ++ */
78 ++ if (watchpoint_fault_on_uaccess(regs, info))
79 ++ goto step;
80 ++
81 + perf_bp_event(wp, regs);
82 +
83 + /*
84 +- * If no overflow handler is present, insert a temporary
85 +- * mismatch breakpoint so we can single-step over the
86 +- * watchpoint trigger.
87 ++ * Defer stepping to the overflow handler if one is installed.
88 ++ * Otherwise, insert a temporary mismatch breakpoint so that
89 ++ * we can single-step over the watchpoint trigger.
90 + */
91 +- if (is_default_overflow_handler(wp))
92 +- enable_single_step(wp, instruction_pointer(regs));
93 ++ if (!is_default_overflow_handler(wp))
94 ++ goto unlock;
95 +
96 ++step:
97 ++ enable_single_step(wp, instruction_pointer(regs));
98 + unlock:
99 + rcu_read_unlock();
100 + }
101 +diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
102 +index 849d891c60a8..844f05b23115 100644
103 +--- a/arch/arm64/include/asm/alternative.h
104 ++++ b/arch/arm64/include/asm/alternative.h
105 +@@ -77,9 +77,9 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
106 + "663:\n\t" \
107 + newinstr "\n" \
108 + "664:\n\t" \
109 +- ".previous\n\t" \
110 + ".org . - (664b-663b) + (662b-661b)\n\t" \
111 +- ".org . - (662b-661b) + (664b-663b)\n" \
112 ++ ".org . - (662b-661b) + (664b-663b)\n\t" \
113 ++ ".previous\n" \
114 + ".endif\n"
115 +
116 + #define __ALTERNATIVE_CFG_CB(oldinstr, feature, cfg_enabled, cb) \
117 +diff --git a/arch/arm64/include/asm/checksum.h b/arch/arm64/include/asm/checksum.h
118 +index 0b6f5a7d4027..fd11e0d70e44 100644
119 +--- a/arch/arm64/include/asm/checksum.h
120 ++++ b/arch/arm64/include/asm/checksum.h
121 +@@ -30,16 +30,17 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
122 + {
123 + __uint128_t tmp;
124 + u64 sum;
125 ++ int n = ihl; /* we want it signed */
126 +
127 + tmp = *(const __uint128_t *)iph;
128 + iph += 16;
129 +- ihl -= 4;
130 ++ n -= 4;
131 + tmp += ((tmp >> 64) | (tmp << 64));
132 + sum = tmp >> 64;
133 + do {
134 + sum += *(const u32 *)iph;
135 + iph += 4;
136 +- } while (--ihl);
137 ++ } while (--n > 0);
138 +
139 + sum += ((sum >> 32) | (sum << 32));
140 + return csum_fold((__force u32)(sum >> 32));
141 +diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h
142 +index ab5c215cf46c..068958575871 100644
143 +--- a/arch/parisc/include/asm/cmpxchg.h
144 ++++ b/arch/parisc/include/asm/cmpxchg.h
145 +@@ -60,6 +60,7 @@ extern void __cmpxchg_called_with_bad_pointer(void);
146 + extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old,
147 + unsigned int new_);
148 + extern u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new_);
149 ++extern u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new_);
150 +
151 + /* don't worry...optimizer will get rid of most of this */
152 + static inline unsigned long
153 +@@ -71,6 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
154 + #endif
155 + case 4: return __cmpxchg_u32((unsigned int *)ptr,
156 + (unsigned int)old, (unsigned int)new_);
157 ++ case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
158 + }
159 + __cmpxchg_called_with_bad_pointer();
160 + return old;
161 +diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
162 +index 70ffbcf889b8..2e4d1f05a926 100644
163 +--- a/arch/parisc/lib/bitops.c
164 ++++ b/arch/parisc/lib/bitops.c
165 +@@ -79,3 +79,15 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign
166 + _atomic_spin_unlock_irqrestore(ptr, flags);
167 + return (unsigned long)prev;
168 + }
169 ++
170 ++u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new)
171 ++{
172 ++ unsigned long flags;
173 ++ u8 prev;
174 ++
175 ++ _atomic_spin_lock_irqsave(ptr, flags);
176 ++ if ((prev = *ptr) == old)
177 ++ *ptr = new;
178 ++ _atomic_spin_unlock_irqrestore(ptr, flags);
179 ++ return prev;
180 ++}
181 +diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
182 +index 28cc61216b64..ed5b758c650d 100644
183 +--- a/arch/sh/kernel/entry-common.S
184 ++++ b/arch/sh/kernel/entry-common.S
185 +@@ -203,7 +203,7 @@ syscall_trace_entry:
186 + mov.l @(OFF_R7,r15), r7 ! arg3
187 + mov.l @(OFF_R3,r15), r3 ! syscall_nr
188 + !
189 +- mov.l 2f, r10 ! Number of syscalls
190 ++ mov.l 6f, r10 ! Number of syscalls
191 + cmp/hs r10, r3
192 + bf syscall_call
193 + mov #-ENOSYS, r0
194 +@@ -357,7 +357,7 @@ ENTRY(system_call)
195 + tst r9, r8
196 + bf syscall_trace_entry
197 + !
198 +- mov.l 2f, r8 ! Number of syscalls
199 ++ mov.l 6f, r8 ! Number of syscalls
200 + cmp/hs r8, r3
201 + bt syscall_badsys
202 + !
203 +@@ -396,7 +396,7 @@ syscall_exit:
204 + #if !defined(CONFIG_CPU_SH2)
205 + 1: .long TRA
206 + #endif
207 +-2: .long NR_syscalls
208 ++6: .long NR_syscalls
209 + 3: .long sys_call_table
210 + 7: .long do_syscall_trace_enter
211 + 8: .long do_syscall_trace_leave
212 +diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
213 +index 519649ddf100..fe522691ac71 100644
214 +--- a/arch/x86/kernel/i8259.c
215 ++++ b/arch/x86/kernel/i8259.c
216 +@@ -207,7 +207,7 @@ spurious_8259A_irq:
217 + * lets ACK and report it. [once per IRQ]
218 + */
219 + if (!(spurious_irq_mask & irqmask)) {
220 +- printk(KERN_DEBUG
221 ++ printk_deferred(KERN_DEBUG
222 + "spurious 8259A interrupt: IRQ%d.\n", irq);
223 + spurious_irq_mask |= irqmask;
224 + }
225 +diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
226 +index 2701b370e58f..1d264ba1e56d 100644
227 +--- a/arch/x86/kernel/unwind_orc.c
228 ++++ b/arch/x86/kernel/unwind_orc.c
229 +@@ -420,8 +420,11 @@ bool unwind_next_frame(struct unwind_state *state)
230 + /*
231 + * Find the orc_entry associated with the text address.
232 + *
233 +- * Decrement call return addresses by one so they work for sibling
234 +- * calls and calls to noreturn functions.
235 ++ * For a call frame (as opposed to a signal frame), state->ip points to
236 ++ * the instruction after the call. That instruction's stack layout
237 ++ * could be different from the call instruction's layout, for example
238 ++ * if the call was to a noreturn function. So get the ORC data for the
239 ++ * call instruction itself.
240 + */
241 + orc = orc_find(state->signal ? state->ip : state->ip - 1);
242 + if (!orc)
243 +@@ -634,6 +637,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
244 + state->sp = task->thread.sp;
245 + state->bp = READ_ONCE_NOCHECK(frame->bp);
246 + state->ip = READ_ONCE_NOCHECK(frame->ret_addr);
247 ++ state->signal = (void *)state->ip == ret_from_fork;
248 + }
249 +
250 + if (get_stack_info((unsigned long *)state->sp, state->task,
251 +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
252 +index 8c6392534d14..bba2f76c356d 100644
253 +--- a/arch/x86/kvm/lapic.c
254 ++++ b/arch/x86/kvm/lapic.c
255 +@@ -2034,7 +2034,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)
256 + {
257 + struct kvm_lapic *apic = vcpu->arch.apic;
258 +
259 +- if (!lapic_in_kernel(vcpu) || apic_lvtt_oneshot(apic) ||
260 ++ if (!kvm_apic_present(vcpu) || apic_lvtt_oneshot(apic) ||
261 + apic_lvtt_period(apic))
262 + return;
263 +
264 +diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
265 +index 330853a2702f..43b74cf0787e 100644
266 +--- a/drivers/crypto/ccp/ccp-ops.c
267 ++++ b/drivers/crypto/ccp/ccp-ops.c
268 +@@ -1783,8 +1783,9 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
269 + LSB_ITEM_SIZE);
270 + break;
271 + default:
272 ++ kfree(hmac_buf);
273 + ret = -EINVAL;
274 +- goto e_ctx;
275 ++ goto e_data;
276 + }
277 +
278 + memset(&hmac_cmd, 0, sizeof(hmac_cmd));
279 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
280 +index 71efcf38f11b..94cd8a261091 100644
281 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
282 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
283 +@@ -276,7 +276,7 @@ static int acp_hw_init(void *handle)
284 + u32 val = 0;
285 + u32 count = 0;
286 + struct device *dev;
287 +- struct i2s_platform_data *i2s_pdata;
288 ++ struct i2s_platform_data *i2s_pdata = NULL;
289 +
290 + struct amdgpu_device *adev = (struct amdgpu_device *)handle;
291 +
292 +@@ -317,20 +317,21 @@ static int acp_hw_init(void *handle)
293 + adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell),
294 + GFP_KERNEL);
295 +
296 +- if (adev->acp.acp_cell == NULL)
297 +- return -ENOMEM;
298 ++ if (adev->acp.acp_cell == NULL) {
299 ++ r = -ENOMEM;
300 ++ goto failure;
301 ++ }
302 +
303 + adev->acp.acp_res = kcalloc(5, sizeof(struct resource), GFP_KERNEL);
304 + if (adev->acp.acp_res == NULL) {
305 +- kfree(adev->acp.acp_cell);
306 +- return -ENOMEM;
307 ++ r = -ENOMEM;
308 ++ goto failure;
309 + }
310 +
311 + i2s_pdata = kcalloc(3, sizeof(struct i2s_platform_data), GFP_KERNEL);
312 + if (i2s_pdata == NULL) {
313 +- kfree(adev->acp.acp_res);
314 +- kfree(adev->acp.acp_cell);
315 +- return -ENOMEM;
316 ++ r = -ENOMEM;
317 ++ goto failure;
318 + }
319 +
320 + switch (adev->asic_type) {
321 +@@ -427,7 +428,7 @@ static int acp_hw_init(void *handle)
322 + r = mfd_add_hotplug_devices(adev->acp.parent, adev->acp.acp_cell,
323 + ACP_DEVS);
324 + if (r)
325 +- return r;
326 ++ goto failure;
327 +
328 + if (adev->asic_type != CHIP_STONEY) {
329 + for (i = 0; i < ACP_DEVS ; i++) {
330 +@@ -435,7 +436,7 @@ static int acp_hw_init(void *handle)
331 + r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev);
332 + if (r) {
333 + dev_err(dev, "Failed to add dev to genpd\n");
334 +- return r;
335 ++ goto failure;
336 + }
337 + }
338 + }
339 +@@ -454,7 +455,8 @@ static int acp_hw_init(void *handle)
340 + break;
341 + if (--count == 0) {
342 + dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
343 +- return -ETIMEDOUT;
344 ++ r = -ETIMEDOUT;
345 ++ goto failure;
346 + }
347 + udelay(100);
348 + }
349 +@@ -471,7 +473,8 @@ static int acp_hw_init(void *handle)
350 + break;
351 + if (--count == 0) {
352 + dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
353 +- return -ETIMEDOUT;
354 ++ r = -ETIMEDOUT;
355 ++ goto failure;
356 + }
357 + udelay(100);
358 + }
359 +@@ -480,6 +483,13 @@ static int acp_hw_init(void *handle)
360 + val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
361 + cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val);
362 + return 0;
363 ++
364 ++failure:
365 ++ kfree(i2s_pdata);
366 ++ kfree(adev->acp.acp_res);
367 ++ kfree(adev->acp.acp_cell);
368 ++ kfree(adev->acp.acp_genpd);
369 ++ return r;
370 + }
371 +
372 + /**
373 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
374 +index ba10577569f8..bb41936df0d9 100644
375 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
376 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
377 +@@ -549,9 +549,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
378 + return n ? -EFAULT : 0;
379 + }
380 + case AMDGPU_INFO_DEV_INFO: {
381 +- struct drm_amdgpu_info_device dev_info = {};
382 ++ struct drm_amdgpu_info_device dev_info;
383 + uint64_t vm_size;
384 +
385 ++ memset(&dev_info, 0, sizeof(dev_info));
386 + dev_info.device_id = dev->pdev->device;
387 + dev_info.chip_rev = adev->rev_id;
388 + dev_info.external_rev = adev->external_rev_id;
389 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
390 +index 7bea8ba89e88..e63a253eb425 100644
391 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
392 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
393 +@@ -529,7 +529,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
394 +
395 + while (isspace(*++tmp_str));
396 +
397 +- while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
398 ++ while (tmp_str[0]) {
399 ++ sub_str = strsep(&tmp_str, delimiter);
400 + ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
401 + if (ret)
402 + return -EINVAL;
403 +@@ -629,7 +630,8 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
404 + memcpy(buf_cpy, buf, bytes);
405 + buf_cpy[bytes] = '\0';
406 + tmp = buf_cpy;
407 +- while ((sub_str = strsep(&tmp, delimiter)) != NULL) {
408 ++ while (tmp[0]) {
409 ++ sub_str = strsep(&tmp, delimiter);
410 + if (strlen(sub_str)) {
411 + ret = kstrtol(sub_str, 0, &level);
412 + if (ret)
413 +@@ -880,7 +882,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
414 + i++;
415 + memcpy(buf_cpy, buf, count-i);
416 + tmp_str = buf_cpy;
417 +- while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
418 ++ while (tmp_str[0]) {
419 ++ sub_str = strsep(&tmp_str, delimiter);
420 + ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
421 + if (ret) {
422 + count = -EINVAL;
423 +diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
424 +index 3f76e6019546..5a2f29bd3508 100644
425 +--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
426 ++++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
427 +@@ -1001,6 +1001,7 @@ struct resource_pool *dce100_create_resource_pool(
428 + if (construct(num_virtual_links, dc, pool))
429 + return &pool->base;
430 +
431 ++ kfree(pool);
432 + BREAK_TO_DEBUGGER();
433 + return NULL;
434 + }
435 +diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
436 +index e5e9e92521e9..17d936c260d9 100644
437 +--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
438 ++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
439 +@@ -1344,6 +1344,7 @@ struct resource_pool *dce110_create_resource_pool(
440 + if (construct(num_virtual_links, dc, pool, asic_id))
441 + return &pool->base;
442 +
443 ++ kfree(pool);
444 + BREAK_TO_DEBUGGER();
445 + return NULL;
446 + }
447 +diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
448 +index 288129343c77..71adab8bf31b 100644
449 +--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
450 ++++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
451 +@@ -1287,6 +1287,7 @@ struct resource_pool *dce112_create_resource_pool(
452 + if (construct(num_virtual_links, dc, pool))
453 + return &pool->base;
454 +
455 ++ kfree(pool);
456 + BREAK_TO_DEBUGGER();
457 + return NULL;
458 + }
459 +diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
460 +index d43f37d99c7d..f0f2ce6da827 100644
461 +--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
462 ++++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
463 +@@ -1076,6 +1076,7 @@ struct resource_pool *dce120_create_resource_pool(
464 + if (construct(num_virtual_links, dc, pool))
465 + return &pool->base;
466 +
467 ++ kfree(pool);
468 + BREAK_TO_DEBUGGER();
469 + return NULL;
470 + }
471 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
472 +index 6b44ed3697a4..e6d556881140 100644
473 +--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
474 ++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
475 +@@ -1361,6 +1361,7 @@ struct resource_pool *dcn10_create_resource_pool(
476 + if (construct(num_virtual_links, dc, pool))
477 + return &pool->base;
478 +
479 ++ kfree(pool);
480 + BREAK_TO_DEBUGGER();
481 + return NULL;
482 + }
483 +diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
484 +index bf90625df3c5..ac545c88a6f3 100644
485 +--- a/drivers/gpu/drm/drm_gem.c
486 ++++ b/drivers/gpu/drm/drm_gem.c
487 +@@ -731,9 +731,6 @@ err:
488 + * @file_priv: drm file-private structure
489 + *
490 + * Open an object using the global name, returning a handle and the size.
491 +- *
492 +- * This handle (of course) holds a reference to the object, so the object
493 +- * will not go away until the handle is deleted.
494 + */
495 + int
496 + drm_gem_open_ioctl(struct drm_device *dev, void *data,
497 +@@ -758,14 +755,15 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
498 +
499 + /* drm_gem_handle_create_tail unlocks dev->object_name_lock. */
500 + ret = drm_gem_handle_create_tail(file_priv, obj, &handle);
501 +- drm_gem_object_put_unlocked(obj);
502 + if (ret)
503 +- return ret;
504 ++ goto err;
505 +
506 + args->handle = handle;
507 + args->size = obj->size;
508 +
509 +- return 0;
510 ++err:
511 ++ drm_gem_object_put_unlocked(obj);
512 ++ return ret;
513 + }
514 +
515 + /**
516 +diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
517 +index d917cefc5a19..b13605718291 100644
518 +--- a/drivers/i2c/busses/i2c-cadence.c
519 ++++ b/drivers/i2c/busses/i2c-cadence.c
520 +@@ -382,10 +382,8 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
521 + * Check for the message size against FIFO depth and set the
522 + * 'hold bus' bit if it is greater than FIFO depth.
523 + */
524 +- if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
525 ++ if (id->recv_count > CDNS_I2C_FIFO_DEPTH)
526 + ctrl_reg |= CDNS_I2C_CR_HOLD;
527 +- else
528 +- ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
529 +
530 + cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
531 +
532 +@@ -442,11 +440,8 @@ static void cdns_i2c_msend(struct cdns_i2c *id)
533 + * Check for the message size against FIFO depth and set the
534 + * 'hold bus' bit if it is greater than FIFO depth.
535 + */
536 +- if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
537 ++ if (id->send_count > CDNS_I2C_FIFO_DEPTH)
538 + ctrl_reg |= CDNS_I2C_CR_HOLD;
539 +- else
540 +- ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
541 +-
542 + cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
543 +
544 + /* Clear the interrupts in interrupt status register. */
545 +diff --git a/drivers/iio/imu/adis16400_buffer.c b/drivers/iio/imu/adis16400_buffer.c
546 +index e70a5339acb1..3fc11aec98b9 100644
547 +--- a/drivers/iio/imu/adis16400_buffer.c
548 ++++ b/drivers/iio/imu/adis16400_buffer.c
549 +@@ -38,8 +38,11 @@ int adis16400_update_scan_mode(struct iio_dev *indio_dev,
550 + return -ENOMEM;
551 +
552 + adis->buffer = kzalloc(burst_length + sizeof(u16), GFP_KERNEL);
553 +- if (!adis->buffer)
554 ++ if (!adis->buffer) {
555 ++ kfree(adis->xfer);
556 ++ adis->xfer = NULL;
557 + return -ENOMEM;
558 ++ }
559 +
560 + tx = adis->buffer + burst_length;
561 + tx[0] = ADIS_READ_REG(ADIS16400_GLOB_CMD);
562 +diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c
563 +index 00329f668b59..5177479d13d3 100644
564 +--- a/drivers/media/pci/cx23885/cx23888-ir.c
565 ++++ b/drivers/media/pci/cx23885/cx23888-ir.c
566 +@@ -1178,8 +1178,11 @@ int cx23888_ir_probe(struct cx23885_dev *dev)
567 + return -ENOMEM;
568 +
569 + spin_lock_init(&state->rx_kfifo_lock);
570 +- if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL))
571 ++ if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE,
572 ++ GFP_KERNEL)) {
573 ++ kfree(state);
574 + return -ENOMEM;
575 ++ }
576 +
577 + state->dev = dev;
578 + sd = &state->sd;
579 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
580 +index 3d4a765e9e61..7801f2aeeb30 100644
581 +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
582 ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
583 +@@ -2367,6 +2367,7 @@ static inline int uld_send(struct adapter *adap, struct sk_buff *skb,
584 + txq_info = adap->sge.uld_txq_info[tx_uld_type];
585 + if (unlikely(!txq_info)) {
586 + WARN_ON(true);
587 ++ kfree_skb(skb);
588 + return NET_XMIT_DROP;
589 + }
590 +
591 +diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
592 +index 01a212097836..f402af39da42 100644
593 +--- a/drivers/net/ethernet/cortina/gemini.c
594 ++++ b/drivers/net/ethernet/cortina/gemini.c
595 +@@ -2451,6 +2451,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
596 + port->reset = devm_reset_control_get_exclusive(dev, NULL);
597 + if (IS_ERR(port->reset)) {
598 + dev_err(dev, "no reset\n");
599 ++ clk_disable_unprepare(port->pclk);
600 + return PTR_ERR(port->reset);
601 + }
602 + reset_control_reset(port->reset);
603 +@@ -2506,8 +2507,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
604 + IRQF_SHARED,
605 + port_names[port->id],
606 + port);
607 +- if (ret)
608 ++ if (ret) {
609 ++ clk_disable_unprepare(port->pclk);
610 + return ret;
611 ++ }
612 +
613 + ret = register_netdev(netdev);
614 + if (!ret) {
615 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
616 +index 5e9e45befc87..d8115a9333e0 100644
617 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
618 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
619 +@@ -2926,7 +2926,7 @@ req_rx_irq_failed:
620 + req_tx_irq_failed:
621 + for (j = 0; j < i; j++) {
622 + free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]);
623 +- irq_dispose_mapping(adapter->rx_scrq[j]->irq);
624 ++ irq_dispose_mapping(adapter->tx_scrq[j]->irq);
625 + }
626 + release_sub_crqs(adapter, 1);
627 + return rc;
628 +diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
629 +index f7825c7b92fe..8d7bb9a88967 100644
630 +--- a/drivers/net/ethernet/mellanox/mlx4/main.c
631 ++++ b/drivers/net/ethernet/mellanox/mlx4/main.c
632 +@@ -4311,12 +4311,14 @@ end:
633 + static void mlx4_shutdown(struct pci_dev *pdev)
634 + {
635 + struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);
636 ++ struct mlx4_dev *dev = persist->dev;
637 +
638 + mlx4_info(persist->dev, "mlx4_shutdown was called\n");
639 + mutex_lock(&persist->interface_state_mutex);
640 + if (persist->interface_state & MLX4_INTERFACE_STATE_UP)
641 + mlx4_unload_one(pdev);
642 + mutex_unlock(&persist->interface_state_mutex);
643 ++ mlx4_pci_disable_device(dev);
644 + }
645 +
646 + static const struct pci_error_handlers mlx4_err_handler = {
647 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
648 +index 7e6706333fa8..51edc507b7b5 100644
649 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
650 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
651 +@@ -519,7 +519,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
652 + err = mlx5_wq_ll_create(mdev, &rqp->wq, rqc_wq, &rq->mpwqe.wq,
653 + &rq->wq_ctrl);
654 + if (err)
655 +- return err;
656 ++ goto err_rq_wq_destroy;
657 +
658 + rq->mpwqe.wq.db = &rq->mpwqe.wq.db[MLX5_RCV_DBR];
659 +
660 +@@ -564,7 +564,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
661 + err = mlx5_wq_cyc_create(mdev, &rqp->wq, rqc_wq, &rq->wqe.wq,
662 + &rq->wq_ctrl);
663 + if (err)
664 +- return err;
665 ++ goto err_rq_wq_destroy;
666 +
667 + rq->wqe.wq.db = &rq->wqe.wq.db[MLX5_RCV_DBR];
668 +
669 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
670 +index 54f1a40a68ed..d359e850dbf0 100644
671 +--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
672 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
673 +@@ -366,10 +366,31 @@ static int mlx5_ptp_enable(struct ptp_clock_info *ptp,
674 + return 0;
675 + }
676 +
677 ++enum {
678 ++ MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN = BIT(0),
679 ++ MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT = BIT(1),
680 ++};
681 ++
682 + static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
683 + enum ptp_pin_function func, unsigned int chan)
684 + {
685 +- return (func == PTP_PF_PHYSYNC) ? -EOPNOTSUPP : 0;
686 ++ struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock,
687 ++ ptp_info);
688 ++
689 ++ switch (func) {
690 ++ case PTP_PF_NONE:
691 ++ return 0;
692 ++ case PTP_PF_EXTTS:
693 ++ return !(clock->pps_info.pin_caps[pin] &
694 ++ MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN);
695 ++ case PTP_PF_PEROUT:
696 ++ return !(clock->pps_info.pin_caps[pin] &
697 ++ MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT);
698 ++ default:
699 ++ return -EOPNOTSUPP;
700 ++ }
701 ++
702 ++ return -EOPNOTSUPP;
703 + }
704 +
705 + static const struct ptp_clock_info mlx5_ptp_clock_info = {
706 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
707 +index e180ec4f1a24..d8e7ca48753f 100644
708 +--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
709 ++++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
710 +@@ -1384,7 +1384,7 @@ static int mlxsw_core_reg_access_emad(struct mlxsw_core *mlxsw_core,
711 + err = mlxsw_emad_reg_access(mlxsw_core, reg, payload, type, trans,
712 + bulk_list, cb, cb_priv, tid);
713 + if (err) {
714 +- kfree(trans);
715 ++ kfree_rcu(trans, rcu);
716 + return err;
717 + }
718 + return 0;
719 +@@ -1605,11 +1605,13 @@ void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
720 + break;
721 + }
722 + }
723 +- rcu_read_unlock();
724 +- if (!found)
725 ++ if (!found) {
726 ++ rcu_read_unlock();
727 + goto drop;
728 ++ }
729 +
730 + rxl->func(skb, local_port, rxl_item->priv);
731 ++ rcu_read_unlock();
732 + return;
733 +
734 + drop:
735 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c
736 +index f9e475075d3e..61d5d7654568 100644
737 +--- a/drivers/net/ethernet/qlogic/qed/qed_int.c
738 ++++ b/drivers/net/ethernet/qlogic/qed/qed_int.c
739 +@@ -1015,7 +1015,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn)
740 + index, attn_bits, attn_acks, asserted_bits,
741 + deasserted_bits, p_sb_attn_sw->known_attn);
742 + } else if (asserted_bits == 0x100) {
743 +- DP_INFO(p_hwfn, "MFW indication via attention\n");
744 ++ DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
745 ++ "MFW indication via attention\n");
746 + } else {
747 + DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
748 + "MFW indication [deassertion]\n");
749 +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
750 +index faaf74073a12..569e698b5c80 100644
751 +--- a/drivers/net/ethernet/renesas/ravb_main.c
752 ++++ b/drivers/net/ethernet/renesas/ravb_main.c
753 +@@ -1445,6 +1445,7 @@ static void ravb_tx_timeout_work(struct work_struct *work)
754 + struct ravb_private *priv = container_of(work, struct ravb_private,
755 + work);
756 + struct net_device *ndev = priv->ndev;
757 ++ int error;
758 +
759 + netif_tx_stop_all_queues(ndev);
760 +
761 +@@ -1453,15 +1454,36 @@ static void ravb_tx_timeout_work(struct work_struct *work)
762 + ravb_ptp_stop(ndev);
763 +
764 + /* Wait for DMA stopping */
765 +- ravb_stop_dma(ndev);
766 ++ if (ravb_stop_dma(ndev)) {
767 ++ /* If ravb_stop_dma() fails, the hardware is still operating
768 ++ * for TX and/or RX. So, this should not call the following
769 ++ * functions because ravb_dmac_init() is possible to fail too.
770 ++ * Also, this should not retry ravb_stop_dma() again and again
771 ++ * here because it's possible to wait forever. So, this just
772 ++ * re-enables the TX and RX and skip the following
773 ++ * re-initialization procedure.
774 ++ */
775 ++ ravb_rcv_snd_enable(ndev);
776 ++ goto out;
777 ++ }
778 +
779 + ravb_ring_free(ndev, RAVB_BE);
780 + ravb_ring_free(ndev, RAVB_NC);
781 +
782 + /* Device init */
783 +- ravb_dmac_init(ndev);
784 ++ error = ravb_dmac_init(ndev);
785 ++ if (error) {
786 ++ /* If ravb_dmac_init() fails, descriptors are freed. So, this
787 ++ * should return here to avoid re-enabling the TX and RX in
788 ++ * ravb_emac_init().
789 ++ */
790 ++ netdev_err(ndev, "%s: ravb_dmac_init() failed, error %d\n",
791 ++ __func__, error);
792 ++ return;
793 ++ }
794 + ravb_emac_init(ndev);
795 +
796 ++out:
797 + /* Initialise PTP Clock driver */
798 + if (priv->chip_id == RCAR_GEN2)
799 + ravb_ptp_init(ndev, priv->pdev);
800 +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
801 +index 5251c5f6f96e..61b9d3368148 100644
802 +--- a/drivers/net/usb/hso.c
803 ++++ b/drivers/net/usb/hso.c
804 +@@ -1403,8 +1403,9 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)
805 + unsigned long flags;
806 +
807 + if (old)
808 +- hso_dbg(0x16, "Termios called with: cflags new[%d] - old[%d]\n",
809 +- tty->termios.c_cflag, old->c_cflag);
810 ++ hso_dbg(0x16, "Termios called with: cflags new[%u] - old[%u]\n",
811 ++ (unsigned int)tty->termios.c_cflag,
812 ++ (unsigned int)old->c_cflag);
813 +
814 + /* the actual setup */
815 + spin_lock_irqsave(&serial->serial_lock, flags);
816 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
817 +index 92548887df2f..d198f36785a4 100644
818 +--- a/drivers/net/usb/lan78xx.c
819 ++++ b/drivers/net/usb/lan78xx.c
820 +@@ -3786,6 +3786,11 @@ static int lan78xx_probe(struct usb_interface *intf,
821 + netdev->max_mtu = MAX_SINGLE_PACKET_SIZE;
822 + netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER);
823 +
824 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 3) {
825 ++ ret = -ENODEV;
826 ++ goto out3;
827 ++ }
828 ++
829 + dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0;
830 + dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1;
831 + dev->ep_intr = (intf->cur_altsetting)->endpoint + 2;
832 +@@ -3810,6 +3815,7 @@ static int lan78xx_probe(struct usb_interface *intf,
833 + usb_fill_int_urb(dev->urb_intr, dev->udev,
834 + dev->pipe_intr, buf, maxp,
835 + intr_complete, dev, period);
836 ++ dev->urb_intr->transfer_flags |= URB_FREE_BUFFER;
837 + }
838 + }
839 +
840 +diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
841 +index d2e062eaf561..f705f0e1cb5b 100644
842 +--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
843 ++++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
844 +@@ -173,6 +173,7 @@ static int htc_config_pipe_credits(struct htc_target *target)
845 + time_left = wait_for_completion_timeout(&target->cmd_wait, HZ);
846 + if (!time_left) {
847 + dev_err(target->dev, "HTC credit config timeout\n");
848 ++ kfree_skb(skb);
849 + return -ETIMEDOUT;
850 + }
851 +
852 +@@ -208,6 +209,7 @@ static int htc_setup_complete(struct htc_target *target)
853 + time_left = wait_for_completion_timeout(&target->cmd_wait, HZ);
854 + if (!time_left) {
855 + dev_err(target->dev, "HTC start timeout\n");
856 ++ kfree_skb(skb);
857 + return -ETIMEDOUT;
858 + }
859 +
860 +@@ -280,6 +282,7 @@ int htc_connect_service(struct htc_target *target,
861 + if (!time_left) {
862 + dev_err(target->dev, "Service connection timeout for: %d\n",
863 + service_connreq->service_id);
864 ++ kfree_skb(skb);
865 + return -ETIMEDOUT;
866 + }
867 +
868 +diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
869 +index e7a3127395be..066677bb83eb 100644
870 +--- a/drivers/net/wireless/ath/ath9k/wmi.c
871 ++++ b/drivers/net/wireless/ath/ath9k/wmi.c
872 +@@ -339,6 +339,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
873 + ath_dbg(common, WMI, "Timeout waiting for WMI command: %s\n",
874 + wmi_cmd_to_name(cmd_id));
875 + mutex_unlock(&wmi->op_mutex);
876 ++ kfree_skb(skb);
877 + return -ETIMEDOUT;
878 + }
879 +
880 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
881 +index 6b4675a9494b..c8e84276e639 100644
882 +--- a/drivers/net/xen-netfront.c
883 ++++ b/drivers/net/xen-netfront.c
884 +@@ -63,6 +63,8 @@ module_param_named(max_queues, xennet_max_queues, uint, 0644);
885 + MODULE_PARM_DESC(max_queues,
886 + "Maximum number of queues per virtual interface");
887 +
888 ++#define XENNET_TIMEOUT (5 * HZ)
889 ++
890 + static const struct ethtool_ops xennet_ethtool_ops;
891 +
892 + struct netfront_cb {
893 +@@ -1337,12 +1339,15 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
894 +
895 + netif_carrier_off(netdev);
896 +
897 +- xenbus_switch_state(dev, XenbusStateInitialising);
898 +- wait_event(module_wq,
899 +- xenbus_read_driver_state(dev->otherend) !=
900 +- XenbusStateClosed &&
901 +- xenbus_read_driver_state(dev->otherend) !=
902 +- XenbusStateUnknown);
903 ++ do {
904 ++ xenbus_switch_state(dev, XenbusStateInitialising);
905 ++ err = wait_event_timeout(module_wq,
906 ++ xenbus_read_driver_state(dev->otherend) !=
907 ++ XenbusStateClosed &&
908 ++ xenbus_read_driver_state(dev->otherend) !=
909 ++ XenbusStateUnknown, XENNET_TIMEOUT);
910 ++ } while (!err);
911 ++
912 + return netdev;
913 +
914 + exit:
915 +@@ -2142,28 +2147,43 @@ static const struct attribute_group xennet_dev_group = {
916 + };
917 + #endif /* CONFIG_SYSFS */
918 +
919 +-static int xennet_remove(struct xenbus_device *dev)
920 ++static void xennet_bus_close(struct xenbus_device *dev)
921 + {
922 +- struct netfront_info *info = dev_get_drvdata(&dev->dev);
923 +-
924 +- dev_dbg(&dev->dev, "%s\n", dev->nodename);
925 ++ int ret;
926 +
927 +- if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) {
928 ++ if (xenbus_read_driver_state(dev->otherend) == XenbusStateClosed)
929 ++ return;
930 ++ do {
931 + xenbus_switch_state(dev, XenbusStateClosing);
932 +- wait_event(module_wq,
933 +- xenbus_read_driver_state(dev->otherend) ==
934 +- XenbusStateClosing ||
935 +- xenbus_read_driver_state(dev->otherend) ==
936 +- XenbusStateUnknown);
937 ++ ret = wait_event_timeout(module_wq,
938 ++ xenbus_read_driver_state(dev->otherend) ==
939 ++ XenbusStateClosing ||
940 ++ xenbus_read_driver_state(dev->otherend) ==
941 ++ XenbusStateClosed ||
942 ++ xenbus_read_driver_state(dev->otherend) ==
943 ++ XenbusStateUnknown,
944 ++ XENNET_TIMEOUT);
945 ++ } while (!ret);
946 ++
947 ++ if (xenbus_read_driver_state(dev->otherend) == XenbusStateClosed)
948 ++ return;
949 +
950 ++ do {
951 + xenbus_switch_state(dev, XenbusStateClosed);
952 +- wait_event(module_wq,
953 +- xenbus_read_driver_state(dev->otherend) ==
954 +- XenbusStateClosed ||
955 +- xenbus_read_driver_state(dev->otherend) ==
956 +- XenbusStateUnknown);
957 +- }
958 ++ ret = wait_event_timeout(module_wq,
959 ++ xenbus_read_driver_state(dev->otherend) ==
960 ++ XenbusStateClosed ||
961 ++ xenbus_read_driver_state(dev->otherend) ==
962 ++ XenbusStateUnknown,
963 ++ XENNET_TIMEOUT);
964 ++ } while (!ret);
965 ++}
966 ++
967 ++static int xennet_remove(struct xenbus_device *dev)
968 ++{
969 ++ struct netfront_info *info = dev_get_drvdata(&dev->dev);
970 +
971 ++ xennet_bus_close(dev);
972 + xennet_disconnect_backend(info);
973 +
974 + if (info->netdev->reg_state == NETREG_REGISTERED)
975 +diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c
976 +index 9d9c8d57a042..64b58455e620 100644
977 +--- a/drivers/nfc/s3fwrn5/core.c
978 ++++ b/drivers/nfc/s3fwrn5/core.c
979 +@@ -209,6 +209,7 @@ int s3fwrn5_recv_frame(struct nci_dev *ndev, struct sk_buff *skb,
980 + case S3FWRN5_MODE_FW:
981 + return s3fwrn5_fw_recv_frame(ndev, skb);
982 + default:
983 ++ kfree_skb(skb);
984 + return -ENODEV;
985 + }
986 + }
987 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
988 +index 0862cb633849..8f856657dac2 100644
989 +--- a/drivers/pci/quirks.c
990 ++++ b/drivers/pci/quirks.c
991 +@@ -2307,6 +2307,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
992 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
993 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
994 +
995 ++static void quirk_disable_aspm_l0s_l1(struct pci_dev *dev)
996 ++{
997 ++ pci_info(dev, "Disabling ASPM L0s/L1\n");
998 ++ pci_disable_link_state(dev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
999 ++}
1000 ++
1001 ++/*
1002 ++ * ASM1083/1085 PCIe-PCI bridge devices cause AER timeout errors on the
1003 ++ * upstream PCIe root port when ASPM is enabled. At least L0s mode is affected;
1004 ++ * disable both L0s and L1 for now to be safe.
1005 ++ */
1006 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1);
1007 ++
1008 + /*
1009 + * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
1010 + * Link bit cleared after starting the link retrain process to allow this
1011 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1012 +index 8dd2702ce859..7befb7c12bd3 100644
1013 +--- a/fs/btrfs/inode.c
1014 ++++ b/fs/btrfs/inode.c
1015 +@@ -5553,12 +5553,14 @@ no_delete:
1016 + }
1017 +
1018 + /*
1019 +- * this returns the key found in the dir entry in the location pointer.
1020 ++ * Return the key found in the dir entry in the location pointer, fill @type
1021 ++ * with BTRFS_FT_*, and return 0.
1022 ++ *
1023 + * If no dir entries were found, returns -ENOENT.
1024 + * If found a corrupted location in dir entry, returns -EUCLEAN.
1025 + */
1026 + static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
1027 +- struct btrfs_key *location)
1028 ++ struct btrfs_key *location, u8 *type)
1029 + {
1030 + const char *name = dentry->d_name.name;
1031 + int namelen = dentry->d_name.len;
1032 +@@ -5591,6 +5593,8 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
1033 + __func__, name, btrfs_ino(BTRFS_I(dir)),
1034 + location->objectid, location->type, location->offset);
1035 + }
1036 ++ if (!ret)
1037 ++ *type = btrfs_dir_type(path->nodes[0], di);
1038 + out:
1039 + btrfs_free_path(path);
1040 + return ret;
1041 +@@ -5826,6 +5830,11 @@ static struct inode *new_simple_dir(struct super_block *s,
1042 + return inode;
1043 + }
1044 +
1045 ++static inline u8 btrfs_inode_type(struct inode *inode)
1046 ++{
1047 ++ return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT];
1048 ++}
1049 ++
1050 + struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
1051 + {
1052 + struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
1053 +@@ -5833,18 +5842,31 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
1054 + struct btrfs_root *root = BTRFS_I(dir)->root;
1055 + struct btrfs_root *sub_root = root;
1056 + struct btrfs_key location;
1057 ++ u8 di_type = 0;
1058 + int index;
1059 + int ret = 0;
1060 +
1061 + if (dentry->d_name.len > BTRFS_NAME_LEN)
1062 + return ERR_PTR(-ENAMETOOLONG);
1063 +
1064 +- ret = btrfs_inode_by_name(dir, dentry, &location);
1065 ++ ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
1066 + if (ret < 0)
1067 + return ERR_PTR(ret);
1068 +
1069 + if (location.type == BTRFS_INODE_ITEM_KEY) {
1070 + inode = btrfs_iget(dir->i_sb, &location, root, NULL);
1071 ++ if (IS_ERR(inode))
1072 ++ return inode;
1073 ++
1074 ++ /* Do extra check against inode mode with di_type */
1075 ++ if (btrfs_inode_type(inode) != di_type) {
1076 ++ btrfs_crit(fs_info,
1077 ++"inode mode mismatch with dir: inode mode=0%o btrfs type=%u dir type=%u",
1078 ++ inode->i_mode, btrfs_inode_type(inode),
1079 ++ di_type);
1080 ++ iput(inode);
1081 ++ return ERR_PTR(-EUCLEAN);
1082 ++ }
1083 + return inode;
1084 + }
1085 +
1086 +@@ -6455,11 +6477,6 @@ fail:
1087 + return ERR_PTR(ret);
1088 + }
1089 +
1090 +-static inline u8 btrfs_inode_type(struct inode *inode)
1091 +-{
1092 +- return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT];
1093 +-}
1094 +-
1095 + /*
1096 + * utility function to add 'inode' into 'parent_inode' with
1097 + * a give name and a given sequence number.
1098 +@@ -6993,6 +7010,14 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
1099 + extent_start = found_key.offset;
1100 + if (found_type == BTRFS_FILE_EXTENT_REG ||
1101 + found_type == BTRFS_FILE_EXTENT_PREALLOC) {
1102 ++ /* Only regular file could have regular/prealloc extent */
1103 ++ if (!S_ISREG(inode->vfs_inode.i_mode)) {
1104 ++ ret = -EUCLEAN;
1105 ++ btrfs_crit(fs_info,
1106 ++ "regular/prealloc extent found for non-regular inode %llu",
1107 ++ btrfs_ino(inode));
1108 ++ goto out;
1109 ++ }
1110 + extent_end = extent_start +
1111 + btrfs_file_extent_num_bytes(leaf, item);
1112 +
1113 +diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
1114 +index 2eec1dd3803a..82d874b10438 100644
1115 +--- a/fs/btrfs/tests/btrfs-tests.c
1116 ++++ b/fs/btrfs/tests/btrfs-tests.c
1117 +@@ -38,7 +38,13 @@ static struct file_system_type test_type = {
1118 +
1119 + struct inode *btrfs_new_test_inode(void)
1120 + {
1121 +- return new_inode(test_mnt->mnt_sb);
1122 ++ struct inode *inode;
1123 ++
1124 ++ inode = new_inode(test_mnt->mnt_sb);
1125 ++ if (inode)
1126 ++ inode_init_owner(inode, NULL, S_IFREG);
1127 ++
1128 ++ return inode;
1129 + }
1130 +
1131 + static int btrfs_init_test_fs(void)
1132 +diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c
1133 +index 64043f028820..648633aae968 100644
1134 +--- a/fs/btrfs/tests/inode-tests.c
1135 ++++ b/fs/btrfs/tests/inode-tests.c
1136 +@@ -232,6 +232,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
1137 + return ret;
1138 + }
1139 +
1140 ++ inode->i_mode = S_IFREG;
1141 + BTRFS_I(inode)->location.type = BTRFS_INODE_ITEM_KEY;
1142 + BTRFS_I(inode)->location.objectid = BTRFS_FIRST_FREE_OBJECTID;
1143 + BTRFS_I(inode)->location.offset = 0;
1144 +diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
1145 +index 7bba551cbf90..8b1b0862e869 100644
1146 +--- a/fs/xfs/xfs_log.c
1147 ++++ b/fs/xfs/xfs_log.c
1148 +@@ -2712,7 +2712,6 @@ xlog_state_do_callback(
1149 + int funcdidcallbacks; /* flag: function did callbacks */
1150 + int repeats; /* for issuing console warnings if
1151 + * looping too many times */
1152 +- int wake = 0;
1153 +
1154 + spin_lock(&log->l_icloglock);
1155 + first_iclog = iclog = log->l_iclog;
1156 +@@ -2914,11 +2913,9 @@ xlog_state_do_callback(
1157 + #endif
1158 +
1159 + if (log->l_iclog->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_IOERROR))
1160 +- wake = 1;
1161 +- spin_unlock(&log->l_icloglock);
1162 +-
1163 +- if (wake)
1164 + wake_up_all(&log->l_flush_wait);
1165 ++
1166 ++ spin_unlock(&log->l_icloglock);
1167 + }
1168 +
1169 +
1170 +@@ -4026,7 +4023,9 @@ xfs_log_force_umount(
1171 + * item committed callback functions will do this again under lock to
1172 + * avoid races.
1173 + */
1174 ++ spin_lock(&log->l_cilp->xc_push_lock);
1175 + wake_up_all(&log->l_cilp->xc_commit_wait);
1176 ++ spin_unlock(&log->l_cilp->xc_push_lock);
1177 + xlog_state_do_callback(log, XFS_LI_ABORTED, NULL);
1178 +
1179 + #ifdef XFSERRORDEBUG
1180 +diff --git a/include/net/xfrm.h b/include/net/xfrm.h
1181 +index f087c8d125b8..3a0b5de742e9 100644
1182 +--- a/include/net/xfrm.h
1183 ++++ b/include/net/xfrm.h
1184 +@@ -1016,7 +1016,7 @@ struct xfrm_dst {
1185 + static inline struct dst_entry *xfrm_dst_path(const struct dst_entry *dst)
1186 + {
1187 + #ifdef CONFIG_XFRM
1188 +- if (dst->xfrm) {
1189 ++ if (dst->xfrm || (dst->flags & DST_XFRM_QUEUE)) {
1190 + const struct xfrm_dst *xdst = (const struct xfrm_dst *) dst;
1191 +
1192 + return xdst->path;
1193 +@@ -1028,7 +1028,7 @@ static inline struct dst_entry *xfrm_dst_path(const struct dst_entry *dst)
1194 + static inline struct dst_entry *xfrm_dst_child(const struct dst_entry *dst)
1195 + {
1196 + #ifdef CONFIG_XFRM
1197 +- if (dst->xfrm) {
1198 ++ if (dst->xfrm || (dst->flags & DST_XFRM_QUEUE)) {
1199 + struct xfrm_dst *xdst = (struct xfrm_dst *) dst;
1200 + return xdst->child;
1201 + }
1202 +diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h
1203 +index 86eca3208b6b..a2c006a364e0 100644
1204 +--- a/include/uapi/linux/wireless.h
1205 ++++ b/include/uapi/linux/wireless.h
1206 +@@ -74,6 +74,8 @@
1207 + #include <linux/socket.h> /* for "struct sockaddr" et al */
1208 + #include <linux/if.h> /* for IFNAMSIZ and co... */
1209 +
1210 ++#include <stddef.h> /* for offsetof */
1211 ++
1212 + /***************************** VERSION *****************************/
1213 + /*
1214 + * This constant is used to know the availability of the wireless
1215 +@@ -1090,8 +1092,7 @@ struct iw_event {
1216 + /* iw_point events are special. First, the payload (extra data) come at
1217 + * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
1218 + * we omit the pointer, so start at an offset. */
1219 +-#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
1220 +- (char *) NULL)
1221 ++#define IW_EV_POINT_OFF offsetof(struct iw_point, length)
1222 + #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1223 + IW_EV_POINT_OFF)
1224 +
1225 +diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
1226 +index 6fe72792312d..1b28fb006763 100644
1227 +--- a/kernel/bpf/hashtab.c
1228 ++++ b/kernel/bpf/hashtab.c
1229 +@@ -678,15 +678,20 @@ static void htab_elem_free_rcu(struct rcu_head *head)
1230 + preempt_enable();
1231 + }
1232 +
1233 +-static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l)
1234 ++static void htab_put_fd_value(struct bpf_htab *htab, struct htab_elem *l)
1235 + {
1236 + struct bpf_map *map = &htab->map;
1237 ++ void *ptr;
1238 +
1239 + if (map->ops->map_fd_put_ptr) {
1240 +- void *ptr = fd_htab_map_get_ptr(map, l);
1241 +-
1242 ++ ptr = fd_htab_map_get_ptr(map, l);
1243 + map->ops->map_fd_put_ptr(ptr);
1244 + }
1245 ++}
1246 ++
1247 ++static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l)
1248 ++{
1249 ++ htab_put_fd_value(htab, l);
1250 +
1251 + if (htab_is_prealloc(htab)) {
1252 + __pcpu_freelist_push(&htab->freelist, &l->fnode);
1253 +@@ -747,6 +752,7 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
1254 + */
1255 + pl_new = this_cpu_ptr(htab->extra_elems);
1256 + l_new = *pl_new;
1257 ++ htab_put_fd_value(htab, old_elem);
1258 + *pl_new = old_elem;
1259 + } else {
1260 + struct pcpu_freelist_node *l;
1261 +diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
1262 +index b949c3917c67..9be3d1d1fcb4 100644
1263 +--- a/kernel/trace/trace_events_filter.c
1264 ++++ b/kernel/trace/trace_events_filter.c
1265 +@@ -451,8 +451,10 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
1266 +
1267 + switch (*next) {
1268 + case '(': /* #2 */
1269 +- if (top - op_stack > nr_parens)
1270 +- return ERR_PTR(-EINVAL);
1271 ++ if (top - op_stack > nr_parens) {
1272 ++ ret = -EINVAL;
1273 ++ goto out_free;
1274 ++ }
1275 + *(++top) = invert;
1276 + continue;
1277 + case '!': /* #3 */
1278 +diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
1279 +index f868cf6fba79..d28c2cc9618f 100644
1280 +--- a/net/9p/trans_fd.c
1281 ++++ b/net/9p/trans_fd.c
1282 +@@ -377,6 +377,10 @@ static void p9_read_work(struct work_struct *work)
1283 + if (m->rreq->status == REQ_STATUS_SENT) {
1284 + list_del(&m->rreq->req_list);
1285 + p9_client_cb(m->client, m->rreq, REQ_STATUS_RCVD);
1286 ++ } else if (m->rreq->status == REQ_STATUS_FLSHD) {
1287 ++ /* Ignore replies associated with a cancelled request. */
1288 ++ p9_debug(P9_DEBUG_TRANS,
1289 ++ "Ignore replies associated with a cancelled request\n");
1290 + } else {
1291 + spin_unlock(&m->client->lock);
1292 + p9_debug(P9_DEBUG_ERROR,
1293 +@@ -718,11 +722,20 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
1294 + {
1295 + p9_debug(P9_DEBUG_TRANS, "client %p req %p\n", client, req);
1296 +
1297 ++ spin_lock(&client->lock);
1298 ++ /* Ignore cancelled request if message has been received
1299 ++ * before lock.
1300 ++ */
1301 ++ if (req->status == REQ_STATUS_RCVD) {
1302 ++ spin_unlock(&client->lock);
1303 ++ return 0;
1304 ++ }
1305 ++
1306 + /* we haven't received a response for oldreq,
1307 + * remove it from the list.
1308 + */
1309 +- spin_lock(&client->lock);
1310 + list_del(&req->req_list);
1311 ++ req->status = REQ_STATUS_FLSHD;
1312 + spin_unlock(&client->lock);
1313 + p9_req_put(req);
1314 +
1315 +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
1316 +index a044e6bb12b8..cdb92b129906 100644
1317 +--- a/net/bluetooth/hci_event.c
1318 ++++ b/net/bluetooth/hci_event.c
1319 +@@ -1229,6 +1229,9 @@ static void store_pending_adv_report(struct hci_dev *hdev, bdaddr_t *bdaddr,
1320 + {
1321 + struct discovery_state *d = &hdev->discovery;
1322 +
1323 ++ if (len > HCI_MAX_AD_LENGTH)
1324 ++ return;
1325 ++
1326 + bacpy(&d->last_adv_addr, bdaddr);
1327 + d->last_adv_addr_type = bdaddr_type;
1328 + d->last_adv_rssi = rssi;
1329 +@@ -5116,7 +5119,8 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
1330 +
1331 + static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
1332 + u8 bdaddr_type, bdaddr_t *direct_addr,
1333 +- u8 direct_addr_type, s8 rssi, u8 *data, u8 len)
1334 ++ u8 direct_addr_type, s8 rssi, u8 *data, u8 len,
1335 ++ bool ext_adv)
1336 + {
1337 + struct discovery_state *d = &hdev->discovery;
1338 + struct smp_irk *irk;
1339 +@@ -5138,6 +5142,11 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
1340 + return;
1341 + }
1342 +
1343 ++ if (!ext_adv && len > HCI_MAX_AD_LENGTH) {
1344 ++ bt_dev_err_ratelimited(hdev, "legacy adv larger than 31 bytes");
1345 ++ return;
1346 ++ }
1347 ++
1348 + /* Find the end of the data in case the report contains padded zero
1349 + * bytes at the end causing an invalid length value.
1350 + *
1351 +@@ -5197,7 +5206,7 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
1352 + */
1353 + conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type,
1354 + direct_addr);
1355 +- if (conn && type == LE_ADV_IND) {
1356 ++ if (!ext_adv && conn && type == LE_ADV_IND && len <= HCI_MAX_AD_LENGTH) {
1357 + /* Store report for later inclusion by
1358 + * mgmt_device_connected
1359 + */
1360 +@@ -5251,7 +5260,7 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
1361 + * event or send an immediate device found event if the data
1362 + * should not be stored for later.
1363 + */
1364 +- if (!has_pending_adv_report(hdev)) {
1365 ++ if (!ext_adv && !has_pending_adv_report(hdev)) {
1366 + /* If the report will trigger a SCAN_REQ store it for
1367 + * later merging.
1368 + */
1369 +@@ -5286,7 +5295,8 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
1370 + /* If the new report will trigger a SCAN_REQ store it for
1371 + * later merging.
1372 + */
1373 +- if (type == LE_ADV_IND || type == LE_ADV_SCAN_IND) {
1374 ++ if (!ext_adv && (type == LE_ADV_IND ||
1375 ++ type == LE_ADV_SCAN_IND)) {
1376 + store_pending_adv_report(hdev, bdaddr, bdaddr_type,
1377 + rssi, flags, data, len);
1378 + return;
1379 +@@ -5326,7 +5336,7 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
1380 + rssi = ev->data[ev->length];
1381 + process_adv_report(hdev, ev->evt_type, &ev->bdaddr,
1382 + ev->bdaddr_type, NULL, 0, rssi,
1383 +- ev->data, ev->length);
1384 ++ ev->data, ev->length, false);
1385 + } else {
1386 + bt_dev_err(hdev, "Dropping invalid advertising data");
1387 + }
1388 +@@ -5400,7 +5410,8 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
1389 + if (legacy_evt_type != LE_ADV_INVALID) {
1390 + process_adv_report(hdev, legacy_evt_type, &ev->bdaddr,
1391 + ev->bdaddr_type, NULL, 0, ev->rssi,
1392 +- ev->data, ev->length);
1393 ++ ev->data, ev->length,
1394 ++ !(evt_type & LE_EXT_ADV_LEGACY_PDU));
1395 + }
1396 +
1397 + ptr += sizeof(*ev) + ev->length + 1;
1398 +@@ -5598,7 +5609,8 @@ static void hci_le_direct_adv_report_evt(struct hci_dev *hdev,
1399 +
1400 + process_adv_report(hdev, ev->evt_type, &ev->bdaddr,
1401 + ev->bdaddr_type, &ev->direct_addr,
1402 +- ev->direct_addr_type, ev->rssi, NULL, 0);
1403 ++ ev->direct_addr_type, ev->rssi, NULL, 0,
1404 ++ false);
1405 +
1406 + ptr += sizeof(*ev);
1407 + }
1408 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
1409 +index cb7076d9a769..b6670e74aeb7 100644
1410 +--- a/net/mac80211/cfg.c
1411 ++++ b/net/mac80211/cfg.c
1412 +@@ -2011,6 +2011,7 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
1413 + ieee80211_stop_mesh(sdata);
1414 + mutex_lock(&sdata->local->mtx);
1415 + ieee80211_vif_release_channel(sdata);
1416 ++ kfree(sdata->u.mesh.ie);
1417 + mutex_unlock(&sdata->local->mtx);
1418 +
1419 + return 0;
1420 +diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
1421 +index ac1f5db52994..4fc720c77e37 100644
1422 +--- a/net/mac80211/mesh_pathtbl.c
1423 ++++ b/net/mac80211/mesh_pathtbl.c
1424 +@@ -532,6 +532,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl,
1425 + del_timer_sync(&mpath->timer);
1426 + atomic_dec(&sdata->u.mesh.mpaths);
1427 + atomic_dec(&tbl->entries);
1428 ++ mesh_path_flush_pending(mpath);
1429 + kfree_rcu(mpath, rcu);
1430 + }
1431 +
1432 +diff --git a/net/rds/recv.c b/net/rds/recv.c
1433 +index c0b945516cdb..3ca278988b52 100644
1434 +--- a/net/rds/recv.c
1435 ++++ b/net/rds/recv.c
1436 +@@ -455,12 +455,13 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc,
1437 + int rds_notify_queue_get(struct rds_sock *rs, struct msghdr *msghdr)
1438 + {
1439 + struct rds_notifier *notifier;
1440 +- struct rds_rdma_notify cmsg = { 0 }; /* fill holes with zero */
1441 ++ struct rds_rdma_notify cmsg;
1442 + unsigned int count = 0, max_messages = ~0U;
1443 + unsigned long flags;
1444 + LIST_HEAD(copy);
1445 + int err = 0;
1446 +
1447 ++ memset(&cmsg, 0, sizeof(cmsg)); /* fill holes with zero */
1448 +
1449 + /* put_cmsg copies to user space and thus may sleep. We can't do this
1450 + * with rs_lock held, so first grab as many notifications as we can stuff
1451 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
1452 +index c93be3ba5df2..df4a7d7c5ec0 100644
1453 +--- a/net/sctp/socket.c
1454 ++++ b/net/sctp/socket.c
1455 +@@ -1931,7 +1931,10 @@ static int sctp_sendmsg_to_asoc(struct sctp_association *asoc,
1456 + if (sctp_wspace(asoc) < (int)msg_len)
1457 + sctp_prsctp_prune(asoc, sinfo, msg_len - sctp_wspace(asoc));
1458 +
1459 +- if (sctp_wspace(asoc) <= 0) {
1460 ++ if (sk_under_memory_pressure(sk))
1461 ++ sk_mem_reclaim(sk);
1462 ++
1463 ++ if (sctp_wspace(asoc) <= 0 || !sk_wmem_schedule(sk, msg_len)) {
1464 + timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
1465 + err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len);
1466 + if (err)
1467 +@@ -8515,7 +8518,10 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
1468 + goto do_error;
1469 + if (signal_pending(current))
1470 + goto do_interrupted;
1471 +- if ((int)msg_len <= sctp_wspace(asoc))
1472 ++ if (sk_under_memory_pressure(sk))
1473 ++ sk_mem_reclaim(sk);
1474 ++ if ((int)msg_len <= sctp_wspace(asoc) &&
1475 ++ sk_wmem_schedule(sk, msg_len))
1476 + break;
1477 +
1478 + /* Let another process have a go. Since we are going
1479 +diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c
1480 +index 743103786652..f3d34582581b 100644
1481 +--- a/net/x25/x25_subr.c
1482 ++++ b/net/x25/x25_subr.c
1483 +@@ -362,6 +362,12 @@ void x25_disconnect(struct sock *sk, int reason, unsigned char cause,
1484 + sk->sk_state_change(sk);
1485 + sock_set_flag(sk, SOCK_DEAD);
1486 + }
1487 ++ if (x25->neighbour) {
1488 ++ read_lock_bh(&x25_list_lock);
1489 ++ x25_neigh_put(x25->neighbour);
1490 ++ x25->neighbour = NULL;
1491 ++ read_unlock_bh(&x25_list_lock);
1492 ++ }
1493 + }
1494 +
1495 + /*
1496 +diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
1497 +index bd9b9632c72b..f496ba3b1cd3 100644
1498 +--- a/tools/testing/selftests/net/psock_fanout.c
1499 ++++ b/tools/testing/selftests/net/psock_fanout.c
1500 +@@ -364,7 +364,8 @@ static int test_datapath(uint16_t typeflags, int port_off,
1501 + int fds[2], fds_udp[2][2], ret;
1502 +
1503 + fprintf(stderr, "\ntest: datapath 0x%hx ports %hu,%hu\n",
1504 +- typeflags, PORT_BASE, PORT_BASE + port_off);
1505 ++ typeflags, (uint16_t)PORT_BASE,
1506 ++ (uint16_t)(PORT_BASE + port_off));
1507 +
1508 + fds[0] = sock_fanout_open(typeflags, 0);
1509 + fds[1] = sock_fanout_open(typeflags, 0);
1510 +diff --git a/tools/testing/selftests/networking/timestamping/rxtimestamp.c b/tools/testing/selftests/networking/timestamping/rxtimestamp.c
1511 +index 7a573fb4c1c4..c6428f1ac22f 100644
1512 +--- a/tools/testing/selftests/networking/timestamping/rxtimestamp.c
1513 ++++ b/tools/testing/selftests/networking/timestamping/rxtimestamp.c
1514 +@@ -328,8 +328,7 @@ int main(int argc, char **argv)
1515 + bool all_tests = true;
1516 + int arg_index = 0;
1517 + int failures = 0;
1518 +- int s, t;
1519 +- char opt;
1520 ++ int s, t, opt;
1521 +
1522 + while ((opt = getopt_long(argc, argv, "", long_options,
1523 + &arg_index)) != -1) {