Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Tue, 29 Oct 2019 14:00:02
Message-Id: 1572357542.be433ab6c07b3146a6d6d2688fb5f0d110d71cab.mpagano@gentoo
1 commit: be433ab6c07b3146a6d6d2688fb5f0d110d71cab
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 10 11:03:59 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 29 13:59:02 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=be433ab6
7
8 Linux patch 4.14.133
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1132_linux-4.14.133.patch | 1428 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1432 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index f51c89c..dd56b3e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -571,6 +571,10 @@ Patch: 1131_linux-4.14.132.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.132
23
24 +Patch: 1132_linux-4.14.133.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.133
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/1132_linux-4.14.133.patch b/1132_linux-4.14.133.patch
33 new file mode 100644
34 index 0000000..4d51a54
35 --- /dev/null
36 +++ b/1132_linux-4.14.133.patch
37 @@ -0,0 +1,1428 @@
38 +diff --git a/Makefile b/Makefile
39 +index 23b2916ef0ff..c36e64bd9ae7 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 132
47 ++SUBLEVEL = 133
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c
52 +index bcd7c9fc5d0f..869ac2d421c8 100644
53 +--- a/arch/arc/kernel/traps.c
54 ++++ b/arch/arc/kernel/traps.c
55 +@@ -155,3 +155,11 @@ void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs)
56 +
57 + insterror_is_error(address, regs);
58 + }
59 ++
60 ++/*
61 ++ * abort() call generated by older gcc for __builtin_trap()
62 ++ */
63 ++void abort(void)
64 ++{
65 ++ __asm__ __volatile__("trap_s 5\n");
66 ++}
67 +diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
68 +index f469e0435903..73ecccc514e1 100644
69 +--- a/arch/arm64/kernel/module.c
70 ++++ b/arch/arm64/kernel/module.c
71 +@@ -32,6 +32,7 @@
72 +
73 + void *module_alloc(unsigned long size)
74 + {
75 ++ u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
76 + gfp_t gfp_mask = GFP_KERNEL;
77 + void *p;
78 +
79 +@@ -39,9 +40,12 @@ void *module_alloc(unsigned long size)
80 + if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
81 + gfp_mask |= __GFP_NOWARN;
82 +
83 ++ if (IS_ENABLED(CONFIG_KASAN))
84 ++ /* don't exceed the static module region - see below */
85 ++ module_alloc_end = MODULES_END;
86 ++
87 + p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
88 +- module_alloc_base + MODULES_VSIZE,
89 +- gfp_mask, PAGE_KERNEL_EXEC, 0,
90 ++ module_alloc_end, gfp_mask, PAGE_KERNEL_EXEC, 0,
91 + NUMA_NO_NODE, __builtin_return_address(0));
92 +
93 + if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
94 +diff --git a/arch/mips/include/asm/netlogic/xlr/fmn.h b/arch/mips/include/asm/netlogic/xlr/fmn.h
95 +index 5604db3d1836..d79c68fa78d9 100644
96 +--- a/arch/mips/include/asm/netlogic/xlr/fmn.h
97 ++++ b/arch/mips/include/asm/netlogic/xlr/fmn.h
98 +@@ -301,8 +301,6 @@ static inline int nlm_fmn_send(unsigned int size, unsigned int code,
99 + for (i = 0; i < 8; i++) {
100 + nlm_msgsnd(dest);
101 + status = nlm_read_c2_status0();
102 +- if ((status & 0x2) == 1)
103 +- pr_info("Send pending fail!\n");
104 + if ((status & 0x4) == 0)
105 + return 0;
106 + }
107 +diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
108 +index 91ad023ead8c..60c58005fd20 100644
109 +--- a/arch/mips/mm/mmap.c
110 ++++ b/arch/mips/mm/mmap.c
111 +@@ -203,7 +203,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
112 +
113 + int __virt_addr_valid(const volatile void *kaddr)
114 + {
115 +- unsigned long vaddr = (unsigned long)vaddr;
116 ++ unsigned long vaddr = (unsigned long)kaddr;
117 +
118 + if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE))
119 + return 0;
120 +diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
121 +index 79b9f2ad3ff5..c2a6869418f7 100644
122 +--- a/arch/mips/mm/tlbex.c
123 ++++ b/arch/mips/mm/tlbex.c
124 +@@ -388,6 +388,7 @@ static struct work_registers build_get_work_registers(u32 **p)
125 + static void build_restore_work_registers(u32 **p)
126 + {
127 + if (scratch_reg >= 0) {
128 ++ uasm_i_ehb(p);
129 + UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
130 + return;
131 + }
132 +@@ -671,10 +672,12 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r,
133 + uasm_i_mtc0(p, 0, C0_PAGEMASK);
134 + uasm_il_b(p, r, lid);
135 + }
136 +- if (scratch_reg >= 0)
137 ++ if (scratch_reg >= 0) {
138 ++ uasm_i_ehb(p);
139 + UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
140 +- else
141 ++ } else {
142 + UASM_i_LW(p, 1, scratchpad_offset(0), 0);
143 ++ }
144 + } else {
145 + /* Reset default page size */
146 + if (PM_DEFAULT_MASK >> 16) {
147 +@@ -939,10 +942,12 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
148 + uasm_i_jr(p, ptr);
149 +
150 + if (mode == refill_scratch) {
151 +- if (scratch_reg >= 0)
152 ++ if (scratch_reg >= 0) {
153 ++ uasm_i_ehb(p);
154 + UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
155 +- else
156 ++ } else {
157 + UASM_i_LW(p, 1, scratchpad_offset(0), 0);
158 ++ }
159 + } else {
160 + uasm_i_nop(p);
161 + }
162 +@@ -1259,6 +1264,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
163 + UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */
164 +
165 + if (c0_scratch_reg >= 0) {
166 ++ uasm_i_ehb(p);
167 + UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg);
168 + build_tlb_write_entry(p, l, r, tlb_random);
169 + uasm_l_leave(l, *p);
170 +@@ -1615,15 +1621,17 @@ static void build_setup_pgd(void)
171 + uasm_i_dinsm(&p, a0, 0, 29, 64 - 29);
172 + uasm_l_tlbl_goaround1(&l, p);
173 + UASM_i_SLL(&p, a0, a0, 11);
174 +- uasm_i_jr(&p, 31);
175 + UASM_i_MTC0(&p, a0, C0_CONTEXT);
176 ++ uasm_i_jr(&p, 31);
177 ++ uasm_i_ehb(&p);
178 + } else {
179 + /* PGD in c0_KScratch */
180 +- uasm_i_jr(&p, 31);
181 + if (cpu_has_ldpte)
182 + UASM_i_MTC0(&p, a0, C0_PWBASE);
183 + else
184 + UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
185 ++ uasm_i_jr(&p, 31);
186 ++ uasm_i_ehb(&p);
187 + }
188 + #else
189 + #ifdef CONFIG_SMP
190 +@@ -1637,13 +1645,16 @@ static void build_setup_pgd(void)
191 + UASM_i_LA_mostly(&p, a2, pgdc);
192 + UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2);
193 + #endif /* SMP */
194 +- uasm_i_jr(&p, 31);
195 +
196 + /* if pgd_reg is allocated, save PGD also to scratch register */
197 +- if (pgd_reg != -1)
198 ++ if (pgd_reg != -1) {
199 + UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
200 +- else
201 ++ uasm_i_jr(&p, 31);
202 ++ uasm_i_ehb(&p);
203 ++ } else {
204 ++ uasm_i_jr(&p, 31);
205 + uasm_i_nop(&p);
206 ++ }
207 + #endif
208 + if (p >= tlbmiss_handler_setup_pgd_end)
209 + panic("tlbmiss_handler_setup_pgd space exceeded");
210 +diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
211 +index c020ba4b7eb6..ccc2b9d2956a 100644
212 +--- a/arch/x86/kernel/ftrace.c
213 ++++ b/arch/x86/kernel/ftrace.c
214 +@@ -22,6 +22,7 @@
215 + #include <linux/init.h>
216 + #include <linux/list.h>
217 + #include <linux/module.h>
218 ++#include <linux/memory.h>
219 +
220 + #include <trace/syscall.h>
221 +
222 +@@ -36,6 +37,7 @@
223 +
224 + int ftrace_arch_code_modify_prepare(void)
225 + {
226 ++ mutex_lock(&text_mutex);
227 + set_kernel_text_rw();
228 + set_all_modules_text_rw();
229 + return 0;
230 +@@ -45,6 +47,7 @@ int ftrace_arch_code_modify_post_process(void)
231 + {
232 + set_all_modules_text_ro();
233 + set_kernel_text_ro();
234 ++ mutex_unlock(&text_mutex);
235 + return 0;
236 + }
237 +
238 +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
239 +index 053e4937af0c..3aa0b8123c91 100644
240 +--- a/arch/x86/kvm/lapic.c
241 ++++ b/arch/x86/kvm/lapic.c
242 +@@ -2161,7 +2161,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu)
243 + struct kvm_lapic *apic = vcpu->arch.apic;
244 + u32 ppr;
245 +
246 +- if (!apic_enabled(apic))
247 ++ if (!kvm_apic_hw_enabled(apic))
248 + return -1;
249 +
250 + __apic_update_ppr(apic, &ppr);
251 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
252 +index 858dd0d89b02..a8526042d176 100644
253 +--- a/arch/x86/kvm/x86.c
254 ++++ b/arch/x86/kvm/x86.c
255 +@@ -1392,7 +1392,7 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
256 + vcpu->arch.tsc_always_catchup = 1;
257 + return 0;
258 + } else {
259 +- WARN(1, "user requested TSC rate below hardware speed\n");
260 ++ pr_warn_ratelimited("user requested TSC rate below hardware speed\n");
261 + return -1;
262 + }
263 + }
264 +@@ -1402,8 +1402,8 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
265 + user_tsc_khz, tsc_khz);
266 +
267 + if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) {
268 +- WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
269 +- user_tsc_khz);
270 ++ pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
271 ++ user_tsc_khz);
272 + return -1;
273 + }
274 +
275 +diff --git a/crypto/cryptd.c b/crypto/cryptd.c
276 +index 248f6ba41688..4cc1871646a8 100644
277 +--- a/crypto/cryptd.c
278 ++++ b/crypto/cryptd.c
279 +@@ -585,6 +585,7 @@ static void cryptd_skcipher_free(struct skcipher_instance *inst)
280 + struct skcipherd_instance_ctx *ctx = skcipher_instance_ctx(inst);
281 +
282 + crypto_drop_skcipher(&ctx->spawn);
283 ++ kfree(inst);
284 + }
285 +
286 + static int cryptd_create_skcipher(struct crypto_template *tmpl,
287 +diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
288 +index b5758768920b..2b8fb8f1391e 100644
289 +--- a/crypto/crypto_user.c
290 ++++ b/crypto/crypto_user.c
291 +@@ -55,6 +55,9 @@ static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact)
292 + list_for_each_entry(q, &crypto_alg_list, cra_list) {
293 + int match = 0;
294 +
295 ++ if (crypto_is_larval(q))
296 ++ continue;
297 ++
298 + if ((q->cra_flags ^ p->cru_type) & p->cru_mask)
299 + continue;
300 +
301 +diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
302 +index a67ec1bdc4e0..b8e7c2d8915e 100644
303 +--- a/drivers/dma/imx-sdma.c
304 ++++ b/drivers/dma/imx-sdma.c
305 +@@ -632,7 +632,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
306 + spin_lock_irqsave(&sdma->channel_0_lock, flags);
307 +
308 + bd0->mode.command = C0_SETPM;
309 +- bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD;
310 ++ bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
311 + bd0->mode.count = size / 2;
312 + bd0->buffer_addr = buf_phys;
313 + bd0->ext_buffer_addr = address;
314 +@@ -909,7 +909,7 @@ static int sdma_load_context(struct sdma_channel *sdmac)
315 + context->gReg[7] = sdmac->watermark_level;
316 +
317 + bd0->mode.command = C0_SETDM;
318 +- bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD;
319 ++ bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
320 + bd0->mode.count = sizeof(*context) / 4;
321 + bd0->buffer_addr = sdma->context_phys;
322 + bd0->ext_buffer_addr = 2048 + (sizeof(*context) / 4) * channel;
323 +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
324 +index b2eecfc9042e..53186c5e1066 100644
325 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
326 ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
327 +@@ -1534,25 +1534,6 @@ static void gfx_v9_0_gpu_init(struct amdgpu_device *adev)
328 + mutex_unlock(&adev->srbm_mutex);
329 +
330 + gfx_v9_0_init_compute_vmid(adev);
331 +-
332 +- mutex_lock(&adev->grbm_idx_mutex);
333 +- /*
334 +- * making sure that the following register writes will be broadcasted
335 +- * to all the shaders
336 +- */
337 +- gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
338 +-
339 +- WREG32_SOC15(GC, 0, mmPA_SC_FIFO_SIZE,
340 +- (adev->gfx.config.sc_prim_fifo_size_frontend <<
341 +- PA_SC_FIFO_SIZE__SC_FRONTEND_PRIM_FIFO_SIZE__SHIFT) |
342 +- (adev->gfx.config.sc_prim_fifo_size_backend <<
343 +- PA_SC_FIFO_SIZE__SC_BACKEND_PRIM_FIFO_SIZE__SHIFT) |
344 +- (adev->gfx.config.sc_hiz_tile_fifo_size <<
345 +- PA_SC_FIFO_SIZE__SC_HIZ_TILE_FIFO_SIZE__SHIFT) |
346 +- (adev->gfx.config.sc_earlyz_tile_fifo_size <<
347 +- PA_SC_FIFO_SIZE__SC_EARLYZ_TILE_FIFO_SIZE__SHIFT));
348 +- mutex_unlock(&adev->grbm_idx_mutex);
349 +-
350 + }
351 +
352 + static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)
353 +diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
354 +index 92c1f8e166dc..0bdbbd4027fe 100644
355 +--- a/drivers/gpu/drm/i915/intel_csr.c
356 ++++ b/drivers/gpu/drm/i915/intel_csr.c
357 +@@ -277,10 +277,17 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
358 + uint32_t i;
359 + uint32_t *dmc_payload;
360 + uint32_t required_version;
361 ++ size_t fsize;
362 +
363 + if (!fw)
364 + return NULL;
365 +
366 ++ fsize = sizeof(struct intel_css_header) +
367 ++ sizeof(struct intel_package_header) +
368 ++ sizeof(struct intel_dmc_header);
369 ++ if (fsize > fw->size)
370 ++ goto error_truncated;
371 ++
372 + /* Extract CSS Header information*/
373 + css_header = (struct intel_css_header *)fw->data;
374 + if (sizeof(struct intel_css_header) !=
375 +@@ -350,6 +357,9 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
376 + return NULL;
377 + }
378 + readcount += dmc_offset;
379 ++ fsize += dmc_offset;
380 ++ if (fsize > fw->size)
381 ++ goto error_truncated;
382 +
383 + /* Extract dmc_header information. */
384 + dmc_header = (struct intel_dmc_header *)&fw->data[readcount];
385 +@@ -380,6 +390,10 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
386 +
387 + /* fw_size is in dwords, so multiplied by 4 to convert into bytes. */
388 + nbytes = dmc_header->fw_size * 4;
389 ++ fsize += nbytes;
390 ++ if (fsize > fw->size)
391 ++ goto error_truncated;
392 ++
393 + if (nbytes > CSR_MAX_FW_SIZE) {
394 + DRM_ERROR("CSR firmware too big (%u) bytes\n", nbytes);
395 + return NULL;
396 +@@ -393,6 +407,10 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
397 + }
398 +
399 + return memcpy(dmc_payload, &fw->data[readcount], nbytes);
400 ++
401 ++error_truncated:
402 ++ DRM_ERROR("Truncated DMC firmware, rejecting.\n");
403 ++ return NULL;
404 + }
405 +
406 + static void csr_load_work_fn(struct work_struct *work)
407 +diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
408 +index 957fbf8c55eb..12dd261fc308 100644
409 +--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
410 ++++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
411 +@@ -99,14 +99,14 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc,
412 + ipu_dc_disable(ipu);
413 + ipu_prg_disable(ipu);
414 +
415 ++ drm_crtc_vblank_off(crtc);
416 ++
417 + spin_lock_irq(&crtc->dev->event_lock);
418 +- if (crtc->state->event) {
419 ++ if (crtc->state->event && !crtc->state->active) {
420 + drm_crtc_send_vblank_event(crtc, crtc->state->event);
421 + crtc->state->event = NULL;
422 + }
423 + spin_unlock_irq(&crtc->dev->event_lock);
424 +-
425 +- drm_crtc_vblank_off(crtc);
426 + }
427 +
428 + static void imx_drm_crtc_reset(struct drm_crtc *crtc)
429 +diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
430 +index a2ca90fc403c..cada1c75c41c 100644
431 +--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
432 ++++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
433 +@@ -270,6 +270,7 @@ err_config_cleanup:
434 + static void mtk_drm_kms_deinit(struct drm_device *drm)
435 + {
436 + drm_kms_helper_poll_fini(drm);
437 ++ drm_atomic_helper_shutdown(drm);
438 +
439 + component_unbind_all(drm->dev, drm);
440 + drm_mode_config_cleanup(drm);
441 +diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
442 +index 7e5e24c2152a..c1b8caad65e6 100644
443 +--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
444 ++++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
445 +@@ -631,6 +631,15 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
446 + if (--dsi->refcount != 0)
447 + return;
448 +
449 ++ /*
450 ++ * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
451 ++ * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
452 ++ * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
453 ++ * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
454 ++ * after dsi is fully set.
455 ++ */
456 ++ mtk_dsi_stop(dsi);
457 ++
458 + if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
459 + if (dsi->panel) {
460 + if (drm_panel_unprepare(dsi->panel)) {
461 +@@ -697,7 +706,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
462 + }
463 + }
464 +
465 +- mtk_dsi_stop(dsi);
466 + mtk_dsi_poweroff(dsi);
467 +
468 + dsi->enabled = false;
469 +@@ -851,6 +859,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi)
470 + /* Skip connector cleanup if creation was delegated to the bridge */
471 + if (dsi->conn.dev)
472 + drm_connector_cleanup(&dsi->conn);
473 ++ if (dsi->panel)
474 ++ drm_panel_detach(dsi->panel);
475 + }
476 +
477 + static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp)
478 +diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c
479 +index 4f3de2a8c4df..9aced80f31a2 100644
480 +--- a/drivers/platform/x86/mlx-platform.c
481 ++++ b/drivers/platform/x86/mlx-platform.c
482 +@@ -318,7 +318,7 @@ static int __init mlxplat_init(void)
483 +
484 + for (i = 0; i < ARRAY_SIZE(mlxplat_mux_data); i++) {
485 + priv->pdev_mux[i] = platform_device_register_resndata(
486 +- &mlxplat_dev->dev,
487 ++ &priv->pdev_i2c->dev,
488 + "i2c-mux-reg", i, NULL,
489 + 0, &mlxplat_mux_data[i],
490 + sizeof(mlxplat_mux_data[i]));
491 +diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
492 +index 5b4b7f9be2d7..6d520e8945f7 100644
493 +--- a/drivers/scsi/hpsa.c
494 ++++ b/drivers/scsi/hpsa.c
495 +@@ -4800,7 +4800,7 @@ static int hpsa_scsi_ioaccel2_queue_command(struct ctlr_info *h,
496 + curr_sg->reserved[0] = 0;
497 + curr_sg->reserved[1] = 0;
498 + curr_sg->reserved[2] = 0;
499 +- curr_sg->chain_indicator = 0x80;
500 ++ curr_sg->chain_indicator = IOACCEL2_CHAIN;
501 +
502 + curr_sg = h->ioaccel2_cmd_sg_list[c->cmdindex];
503 + }
504 +@@ -4817,6 +4817,11 @@ static int hpsa_scsi_ioaccel2_queue_command(struct ctlr_info *h,
505 + curr_sg++;
506 + }
507 +
508 ++ /*
509 ++ * Set the last s/g element bit
510 ++ */
511 ++ (curr_sg - 1)->chain_indicator = IOACCEL2_LAST_SG;
512 ++
513 + switch (cmd->sc_data_direction) {
514 + case DMA_TO_DEVICE:
515 + cp->direction &= ~IOACCEL2_DIRECTION_MASK;
516 +diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
517 +index 078afe448115..ecf15344b55d 100644
518 +--- a/drivers/scsi/hpsa_cmd.h
519 ++++ b/drivers/scsi/hpsa_cmd.h
520 +@@ -516,6 +516,7 @@ struct ioaccel2_sg_element {
521 + u8 reserved[3];
522 + u8 chain_indicator;
523 + #define IOACCEL2_CHAIN 0x80
524 ++#define IOACCEL2_LAST_SG 0x40
525 + };
526 +
527 + /*
528 +diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c
529 +index 3aa9e6e3dac8..4ef54436b9d4 100644
530 +--- a/drivers/spi/spi-bitbang.c
531 ++++ b/drivers/spi/spi-bitbang.c
532 +@@ -392,7 +392,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
533 + if (ret)
534 + spi_master_put(master);
535 +
536 +- return 0;
537 ++ return ret;
538 + }
539 + EXPORT_SYMBOL_GPL(spi_bitbang_start);
540 +
541 +diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
542 +index 070733ca94d5..32943afacffd 100644
543 +--- a/drivers/tty/rocket.c
544 ++++ b/drivers/tty/rocket.c
545 +@@ -279,7 +279,7 @@ MODULE_PARM_DESC(pc104_3, "set interface types for ISA(PC104) board #3 (e.g. pc1
546 + module_param_array(pc104_4, ulong, NULL, 0);
547 + MODULE_PARM_DESC(pc104_4, "set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,...");
548 +
549 +-static int rp_init(void);
550 ++static int __init rp_init(void);
551 + static void rp_cleanup_module(void);
552 +
553 + module_init(rp_init);
554 +diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c
555 +index e0c1b0099265..089f39de6897 100644
556 +--- a/drivers/usb/gadget/udc/fusb300_udc.c
557 ++++ b/drivers/usb/gadget/udc/fusb300_udc.c
558 +@@ -1345,12 +1345,15 @@ static const struct usb_gadget_ops fusb300_gadget_ops = {
559 + static int fusb300_remove(struct platform_device *pdev)
560 + {
561 + struct fusb300 *fusb300 = platform_get_drvdata(pdev);
562 ++ int i;
563 +
564 + usb_del_gadget_udc(&fusb300->gadget);
565 + iounmap(fusb300->reg);
566 + free_irq(platform_get_irq(pdev, 0), fusb300);
567 +
568 + fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req);
569 ++ for (i = 0; i < FUSB300_MAX_NUM_EP; i++)
570 ++ kfree(fusb300->ep[i]);
571 + kfree(fusb300);
572 +
573 + return 0;
574 +@@ -1494,6 +1497,8 @@ clean_up:
575 + if (fusb300->ep0_req)
576 + fusb300_free_request(&fusb300->ep[0]->ep,
577 + fusb300->ep0_req);
578 ++ for (i = 0; i < FUSB300_MAX_NUM_EP; i++)
579 ++ kfree(fusb300->ep[i]);
580 + kfree(fusb300);
581 + }
582 + if (reg)
583 +diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
584 +index 8f32b5ee7734..6df1aded4503 100644
585 +--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
586 ++++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
587 +@@ -935,8 +935,7 @@ static struct lpc32xx_usbd_dd_gad *udc_dd_alloc(struct lpc32xx_udc *udc)
588 + dma_addr_t dma;
589 + struct lpc32xx_usbd_dd_gad *dd;
590 +
591 +- dd = (struct lpc32xx_usbd_dd_gad *) dma_pool_alloc(
592 +- udc->dd_cache, (GFP_KERNEL | GFP_DMA), &dma);
593 ++ dd = dma_pool_alloc(udc->dd_cache, GFP_ATOMIC | GFP_DMA, &dma);
594 + if (dd)
595 + dd->this_dma = dma;
596 +
597 +diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
598 +index 4eba9ee179e3..b40e8ded49c6 100644
599 +--- a/drivers/vhost/net.c
600 ++++ b/drivers/vhost/net.c
601 +@@ -44,6 +44,12 @@ MODULE_PARM_DESC(experimental_zcopytx, "Enable Zero Copy TX;"
602 + * Using this limit prevents one virtqueue from starving others. */
603 + #define VHOST_NET_WEIGHT 0x80000
604 +
605 ++/* Max number of packets transferred before requeueing the job.
606 ++ * Using this limit prevents one virtqueue from starving others with small
607 ++ * pkts.
608 ++ */
609 ++#define VHOST_NET_PKT_WEIGHT 256
610 ++
611 + /* MAX number of TX used buffers for outstanding zerocopy */
612 + #define VHOST_MAX_PEND 128
613 + #define VHOST_GOODCOPY_LEN 256
614 +@@ -461,6 +467,7 @@ static void handle_tx(struct vhost_net *net)
615 + struct socket *sock;
616 + struct vhost_net_ubuf_ref *uninitialized_var(ubufs);
617 + bool zcopy, zcopy_used;
618 ++ int sent_pkts = 0;
619 +
620 + mutex_lock(&vq->mutex);
621 + sock = vq->private_data;
622 +@@ -475,7 +482,7 @@ static void handle_tx(struct vhost_net *net)
623 + hdr_size = nvq->vhost_hlen;
624 + zcopy = nvq->ubufs;
625 +
626 +- for (;;) {
627 ++ do {
628 + /* Release DMAs done buffers first */
629 + if (zcopy)
630 + vhost_zerocopy_signal_used(net, vq);
631 +@@ -543,7 +550,6 @@ static void handle_tx(struct vhost_net *net)
632 + msg.msg_control = NULL;
633 + ubufs = NULL;
634 + }
635 +-
636 + total_len += len;
637 + if (total_len < VHOST_NET_WEIGHT &&
638 + !vhost_vq_avail_empty(&net->dev, vq) &&
639 +@@ -572,11 +578,7 @@ static void handle_tx(struct vhost_net *net)
640 + else
641 + vhost_zerocopy_signal_used(net, vq);
642 + vhost_net_tx_packet(net);
643 +- if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
644 +- vhost_poll_queue(&vq->poll);
645 +- break;
646 +- }
647 +- }
648 ++ } while (likely(!vhost_exceeds_weight(vq, ++sent_pkts, total_len)));
649 + out:
650 + mutex_unlock(&vq->mutex);
651 + }
652 +@@ -754,6 +756,7 @@ static void handle_rx(struct vhost_net *net)
653 + struct socket *sock;
654 + struct iov_iter fixup;
655 + __virtio16 num_buffers;
656 ++ int recv_pkts = 0;
657 +
658 + mutex_lock_nested(&vq->mutex, 0);
659 + sock = vq->private_data;
660 +@@ -773,7 +776,11 @@ static void handle_rx(struct vhost_net *net)
661 + vq->log : NULL;
662 + mergeable = vhost_has_feature(vq, VIRTIO_NET_F_MRG_RXBUF);
663 +
664 +- while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk))) {
665 ++ do {
666 ++ sock_len = vhost_net_rx_peek_head_len(net, sock->sk);
667 ++
668 ++ if (!sock_len)
669 ++ break;
670 + sock_len += sock_hlen;
671 + vhost_len = sock_len + vhost_hlen;
672 + headcount = get_rx_bufs(vq, vq->heads, vhost_len,
673 +@@ -854,11 +861,8 @@ static void handle_rx(struct vhost_net *net)
674 + vhost_log_write(vq, vq_log, log, vhost_len,
675 + vq->iov, in);
676 + total_len += vhost_len;
677 +- if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
678 +- vhost_poll_queue(&vq->poll);
679 +- goto out;
680 +- }
681 +- }
682 ++ } while (likely(!vhost_exceeds_weight(vq, ++recv_pkts, total_len)));
683 ++
684 + vhost_net_enable_vq(net, vq);
685 + out:
686 + mutex_unlock(&vq->mutex);
687 +@@ -936,7 +940,8 @@ static int vhost_net_open(struct inode *inode, struct file *f)
688 + n->vqs[i].sock_hlen = 0;
689 + vhost_net_buf_init(&n->vqs[i].rxq);
690 + }
691 +- vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
692 ++ vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX,
693 ++ VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT);
694 +
695 + vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
696 + vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
697 +diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
698 +index 35ebf06d9ecb..cb4ab5b955ad 100644
699 +--- a/drivers/vhost/scsi.c
700 ++++ b/drivers/vhost/scsi.c
701 +@@ -58,6 +58,12 @@
702 + #define VHOST_SCSI_PREALLOC_UPAGES 2048
703 + #define VHOST_SCSI_PREALLOC_PROT_SGLS 512
704 +
705 ++/* Max number of requests before requeueing the job.
706 ++ * Using this limit prevents one virtqueue from starving others with
707 ++ * request.
708 ++ */
709 ++#define VHOST_SCSI_WEIGHT 256
710 ++
711 + struct vhost_scsi_inflight {
712 + /* Wait for the flush operation to finish */
713 + struct completion comp;
714 +@@ -840,7 +846,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
715 + u64 tag;
716 + u32 exp_data_len, data_direction;
717 + unsigned int out = 0, in = 0;
718 +- int head, ret, prot_bytes;
719 ++ int head, ret, prot_bytes, c = 0;
720 + size_t req_size, rsp_size = sizeof(struct virtio_scsi_cmd_resp);
721 + size_t out_size, in_size;
722 + u16 lun;
723 +@@ -859,7 +865,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
724 +
725 + vhost_disable_notify(&vs->dev, vq);
726 +
727 +- for (;;) {
728 ++ do {
729 + head = vhost_get_vq_desc(vq, vq->iov,
730 + ARRAY_SIZE(vq->iov), &out, &in,
731 + NULL, NULL);
732 +@@ -1074,7 +1080,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
733 + */
734 + INIT_WORK(&cmd->work, vhost_scsi_submission_work);
735 + queue_work(vhost_scsi_workqueue, &cmd->work);
736 +- }
737 ++ } while (likely(!vhost_exceeds_weight(vq, ++c, 0)));
738 + out:
739 + mutex_unlock(&vq->mutex);
740 + }
741 +@@ -1427,7 +1433,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
742 + vqs[i] = &vs->vqs[i].vq;
743 + vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick;
744 + }
745 +- vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
746 ++ vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ, VHOST_SCSI_WEIGHT, 0);
747 +
748 + vhost_scsi_init_inflight(vs, NULL);
749 +
750 +diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
751 +index 0e93ac888a5f..88fa81c482e8 100644
752 +--- a/drivers/vhost/vhost.c
753 ++++ b/drivers/vhost/vhost.c
754 +@@ -412,8 +412,24 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
755 + vhost_vq_free_iovecs(dev->vqs[i]);
756 + }
757 +
758 ++bool vhost_exceeds_weight(struct vhost_virtqueue *vq,
759 ++ int pkts, int total_len)
760 ++{
761 ++ struct vhost_dev *dev = vq->dev;
762 ++
763 ++ if ((dev->byte_weight && total_len >= dev->byte_weight) ||
764 ++ pkts >= dev->weight) {
765 ++ vhost_poll_queue(&vq->poll);
766 ++ return true;
767 ++ }
768 ++
769 ++ return false;
770 ++}
771 ++EXPORT_SYMBOL_GPL(vhost_exceeds_weight);
772 ++
773 + void vhost_dev_init(struct vhost_dev *dev,
774 +- struct vhost_virtqueue **vqs, int nvqs)
775 ++ struct vhost_virtqueue **vqs, int nvqs,
776 ++ int weight, int byte_weight)
777 + {
778 + struct vhost_virtqueue *vq;
779 + int i;
780 +@@ -427,6 +443,8 @@ void vhost_dev_init(struct vhost_dev *dev,
781 + dev->iotlb = NULL;
782 + dev->mm = NULL;
783 + dev->worker = NULL;
784 ++ dev->weight = weight;
785 ++ dev->byte_weight = byte_weight;
786 + init_llist_head(&dev->work_list);
787 + init_waitqueue_head(&dev->wait);
788 + INIT_LIST_HEAD(&dev->read_list);
789 +diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
790 +index 75d21d4a8354..950c5c4e4ee3 100644
791 +--- a/drivers/vhost/vhost.h
792 ++++ b/drivers/vhost/vhost.h
793 +@@ -173,9 +173,13 @@ struct vhost_dev {
794 + struct list_head read_list;
795 + struct list_head pending_list;
796 + wait_queue_head_t wait;
797 ++ int weight;
798 ++ int byte_weight;
799 + };
800 +
801 +-void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
802 ++bool vhost_exceeds_weight(struct vhost_virtqueue *vq, int pkts, int total_len);
803 ++void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs,
804 ++ int nvqs, int weight, int byte_weight);
805 + long vhost_dev_set_owner(struct vhost_dev *dev);
806 + bool vhost_dev_has_owner(struct vhost_dev *dev);
807 + long vhost_dev_check_owner(struct vhost_dev *);
808 +diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
809 +index d0cf3d5aa570..5b9db5deffbb 100644
810 +--- a/drivers/vhost/vsock.c
811 ++++ b/drivers/vhost/vsock.c
812 +@@ -21,6 +21,14 @@
813 + #include "vhost.h"
814 +
815 + #define VHOST_VSOCK_DEFAULT_HOST_CID 2
816 ++/* Max number of bytes transferred before requeueing the job.
817 ++ * Using this limit prevents one virtqueue from starving others. */
818 ++#define VHOST_VSOCK_WEIGHT 0x80000
819 ++/* Max number of packets transferred before requeueing the job.
820 ++ * Using this limit prevents one virtqueue from starving others with
821 ++ * small pkts.
822 ++ */
823 ++#define VHOST_VSOCK_PKT_WEIGHT 256
824 +
825 + enum {
826 + VHOST_VSOCK_FEATURES = VHOST_FEATURES,
827 +@@ -78,6 +86,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
828 + struct vhost_virtqueue *vq)
829 + {
830 + struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX];
831 ++ int pkts = 0, total_len = 0;
832 + bool added = false;
833 + bool restart_tx = false;
834 +
835 +@@ -89,7 +98,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
836 + /* Avoid further vmexits, we're already processing the virtqueue */
837 + vhost_disable_notify(&vsock->dev, vq);
838 +
839 +- for (;;) {
840 ++ do {
841 + struct virtio_vsock_pkt *pkt;
842 + struct iov_iter iov_iter;
843 + unsigned out, in;
844 +@@ -174,8 +183,9 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
845 + */
846 + virtio_transport_deliver_tap_pkt(pkt);
847 +
848 ++ total_len += pkt->len;
849 + virtio_transport_free_pkt(pkt);
850 +- }
851 ++ } while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
852 + if (added)
853 + vhost_signal(&vsock->dev, vq);
854 +
855 +@@ -350,7 +360,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
856 + struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock,
857 + dev);
858 + struct virtio_vsock_pkt *pkt;
859 +- int head;
860 ++ int head, pkts = 0, total_len = 0;
861 + unsigned int out, in;
862 + bool added = false;
863 +
864 +@@ -360,7 +370,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
865 + goto out;
866 +
867 + vhost_disable_notify(&vsock->dev, vq);
868 +- for (;;) {
869 ++ do {
870 + u32 len;
871 +
872 + if (!vhost_vsock_more_replies(vsock)) {
873 +@@ -401,9 +411,11 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
874 + else
875 + virtio_transport_free_pkt(pkt);
876 +
877 +- vhost_add_used(vq, head, sizeof(pkt->hdr) + len);
878 ++ len += sizeof(pkt->hdr);
879 ++ vhost_add_used(vq, head, len);
880 ++ total_len += len;
881 + added = true;
882 +- }
883 ++ } while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
884 +
885 + no_more_replies:
886 + if (added)
887 +@@ -531,7 +543,8 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
888 + vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick;
889 + vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick;
890 +
891 +- vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs));
892 ++ vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs),
893 ++ VHOST_VSOCK_PKT_WEIGHT, VHOST_VSOCK_WEIGHT);
894 +
895 + file->private_data = vsock;
896 + spin_lock_init(&vsock->send_pkt_list_lock);
897 +diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
898 +index d826fbaf7d50..e4d5e6eae409 100644
899 +--- a/fs/btrfs/backref.c
900 ++++ b/fs/btrfs/backref.c
901 +@@ -1290,8 +1290,6 @@ again:
902 + ret = -EIO;
903 + goto out;
904 + }
905 +- btrfs_tree_read_lock(eb);
906 +- btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
907 + if (!path->skip_locking) {
908 + btrfs_tree_read_lock(eb);
909 + btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
910 +diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
911 +index f86457713e60..f1e9dd246ab0 100644
912 +--- a/fs/btrfs/dev-replace.c
913 ++++ b/fs/btrfs/dev-replace.c
914 +@@ -512,18 +512,27 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
915 + }
916 + btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
917 +
918 +- trans = btrfs_start_transaction(root, 0);
919 +- if (IS_ERR(trans)) {
920 +- mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
921 +- return PTR_ERR(trans);
922 ++ while (1) {
923 ++ trans = btrfs_start_transaction(root, 0);
924 ++ if (IS_ERR(trans)) {
925 ++ mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
926 ++ return PTR_ERR(trans);
927 ++ }
928 ++ ret = btrfs_commit_transaction(trans);
929 ++ WARN_ON(ret);
930 ++ mutex_lock(&uuid_mutex);
931 ++ /* keep away write_all_supers() during the finishing procedure */
932 ++ mutex_lock(&fs_info->fs_devices->device_list_mutex);
933 ++ mutex_lock(&fs_info->chunk_mutex);
934 ++ if (src_device->has_pending_chunks) {
935 ++ mutex_unlock(&root->fs_info->chunk_mutex);
936 ++ mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
937 ++ mutex_unlock(&uuid_mutex);
938 ++ } else {
939 ++ break;
940 ++ }
941 + }
942 +- ret = btrfs_commit_transaction(trans);
943 +- WARN_ON(ret);
944 +
945 +- mutex_lock(&uuid_mutex);
946 +- /* keep away write_all_supers() during the finishing procedure */
947 +- mutex_lock(&fs_info->fs_devices->device_list_mutex);
948 +- mutex_lock(&fs_info->chunk_mutex);
949 + btrfs_dev_replace_lock(dev_replace, 1);
950 + dev_replace->replace_state =
951 + scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED
952 +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
953 +index 38ed8e259e00..85294fef1051 100644
954 +--- a/fs/btrfs/volumes.c
955 ++++ b/fs/btrfs/volumes.c
956 +@@ -4851,6 +4851,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
957 + for (i = 0; i < map->num_stripes; i++) {
958 + num_bytes = map->stripes[i].dev->bytes_used + stripe_size;
959 + btrfs_device_set_bytes_used(map->stripes[i].dev, num_bytes);
960 ++ map->stripes[i].dev->has_pending_chunks = true;
961 + }
962 +
963 + atomic64_sub(stripe_size * map->num_stripes, &info->free_chunk_space);
964 +@@ -7310,6 +7311,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_fs_info *fs_info,
965 + for (i = 0; i < map->num_stripes; i++) {
966 + dev = map->stripes[i].dev;
967 + dev->commit_bytes_used = dev->bytes_used;
968 ++ dev->has_pending_chunks = false;
969 + }
970 + }
971 + mutex_unlock(&fs_info->chunk_mutex);
972 +diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
973 +index 76fb6e84f201..f6ae6cdf233d 100644
974 +--- a/fs/btrfs/volumes.h
975 ++++ b/fs/btrfs/volumes.h
976 +@@ -61,6 +61,11 @@ struct btrfs_device {
977 +
978 + spinlock_t io_lock ____cacheline_aligned;
979 + int running_pending;
980 ++ /* When true means this device has pending chunk alloc in
981 ++ * current transaction. Protected by chunk_mutex.
982 ++ */
983 ++ bool has_pending_chunks;
984 ++
985 + /* regular prio bios */
986 + struct btrfs_pending_bios pending_bios;
987 + /* sync bios */
988 +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
989 +index 4657e2924ecb..0a0e1aa11f5e 100644
990 +--- a/kernel/cgroup/cpuset.c
991 ++++ b/kernel/cgroup/cpuset.c
992 +@@ -2436,10 +2436,23 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
993 + spin_unlock_irqrestore(&callback_lock, flags);
994 + }
995 +
996 ++/**
997 ++ * cpuset_cpus_allowed_fallback - final fallback before complete catastrophe.
998 ++ * @tsk: pointer to task_struct with which the scheduler is struggling
999 ++ *
1000 ++ * Description: In the case that the scheduler cannot find an allowed cpu in
1001 ++ * tsk->cpus_allowed, we fall back to task_cs(tsk)->cpus_allowed. In legacy
1002 ++ * mode however, this value is the same as task_cs(tsk)->effective_cpus,
1003 ++ * which will not contain a sane cpumask during cases such as cpu hotplugging.
1004 ++ * This is the absolute last resort for the scheduler and it is only used if
1005 ++ * _every_ other avenue has been traveled.
1006 ++ **/
1007 ++
1008 + void cpuset_cpus_allowed_fallback(struct task_struct *tsk)
1009 + {
1010 + rcu_read_lock();
1011 +- do_set_cpus_allowed(tsk, task_cs(tsk)->effective_cpus);
1012 ++ do_set_cpus_allowed(tsk, is_in_v2_mode() ?
1013 ++ task_cs(tsk)->cpus_allowed : cpu_possible_mask);
1014 + rcu_read_unlock();
1015 +
1016 + /*
1017 +diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
1018 +index 7c51f065b212..88754e9790f9 100644
1019 +--- a/kernel/livepatch/core.c
1020 ++++ b/kernel/livepatch/core.c
1021 +@@ -30,6 +30,7 @@
1022 + #include <linux/elf.h>
1023 + #include <linux/moduleloader.h>
1024 + #include <linux/completion.h>
1025 ++#include <linux/memory.h>
1026 + #include <asm/cacheflush.h>
1027 + #include "core.h"
1028 + #include "patch.h"
1029 +@@ -635,16 +636,21 @@ static int klp_init_object_loaded(struct klp_patch *patch,
1030 + struct klp_func *func;
1031 + int ret;
1032 +
1033 ++ mutex_lock(&text_mutex);
1034 ++
1035 + module_disable_ro(patch->mod);
1036 + ret = klp_write_object_relocations(patch->mod, obj);
1037 + if (ret) {
1038 + module_enable_ro(patch->mod, true);
1039 ++ mutex_unlock(&text_mutex);
1040 + return ret;
1041 + }
1042 +
1043 + arch_klp_init_object_loaded(patch, obj);
1044 + module_enable_ro(patch->mod, true);
1045 +
1046 ++ mutex_unlock(&text_mutex);
1047 ++
1048 + klp_for_each_func(obj, func) {
1049 + ret = klp_find_object_symbol(obj->name, func->old_name,
1050 + func->old_sympos,
1051 +diff --git a/kernel/ptrace.c b/kernel/ptrace.c
1052 +index a75959dc149e..09fb3f58a838 100644
1053 +--- a/kernel/ptrace.c
1054 ++++ b/kernel/ptrace.c
1055 +@@ -78,9 +78,7 @@ void __ptrace_link(struct task_struct *child, struct task_struct *new_parent,
1056 + */
1057 + static void ptrace_link(struct task_struct *child, struct task_struct *new_parent)
1058 + {
1059 +- rcu_read_lock();
1060 +- __ptrace_link(child, new_parent, __task_cred(new_parent));
1061 +- rcu_read_unlock();
1062 ++ __ptrace_link(child, new_parent, current_cred());
1063 + }
1064 +
1065 + /**
1066 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1067 +index 3e92852c8b23..c4a0ad18c859 100644
1068 +--- a/kernel/trace/ftrace.c
1069 ++++ b/kernel/trace/ftrace.c
1070 +@@ -4280,10 +4280,13 @@ void free_ftrace_func_mapper(struct ftrace_func_mapper *mapper,
1071 + struct ftrace_func_entry *entry;
1072 + struct ftrace_func_map *map;
1073 + struct hlist_head *hhd;
1074 +- int size = 1 << mapper->hash.size_bits;
1075 +- int i;
1076 ++ int size, i;
1077 ++
1078 ++ if (!mapper)
1079 ++ return;
1080 +
1081 + if (free_func && mapper->hash.count) {
1082 ++ size = 1 << mapper->hash.size_bits;
1083 + for (i = 0; i < size; i++) {
1084 + hhd = &mapper->hash.buckets[i];
1085 + hlist_for_each_entry(entry, hhd, hlist) {
1086 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1087 +index 76267d82f157..91227e339ef6 100644
1088 +--- a/kernel/trace/trace.c
1089 ++++ b/kernel/trace/trace.c
1090 +@@ -6394,11 +6394,13 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt,
1091 + break;
1092 + }
1093 + #endif
1094 +- if (!tr->allocated_snapshot) {
1095 ++ if (tr->allocated_snapshot)
1096 ++ ret = resize_buffer_duplicate_size(&tr->max_buffer,
1097 ++ &tr->trace_buffer, iter->cpu_file);
1098 ++ else
1099 + ret = tracing_alloc_snapshot_instance(tr);
1100 +- if (ret < 0)
1101 +- break;
1102 +- }
1103 ++ if (ret < 0)
1104 ++ break;
1105 + local_irq_disable();
1106 + /* Now, we're going to swap */
1107 + if (iter->cpu_file == RING_BUFFER_ALL_CPUS)
1108 +diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c
1109 +index 468fb7cd1221..edf345b7f06b 100644
1110 +--- a/lib/mpi/mpi-pow.c
1111 ++++ b/lib/mpi/mpi-pow.c
1112 +@@ -37,6 +37,7 @@
1113 + int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
1114 + {
1115 + mpi_ptr_t mp_marker = NULL, bp_marker = NULL, ep_marker = NULL;
1116 ++ struct karatsuba_ctx karactx = {};
1117 + mpi_ptr_t xp_marker = NULL;
1118 + mpi_ptr_t tspace = NULL;
1119 + mpi_ptr_t rp, ep, mp, bp;
1120 +@@ -164,13 +165,11 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
1121 + int c;
1122 + mpi_limb_t e;
1123 + mpi_limb_t carry_limb;
1124 +- struct karatsuba_ctx karactx;
1125 +
1126 + xp = xp_marker = mpi_alloc_limb_space(2 * (msize + 1));
1127 + if (!xp)
1128 + goto enomem;
1129 +
1130 +- memset(&karactx, 0, sizeof karactx);
1131 + negative_result = (ep[0] & 1) && base->sign;
1132 +
1133 + i = esize - 1;
1134 +@@ -295,8 +294,6 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
1135 + if (mod_shift_cnt)
1136 + mpihelp_rshift(rp, rp, rsize, mod_shift_cnt);
1137 + MPN_NORMALIZE(rp, rsize);
1138 +-
1139 +- mpihelp_release_karatsuba_ctx(&karactx);
1140 + }
1141 +
1142 + if (negative_result && rsize) {
1143 +@@ -313,6 +310,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
1144 + leave:
1145 + rc = 0;
1146 + enomem:
1147 ++ mpihelp_release_karatsuba_ctx(&karactx);
1148 + if (assign_rp)
1149 + mpi_assign_limb_space(res, rp, size);
1150 + if (mp_marker)
1151 +diff --git a/mm/mlock.c b/mm/mlock.c
1152 +index 46af369c13e5..1f9ee86672e8 100644
1153 +--- a/mm/mlock.c
1154 ++++ b/mm/mlock.c
1155 +@@ -629,11 +629,11 @@ static int apply_vma_lock_flags(unsigned long start, size_t len,
1156 + * is also counted.
1157 + * Return value: previously mlocked page counts
1158 + */
1159 +-static int count_mm_mlocked_page_nr(struct mm_struct *mm,
1160 ++static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm,
1161 + unsigned long start, size_t len)
1162 + {
1163 + struct vm_area_struct *vma;
1164 +- int count = 0;
1165 ++ unsigned long count = 0;
1166 +
1167 + if (mm == NULL)
1168 + mm = current->mm;
1169 +diff --git a/mm/vmscan.c b/mm/vmscan.c
1170 +index 414c5cf87234..290078e8d4b1 100644
1171 +--- a/mm/vmscan.c
1172 ++++ b/mm/vmscan.c
1173 +@@ -3439,19 +3439,18 @@ out:
1174 + }
1175 +
1176 + /*
1177 +- * pgdat->kswapd_classzone_idx is the highest zone index that a recent
1178 +- * allocation request woke kswapd for. When kswapd has not woken recently,
1179 +- * the value is MAX_NR_ZONES which is not a valid index. This compares a
1180 +- * given classzone and returns it or the highest classzone index kswapd
1181 +- * was recently woke for.
1182 ++ * The pgdat->kswapd_classzone_idx is used to pass the highest zone index to be
1183 ++ * reclaimed by kswapd from the waker. If the value is MAX_NR_ZONES which is not
1184 ++ * a valid index then either kswapd runs for first time or kswapd couldn't sleep
1185 ++ * after previous reclaim attempt (node is still unbalanced). In that case
1186 ++ * return the zone index of the previous kswapd reclaim cycle.
1187 + */
1188 + static enum zone_type kswapd_classzone_idx(pg_data_t *pgdat,
1189 +- enum zone_type classzone_idx)
1190 ++ enum zone_type prev_classzone_idx)
1191 + {
1192 + if (pgdat->kswapd_classzone_idx == MAX_NR_ZONES)
1193 +- return classzone_idx;
1194 +-
1195 +- return max(pgdat->kswapd_classzone_idx, classzone_idx);
1196 ++ return prev_classzone_idx;
1197 ++ return pgdat->kswapd_classzone_idx;
1198 + }
1199 +
1200 + static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_order,
1201 +@@ -3592,7 +3591,7 @@ kswapd_try_sleep:
1202 +
1203 + /* Read the new order and classzone_idx */
1204 + alloc_order = reclaim_order = pgdat->kswapd_order;
1205 +- classzone_idx = kswapd_classzone_idx(pgdat, 0);
1206 ++ classzone_idx = kswapd_classzone_idx(pgdat, classzone_idx);
1207 + pgdat->kswapd_order = 0;
1208 + pgdat->kswapd_classzone_idx = MAX_NR_ZONES;
1209 +
1210 +@@ -3643,8 +3642,12 @@ void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx)
1211 + if (!cpuset_zone_allowed(zone, GFP_KERNEL | __GFP_HARDWALL))
1212 + return;
1213 + pgdat = zone->zone_pgdat;
1214 +- pgdat->kswapd_classzone_idx = kswapd_classzone_idx(pgdat,
1215 +- classzone_idx);
1216 ++
1217 ++ if (pgdat->kswapd_classzone_idx == MAX_NR_ZONES)
1218 ++ pgdat->kswapd_classzone_idx = classzone_idx;
1219 ++ else
1220 ++ pgdat->kswapd_classzone_idx = max(pgdat->kswapd_classzone_idx,
1221 ++ classzone_idx);
1222 + pgdat->kswapd_order = max(pgdat->kswapd_order, order);
1223 + if (!waitqueue_active(&pgdat->kswapd_wait))
1224 + return;
1225 +diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
1226 +index e9698592cf98..0ee64f67300a 100644
1227 +--- a/net/bluetooth/l2cap_core.c
1228 ++++ b/net/bluetooth/l2cap_core.c
1229 +@@ -1352,7 +1352,7 @@ static bool l2cap_check_enc_key_size(struct hci_conn *hcon)
1230 + * actually encrypted before enforcing a key size.
1231 + */
1232 + return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) ||
1233 +- hcon->enc_key_size > HCI_MIN_ENC_KEY_SIZE);
1234 ++ hcon->enc_key_size >= HCI_MIN_ENC_KEY_SIZE);
1235 + }
1236 +
1237 + static void l2cap_do_start(struct l2cap_chan *chan)
1238 +diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
1239 +index 5caf8e722a11..51e6cf2dc277 100644
1240 +--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
1241 ++++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
1242 +@@ -524,9 +524,14 @@ static void handle_connect_req(struct rdma_cm_id *new_cma_id,
1243 + /* Save client advertised inbound read limit for use later in accept. */
1244 + newxprt->sc_ord = param->initiator_depth;
1245 +
1246 +- /* Set the local and remote addresses in the transport */
1247 + sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr;
1248 + svc_xprt_set_remote(&newxprt->sc_xprt, sa, svc_addr_len(sa));
1249 ++ /* The remote port is arbitrary and not under the control of the
1250 ++ * client ULP. Set it to a fixed value so that the DRC continues
1251 ++ * to be effective after a reconnect.
1252 ++ */
1253 ++ rpc_set_port((struct sockaddr *)&newxprt->sc_xprt.xpt_remote, 0);
1254 ++
1255 + sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr;
1256 + svc_xprt_set_local(&newxprt->sc_xprt, sa, svc_addr_len(sa));
1257 +
1258 +diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
1259 +index 98a7d63a723e..c4a9ddb174bc 100755
1260 +--- a/scripts/decode_stacktrace.sh
1261 ++++ b/scripts/decode_stacktrace.sh
1262 +@@ -66,7 +66,7 @@ parse_symbol() {
1263 + if [[ "${cache[$module,$address]+isset}" == "isset" ]]; then
1264 + local code=${cache[$module,$address]}
1265 + else
1266 +- local code=$(addr2line -i -e "$objfile" "$address")
1267 ++ local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address")
1268 + cache[$module,$address]=$code
1269 + fi
1270 +
1271 +diff --git a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c
1272 +index 5b8520177b0e..7d72e3d48ad5 100644
1273 +--- a/sound/core/seq/oss/seq_oss_ioctl.c
1274 ++++ b/sound/core/seq/oss/seq_oss_ioctl.c
1275 +@@ -62,7 +62,7 @@ static int snd_seq_oss_oob_user(struct seq_oss_devinfo *dp, void __user *arg)
1276 + if (copy_from_user(ev, arg, 8))
1277 + return -EFAULT;
1278 + memset(&tmpev, 0, sizeof(tmpev));
1279 +- snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.port, dp->addr.client);
1280 ++ snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.client, dp->addr.port);
1281 + tmpev.time.tick = 0;
1282 + if (! snd_seq_oss_process_event(dp, (union evrec *)ev, &tmpev)) {
1283 + snd_seq_oss_dispatch(dp, &tmpev, 0, 0);
1284 +diff --git a/sound/core/seq/oss/seq_oss_rw.c b/sound/core/seq/oss/seq_oss_rw.c
1285 +index 6a7b6aceeca9..499f3e8f4949 100644
1286 +--- a/sound/core/seq/oss/seq_oss_rw.c
1287 ++++ b/sound/core/seq/oss/seq_oss_rw.c
1288 +@@ -174,7 +174,7 @@ insert_queue(struct seq_oss_devinfo *dp, union evrec *rec, struct file *opt)
1289 + memset(&event, 0, sizeof(event));
1290 + /* set dummy -- to be sure */
1291 + event.type = SNDRV_SEQ_EVENT_NOTEOFF;
1292 +- snd_seq_oss_fill_addr(dp, &event, dp->addr.port, dp->addr.client);
1293 ++ snd_seq_oss_fill_addr(dp, &event, dp->addr.client, dp->addr.port);
1294 +
1295 + if (snd_seq_oss_process_event(dp, rec, &event))
1296 + return 0; /* invalid event - no need to insert queue */
1297 +diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c
1298 +index 23ccddb20de1..8fc554d745f6 100644
1299 +--- a/sound/firewire/amdtp-am824.c
1300 ++++ b/sound/firewire/amdtp-am824.c
1301 +@@ -321,7 +321,7 @@ static void read_midi_messages(struct amdtp_stream *s,
1302 + u8 *b;
1303 +
1304 + for (f = 0; f < frames; f++) {
1305 +- port = (s->data_block_counter + f) % 8;
1306 ++ port = (8 - s->tx_first_dbc + s->data_block_counter + f) % 8;
1307 + b = (u8 *)&buffer[p->midi_position];
1308 +
1309 + len = b[0] - 0x80;
1310 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1311 +index 6d06f5d029aa..3552b4b1f902 100644
1312 +--- a/sound/pci/hda/patch_realtek.c
1313 ++++ b/sound/pci/hda/patch_realtek.c
1314 +@@ -6590,6 +6590,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1315 + SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
1316 + SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
1317 + SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
1318 ++ SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
1319 + SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
1320 + SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
1321 + SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
1322 +diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
1323 +index 6e8eb1f5a041..bed64723e5d9 100644
1324 +--- a/sound/soc/codecs/cs4265.c
1325 ++++ b/sound/soc/codecs/cs4265.c
1326 +@@ -60,7 +60,7 @@ static const struct reg_default cs4265_reg_defaults[] = {
1327 + static bool cs4265_readable_register(struct device *dev, unsigned int reg)
1328 + {
1329 + switch (reg) {
1330 +- case CS4265_CHIP_ID ... CS4265_SPDIF_CTL2:
1331 ++ case CS4265_CHIP_ID ... CS4265_MAX_REGISTER:
1332 + return true;
1333 + default:
1334 + return false;
1335 +diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
1336 +index cc66ea5cc776..3fe09828745a 100644
1337 +--- a/sound/soc/codecs/max98090.c
1338 ++++ b/sound/soc/codecs/max98090.c
1339 +@@ -1924,6 +1924,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090,
1340 + return 0;
1341 + }
1342 +
1343 ++static int max98090_dai_startup(struct snd_pcm_substream *substream,
1344 ++ struct snd_soc_dai *dai)
1345 ++{
1346 ++ struct snd_soc_component *component = dai->component;
1347 ++ struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
1348 ++ unsigned int fmt = max98090->dai_fmt;
1349 ++
1350 ++ /* Remove 24-bit format support if it is not in right justified mode. */
1351 ++ if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
1352 ++ substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
1353 ++ snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
1354 ++ }
1355 ++ return 0;
1356 ++}
1357 ++
1358 + static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
1359 + struct snd_pcm_hw_params *params,
1360 + struct snd_soc_dai *dai)
1361 +@@ -2331,6 +2346,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
1362 + #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
1363 +
1364 + static const struct snd_soc_dai_ops max98090_dai_ops = {
1365 ++ .startup = max98090_dai_startup,
1366 + .set_sysclk = max98090_dai_set_sysclk,
1367 + .set_fmt = max98090_dai_set_fmt,
1368 + .set_tdm_slot = max98090_set_tdm_slot,
1369 +diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c
1370 +index cd048df76232..43086ac9ffec 100644
1371 +--- a/sound/soc/codecs/rt274.c
1372 ++++ b/sound/soc/codecs/rt274.c
1373 +@@ -398,6 +398,8 @@ static int rt274_mic_detect(struct snd_soc_codec *codec,
1374 + {
1375 + struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec);
1376 +
1377 ++ rt274->jack = jack;
1378 ++
1379 + if (jack == NULL) {
1380 + /* Disable jack detection */
1381 + regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
1382 +@@ -405,7 +407,6 @@ static int rt274_mic_detect(struct snd_soc_codec *codec,
1383 +
1384 + return 0;
1385 + }
1386 +- rt274->jack = jack;
1387 +
1388 + regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
1389 + RT274_IRQ_EN, RT274_IRQ_EN);
1390 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
1391 +index 584b7ffe78f5..052b6294a428 100644
1392 +--- a/sound/soc/soc-pcm.c
1393 ++++ b/sound/soc/soc-pcm.c
1394 +@@ -2233,7 +2233,8 @@ int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
1395 +
1396 + if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
1397 + (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
1398 +- (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND))
1399 ++ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) &&
1400 ++ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
1401 + continue;
1402 +
1403 + dev_dbg(be->dev, "ASoC: prepare BE %s\n",
1404 +diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
1405 +index b4af5ce78ecb..da0a2083e12a 100644
1406 +--- a/sound/soc/sunxi/sun4i-i2s.c
1407 ++++ b/sound/soc/sunxi/sun4i-i2s.c
1408 +@@ -110,7 +110,7 @@
1409 +
1410 + #define SUN8I_I2S_TX_CHAN_MAP_REG 0x44
1411 + #define SUN8I_I2S_TX_CHAN_SEL_REG 0x34
1412 +-#define SUN8I_I2S_TX_CHAN_OFFSET_MASK GENMASK(13, 11)
1413 ++#define SUN8I_I2S_TX_CHAN_OFFSET_MASK GENMASK(13, 12)
1414 + #define SUN8I_I2S_TX_CHAN_OFFSET(offset) (offset << 12)
1415 + #define SUN8I_I2S_TX_CHAN_EN_MASK GENMASK(11, 4)
1416 + #define SUN8I_I2S_TX_CHAN_EN(num_chan) (((1 << num_chan) - 1) << 4)
1417 +@@ -442,6 +442,10 @@ static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1418 + regmap_update_bits(i2s->regmap, SUN8I_I2S_TX_CHAN_SEL_REG,
1419 + SUN8I_I2S_TX_CHAN_OFFSET_MASK,
1420 + SUN8I_I2S_TX_CHAN_OFFSET(offset));
1421 ++
1422 ++ regmap_update_bits(i2s->regmap, SUN8I_I2S_RX_CHAN_SEL_REG,
1423 ++ SUN8I_I2S_TX_CHAN_OFFSET_MASK,
1424 ++ SUN8I_I2S_TX_CHAN_OFFSET(offset));
1425 + }
1426 +
1427 + regmap_field_write(i2s->field_fmt_mode, val);
1428 +diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
1429 +index b3854f8c0c67..f5614507a81c 100644
1430 +--- a/sound/usb/line6/pcm.c
1431 ++++ b/sound/usb/line6/pcm.c
1432 +@@ -558,6 +558,11 @@ int line6_init_pcm(struct usb_line6 *line6,
1433 + line6pcm->max_packet_size_out =
1434 + usb_maxpacket(line6->usbdev,
1435 + usb_sndisocpipe(line6->usbdev, ep_write), 1);
1436 ++ if (!line6pcm->max_packet_size_in || !line6pcm->max_packet_size_out) {
1437 ++ dev_err(line6pcm->line6->ifcdev,
1438 ++ "cannot get proper max packet size\n");
1439 ++ return -EINVAL;
1440 ++ }
1441 +
1442 + spin_lock_init(&line6pcm->out.lock);
1443 + spin_lock_init(&line6pcm->in.lock);
1444 +diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
1445 +index e1e7ce9ab217..b54f7dab8372 100644
1446 +--- a/sound/usb/mixer_quirks.c
1447 ++++ b/sound/usb/mixer_quirks.c
1448 +@@ -754,7 +754,7 @@ static int snd_ni_control_init_val(struct usb_mixer_interface *mixer,
1449 + return err;
1450 + }
1451 +
1452 +- kctl->private_value |= (value << 24);
1453 ++ kctl->private_value |= ((unsigned int)value << 24);
1454 + return 0;
1455 + }
1456 +
1457 +@@ -915,7 +915,7 @@ static int snd_ftu_eff_switch_init(struct usb_mixer_interface *mixer,
1458 + if (err < 0)
1459 + return err;
1460 +
1461 +- kctl->private_value |= value[0] << 24;
1462 ++ kctl->private_value |= (unsigned int)value[0] << 24;
1463 + return 0;
1464 + }
1465 +