Contents of /trunk/kernel-alx/patches-4.19/0157-4.19.58-all-fixes.patch
Parent Directory | Revision Log
Revision 3436 -
(show annotations)
(download)
Fri Aug 2 11:48:04 2019 UTC (5 years, 1 month ago) by niro
File size: 80452 byte(s)
Fri Aug 2 11:48:04 2019 UTC (5 years, 1 month ago) by niro
File size: 80452 byte(s)
-linux-4.19.58
1 | diff --git a/Makefile b/Makefile |
2 | index 5412d556b561..5dcd01cd1bf6 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 4 |
8 | PATCHLEVEL = 19 |
9 | -SUBLEVEL = 57 |
10 | +SUBLEVEL = 58 |
11 | EXTRAVERSION = |
12 | NAME = "People's Front" |
13 | |
14 | diff --git a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
15 | index 8d708cc22495..3e7d093d7a9a 100644 |
16 | --- a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
17 | +++ b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
18 | @@ -336,3 +336,11 @@ |
19 | status = "disabled"; |
20 | }; |
21 | |
22 | +&uart0 { |
23 | + compatible = "marvell,armada-38x-uart"; |
24 | +}; |
25 | + |
26 | +&uart1 { |
27 | + compatible = "marvell,armada-38x-uart"; |
28 | +}; |
29 | + |
30 | diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c |
31 | index 0b368ceccee4..8644f154ea7a 100644 |
32 | --- a/arch/arm64/kernel/module.c |
33 | +++ b/arch/arm64/kernel/module.c |
34 | @@ -32,6 +32,7 @@ |
35 | |
36 | void *module_alloc(unsigned long size) |
37 | { |
38 | + u64 module_alloc_end = module_alloc_base + MODULES_VSIZE; |
39 | gfp_t gfp_mask = GFP_KERNEL; |
40 | void *p; |
41 | |
42 | @@ -39,9 +40,12 @@ void *module_alloc(unsigned long size) |
43 | if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)) |
44 | gfp_mask |= __GFP_NOWARN; |
45 | |
46 | + if (IS_ENABLED(CONFIG_KASAN)) |
47 | + /* don't exceed the static module region - see below */ |
48 | + module_alloc_end = MODULES_END; |
49 | + |
50 | p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, |
51 | - module_alloc_base + MODULES_VSIZE, |
52 | - gfp_mask, PAGE_KERNEL_EXEC, 0, |
53 | + module_alloc_end, gfp_mask, PAGE_KERNEL_EXEC, 0, |
54 | NUMA_NO_NODE, __builtin_return_address(0)); |
55 | |
56 | if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && |
57 | diff --git a/arch/mips/Makefile b/arch/mips/Makefile |
58 | index d74b3742fa5d..ad0a92f95af1 100644 |
59 | --- a/arch/mips/Makefile |
60 | +++ b/arch/mips/Makefile |
61 | @@ -16,6 +16,7 @@ archscripts: scripts_basic |
62 | $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs |
63 | |
64 | KBUILD_DEFCONFIG := 32r2el_defconfig |
65 | +KBUILD_DTBS := dtbs |
66 | |
67 | # |
68 | # Select the object file format to substitute into the linker script. |
69 | @@ -385,7 +386,7 @@ quiet_cmd_64 = OBJCOPY $@ |
70 | vmlinux.64: vmlinux |
71 | $(call cmd,64) |
72 | |
73 | -all: $(all-y) |
74 | +all: $(all-y) $(KBUILD_DTBS) |
75 | |
76 | # boot |
77 | $(boot-y): $(vmlinux-32) FORCE |
78 | diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c |
79 | index 7755a1fad05a..1b705fb2f10c 100644 |
80 | --- a/arch/mips/mm/mmap.c |
81 | +++ b/arch/mips/mm/mmap.c |
82 | @@ -203,7 +203,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) |
83 | |
84 | int __virt_addr_valid(const volatile void *kaddr) |
85 | { |
86 | - unsigned long vaddr = (unsigned long)vaddr; |
87 | + unsigned long vaddr = (unsigned long)kaddr; |
88 | |
89 | if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE)) |
90 | return 0; |
91 | diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c |
92 | index 067714291643..8c4fda52b91d 100644 |
93 | --- a/arch/mips/mm/tlbex.c |
94 | +++ b/arch/mips/mm/tlbex.c |
95 | @@ -391,6 +391,7 @@ static struct work_registers build_get_work_registers(u32 **p) |
96 | static void build_restore_work_registers(u32 **p) |
97 | { |
98 | if (scratch_reg >= 0) { |
99 | + uasm_i_ehb(p); |
100 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); |
101 | return; |
102 | } |
103 | @@ -667,10 +668,12 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, |
104 | uasm_i_mtc0(p, 0, C0_PAGEMASK); |
105 | uasm_il_b(p, r, lid); |
106 | } |
107 | - if (scratch_reg >= 0) |
108 | + if (scratch_reg >= 0) { |
109 | + uasm_i_ehb(p); |
110 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); |
111 | - else |
112 | + } else { |
113 | UASM_i_LW(p, 1, scratchpad_offset(0), 0); |
114 | + } |
115 | } else { |
116 | /* Reset default page size */ |
117 | if (PM_DEFAULT_MASK >> 16) { |
118 | @@ -935,10 +938,12 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, |
119 | uasm_i_jr(p, ptr); |
120 | |
121 | if (mode == refill_scratch) { |
122 | - if (scratch_reg >= 0) |
123 | + if (scratch_reg >= 0) { |
124 | + uasm_i_ehb(p); |
125 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); |
126 | - else |
127 | + } else { |
128 | UASM_i_LW(p, 1, scratchpad_offset(0), 0); |
129 | + } |
130 | } else { |
131 | uasm_i_nop(p); |
132 | } |
133 | @@ -1255,6 +1260,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, |
134 | UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */ |
135 | |
136 | if (c0_scratch_reg >= 0) { |
137 | + uasm_i_ehb(p); |
138 | UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg); |
139 | build_tlb_write_entry(p, l, r, tlb_random); |
140 | uasm_l_leave(l, *p); |
141 | @@ -1600,15 +1606,17 @@ static void build_setup_pgd(void) |
142 | uasm_i_dinsm(&p, a0, 0, 29, 64 - 29); |
143 | uasm_l_tlbl_goaround1(&l, p); |
144 | UASM_i_SLL(&p, a0, a0, 11); |
145 | - uasm_i_jr(&p, 31); |
146 | UASM_i_MTC0(&p, a0, C0_CONTEXT); |
147 | + uasm_i_jr(&p, 31); |
148 | + uasm_i_ehb(&p); |
149 | } else { |
150 | /* PGD in c0_KScratch */ |
151 | - uasm_i_jr(&p, 31); |
152 | if (cpu_has_ldpte) |
153 | UASM_i_MTC0(&p, a0, C0_PWBASE); |
154 | else |
155 | UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); |
156 | + uasm_i_jr(&p, 31); |
157 | + uasm_i_ehb(&p); |
158 | } |
159 | #else |
160 | #ifdef CONFIG_SMP |
161 | @@ -1622,13 +1630,16 @@ static void build_setup_pgd(void) |
162 | UASM_i_LA_mostly(&p, a2, pgdc); |
163 | UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); |
164 | #endif /* SMP */ |
165 | - uasm_i_jr(&p, 31); |
166 | |
167 | /* if pgd_reg is allocated, save PGD also to scratch register */ |
168 | - if (pgd_reg != -1) |
169 | + if (pgd_reg != -1) { |
170 | UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); |
171 | - else |
172 | + uasm_i_jr(&p, 31); |
173 | + uasm_i_ehb(&p); |
174 | + } else { |
175 | + uasm_i_jr(&p, 31); |
176 | uasm_i_nop(&p); |
177 | + } |
178 | #endif |
179 | if (p >= (u32 *)tlbmiss_handler_setup_pgd_end) |
180 | panic("tlbmiss_handler_setup_pgd space exceeded"); |
181 | diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S |
182 | index f105ae8651c9..f62e347862cc 100644 |
183 | --- a/arch/x86/boot/compressed/head_64.S |
184 | +++ b/arch/x86/boot/compressed/head_64.S |
185 | @@ -602,10 +602,12 @@ ENTRY(trampoline_32bit_src) |
186 | 3: |
187 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ |
188 | pushl %ecx |
189 | + pushl %edx |
190 | movl $MSR_EFER, %ecx |
191 | rdmsr |
192 | btsl $_EFER_LME, %eax |
193 | wrmsr |
194 | + popl %edx |
195 | popl %ecx |
196 | |
197 | /* Enable PAE and LA57 (if required) paging modes */ |
198 | diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h |
199 | index 058b1a1994c4..2e38fb82b91d 100644 |
200 | --- a/arch/x86/include/asm/intel-family.h |
201 | +++ b/arch/x86/include/asm/intel-family.h |
202 | @@ -52,6 +52,9 @@ |
203 | |
204 | #define INTEL_FAM6_CANNONLAKE_MOBILE 0x66 |
205 | |
206 | +#define INTEL_FAM6_ICELAKE_X 0x6A |
207 | +#define INTEL_FAM6_ICELAKE_XEON_D 0x6C |
208 | +#define INTEL_FAM6_ICELAKE_DESKTOP 0x7D |
209 | #define INTEL_FAM6_ICELAKE_MOBILE 0x7E |
210 | |
211 | /* "Small Core" Processors (Atom) */ |
212 | diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c |
213 | index 9f033dfd2766..50d309662d78 100644 |
214 | --- a/arch/x86/kernel/ftrace.c |
215 | +++ b/arch/x86/kernel/ftrace.c |
216 | @@ -22,6 +22,7 @@ |
217 | #include <linux/init.h> |
218 | #include <linux/list.h> |
219 | #include <linux/module.h> |
220 | +#include <linux/memory.h> |
221 | |
222 | #include <trace/syscall.h> |
223 | |
224 | @@ -35,6 +36,7 @@ |
225 | |
226 | int ftrace_arch_code_modify_prepare(void) |
227 | { |
228 | + mutex_lock(&text_mutex); |
229 | set_kernel_text_rw(); |
230 | set_all_modules_text_rw(); |
231 | return 0; |
232 | @@ -44,6 +46,7 @@ int ftrace_arch_code_modify_post_process(void) |
233 | { |
234 | set_all_modules_text_ro(); |
235 | set_kernel_text_ro(); |
236 | + mutex_unlock(&text_mutex); |
237 | return 0; |
238 | } |
239 | |
240 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
241 | index cba414db14cb..031bd7f91f98 100644 |
242 | --- a/arch/x86/kvm/lapic.c |
243 | +++ b/arch/x86/kvm/lapic.c |
244 | @@ -2275,7 +2275,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) |
245 | struct kvm_lapic *apic = vcpu->arch.apic; |
246 | u32 ppr; |
247 | |
248 | - if (!apic_enabled(apic)) |
249 | + if (!kvm_apic_hw_enabled(apic)) |
250 | return -1; |
251 | |
252 | __apic_update_ppr(apic, &ppr); |
253 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
254 | index 7fed1d6dd1a1..cea6568667c4 100644 |
255 | --- a/arch/x86/kvm/x86.c |
256 | +++ b/arch/x86/kvm/x86.c |
257 | @@ -1447,7 +1447,7 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale) |
258 | vcpu->arch.tsc_always_catchup = 1; |
259 | return 0; |
260 | } else { |
261 | - WARN(1, "user requested TSC rate below hardware speed\n"); |
262 | + pr_warn_ratelimited("user requested TSC rate below hardware speed\n"); |
263 | return -1; |
264 | } |
265 | } |
266 | @@ -1457,8 +1457,8 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale) |
267 | user_tsc_khz, tsc_khz); |
268 | |
269 | if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) { |
270 | - WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n", |
271 | - user_tsc_khz); |
272 | + pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n", |
273 | + user_tsc_khz); |
274 | return -1; |
275 | } |
276 | |
277 | diff --git a/block/blk-core.c b/block/blk-core.c |
278 | index 6eed5d84c2ef..682bc561b77b 100644 |
279 | --- a/block/blk-core.c |
280 | +++ b/block/blk-core.c |
281 | @@ -2445,10 +2445,8 @@ blk_qc_t generic_make_request(struct bio *bio) |
282 | flags = 0; |
283 | if (bio->bi_opf & REQ_NOWAIT) |
284 | flags = BLK_MQ_REQ_NOWAIT; |
285 | - if (blk_queue_enter(q, flags) < 0) { |
286 | + if (blk_queue_enter(q, flags) < 0) |
287 | enter_succeeded = false; |
288 | - q = NULL; |
289 | - } |
290 | } |
291 | |
292 | if (enter_succeeded) { |
293 | @@ -2479,6 +2477,7 @@ blk_qc_t generic_make_request(struct bio *bio) |
294 | bio_wouldblock_error(bio); |
295 | else |
296 | bio_io_error(bio); |
297 | + q = NULL; |
298 | } |
299 | bio = bio_list_pop(&bio_list_on_stack[0]); |
300 | } while (bio); |
301 | diff --git a/crypto/cryptd.c b/crypto/cryptd.c |
302 | index addca7bae33f..e0c8e907b086 100644 |
303 | --- a/crypto/cryptd.c |
304 | +++ b/crypto/cryptd.c |
305 | @@ -586,6 +586,7 @@ static void cryptd_skcipher_free(struct skcipher_instance *inst) |
306 | struct skcipherd_instance_ctx *ctx = skcipher_instance_ctx(inst); |
307 | |
308 | crypto_drop_skcipher(&ctx->spawn); |
309 | + kfree(inst); |
310 | } |
311 | |
312 | static int cryptd_create_skcipher(struct crypto_template *tmpl, |
313 | diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c |
314 | index ceeb2eaf28cf..3cca814348a2 100644 |
315 | --- a/crypto/crypto_user.c |
316 | +++ b/crypto/crypto_user.c |
317 | @@ -55,6 +55,9 @@ static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) |
318 | list_for_each_entry(q, &crypto_alg_list, cra_list) { |
319 | int match = 0; |
320 | |
321 | + if (crypto_is_larval(q)) |
322 | + continue; |
323 | + |
324 | if ((q->cra_flags ^ p->cru_type) & p->cru_mask) |
325 | continue; |
326 | |
327 | diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c |
328 | index cb1b44d78a1f..1c658ec3cbf4 100644 |
329 | --- a/drivers/dma/imx-sdma.c |
330 | +++ b/drivers/dma/imx-sdma.c |
331 | @@ -681,7 +681,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size, |
332 | spin_lock_irqsave(&sdma->channel_0_lock, flags); |
333 | |
334 | bd0->mode.command = C0_SETPM; |
335 | - bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD; |
336 | + bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD; |
337 | bd0->mode.count = size / 2; |
338 | bd0->buffer_addr = buf_phys; |
339 | bd0->ext_buffer_addr = address; |
340 | @@ -1000,7 +1000,7 @@ static int sdma_load_context(struct sdma_channel *sdmac) |
341 | context->gReg[7] = sdmac->watermark_level; |
342 | |
343 | bd0->mode.command = C0_SETDM; |
344 | - bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD; |
345 | + bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD; |
346 | bd0->mode.count = sizeof(*context) / 4; |
347 | bd0->buffer_addr = sdma->context_phys; |
348 | bd0->ext_buffer_addr = 2048 + (sizeof(*context) / 4) * channel; |
349 | diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c |
350 | index 1617715aa6e0..489c8fa4d2e2 100644 |
351 | --- a/drivers/dma/qcom/bam_dma.c |
352 | +++ b/drivers/dma/qcom/bam_dma.c |
353 | @@ -808,6 +808,9 @@ static u32 process_channel_irqs(struct bam_device *bdev) |
354 | /* Number of bytes available to read */ |
355 | avail = CIRC_CNT(offset, bchan->head, MAX_DESCRIPTORS + 1); |
356 | |
357 | + if (offset < bchan->head) |
358 | + avail--; |
359 | + |
360 | list_for_each_entry_safe(async_desc, tmp, |
361 | &bchan->desc_list, desc_node) { |
362 | /* Not enough data to read */ |
363 | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
364 | index 325e2213cac5..46568497ef18 100644 |
365 | --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
366 | +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
367 | @@ -1801,25 +1801,6 @@ static void gfx_v9_0_gpu_init(struct amdgpu_device *adev) |
368 | mutex_unlock(&adev->srbm_mutex); |
369 | |
370 | gfx_v9_0_init_compute_vmid(adev); |
371 | - |
372 | - mutex_lock(&adev->grbm_idx_mutex); |
373 | - /* |
374 | - * making sure that the following register writes will be broadcasted |
375 | - * to all the shaders |
376 | - */ |
377 | - gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); |
378 | - |
379 | - WREG32_SOC15(GC, 0, mmPA_SC_FIFO_SIZE, |
380 | - (adev->gfx.config.sc_prim_fifo_size_frontend << |
381 | - PA_SC_FIFO_SIZE__SC_FRONTEND_PRIM_FIFO_SIZE__SHIFT) | |
382 | - (adev->gfx.config.sc_prim_fifo_size_backend << |
383 | - PA_SC_FIFO_SIZE__SC_BACKEND_PRIM_FIFO_SIZE__SHIFT) | |
384 | - (adev->gfx.config.sc_hiz_tile_fifo_size << |
385 | - PA_SC_FIFO_SIZE__SC_HIZ_TILE_FIFO_SIZE__SHIFT) | |
386 | - (adev->gfx.config.sc_earlyz_tile_fifo_size << |
387 | - PA_SC_FIFO_SIZE__SC_EARLYZ_TILE_FIFO_SIZE__SHIFT)); |
388 | - mutex_unlock(&adev->grbm_idx_mutex); |
389 | - |
390 | } |
391 | |
392 | static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev) |
393 | diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c |
394 | index 4e1fd5393845..fbbd5a4877e9 100644 |
395 | --- a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c |
396 | +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c |
397 | @@ -916,8 +916,10 @@ static int init_thermal_controller( |
398 | PHM_PlatformCaps_ThermalController |
399 | ); |
400 | |
401 | - if (0 == powerplay_table->usFanTableOffset) |
402 | + if (0 == powerplay_table->usFanTableOffset) { |
403 | + hwmgr->thermal_controller.use_hw_fan_control = 1; |
404 | return 0; |
405 | + } |
406 | |
407 | fan_table = (const PPTable_Generic_SubTable_Header *) |
408 | (((unsigned long)powerplay_table) + |
409 | diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h |
410 | index d3d96260f440..6ee864455a12 100644 |
411 | --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h |
412 | +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h |
413 | @@ -677,6 +677,7 @@ struct pp_thermal_controller_info { |
414 | uint8_t ucType; |
415 | uint8_t ucI2cLine; |
416 | uint8_t ucI2cAddress; |
417 | + uint8_t use_hw_fan_control; |
418 | struct pp_fan_info fanInfo; |
419 | struct pp_advance_fan_control_parameters advanceFanControlParameters; |
420 | }; |
421 | diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |
422 | index 45629f26dbc2..0dbca3865851 100644 |
423 | --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |
424 | +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |
425 | @@ -2038,6 +2038,10 @@ static int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr) |
426 | return 0; |
427 | } |
428 | |
429 | + /* use hardware fan control */ |
430 | + if (hwmgr->thermal_controller.use_hw_fan_control) |
431 | + return 0; |
432 | + |
433 | tmp64 = hwmgr->thermal_controller.advanceFanControlParameters. |
434 | usPWMMin * duty100; |
435 | do_div(tmp64, 10000); |
436 | diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
437 | index a0663f44e218..8b546fde139d 100644 |
438 | --- a/drivers/gpu/drm/drm_fb_helper.c |
439 | +++ b/drivers/gpu/drm/drm_fb_helper.c |
440 | @@ -2957,7 +2957,8 @@ static int drm_fbdev_fb_open(struct fb_info *info, int user) |
441 | { |
442 | struct drm_fb_helper *fb_helper = info->par; |
443 | |
444 | - if (!try_module_get(fb_helper->dev->driver->fops->owner)) |
445 | + /* No need to take a ref for fbcon because it unbinds on unregister */ |
446 | + if (user && !try_module_get(fb_helper->dev->driver->fops->owner)) |
447 | return -ENODEV; |
448 | |
449 | return 0; |
450 | @@ -2967,7 +2968,8 @@ static int drm_fbdev_fb_release(struct fb_info *info, int user) |
451 | { |
452 | struct drm_fb_helper *fb_helper = info->par; |
453 | |
454 | - module_put(fb_helper->dev->driver->fops->owner); |
455 | + if (user) |
456 | + module_put(fb_helper->dev->driver->fops->owner); |
457 | |
458 | return 0; |
459 | } |
460 | diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
461 | index ee4a5e1221f1..b44bed554211 100644 |
462 | --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c |
463 | +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
464 | @@ -42,6 +42,14 @@ static const struct drm_dmi_panel_orientation_data asus_t100ha = { |
465 | .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP, |
466 | }; |
467 | |
468 | +static const struct drm_dmi_panel_orientation_data gpd_micropc = { |
469 | + .width = 720, |
470 | + .height = 1280, |
471 | + .bios_dates = (const char * const []){ "04/26/2019", |
472 | + NULL }, |
473 | + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, |
474 | +}; |
475 | + |
476 | static const struct drm_dmi_panel_orientation_data gpd_pocket = { |
477 | .width = 1200, |
478 | .height = 1920, |
479 | @@ -50,6 +58,14 @@ static const struct drm_dmi_panel_orientation_data gpd_pocket = { |
480 | .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, |
481 | }; |
482 | |
483 | +static const struct drm_dmi_panel_orientation_data gpd_pocket2 = { |
484 | + .width = 1200, |
485 | + .height = 1920, |
486 | + .bios_dates = (const char * const []){ "06/28/2018", "08/28/2018", |
487 | + "12/07/2018", NULL }, |
488 | + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, |
489 | +}; |
490 | + |
491 | static const struct drm_dmi_panel_orientation_data gpd_win = { |
492 | .width = 720, |
493 | .height = 1280, |
494 | @@ -85,6 +101,14 @@ static const struct dmi_system_id orientation_data[] = { |
495 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"), |
496 | }, |
497 | .driver_data = (void *)&asus_t100ha, |
498 | + }, { /* GPD MicroPC (generic strings, also match on bios date) */ |
499 | + .matches = { |
500 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), |
501 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), |
502 | + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), |
503 | + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), |
504 | + }, |
505 | + .driver_data = (void *)&gpd_micropc, |
506 | }, { /* |
507 | * GPD Pocket, note that the the DMI data is less generic then |
508 | * it seems, devices with a board-vendor of "AMI Corporation" |
509 | @@ -98,6 +122,14 @@ static const struct dmi_system_id orientation_data[] = { |
510 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), |
511 | }, |
512 | .driver_data = (void *)&gpd_pocket, |
513 | + }, { /* GPD Pocket 2 (generic strings, also match on bios date) */ |
514 | + .matches = { |
515 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), |
516 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), |
517 | + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), |
518 | + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), |
519 | + }, |
520 | + .driver_data = (void *)&gpd_pocket2, |
521 | }, { /* GPD Win (same note on DMI match as GPD Pocket) */ |
522 | .matches = { |
523 | DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), |
524 | diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
525 | index f225fbc6edd2..6a859e077ea0 100644 |
526 | --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
527 | +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
528 | @@ -760,7 +760,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
529 | if (IS_ERR(gpu->cmdbuf_suballoc)) { |
530 | dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n"); |
531 | ret = PTR_ERR(gpu->cmdbuf_suballoc); |
532 | - goto fail; |
533 | + goto destroy_iommu; |
534 | } |
535 | |
536 | /* Create buffer: */ |
537 | @@ -768,7 +768,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
538 | PAGE_SIZE); |
539 | if (ret) { |
540 | dev_err(gpu->dev, "could not create command buffer\n"); |
541 | - goto destroy_iommu; |
542 | + goto destroy_suballoc; |
543 | } |
544 | |
545 | if (gpu->mmu->version == ETNAVIV_IOMMU_V1 && |
546 | @@ -800,6 +800,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
547 | free_buffer: |
548 | etnaviv_cmdbuf_free(&gpu->buffer); |
549 | gpu->buffer.suballoc = NULL; |
550 | +destroy_suballoc: |
551 | + etnaviv_cmdbuf_suballoc_destroy(gpu->cmdbuf_suballoc); |
552 | + gpu->cmdbuf_suballoc = NULL; |
553 | destroy_iommu: |
554 | etnaviv_iommu_destroy(gpu->mmu); |
555 | gpu->mmu = NULL; |
556 | diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c |
557 | index cf9b600cca79..ca1a578d790d 100644 |
558 | --- a/drivers/gpu/drm/i915/intel_csr.c |
559 | +++ b/drivers/gpu/drm/i915/intel_csr.c |
560 | @@ -282,10 +282,17 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv, |
561 | uint32_t i; |
562 | uint32_t *dmc_payload; |
563 | uint32_t required_version; |
564 | + size_t fsize; |
565 | |
566 | if (!fw) |
567 | return NULL; |
568 | |
569 | + fsize = sizeof(struct intel_css_header) + |
570 | + sizeof(struct intel_package_header) + |
571 | + sizeof(struct intel_dmc_header); |
572 | + if (fsize > fw->size) |
573 | + goto error_truncated; |
574 | + |
575 | /* Extract CSS Header information*/ |
576 | css_header = (struct intel_css_header *)fw->data; |
577 | if (sizeof(struct intel_css_header) != |
578 | @@ -360,6 +367,9 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv, |
579 | return NULL; |
580 | } |
581 | readcount += dmc_offset; |
582 | + fsize += dmc_offset; |
583 | + if (fsize > fw->size) |
584 | + goto error_truncated; |
585 | |
586 | /* Extract dmc_header information. */ |
587 | dmc_header = (struct intel_dmc_header *)&fw->data[readcount]; |
588 | @@ -391,6 +401,10 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv, |
589 | |
590 | /* fw_size is in dwords, so multiplied by 4 to convert into bytes. */ |
591 | nbytes = dmc_header->fw_size * 4; |
592 | + fsize += nbytes; |
593 | + if (fsize > fw->size) |
594 | + goto error_truncated; |
595 | + |
596 | if (nbytes > CSR_MAX_FW_SIZE) { |
597 | DRM_ERROR("DMC firmware too big (%u bytes)\n", nbytes); |
598 | return NULL; |
599 | @@ -404,6 +418,10 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv, |
600 | } |
601 | |
602 | return memcpy(dmc_payload, &fw->data[readcount], nbytes); |
603 | + |
604 | +error_truncated: |
605 | + DRM_ERROR("Truncated DMC firmware, rejecting.\n"); |
606 | + return NULL; |
607 | } |
608 | |
609 | static void csr_load_work_fn(struct work_struct *work) |
610 | diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c |
611 | index 11e2dcdd6b18..ff34f9bb55a1 100644 |
612 | --- a/drivers/gpu/drm/imx/ipuv3-crtc.c |
613 | +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c |
614 | @@ -98,14 +98,14 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, |
615 | ipu_dc_disable(ipu); |
616 | ipu_prg_disable(ipu); |
617 | |
618 | + drm_crtc_vblank_off(crtc); |
619 | + |
620 | spin_lock_irq(&crtc->dev->event_lock); |
621 | - if (crtc->state->event) { |
622 | + if (crtc->state->event && !crtc->state->active) { |
623 | drm_crtc_send_vblank_event(crtc, crtc->state->event); |
624 | crtc->state->event = NULL; |
625 | } |
626 | spin_unlock_irq(&crtc->dev->event_lock); |
627 | - |
628 | - drm_crtc_vblank_off(crtc); |
629 | } |
630 | |
631 | static void imx_drm_crtc_reset(struct drm_crtc *crtc) |
632 | diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c |
633 | index 47ec604289b7..fd83046d8376 100644 |
634 | --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c |
635 | +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c |
636 | @@ -310,6 +310,7 @@ err_config_cleanup: |
637 | static void mtk_drm_kms_deinit(struct drm_device *drm) |
638 | { |
639 | drm_kms_helper_poll_fini(drm); |
640 | + drm_atomic_helper_shutdown(drm); |
641 | |
642 | component_unbind_all(drm->dev, drm); |
643 | drm_mode_config_cleanup(drm); |
644 | @@ -390,7 +391,9 @@ static void mtk_drm_unbind(struct device *dev) |
645 | struct mtk_drm_private *private = dev_get_drvdata(dev); |
646 | |
647 | drm_dev_unregister(private->drm); |
648 | + mtk_drm_kms_deinit(private->drm); |
649 | drm_dev_put(private->drm); |
650 | + private->num_pipes = 0; |
651 | private->drm = NULL; |
652 | } |
653 | |
654 | @@ -559,13 +562,8 @@ err_node: |
655 | static int mtk_drm_remove(struct platform_device *pdev) |
656 | { |
657 | struct mtk_drm_private *private = platform_get_drvdata(pdev); |
658 | - struct drm_device *drm = private->drm; |
659 | int i; |
660 | |
661 | - drm_dev_unregister(drm); |
662 | - mtk_drm_kms_deinit(drm); |
663 | - drm_dev_put(drm); |
664 | - |
665 | component_master_del(&pdev->dev, &mtk_drm_ops); |
666 | pm_runtime_disable(&pdev->dev); |
667 | of_node_put(private->mutex_node); |
668 | diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c |
669 | index 66df1b177959..0dd317ac5fe5 100644 |
670 | --- a/drivers/gpu/drm/mediatek/mtk_dsi.c |
671 | +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c |
672 | @@ -630,6 +630,15 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) |
673 | if (--dsi->refcount != 0) |
674 | return; |
675 | |
676 | + /* |
677 | + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since |
678 | + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), |
679 | + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. |
680 | + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), |
681 | + * after dsi is fully set. |
682 | + */ |
683 | + mtk_dsi_stop(dsi); |
684 | + |
685 | if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) { |
686 | if (dsi->panel) { |
687 | if (drm_panel_unprepare(dsi->panel)) { |
688 | @@ -696,7 +705,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) |
689 | } |
690 | } |
691 | |
692 | - mtk_dsi_stop(dsi); |
693 | mtk_dsi_poweroff(dsi); |
694 | |
695 | dsi->enabled = false; |
696 | @@ -841,6 +849,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi) |
697 | /* Skip connector cleanup if creation was delegated to the bridge */ |
698 | if (dsi->conn.dev) |
699 | drm_connector_cleanup(&dsi->conn); |
700 | + if (dsi->panel) |
701 | + drm_panel_detach(dsi->panel); |
702 | } |
703 | |
704 | static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp) |
705 | diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c |
706 | index de3fe6e828cb..f50afa8e3cba 100644 |
707 | --- a/drivers/i2c/busses/i2c-pca-platform.c |
708 | +++ b/drivers/i2c/busses/i2c-pca-platform.c |
709 | @@ -21,7 +21,6 @@ |
710 | #include <linux/platform_device.h> |
711 | #include <linux/i2c-algo-pca.h> |
712 | #include <linux/platform_data/i2c-pca-platform.h> |
713 | -#include <linux/gpio.h> |
714 | #include <linux/gpio/consumer.h> |
715 | #include <linux/io.h> |
716 | #include <linux/of.h> |
717 | @@ -173,7 +172,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev) |
718 | i2c->adap.dev.parent = &pdev->dev; |
719 | i2c->adap.dev.of_node = np; |
720 | |
721 | - i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset-gpios", GPIOD_OUT_LOW); |
722 | + i2c->gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); |
723 | if (IS_ERR(i2c->gpio)) |
724 | return PTR_ERR(i2c->gpio); |
725 | |
726 | diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c |
727 | index ac1cffd2a09b..f4daa56d204d 100644 |
728 | --- a/drivers/md/raid0.c |
729 | +++ b/drivers/md/raid0.c |
730 | @@ -547,6 +547,7 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) |
731 | trace_block_bio_remap(bdev_get_queue(rdev->bdev), |
732 | discard_bio, disk_devt(mddev->gendisk), |
733 | bio->bi_iter.bi_sector); |
734 | + bio_clear_flag(bio, BIO_QUEUE_ENTERED); |
735 | generic_make_request(discard_bio); |
736 | } |
737 | bio_endio(bio); |
738 | @@ -602,6 +603,7 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio) |
739 | disk_devt(mddev->gendisk), bio_sector); |
740 | mddev_check_writesame(mddev, bio); |
741 | mddev_check_write_zeroes(mddev, bio); |
742 | + bio_clear_flag(bio, BIO_QUEUE_ENTERED); |
743 | generic_make_request(bio); |
744 | return true; |
745 | } |
746 | diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
747 | index 927a1235408d..ca11f8a7569d 100644 |
748 | --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c |
749 | +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
750 | @@ -1089,7 +1089,6 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, |
751 | device_initialize(child); |
752 | dev_set_name(child, "%s:%s", dev_name(dev), name); |
753 | child->parent = dev; |
754 | - child->bus = dev->bus; |
755 | child->coherent_dma_mask = dev->coherent_dma_mask; |
756 | child->dma_mask = dev->dma_mask; |
757 | child->release = s5p_mfc_memdev_release; |
758 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c |
759 | index fdff5526d2e8..f2b0b587a1be 100644 |
760 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c |
761 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c |
762 | @@ -2777,7 +2777,7 @@ static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) |
763 | struct hns_mac_cb *mac_cb; |
764 | u8 addr[ETH_ALEN] = {0}; |
765 | u8 port_num; |
766 | - u16 mskid; |
767 | + int mskid; |
768 | |
769 | /* promisc use vague table match with vlanid = 0 & macaddr = 0 */ |
770 | hns_dsaf_set_mac_key(dsaf_dev, &mac_key, 0x00, port, addr); |
771 | @@ -3149,6 +3149,9 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset) |
772 | dsaf_set_bit(credit, DSAF_SBM_ROCEE_CFG_CRD_EN_B, 1); |
773 | dsaf_write_dev(dsaf_dev, DSAF_SBM_ROCEE_CFG_REG_REG, credit); |
774 | } |
775 | + |
776 | + put_device(&pdev->dev); |
777 | + |
778 | return 0; |
779 | } |
780 | EXPORT_SYMBOL(hns_dsaf_roce_reset); |
781 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
782 | index ff2f6b8e2fab..0cab06046e5d 100644 |
783 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
784 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
785 | @@ -4681,6 +4681,16 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev, |
786 | } else if (netif_is_macvlan(upper_dev)) { |
787 | if (!info->linking) |
788 | mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev); |
789 | + } else if (is_vlan_dev(upper_dev)) { |
790 | + struct net_device *br_dev; |
791 | + |
792 | + if (!netif_is_bridge_port(upper_dev)) |
793 | + break; |
794 | + if (info->linking) |
795 | + break; |
796 | + br_dev = netdev_master_upper_dev_get(upper_dev); |
797 | + mlxsw_sp_port_bridge_leave(mlxsw_sp_port, upper_dev, |
798 | + br_dev); |
799 | } |
800 | break; |
801 | } |
802 | diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c |
803 | index eca16d00e310..d52c821b8584 100644 |
804 | --- a/drivers/platform/mellanox/mlxreg-hotplug.c |
805 | +++ b/drivers/platform/mellanox/mlxreg-hotplug.c |
806 | @@ -673,6 +673,7 @@ static int mlxreg_hotplug_remove(struct platform_device *pdev) |
807 | |
808 | /* Clean interrupts setup. */ |
809 | mlxreg_hotplug_unset_irq(priv); |
810 | + devm_free_irq(&pdev->dev, priv->irq, priv); |
811 | |
812 | return 0; |
813 | } |
814 | diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c |
815 | index b6f2ff95c3ed..59f3a37a44d7 100644 |
816 | --- a/drivers/platform/x86/asus-nb-wmi.c |
817 | +++ b/drivers/platform/x86/asus-nb-wmi.c |
818 | @@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str, |
819 | |
820 | static struct quirk_entry quirk_asus_unknown = { |
821 | .wapf = 0, |
822 | + .wmi_backlight_set_devstate = true, |
823 | }; |
824 | |
825 | static struct quirk_entry quirk_asus_q500a = { |
826 | .i8042_filter = asus_q500a_i8042_filter, |
827 | + .wmi_backlight_set_devstate = true, |
828 | }; |
829 | |
830 | /* |
831 | @@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = { |
832 | static struct quirk_entry quirk_asus_x55u = { |
833 | .wapf = 4, |
834 | .wmi_backlight_power = true, |
835 | + .wmi_backlight_set_devstate = true, |
836 | .no_display_toggle = true, |
837 | }; |
838 | |
839 | static struct quirk_entry quirk_asus_wapf4 = { |
840 | .wapf = 4, |
841 | + .wmi_backlight_set_devstate = true, |
842 | }; |
843 | |
844 | static struct quirk_entry quirk_asus_x200ca = { |
845 | .wapf = 2, |
846 | + .wmi_backlight_set_devstate = true, |
847 | }; |
848 | |
849 | static struct quirk_entry quirk_asus_ux303ub = { |
850 | .wmi_backlight_native = true, |
851 | + .wmi_backlight_set_devstate = true, |
852 | }; |
853 | |
854 | static struct quirk_entry quirk_asus_x550lb = { |
855 | + .wmi_backlight_set_devstate = true, |
856 | .xusb2pr = 0x01D9, |
857 | }; |
858 | |
859 | static struct quirk_entry quirk_asus_forceals = { |
860 | + .wmi_backlight_set_devstate = true, |
861 | .wmi_force_als_set = true, |
862 | }; |
863 | |
864 | diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c |
865 | index db3556dc90d1..22eac449d3a3 100644 |
866 | --- a/drivers/platform/x86/asus-wmi.c |
867 | +++ b/drivers/platform/x86/asus-wmi.c |
868 | @@ -2231,7 +2231,7 @@ static int asus_wmi_add(struct platform_device *pdev) |
869 | err = asus_wmi_backlight_init(asus); |
870 | if (err && err != -ENODEV) |
871 | goto fail_backlight; |
872 | - } else |
873 | + } else if (asus->driver->quirks->wmi_backlight_set_devstate) |
874 | err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL); |
875 | |
876 | status = wmi_install_notify_handler(asus->driver->event_guid, |
877 | diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h |
878 | index 6c1311f4b04d..57a79bddb286 100644 |
879 | --- a/drivers/platform/x86/asus-wmi.h |
880 | +++ b/drivers/platform/x86/asus-wmi.h |
881 | @@ -44,6 +44,7 @@ struct quirk_entry { |
882 | bool store_backlight_power; |
883 | bool wmi_backlight_power; |
884 | bool wmi_backlight_native; |
885 | + bool wmi_backlight_set_devstate; |
886 | bool wmi_force_als_set; |
887 | int wapf; |
888 | /* |
889 | diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
890 | index 06cd7e818ed5..a0d0cecff55f 100644 |
891 | --- a/drivers/platform/x86/intel-vbtn.c |
892 | +++ b/drivers/platform/x86/intel-vbtn.c |
893 | @@ -76,12 +76,24 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) |
894 | struct platform_device *device = context; |
895 | struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev); |
896 | unsigned int val = !(event & 1); /* Even=press, Odd=release */ |
897 | - const struct key_entry *ke_rel; |
898 | + const struct key_entry *ke, *ke_rel; |
899 | bool autorelease; |
900 | |
901 | if (priv->wakeup_mode) { |
902 | - if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) { |
903 | + ke = sparse_keymap_entry_from_scancode(priv->input_dev, event); |
904 | + if (ke) { |
905 | pm_wakeup_hard_event(&device->dev); |
906 | + |
907 | + /* |
908 | + * Switch events like tablet mode will wake the device |
909 | + * and report the new switch position to the input |
910 | + * subsystem. |
911 | + */ |
912 | + if (ke->type == KE_SW) |
913 | + sparse_keymap_report_event(priv->input_dev, |
914 | + event, |
915 | + val, |
916 | + 0); |
917 | return; |
918 | } |
919 | goto out_unknown; |
920 | diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c |
921 | index 78b4aa4410fb..742a0c217925 100644 |
922 | --- a/drivers/platform/x86/mlx-platform.c |
923 | +++ b/drivers/platform/x86/mlx-platform.c |
924 | @@ -1626,7 +1626,7 @@ static int __init mlxplat_init(void) |
925 | |
926 | for (i = 0; i < ARRAY_SIZE(mlxplat_mux_data); i++) { |
927 | priv->pdev_mux[i] = platform_device_register_resndata( |
928 | - &mlxplat_dev->dev, |
929 | + &priv->pdev_i2c->dev, |
930 | "i2c-mux-reg", i, NULL, |
931 | 0, &mlxplat_mux_data[i], |
932 | sizeof(mlxplat_mux_data[i])); |
933 | diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c |
934 | index c120929d4ffe..c43eccdea65d 100644 |
935 | --- a/drivers/scsi/hpsa.c |
936 | +++ b/drivers/scsi/hpsa.c |
937 | @@ -4923,7 +4923,7 @@ static int hpsa_scsi_ioaccel2_queue_command(struct ctlr_info *h, |
938 | curr_sg->reserved[0] = 0; |
939 | curr_sg->reserved[1] = 0; |
940 | curr_sg->reserved[2] = 0; |
941 | - curr_sg->chain_indicator = 0x80; |
942 | + curr_sg->chain_indicator = IOACCEL2_CHAIN; |
943 | |
944 | curr_sg = h->ioaccel2_cmd_sg_list[c->cmdindex]; |
945 | } |
946 | @@ -4940,6 +4940,11 @@ static int hpsa_scsi_ioaccel2_queue_command(struct ctlr_info *h, |
947 | curr_sg++; |
948 | } |
949 | |
950 | + /* |
951 | + * Set the last s/g element bit |
952 | + */ |
953 | + (curr_sg - 1)->chain_indicator = IOACCEL2_LAST_SG; |
954 | + |
955 | switch (cmd->sc_data_direction) { |
956 | case DMA_TO_DEVICE: |
957 | cp->direction &= ~IOACCEL2_DIRECTION_MASK; |
958 | diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h |
959 | index 21a726e2eec6..f6afca4b2319 100644 |
960 | --- a/drivers/scsi/hpsa_cmd.h |
961 | +++ b/drivers/scsi/hpsa_cmd.h |
962 | @@ -517,6 +517,7 @@ struct ioaccel2_sg_element { |
963 | u8 reserved[3]; |
964 | u8 chain_indicator; |
965 | #define IOACCEL2_CHAIN 0x80 |
966 | +#define IOACCEL2_LAST_SG 0x40 |
967 | }; |
968 | |
969 | /* |
970 | diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c |
971 | index f29176000b8d..06cf9388e74f 100644 |
972 | --- a/drivers/spi/spi-bitbang.c |
973 | +++ b/drivers/spi/spi-bitbang.c |
974 | @@ -416,7 +416,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) |
975 | if (ret) |
976 | spi_master_put(master); |
977 | |
978 | - return 0; |
979 | + return ret; |
980 | } |
981 | EXPORT_SYMBOL_GPL(spi_bitbang_start); |
982 | |
983 | diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
984 | index ac7620120491..c46efa47d68a 100644 |
985 | --- a/drivers/target/target_core_user.c |
986 | +++ b/drivers/target/target_core_user.c |
987 | @@ -1317,12 +1317,13 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data) |
988 | * target_complete_cmd will translate this to LUN COMM FAILURE |
989 | */ |
990 | scsi_status = SAM_STAT_CHECK_CONDITION; |
991 | + list_del_init(&cmd->queue_entry); |
992 | } else { |
993 | + list_del_init(&cmd->queue_entry); |
994 | idr_remove(&udev->commands, id); |
995 | tcmu_free_cmd(cmd); |
996 | scsi_status = SAM_STAT_TASK_SET_FULL; |
997 | } |
998 | - list_del_init(&cmd->queue_entry); |
999 | |
1000 | pr_debug("Timing out cmd %u on dev %s that is %s.\n", |
1001 | id, udev->name, is_running ? "inflight" : "queued"); |
1002 | diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c |
1003 | index b121d8f8f3d7..27aeca30eeae 100644 |
1004 | --- a/drivers/tty/rocket.c |
1005 | +++ b/drivers/tty/rocket.c |
1006 | @@ -266,7 +266,7 @@ MODULE_PARM_DESC(pc104_3, "set interface types for ISA(PC104) board #3 (e.g. pc1 |
1007 | module_param_array(pc104_4, ulong, NULL, 0); |
1008 | MODULE_PARM_DESC(pc104_4, "set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,..."); |
1009 | |
1010 | -static int rp_init(void); |
1011 | +static int __init rp_init(void); |
1012 | static void rp_cleanup_module(void); |
1013 | |
1014 | module_init(rp_init); |
1015 | diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c |
1016 | index 55b178c1bd65..372cc7ff228f 100644 |
1017 | --- a/drivers/tty/serial/sc16is7xx.c |
1018 | +++ b/drivers/tty/serial/sc16is7xx.c |
1019 | @@ -1494,10 +1494,12 @@ static int __init sc16is7xx_init(void) |
1020 | #endif |
1021 | return ret; |
1022 | |
1023 | +#ifdef CONFIG_SERIAL_SC16IS7XX_SPI |
1024 | err_spi: |
1025 | #ifdef CONFIG_SERIAL_SC16IS7XX_I2C |
1026 | i2c_del_driver(&sc16is7xx_i2c_uart_driver); |
1027 | #endif |
1028 | +#endif |
1029 | err_i2c: |
1030 | uart_unregister_driver(&sc16is7xx_uart); |
1031 | return ret; |
1032 | diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c |
1033 | index 263804d154a7..00e3f66836a9 100644 |
1034 | --- a/drivers/usb/gadget/udc/fusb300_udc.c |
1035 | +++ b/drivers/usb/gadget/udc/fusb300_udc.c |
1036 | @@ -1342,12 +1342,15 @@ static const struct usb_gadget_ops fusb300_gadget_ops = { |
1037 | static int fusb300_remove(struct platform_device *pdev) |
1038 | { |
1039 | struct fusb300 *fusb300 = platform_get_drvdata(pdev); |
1040 | + int i; |
1041 | |
1042 | usb_del_gadget_udc(&fusb300->gadget); |
1043 | iounmap(fusb300->reg); |
1044 | free_irq(platform_get_irq(pdev, 0), fusb300); |
1045 | |
1046 | fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); |
1047 | + for (i = 0; i < FUSB300_MAX_NUM_EP; i++) |
1048 | + kfree(fusb300->ep[i]); |
1049 | kfree(fusb300); |
1050 | |
1051 | return 0; |
1052 | @@ -1491,6 +1494,8 @@ clean_up: |
1053 | if (fusb300->ep0_req) |
1054 | fusb300_free_request(&fusb300->ep[0]->ep, |
1055 | fusb300->ep0_req); |
1056 | + for (i = 0; i < FUSB300_MAX_NUM_EP; i++) |
1057 | + kfree(fusb300->ep[i]); |
1058 | kfree(fusb300); |
1059 | } |
1060 | if (reg) |
1061 | diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c |
1062 | index b0781771704e..eafc2a00c96a 100644 |
1063 | --- a/drivers/usb/gadget/udc/lpc32xx_udc.c |
1064 | +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c |
1065 | @@ -922,8 +922,7 @@ static struct lpc32xx_usbd_dd_gad *udc_dd_alloc(struct lpc32xx_udc *udc) |
1066 | dma_addr_t dma; |
1067 | struct lpc32xx_usbd_dd_gad *dd; |
1068 | |
1069 | - dd = (struct lpc32xx_usbd_dd_gad *) dma_pool_alloc( |
1070 | - udc->dd_cache, (GFP_KERNEL | GFP_DMA), &dma); |
1071 | + dd = dma_pool_alloc(udc->dd_cache, GFP_ATOMIC | GFP_DMA, &dma); |
1072 | if (dd) |
1073 | dd->this_dma = dma; |
1074 | |
1075 | diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c |
1076 | index 8fed470bb7e1..23b13fbecdc2 100644 |
1077 | --- a/fs/btrfs/dev-replace.c |
1078 | +++ b/fs/btrfs/dev-replace.c |
1079 | @@ -599,17 +599,25 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
1080 | } |
1081 | btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); |
1082 | |
1083 | - trans = btrfs_start_transaction(root, 0); |
1084 | - if (IS_ERR(trans)) { |
1085 | - mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
1086 | - return PTR_ERR(trans); |
1087 | + while (1) { |
1088 | + trans = btrfs_start_transaction(root, 0); |
1089 | + if (IS_ERR(trans)) { |
1090 | + mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
1091 | + return PTR_ERR(trans); |
1092 | + } |
1093 | + ret = btrfs_commit_transaction(trans); |
1094 | + WARN_ON(ret); |
1095 | + /* keep away write_all_supers() during the finishing procedure */ |
1096 | + mutex_lock(&fs_info->fs_devices->device_list_mutex); |
1097 | + mutex_lock(&fs_info->chunk_mutex); |
1098 | + if (src_device->has_pending_chunks) { |
1099 | + mutex_unlock(&root->fs_info->chunk_mutex); |
1100 | + mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
1101 | + } else { |
1102 | + break; |
1103 | + } |
1104 | } |
1105 | - ret = btrfs_commit_transaction(trans); |
1106 | - WARN_ON(ret); |
1107 | |
1108 | - /* keep away write_all_supers() during the finishing procedure */ |
1109 | - mutex_lock(&fs_info->fs_devices->device_list_mutex); |
1110 | - mutex_lock(&fs_info->chunk_mutex); |
1111 | btrfs_dev_replace_write_lock(dev_replace); |
1112 | dev_replace->replace_state = |
1113 | scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED |
1114 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1115 | index 207f4e87445d..2fd000308be7 100644 |
1116 | --- a/fs/btrfs/volumes.c |
1117 | +++ b/fs/btrfs/volumes.c |
1118 | @@ -4873,6 +4873,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, |
1119 | for (i = 0; i < map->num_stripes; i++) { |
1120 | num_bytes = map->stripes[i].dev->bytes_used + stripe_size; |
1121 | btrfs_device_set_bytes_used(map->stripes[i].dev, num_bytes); |
1122 | + map->stripes[i].dev->has_pending_chunks = true; |
1123 | } |
1124 | |
1125 | atomic64_sub(stripe_size * map->num_stripes, &info->free_chunk_space); |
1126 | @@ -7348,6 +7349,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_transaction *trans) |
1127 | for (i = 0; i < map->num_stripes; i++) { |
1128 | dev = map->stripes[i].dev; |
1129 | dev->commit_bytes_used = dev->bytes_used; |
1130 | + dev->has_pending_chunks = false; |
1131 | } |
1132 | } |
1133 | mutex_unlock(&fs_info->chunk_mutex); |
1134 | diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h |
1135 | index 23e9285d88de..c0e3015b1bac 100644 |
1136 | --- a/fs/btrfs/volumes.h |
1137 | +++ b/fs/btrfs/volumes.h |
1138 | @@ -54,6 +54,11 @@ struct btrfs_device { |
1139 | |
1140 | spinlock_t io_lock ____cacheline_aligned; |
1141 | int running_pending; |
1142 | + /* When true means this device has pending chunk alloc in |
1143 | + * current transaction. Protected by chunk_mutex. |
1144 | + */ |
1145 | + bool has_pending_chunks; |
1146 | + |
1147 | /* regular prio bios */ |
1148 | struct btrfs_pending_bios pending_bios; |
1149 | /* sync bios */ |
1150 | diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c |
1151 | index ebe649d9793c..bbe155465ca0 100644 |
1152 | --- a/fs/f2fs/debug.c |
1153 | +++ b/fs/f2fs/debug.c |
1154 | @@ -94,8 +94,10 @@ static void update_general_status(struct f2fs_sb_info *sbi) |
1155 | si->free_secs = free_sections(sbi); |
1156 | si->prefree_count = prefree_segments(sbi); |
1157 | si->dirty_count = dirty_segments(sbi); |
1158 | - si->node_pages = NODE_MAPPING(sbi)->nrpages; |
1159 | - si->meta_pages = META_MAPPING(sbi)->nrpages; |
1160 | + if (sbi->node_inode) |
1161 | + si->node_pages = NODE_MAPPING(sbi)->nrpages; |
1162 | + if (sbi->meta_inode) |
1163 | + si->meta_pages = META_MAPPING(sbi)->nrpages; |
1164 | si->nats = NM_I(sbi)->nat_cnt; |
1165 | si->dirty_nats = NM_I(sbi)->dirty_nat_cnt; |
1166 | si->sits = MAIN_SEGS(sbi); |
1167 | @@ -168,7 +170,6 @@ static void update_sit_info(struct f2fs_sb_info *sbi) |
1168 | static void update_mem_info(struct f2fs_sb_info *sbi) |
1169 | { |
1170 | struct f2fs_stat_info *si = F2FS_STAT(sbi); |
1171 | - unsigned npages; |
1172 | int i; |
1173 | |
1174 | if (si->base_mem) |
1175 | @@ -251,10 +252,14 @@ get_cache: |
1176 | sizeof(struct extent_node); |
1177 | |
1178 | si->page_mem = 0; |
1179 | - npages = NODE_MAPPING(sbi)->nrpages; |
1180 | - si->page_mem += (unsigned long long)npages << PAGE_SHIFT; |
1181 | - npages = META_MAPPING(sbi)->nrpages; |
1182 | - si->page_mem += (unsigned long long)npages << PAGE_SHIFT; |
1183 | + if (sbi->node_inode) { |
1184 | + unsigned npages = NODE_MAPPING(sbi)->nrpages; |
1185 | + si->page_mem += (unsigned long long)npages << PAGE_SHIFT; |
1186 | + } |
1187 | + if (sbi->meta_inode) { |
1188 | + unsigned npages = META_MAPPING(sbi)->nrpages; |
1189 | + si->page_mem += (unsigned long long)npages << PAGE_SHIFT; |
1190 | + } |
1191 | } |
1192 | |
1193 | static int stat_show(struct seq_file *s, void *v) |
1194 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
1195 | index 2264f27fd26d..1871031e2d5e 100644 |
1196 | --- a/fs/f2fs/super.c |
1197 | +++ b/fs/f2fs/super.c |
1198 | @@ -1050,7 +1050,10 @@ static void f2fs_put_super(struct super_block *sb) |
1199 | f2fs_bug_on(sbi, sbi->fsync_node_num); |
1200 | |
1201 | iput(sbi->node_inode); |
1202 | + sbi->node_inode = NULL; |
1203 | + |
1204 | iput(sbi->meta_inode); |
1205 | + sbi->meta_inode = NULL; |
1206 | |
1207 | /* |
1208 | * iput() can update stat information, if f2fs_write_checkpoint() |
1209 | @@ -3166,6 +3169,7 @@ free_node_inode: |
1210 | f2fs_release_ino_entry(sbi, true); |
1211 | truncate_inode_pages_final(NODE_MAPPING(sbi)); |
1212 | iput(sbi->node_inode); |
1213 | + sbi->node_inode = NULL; |
1214 | free_stats: |
1215 | f2fs_destroy_stats(sbi); |
1216 | free_nm: |
1217 | @@ -3178,6 +3182,7 @@ free_devices: |
1218 | free_meta_inode: |
1219 | make_bad_inode(sbi->meta_inode); |
1220 | iput(sbi->meta_inode); |
1221 | + sbi->meta_inode = NULL; |
1222 | free_io_dummy: |
1223 | mempool_destroy(sbi->write_io_dummy); |
1224 | free_percpu: |
1225 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
1226 | index bec75600e692..5f62007140cf 100644 |
1227 | --- a/fs/nfsd/nfs4state.c |
1228 | +++ b/fs/nfsd/nfs4state.c |
1229 | @@ -1523,7 +1523,7 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca) |
1230 | * Never use more than a third of the remaining memory, |
1231 | * unless it's the only way to give this client a slot: |
1232 | */ |
1233 | - avail = clamp_t(int, avail, slotsize, total_avail/3); |
1234 | + avail = clamp_t(unsigned long, avail, slotsize, total_avail/3); |
1235 | num = min_t(int, num, avail / slotsize); |
1236 | nfsd_drc_mem_used += num * slotsize; |
1237 | spin_unlock(&nfsd_drc_lock); |
1238 | diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c |
1239 | index aaca81b5e119..e1ebdbe40032 100644 |
1240 | --- a/fs/userfaultfd.c |
1241 | +++ b/fs/userfaultfd.c |
1242 | @@ -40,6 +40,16 @@ enum userfaultfd_state { |
1243 | /* |
1244 | * Start with fault_pending_wqh and fault_wqh so they're more likely |
1245 | * to be in the same cacheline. |
1246 | + * |
1247 | + * Locking order: |
1248 | + * fd_wqh.lock |
1249 | + * fault_pending_wqh.lock |
1250 | + * fault_wqh.lock |
1251 | + * event_wqh.lock |
1252 | + * |
1253 | + * To avoid deadlocks, IRQs must be disabled when taking any of the above locks, |
1254 | + * since fd_wqh.lock is taken by aio_poll() while it's holding a lock that's |
1255 | + * also taken in IRQ context. |
1256 | */ |
1257 | struct userfaultfd_ctx { |
1258 | /* waitqueue head for the pending (i.e. not read) userfaults */ |
1259 | @@ -459,7 +469,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) |
1260 | blocking_state = return_to_userland ? TASK_INTERRUPTIBLE : |
1261 | TASK_KILLABLE; |
1262 | |
1263 | - spin_lock(&ctx->fault_pending_wqh.lock); |
1264 | + spin_lock_irq(&ctx->fault_pending_wqh.lock); |
1265 | /* |
1266 | * After the __add_wait_queue the uwq is visible to userland |
1267 | * through poll/read(). |
1268 | @@ -471,7 +481,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) |
1269 | * __add_wait_queue. |
1270 | */ |
1271 | set_current_state(blocking_state); |
1272 | - spin_unlock(&ctx->fault_pending_wqh.lock); |
1273 | + spin_unlock_irq(&ctx->fault_pending_wqh.lock); |
1274 | |
1275 | if (!is_vm_hugetlb_page(vmf->vma)) |
1276 | must_wait = userfaultfd_must_wait(ctx, vmf->address, vmf->flags, |
1277 | @@ -553,13 +563,13 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) |
1278 | * kernel stack can be released after the list_del_init. |
1279 | */ |
1280 | if (!list_empty_careful(&uwq.wq.entry)) { |
1281 | - spin_lock(&ctx->fault_pending_wqh.lock); |
1282 | + spin_lock_irq(&ctx->fault_pending_wqh.lock); |
1283 | /* |
1284 | * No need of list_del_init(), the uwq on the stack |
1285 | * will be freed shortly anyway. |
1286 | */ |
1287 | list_del(&uwq.wq.entry); |
1288 | - spin_unlock(&ctx->fault_pending_wqh.lock); |
1289 | + spin_unlock_irq(&ctx->fault_pending_wqh.lock); |
1290 | } |
1291 | |
1292 | /* |
1293 | @@ -584,7 +594,7 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, |
1294 | init_waitqueue_entry(&ewq->wq, current); |
1295 | release_new_ctx = NULL; |
1296 | |
1297 | - spin_lock(&ctx->event_wqh.lock); |
1298 | + spin_lock_irq(&ctx->event_wqh.lock); |
1299 | /* |
1300 | * After the __add_wait_queue the uwq is visible to userland |
1301 | * through poll/read(). |
1302 | @@ -614,15 +624,15 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, |
1303 | break; |
1304 | } |
1305 | |
1306 | - spin_unlock(&ctx->event_wqh.lock); |
1307 | + spin_unlock_irq(&ctx->event_wqh.lock); |
1308 | |
1309 | wake_up_poll(&ctx->fd_wqh, EPOLLIN); |
1310 | schedule(); |
1311 | |
1312 | - spin_lock(&ctx->event_wqh.lock); |
1313 | + spin_lock_irq(&ctx->event_wqh.lock); |
1314 | } |
1315 | __set_current_state(TASK_RUNNING); |
1316 | - spin_unlock(&ctx->event_wqh.lock); |
1317 | + spin_unlock_irq(&ctx->event_wqh.lock); |
1318 | |
1319 | if (release_new_ctx) { |
1320 | struct vm_area_struct *vma; |
1321 | @@ -919,10 +929,10 @@ wakeup: |
1322 | * the last page faults that may have been already waiting on |
1323 | * the fault_*wqh. |
1324 | */ |
1325 | - spin_lock(&ctx->fault_pending_wqh.lock); |
1326 | + spin_lock_irq(&ctx->fault_pending_wqh.lock); |
1327 | __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, &range); |
1328 | __wake_up(&ctx->fault_wqh, TASK_NORMAL, 1, &range); |
1329 | - spin_unlock(&ctx->fault_pending_wqh.lock); |
1330 | + spin_unlock_irq(&ctx->fault_pending_wqh.lock); |
1331 | |
1332 | /* Flush pending events that may still wait on event_wqh */ |
1333 | wake_up_all(&ctx->event_wqh); |
1334 | @@ -1135,7 +1145,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, |
1335 | |
1336 | if (!ret && msg->event == UFFD_EVENT_FORK) { |
1337 | ret = resolve_userfault_fork(ctx, fork_nctx, msg); |
1338 | - spin_lock(&ctx->event_wqh.lock); |
1339 | + spin_lock_irq(&ctx->event_wqh.lock); |
1340 | if (!list_empty(&fork_event)) { |
1341 | /* |
1342 | * The fork thread didn't abort, so we can |
1343 | @@ -1181,7 +1191,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, |
1344 | if (ret) |
1345 | userfaultfd_ctx_put(fork_nctx); |
1346 | } |
1347 | - spin_unlock(&ctx->event_wqh.lock); |
1348 | + spin_unlock_irq(&ctx->event_wqh.lock); |
1349 | } |
1350 | |
1351 | return ret; |
1352 | @@ -1220,14 +1230,14 @@ static ssize_t userfaultfd_read(struct file *file, char __user *buf, |
1353 | static void __wake_userfault(struct userfaultfd_ctx *ctx, |
1354 | struct userfaultfd_wake_range *range) |
1355 | { |
1356 | - spin_lock(&ctx->fault_pending_wqh.lock); |
1357 | + spin_lock_irq(&ctx->fault_pending_wqh.lock); |
1358 | /* wake all in the range and autoremove */ |
1359 | if (waitqueue_active(&ctx->fault_pending_wqh)) |
1360 | __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, |
1361 | range); |
1362 | if (waitqueue_active(&ctx->fault_wqh)) |
1363 | __wake_up(&ctx->fault_wqh, TASK_NORMAL, 1, range); |
1364 | - spin_unlock(&ctx->fault_pending_wqh.lock); |
1365 | + spin_unlock_irq(&ctx->fault_pending_wqh.lock); |
1366 | } |
1367 | |
1368 | static __always_inline void wake_userfault(struct userfaultfd_ctx *ctx, |
1369 | @@ -1882,7 +1892,7 @@ static void userfaultfd_show_fdinfo(struct seq_file *m, struct file *f) |
1370 | wait_queue_entry_t *wq; |
1371 | unsigned long pending = 0, total = 0; |
1372 | |
1373 | - spin_lock(&ctx->fault_pending_wqh.lock); |
1374 | + spin_lock_irq(&ctx->fault_pending_wqh.lock); |
1375 | list_for_each_entry(wq, &ctx->fault_pending_wqh.head, entry) { |
1376 | pending++; |
1377 | total++; |
1378 | @@ -1890,7 +1900,7 @@ static void userfaultfd_show_fdinfo(struct seq_file *m, struct file *f) |
1379 | list_for_each_entry(wq, &ctx->fault_wqh.head, entry) { |
1380 | total++; |
1381 | } |
1382 | - spin_unlock(&ctx->fault_pending_wqh.lock); |
1383 | + spin_unlock_irq(&ctx->fault_pending_wqh.lock); |
1384 | |
1385 | /* |
1386 | * If more protocols will be added, there will be all shown |
1387 | diff --git a/include/linux/filter.h b/include/linux/filter.h |
1388 | index d52a7484aeb2..3705c6f10b17 100644 |
1389 | --- a/include/linux/filter.h |
1390 | +++ b/include/linux/filter.h |
1391 | @@ -837,7 +837,7 @@ bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk, |
1392 | extern int bpf_jit_enable; |
1393 | extern int bpf_jit_harden; |
1394 | extern int bpf_jit_kallsyms; |
1395 | -extern int bpf_jit_limit; |
1396 | +extern long bpf_jit_limit; |
1397 | |
1398 | typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size); |
1399 | |
1400 | diff --git a/include/net/ipv6_frag.h b/include/net/ipv6_frag.h |
1401 | index 28aa9b30aece..1f77fb4dc79d 100644 |
1402 | --- a/include/net/ipv6_frag.h |
1403 | +++ b/include/net/ipv6_frag.h |
1404 | @@ -94,7 +94,6 @@ ip6frag_expire_frag_queue(struct net *net, struct frag_queue *fq) |
1405 | goto out; |
1406 | |
1407 | head->dev = dev; |
1408 | - skb_get(head); |
1409 | spin_unlock(&fq->q.lock); |
1410 | |
1411 | icmpv6_send(head, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0); |
1412 | diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c |
1413 | index bad9985b8a08..36be400c3e65 100644 |
1414 | --- a/kernel/bpf/core.c |
1415 | +++ b/kernel/bpf/core.c |
1416 | @@ -366,13 +366,11 @@ void bpf_prog_kallsyms_del_all(struct bpf_prog *fp) |
1417 | } |
1418 | |
1419 | #ifdef CONFIG_BPF_JIT |
1420 | -# define BPF_JIT_LIMIT_DEFAULT (PAGE_SIZE * 40000) |
1421 | - |
1422 | /* All BPF JIT sysctl knobs here. */ |
1423 | int bpf_jit_enable __read_mostly = IS_BUILTIN(CONFIG_BPF_JIT_ALWAYS_ON); |
1424 | int bpf_jit_harden __read_mostly; |
1425 | int bpf_jit_kallsyms __read_mostly; |
1426 | -int bpf_jit_limit __read_mostly = BPF_JIT_LIMIT_DEFAULT; |
1427 | +long bpf_jit_limit __read_mostly; |
1428 | |
1429 | static __always_inline void |
1430 | bpf_get_prog_addr_region(const struct bpf_prog *prog, |
1431 | @@ -583,16 +581,27 @@ int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type, |
1432 | |
1433 | static atomic_long_t bpf_jit_current; |
1434 | |
1435 | +/* Can be overridden by an arch's JIT compiler if it has a custom, |
1436 | + * dedicated BPF backend memory area, or if neither of the two |
1437 | + * below apply. |
1438 | + */ |
1439 | +u64 __weak bpf_jit_alloc_exec_limit(void) |
1440 | +{ |
1441 | #if defined(MODULES_VADDR) |
1442 | + return MODULES_END - MODULES_VADDR; |
1443 | +#else |
1444 | + return VMALLOC_END - VMALLOC_START; |
1445 | +#endif |
1446 | +} |
1447 | + |
1448 | static int __init bpf_jit_charge_init(void) |
1449 | { |
1450 | /* Only used as heuristic here to derive limit. */ |
1451 | - bpf_jit_limit = min_t(u64, round_up((MODULES_END - MODULES_VADDR) >> 2, |
1452 | - PAGE_SIZE), INT_MAX); |
1453 | + bpf_jit_limit = min_t(u64, round_up(bpf_jit_alloc_exec_limit() >> 2, |
1454 | + PAGE_SIZE), LONG_MAX); |
1455 | return 0; |
1456 | } |
1457 | pure_initcall(bpf_jit_charge_init); |
1458 | -#endif |
1459 | |
1460 | static int bpf_jit_charge_modmem(u32 pages) |
1461 | { |
1462 | diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
1463 | index 266f10cb7222..ff956ccbb6df 100644 |
1464 | --- a/kernel/cgroup/cpuset.c |
1465 | +++ b/kernel/cgroup/cpuset.c |
1466 | @@ -2432,10 +2432,23 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) |
1467 | spin_unlock_irqrestore(&callback_lock, flags); |
1468 | } |
1469 | |
1470 | +/** |
1471 | + * cpuset_cpus_allowed_fallback - final fallback before complete catastrophe. |
1472 | + * @tsk: pointer to task_struct with which the scheduler is struggling |
1473 | + * |
1474 | + * Description: In the case that the scheduler cannot find an allowed cpu in |
1475 | + * tsk->cpus_allowed, we fall back to task_cs(tsk)->cpus_allowed. In legacy |
1476 | + * mode however, this value is the same as task_cs(tsk)->effective_cpus, |
1477 | + * which will not contain a sane cpumask during cases such as cpu hotplugging. |
1478 | + * This is the absolute last resort for the scheduler and it is only used if |
1479 | + * _every_ other avenue has been traveled. |
1480 | + **/ |
1481 | + |
1482 | void cpuset_cpus_allowed_fallback(struct task_struct *tsk) |
1483 | { |
1484 | rcu_read_lock(); |
1485 | - do_set_cpus_allowed(tsk, task_cs(tsk)->effective_cpus); |
1486 | + do_set_cpus_allowed(tsk, is_in_v2_mode() ? |
1487 | + task_cs(tsk)->cpus_allowed : cpu_possible_mask); |
1488 | rcu_read_unlock(); |
1489 | |
1490 | /* |
1491 | diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c |
1492 | index 5b77a7314e01..722c27c40e5b 100644 |
1493 | --- a/kernel/livepatch/core.c |
1494 | +++ b/kernel/livepatch/core.c |
1495 | @@ -30,6 +30,7 @@ |
1496 | #include <linux/elf.h> |
1497 | #include <linux/moduleloader.h> |
1498 | #include <linux/completion.h> |
1499 | +#include <linux/memory.h> |
1500 | #include <asm/cacheflush.h> |
1501 | #include "core.h" |
1502 | #include "patch.h" |
1503 | @@ -708,16 +709,21 @@ static int klp_init_object_loaded(struct klp_patch *patch, |
1504 | struct klp_func *func; |
1505 | int ret; |
1506 | |
1507 | + mutex_lock(&text_mutex); |
1508 | + |
1509 | module_disable_ro(patch->mod); |
1510 | ret = klp_write_object_relocations(patch->mod, obj); |
1511 | if (ret) { |
1512 | module_enable_ro(patch->mod, true); |
1513 | + mutex_unlock(&text_mutex); |
1514 | return ret; |
1515 | } |
1516 | |
1517 | arch_klp_init_object_loaded(patch, obj); |
1518 | module_enable_ro(patch->mod, true); |
1519 | |
1520 | + mutex_unlock(&text_mutex); |
1521 | + |
1522 | klp_for_each_func(obj, func) { |
1523 | ret = klp_find_object_symbol(obj->name, func->old_name, |
1524 | func->old_sympos, |
1525 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
1526 | index 5d0838c2349e..fed682a01a75 100644 |
1527 | --- a/kernel/ptrace.c |
1528 | +++ b/kernel/ptrace.c |
1529 | @@ -78,9 +78,7 @@ void __ptrace_link(struct task_struct *child, struct task_struct *new_parent, |
1530 | */ |
1531 | static void ptrace_link(struct task_struct *child, struct task_struct *new_parent) |
1532 | { |
1533 | - rcu_read_lock(); |
1534 | - __ptrace_link(child, new_parent, __task_cred(new_parent)); |
1535 | - rcu_read_unlock(); |
1536 | + __ptrace_link(child, new_parent, current_cred()); |
1537 | } |
1538 | |
1539 | /** |
1540 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
1541 | index 1688782f3dfb..118ecce14386 100644 |
1542 | --- a/kernel/trace/ftrace.c |
1543 | +++ b/kernel/trace/ftrace.c |
1544 | @@ -2952,14 +2952,13 @@ static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs) |
1545 | p = &pg->records[i]; |
1546 | p->flags = rec_flags; |
1547 | |
1548 | -#ifndef CC_USING_NOP_MCOUNT |
1549 | /* |
1550 | * Do the initial record conversion from mcount jump |
1551 | * to the NOP instructions. |
1552 | */ |
1553 | - if (!ftrace_code_disable(mod, p)) |
1554 | + if (!__is_defined(CC_USING_NOP_MCOUNT) && |
1555 | + !ftrace_code_disable(mod, p)) |
1556 | break; |
1557 | -#endif |
1558 | |
1559 | update_cnt++; |
1560 | } |
1561 | @@ -4208,10 +4207,13 @@ void free_ftrace_func_mapper(struct ftrace_func_mapper *mapper, |
1562 | struct ftrace_func_entry *entry; |
1563 | struct ftrace_func_map *map; |
1564 | struct hlist_head *hhd; |
1565 | - int size = 1 << mapper->hash.size_bits; |
1566 | - int i; |
1567 | + int size, i; |
1568 | + |
1569 | + if (!mapper) |
1570 | + return; |
1571 | |
1572 | if (free_func && mapper->hash.count) { |
1573 | + size = 1 << mapper->hash.size_bits; |
1574 | for (i = 0; i < size; i++) { |
1575 | hhd = &mapper->hash.buckets[i]; |
1576 | hlist_for_each_entry(entry, hhd, hlist) { |
1577 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1578 | index 181dba75a203..3b0de19b9ed7 100644 |
1579 | --- a/kernel/trace/trace.c |
1580 | +++ b/kernel/trace/trace.c |
1581 | @@ -6471,11 +6471,13 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, |
1582 | break; |
1583 | } |
1584 | #endif |
1585 | - if (!tr->allocated_snapshot) { |
1586 | + if (tr->allocated_snapshot) |
1587 | + ret = resize_buffer_duplicate_size(&tr->max_buffer, |
1588 | + &tr->trace_buffer, iter->cpu_file); |
1589 | + else |
1590 | ret = tracing_alloc_snapshot_instance(tr); |
1591 | - if (ret < 0) |
1592 | - break; |
1593 | - } |
1594 | + if (ret < 0) |
1595 | + break; |
1596 | local_irq_disable(); |
1597 | /* Now, we're going to swap */ |
1598 | if (iter->cpu_file == RING_BUFFER_ALL_CPUS) |
1599 | diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c |
1600 | index a5c921e6d667..d3ca55093fa5 100644 |
1601 | --- a/lib/mpi/mpi-pow.c |
1602 | +++ b/lib/mpi/mpi-pow.c |
1603 | @@ -37,6 +37,7 @@ |
1604 | int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) |
1605 | { |
1606 | mpi_ptr_t mp_marker = NULL, bp_marker = NULL, ep_marker = NULL; |
1607 | + struct karatsuba_ctx karactx = {}; |
1608 | mpi_ptr_t xp_marker = NULL; |
1609 | mpi_ptr_t tspace = NULL; |
1610 | mpi_ptr_t rp, ep, mp, bp; |
1611 | @@ -163,13 +164,11 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) |
1612 | int c; |
1613 | mpi_limb_t e; |
1614 | mpi_limb_t carry_limb; |
1615 | - struct karatsuba_ctx karactx; |
1616 | |
1617 | xp = xp_marker = mpi_alloc_limb_space(2 * (msize + 1)); |
1618 | if (!xp) |
1619 | goto enomem; |
1620 | |
1621 | - memset(&karactx, 0, sizeof karactx); |
1622 | negative_result = (ep[0] & 1) && base->sign; |
1623 | |
1624 | i = esize - 1; |
1625 | @@ -294,8 +293,6 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) |
1626 | if (mod_shift_cnt) |
1627 | mpihelp_rshift(rp, rp, rsize, mod_shift_cnt); |
1628 | MPN_NORMALIZE(rp, rsize); |
1629 | - |
1630 | - mpihelp_release_karatsuba_ctx(&karactx); |
1631 | } |
1632 | |
1633 | if (negative_result && rsize) { |
1634 | @@ -312,6 +309,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) |
1635 | leave: |
1636 | rc = 0; |
1637 | enomem: |
1638 | + mpihelp_release_karatsuba_ctx(&karactx); |
1639 | if (assign_rp) |
1640 | mpi_assign_limb_space(res, rp, size); |
1641 | if (mp_marker) |
1642 | diff --git a/mm/mlock.c b/mm/mlock.c |
1643 | index 41cc47e28ad6..0ab8250af1f8 100644 |
1644 | --- a/mm/mlock.c |
1645 | +++ b/mm/mlock.c |
1646 | @@ -636,11 +636,11 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, |
1647 | * is also counted. |
1648 | * Return value: previously mlocked page counts |
1649 | */ |
1650 | -static int count_mm_mlocked_page_nr(struct mm_struct *mm, |
1651 | +static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm, |
1652 | unsigned long start, size_t len) |
1653 | { |
1654 | struct vm_area_struct *vma; |
1655 | - int count = 0; |
1656 | + unsigned long count = 0; |
1657 | |
1658 | if (mm == NULL) |
1659 | mm = current->mm; |
1660 | diff --git a/mm/vmscan.c b/mm/vmscan.c |
1661 | index dec88fcf8876..e42f44cf7b43 100644 |
1662 | --- a/mm/vmscan.c |
1663 | +++ b/mm/vmscan.c |
1664 | @@ -3599,19 +3599,18 @@ out: |
1665 | } |
1666 | |
1667 | /* |
1668 | - * pgdat->kswapd_classzone_idx is the highest zone index that a recent |
1669 | - * allocation request woke kswapd for. When kswapd has not woken recently, |
1670 | - * the value is MAX_NR_ZONES which is not a valid index. This compares a |
1671 | - * given classzone and returns it or the highest classzone index kswapd |
1672 | - * was recently woke for. |
1673 | + * The pgdat->kswapd_classzone_idx is used to pass the highest zone index to be |
1674 | + * reclaimed by kswapd from the waker. If the value is MAX_NR_ZONES which is not |
1675 | + * a valid index then either kswapd runs for first time or kswapd couldn't sleep |
1676 | + * after previous reclaim attempt (node is still unbalanced). In that case |
1677 | + * return the zone index of the previous kswapd reclaim cycle. |
1678 | */ |
1679 | static enum zone_type kswapd_classzone_idx(pg_data_t *pgdat, |
1680 | - enum zone_type classzone_idx) |
1681 | + enum zone_type prev_classzone_idx) |
1682 | { |
1683 | if (pgdat->kswapd_classzone_idx == MAX_NR_ZONES) |
1684 | - return classzone_idx; |
1685 | - |
1686 | - return max(pgdat->kswapd_classzone_idx, classzone_idx); |
1687 | + return prev_classzone_idx; |
1688 | + return pgdat->kswapd_classzone_idx; |
1689 | } |
1690 | |
1691 | static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_order, |
1692 | @@ -3752,7 +3751,7 @@ kswapd_try_sleep: |
1693 | |
1694 | /* Read the new order and classzone_idx */ |
1695 | alloc_order = reclaim_order = pgdat->kswapd_order; |
1696 | - classzone_idx = kswapd_classzone_idx(pgdat, 0); |
1697 | + classzone_idx = kswapd_classzone_idx(pgdat, classzone_idx); |
1698 | pgdat->kswapd_order = 0; |
1699 | pgdat->kswapd_classzone_idx = MAX_NR_ZONES; |
1700 | |
1701 | @@ -3806,8 +3805,12 @@ void wakeup_kswapd(struct zone *zone, gfp_t gfp_flags, int order, |
1702 | if (!cpuset_zone_allowed(zone, gfp_flags)) |
1703 | return; |
1704 | pgdat = zone->zone_pgdat; |
1705 | - pgdat->kswapd_classzone_idx = kswapd_classzone_idx(pgdat, |
1706 | - classzone_idx); |
1707 | + |
1708 | + if (pgdat->kswapd_classzone_idx == MAX_NR_ZONES) |
1709 | + pgdat->kswapd_classzone_idx = classzone_idx; |
1710 | + else |
1711 | + pgdat->kswapd_classzone_idx = max(pgdat->kswapd_classzone_idx, |
1712 | + classzone_idx); |
1713 | pgdat->kswapd_order = max(pgdat->kswapd_order, order); |
1714 | if (!waitqueue_active(&pgdat->kswapd_wait)) |
1715 | return; |
1716 | diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
1717 | index 69e3be51a2c3..879d5432bf77 100644 |
1718 | --- a/net/bluetooth/l2cap_core.c |
1719 | +++ b/net/bluetooth/l2cap_core.c |
1720 | @@ -1352,7 +1352,7 @@ static bool l2cap_check_enc_key_size(struct hci_conn *hcon) |
1721 | * actually encrypted before enforcing a key size. |
1722 | */ |
1723 | return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || |
1724 | - hcon->enc_key_size > HCI_MIN_ENC_KEY_SIZE); |
1725 | + hcon->enc_key_size >= HCI_MIN_ENC_KEY_SIZE); |
1726 | } |
1727 | |
1728 | static void l2cap_do_start(struct l2cap_chan *chan) |
1729 | diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c |
1730 | index 37b4667128a3..d67ec17f2cc8 100644 |
1731 | --- a/net/core/sysctl_net_core.c |
1732 | +++ b/net/core/sysctl_net_core.c |
1733 | @@ -28,6 +28,8 @@ static int two __maybe_unused = 2; |
1734 | static int min_sndbuf = SOCK_MIN_SNDBUF; |
1735 | static int min_rcvbuf = SOCK_MIN_RCVBUF; |
1736 | static int max_skb_frags = MAX_SKB_FRAGS; |
1737 | +static long long_one __maybe_unused = 1; |
1738 | +static long long_max __maybe_unused = LONG_MAX; |
1739 | |
1740 | static int net_msg_warn; /* Unused, but still a sysctl */ |
1741 | |
1742 | @@ -289,6 +291,17 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
1743 | |
1744 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
1745 | } |
1746 | + |
1747 | +static int |
1748 | +proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
1749 | + void __user *buffer, size_t *lenp, |
1750 | + loff_t *ppos) |
1751 | +{ |
1752 | + if (!capable(CAP_SYS_ADMIN)) |
1753 | + return -EPERM; |
1754 | + |
1755 | + return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
1756 | +} |
1757 | #endif |
1758 | |
1759 | static struct ctl_table net_core_table[] = { |
1760 | @@ -398,10 +411,11 @@ static struct ctl_table net_core_table[] = { |
1761 | { |
1762 | .procname = "bpf_jit_limit", |
1763 | .data = &bpf_jit_limit, |
1764 | - .maxlen = sizeof(int), |
1765 | + .maxlen = sizeof(long), |
1766 | .mode = 0600, |
1767 | - .proc_handler = proc_dointvec_minmax_bpf_restricted, |
1768 | - .extra1 = &one, |
1769 | + .proc_handler = proc_dolongvec_minmax_bpf_restricted, |
1770 | + .extra1 = &long_one, |
1771 | + .extra2 = &long_max, |
1772 | }, |
1773 | #endif |
1774 | { |
1775 | diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c |
1776 | index cb1b4772dac0..35d5a76867d0 100644 |
1777 | --- a/net/ipv6/netfilter/nf_conntrack_reasm.c |
1778 | +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c |
1779 | @@ -265,8 +265,14 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb, |
1780 | |
1781 | prev = fq->q.fragments_tail; |
1782 | err = inet_frag_queue_insert(&fq->q, skb, offset, end); |
1783 | - if (err) |
1784 | + if (err) { |
1785 | + if (err == IPFRAG_DUP) { |
1786 | + /* No error for duplicates, pretend they got queued. */ |
1787 | + kfree_skb(skb); |
1788 | + return -EINPROGRESS; |
1789 | + } |
1790 | goto insert_error; |
1791 | + } |
1792 | |
1793 | if (dev) |
1794 | fq->iif = dev->ifindex; |
1795 | @@ -293,15 +299,17 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb, |
1796 | skb->_skb_refdst = 0UL; |
1797 | err = nf_ct_frag6_reasm(fq, skb, prev, dev); |
1798 | skb->_skb_refdst = orefdst; |
1799 | - return err; |
1800 | + |
1801 | + /* After queue has assumed skb ownership, only 0 or |
1802 | + * -EINPROGRESS must be returned. |
1803 | + */ |
1804 | + return err ? -EINPROGRESS : 0; |
1805 | } |
1806 | |
1807 | skb_dst_drop(skb); |
1808 | return -EINPROGRESS; |
1809 | |
1810 | insert_error: |
1811 | - if (err == IPFRAG_DUP) |
1812 | - goto err; |
1813 | inet_frag_kill(&fq->q); |
1814 | err: |
1815 | skb_dst_drop(skb); |
1816 | @@ -481,12 +489,6 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user) |
1817 | ret = 0; |
1818 | } |
1819 | |
1820 | - /* after queue has assumed skb ownership, only 0 or -EINPROGRESS |
1821 | - * must be returned. |
1822 | - */ |
1823 | - if (ret) |
1824 | - ret = -EINPROGRESS; |
1825 | - |
1826 | spin_unlock_bh(&fq->q.lock); |
1827 | inet_frag_put(&fq->q); |
1828 | return ret; |
1829 | diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c |
1830 | index 49a90217622b..ac1f5db52994 100644 |
1831 | --- a/net/mac80211/mesh_pathtbl.c |
1832 | +++ b/net/mac80211/mesh_pathtbl.c |
1833 | @@ -627,7 +627,7 @@ static int table_path_del(struct mesh_table *tbl, |
1834 | spin_lock_bh(&tbl->walk_lock); |
1835 | mpath = rhashtable_lookup_fast(&tbl->rhead, addr, mesh_rht_params); |
1836 | if (!mpath) { |
1837 | - rcu_read_unlock(); |
1838 | + spin_unlock_bh(&tbl->walk_lock); |
1839 | return -ENXIO; |
1840 | } |
1841 | |
1842 | diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c |
1843 | index 129e9ec99ec9..a8c9ea12c3f5 100644 |
1844 | --- a/net/netfilter/nf_flow_table_ip.c |
1845 | +++ b/net/netfilter/nf_flow_table_ip.c |
1846 | @@ -246,8 +246,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, |
1847 | flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]); |
1848 | rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache; |
1849 | |
1850 | - if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)) && |
1851 | - (ip_hdr(skb)->frag_off & htons(IP_DF)) != 0) |
1852 | + if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) |
1853 | return NF_ACCEPT; |
1854 | |
1855 | if (skb_try_make_writable(skb, sizeof(*iph))) |
1856 | diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c |
1857 | index 7f85af4c40ff..6e0c26025ab1 100644 |
1858 | --- a/net/netfilter/nft_flow_offload.c |
1859 | +++ b/net/netfilter/nft_flow_offload.c |
1860 | @@ -12,7 +12,6 @@ |
1861 | #include <net/netfilter/nf_conntrack_core.h> |
1862 | #include <linux/netfilter/nf_conntrack_common.h> |
1863 | #include <net/netfilter/nf_flow_table.h> |
1864 | -#include <net/netfilter/nf_conntrack_helper.h> |
1865 | |
1866 | struct nft_flow_offload { |
1867 | struct nft_flowtable *flowtable; |
1868 | @@ -49,15 +48,20 @@ static int nft_flow_route(const struct nft_pktinfo *pkt, |
1869 | return 0; |
1870 | } |
1871 | |
1872 | -static bool nft_flow_offload_skip(struct sk_buff *skb) |
1873 | +static bool nft_flow_offload_skip(struct sk_buff *skb, int family) |
1874 | { |
1875 | - struct ip_options *opt = &(IPCB(skb)->opt); |
1876 | - |
1877 | - if (unlikely(opt->optlen)) |
1878 | - return true; |
1879 | if (skb_sec_path(skb)) |
1880 | return true; |
1881 | |
1882 | + if (family == NFPROTO_IPV4) { |
1883 | + const struct ip_options *opt; |
1884 | + |
1885 | + opt = &(IPCB(skb)->opt); |
1886 | + |
1887 | + if (unlikely(opt->optlen)) |
1888 | + return true; |
1889 | + } |
1890 | + |
1891 | return false; |
1892 | } |
1893 | |
1894 | @@ -67,15 +71,15 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, |
1895 | { |
1896 | struct nft_flow_offload *priv = nft_expr_priv(expr); |
1897 | struct nf_flowtable *flowtable = &priv->flowtable->data; |
1898 | - const struct nf_conn_help *help; |
1899 | enum ip_conntrack_info ctinfo; |
1900 | struct nf_flow_route route; |
1901 | struct flow_offload *flow; |
1902 | enum ip_conntrack_dir dir; |
1903 | + bool is_tcp = false; |
1904 | struct nf_conn *ct; |
1905 | int ret; |
1906 | |
1907 | - if (nft_flow_offload_skip(pkt->skb)) |
1908 | + if (nft_flow_offload_skip(pkt->skb, nft_pf(pkt))) |
1909 | goto out; |
1910 | |
1911 | ct = nf_ct_get(pkt->skb, &ctinfo); |
1912 | @@ -84,14 +88,16 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, |
1913 | |
1914 | switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) { |
1915 | case IPPROTO_TCP: |
1916 | + is_tcp = true; |
1917 | + break; |
1918 | case IPPROTO_UDP: |
1919 | break; |
1920 | default: |
1921 | goto out; |
1922 | } |
1923 | |
1924 | - help = nfct_help(ct); |
1925 | - if (help) |
1926 | + if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) || |
1927 | + ct->status & IPS_SEQ_ADJUST) |
1928 | goto out; |
1929 | |
1930 | if (ctinfo == IP_CT_NEW || |
1931 | @@ -109,6 +115,11 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, |
1932 | if (!flow) |
1933 | goto err_flow_alloc; |
1934 | |
1935 | + if (is_tcp) { |
1936 | + ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; |
1937 | + ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; |
1938 | + } |
1939 | + |
1940 | ret = flow_offload_add(flowtable, flow); |
1941 | if (ret < 0) |
1942 | goto err_flow_add; |
1943 | diff --git a/net/rds/send.c b/net/rds/send.c |
1944 | index ec2267cbf85f..26e2c2305f7a 100644 |
1945 | --- a/net/rds/send.c |
1946 | +++ b/net/rds/send.c |
1947 | @@ -1106,9 +1106,11 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) |
1948 | sock_flag(rds_rs_to_sk(rs), SOCK_ZEROCOPY)); |
1949 | int num_sgs = ceil(payload_len, PAGE_SIZE); |
1950 | int namelen; |
1951 | - struct rds_iov_vector_arr vct = {0}; |
1952 | + struct rds_iov_vector_arr vct; |
1953 | int ind; |
1954 | |
1955 | + memset(&vct, 0, sizeof(vct)); |
1956 | + |
1957 | /* expect 1 RDMA CMSG per rds_sendmsg. can still grow if more needed. */ |
1958 | vct.incr = 1; |
1959 | |
1960 | diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c |
1961 | index e6e506b2db99..9bbab6ba2dab 100644 |
1962 | --- a/net/smc/af_smc.c |
1963 | +++ b/net/smc/af_smc.c |
1964 | @@ -848,11 +848,11 @@ static int smc_clcsock_accept(struct smc_sock *lsmc, struct smc_sock **new_smc) |
1965 | if (rc < 0) |
1966 | lsk->sk_err = -rc; |
1967 | if (rc < 0 || lsk->sk_state == SMC_CLOSED) { |
1968 | + new_sk->sk_prot->unhash(new_sk); |
1969 | if (new_clcsock) |
1970 | sock_release(new_clcsock); |
1971 | new_sk->sk_state = SMC_CLOSED; |
1972 | sock_set_flag(new_sk, SOCK_DEAD); |
1973 | - new_sk->sk_prot->unhash(new_sk); |
1974 | sock_put(new_sk); /* final */ |
1975 | *new_smc = NULL; |
1976 | goto out; |
1977 | @@ -903,11 +903,11 @@ struct sock *smc_accept_dequeue(struct sock *parent, |
1978 | |
1979 | smc_accept_unlink(new_sk); |
1980 | if (new_sk->sk_state == SMC_CLOSED) { |
1981 | + new_sk->sk_prot->unhash(new_sk); |
1982 | if (isk->clcsock) { |
1983 | sock_release(isk->clcsock); |
1984 | isk->clcsock = NULL; |
1985 | } |
1986 | - new_sk->sk_prot->unhash(new_sk); |
1987 | sock_put(new_sk); /* final */ |
1988 | continue; |
1989 | } |
1990 | @@ -932,6 +932,7 @@ void smc_close_non_accepted(struct sock *sk) |
1991 | sock_set_flag(sk, SOCK_DEAD); |
1992 | sk->sk_shutdown |= SHUTDOWN_MASK; |
1993 | } |
1994 | + sk->sk_prot->unhash(sk); |
1995 | if (smc->clcsock) { |
1996 | struct socket *tcp; |
1997 | |
1998 | @@ -947,7 +948,6 @@ void smc_close_non_accepted(struct sock *sk) |
1999 | smc_conn_free(&smc->conn); |
2000 | } |
2001 | release_sock(sk); |
2002 | - sk->sk_prot->unhash(sk); |
2003 | sock_put(sk); /* final sock_put */ |
2004 | } |
2005 | |
2006 | diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c |
2007 | index ce5c610b49c7..7308992b7a18 100644 |
2008 | --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c |
2009 | +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c |
2010 | @@ -270,9 +270,14 @@ static void handle_connect_req(struct rdma_cm_id *new_cma_id, |
2011 | /* Save client advertised inbound read limit for use later in accept. */ |
2012 | newxprt->sc_ord = param->initiator_depth; |
2013 | |
2014 | - /* Set the local and remote addresses in the transport */ |
2015 | sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; |
2016 | svc_xprt_set_remote(&newxprt->sc_xprt, sa, svc_addr_len(sa)); |
2017 | + /* The remote port is arbitrary and not under the control of the |
2018 | + * client ULP. Set it to a fixed value so that the DRC continues |
2019 | + * to be effective after a reconnect. |
2020 | + */ |
2021 | + rpc_set_port((struct sockaddr *)&newxprt->sc_xprt.xpt_remote, 0); |
2022 | + |
2023 | sa = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.src_addr; |
2024 | svc_xprt_set_local(&newxprt->sc_xprt, sa, svc_addr_len(sa)); |
2025 | |
2026 | diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh |
2027 | index 98a7d63a723e..c4a9ddb174bc 100755 |
2028 | --- a/scripts/decode_stacktrace.sh |
2029 | +++ b/scripts/decode_stacktrace.sh |
2030 | @@ -66,7 +66,7 @@ parse_symbol() { |
2031 | if [[ "${cache[$module,$address]+isset}" == "isset" ]]; then |
2032 | local code=${cache[$module,$address]} |
2033 | else |
2034 | - local code=$(addr2line -i -e "$objfile" "$address") |
2035 | + local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address") |
2036 | cache[$module,$address]=$code |
2037 | fi |
2038 | |
2039 | diff --git a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c |
2040 | index 5b8520177b0e..7d72e3d48ad5 100644 |
2041 | --- a/sound/core/seq/oss/seq_oss_ioctl.c |
2042 | +++ b/sound/core/seq/oss/seq_oss_ioctl.c |
2043 | @@ -62,7 +62,7 @@ static int snd_seq_oss_oob_user(struct seq_oss_devinfo *dp, void __user *arg) |
2044 | if (copy_from_user(ev, arg, 8)) |
2045 | return -EFAULT; |
2046 | memset(&tmpev, 0, sizeof(tmpev)); |
2047 | - snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.port, dp->addr.client); |
2048 | + snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.client, dp->addr.port); |
2049 | tmpev.time.tick = 0; |
2050 | if (! snd_seq_oss_process_event(dp, (union evrec *)ev, &tmpev)) { |
2051 | snd_seq_oss_dispatch(dp, &tmpev, 0, 0); |
2052 | diff --git a/sound/core/seq/oss/seq_oss_rw.c b/sound/core/seq/oss/seq_oss_rw.c |
2053 | index 30886f5fb100..05fbb564beb3 100644 |
2054 | --- a/sound/core/seq/oss/seq_oss_rw.c |
2055 | +++ b/sound/core/seq/oss/seq_oss_rw.c |
2056 | @@ -174,7 +174,7 @@ insert_queue(struct seq_oss_devinfo *dp, union evrec *rec, struct file *opt) |
2057 | memset(&event, 0, sizeof(event)); |
2058 | /* set dummy -- to be sure */ |
2059 | event.type = SNDRV_SEQ_EVENT_NOTEOFF; |
2060 | - snd_seq_oss_fill_addr(dp, &event, dp->addr.port, dp->addr.client); |
2061 | + snd_seq_oss_fill_addr(dp, &event, dp->addr.client, dp->addr.port); |
2062 | |
2063 | if (snd_seq_oss_process_event(dp, rec, &event)) |
2064 | return 0; /* invalid event - no need to insert queue */ |
2065 | diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c |
2066 | index 4210e5c6262e..d09da9dbf235 100644 |
2067 | --- a/sound/firewire/amdtp-am824.c |
2068 | +++ b/sound/firewire/amdtp-am824.c |
2069 | @@ -321,7 +321,7 @@ static void read_midi_messages(struct amdtp_stream *s, |
2070 | u8 *b; |
2071 | |
2072 | for (f = 0; f < frames; f++) { |
2073 | - port = (s->data_block_counter + f) % 8; |
2074 | + port = (8 - s->tx_first_dbc + s->data_block_counter + f) % 8; |
2075 | b = (u8 *)&buffer[p->midi_position]; |
2076 | |
2077 | len = b[0] - 0x80; |
2078 | diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c |
2079 | index 9c37d9af3023..08cc0ce3b924 100644 |
2080 | --- a/sound/hda/ext/hdac_ext_bus.c |
2081 | +++ b/sound/hda/ext/hdac_ext_bus.c |
2082 | @@ -173,7 +173,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init); |
2083 | void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev) |
2084 | { |
2085 | snd_hdac_device_exit(hdev); |
2086 | - kfree(hdev); |
2087 | } |
2088 | EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit); |
2089 | |
2090 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
2091 | index 21de8145f1a6..a6233775e779 100644 |
2092 | --- a/sound/pci/hda/hda_codec.c |
2093 | +++ b/sound/pci/hda/hda_codec.c |
2094 | @@ -971,6 +971,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, |
2095 | |
2096 | /* power-up all before initialization */ |
2097 | hda_set_power_state(codec, AC_PWRST_D0); |
2098 | + codec->core.dev.power.power_state = PMSG_ON; |
2099 | |
2100 | snd_hda_codec_proc_new(codec); |
2101 | |
2102 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
2103 | index e154506a66cb..6453370abacc 100644 |
2104 | --- a/sound/pci/hda/patch_realtek.c |
2105 | +++ b/sound/pci/hda/patch_realtek.c |
2106 | @@ -2443,9 +2443,10 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
2107 | SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), |
2108 | SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), |
2109 | SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), |
2110 | - SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
2111 | - SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
2112 | - SND_PCI_QUIRK(0x1558, 0x65d1, "Tuxedo Book XC1509", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
2113 | + SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950), |
2114 | + SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950), |
2115 | + SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
2116 | + SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), |
2117 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), |
2118 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), |
2119 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), |
2120 | @@ -6938,6 +6939,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
2121 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
2122 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
2123 | SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
2124 | + SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
2125 | SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
2126 | SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
2127 | SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
2128 | diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c |
2129 | index 299ada4dfaa0..3bd57c02e6fd 100644 |
2130 | --- a/sound/soc/codecs/ak4458.c |
2131 | +++ b/sound/soc/codecs/ak4458.c |
2132 | @@ -272,7 +272,10 @@ static int ak4458_rstn_control(struct snd_soc_component *component, int bit) |
2133 | AK4458_00_CONTROL1, |
2134 | AK4458_RSTN_MASK, |
2135 | 0x0); |
2136 | - return ret; |
2137 | + if (ret < 0) |
2138 | + return ret; |
2139 | + |
2140 | + return 0; |
2141 | } |
2142 | |
2143 | static int ak4458_hw_params(struct snd_pcm_substream *substream, |
2144 | @@ -492,9 +495,10 @@ static void ak4458_power_on(struct ak4458_priv *ak4458) |
2145 | } |
2146 | } |
2147 | |
2148 | -static void ak4458_init(struct snd_soc_component *component) |
2149 | +static int ak4458_init(struct snd_soc_component *component) |
2150 | { |
2151 | struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); |
2152 | + int ret; |
2153 | |
2154 | /* External Mute ON */ |
2155 | if (ak4458->mute_gpiod) |
2156 | @@ -502,21 +506,21 @@ static void ak4458_init(struct snd_soc_component *component) |
2157 | |
2158 | ak4458_power_on(ak4458); |
2159 | |
2160 | - snd_soc_component_update_bits(component, AK4458_00_CONTROL1, |
2161 | + ret = snd_soc_component_update_bits(component, AK4458_00_CONTROL1, |
2162 | 0x80, 0x80); /* ACKS bit = 1; 10000000 */ |
2163 | + if (ret < 0) |
2164 | + return ret; |
2165 | |
2166 | - ak4458_rstn_control(component, 1); |
2167 | + return ak4458_rstn_control(component, 1); |
2168 | } |
2169 | |
2170 | static int ak4458_probe(struct snd_soc_component *component) |
2171 | { |
2172 | struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); |
2173 | |
2174 | - ak4458_init(component); |
2175 | - |
2176 | ak4458->fs = 48000; |
2177 | |
2178 | - return 0; |
2179 | + return ak4458_init(component); |
2180 | } |
2181 | |
2182 | static void ak4458_remove(struct snd_soc_component *component) |
2183 | diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c |
2184 | index 407554175282..68d18aca397d 100644 |
2185 | --- a/sound/soc/codecs/cs4265.c |
2186 | +++ b/sound/soc/codecs/cs4265.c |
2187 | @@ -60,7 +60,7 @@ static const struct reg_default cs4265_reg_defaults[] = { |
2188 | static bool cs4265_readable_register(struct device *dev, unsigned int reg) |
2189 | { |
2190 | switch (reg) { |
2191 | - case CS4265_CHIP_ID ... CS4265_SPDIF_CTL2: |
2192 | + case CS4265_CHIP_ID ... CS4265_MAX_REGISTER: |
2193 | return true; |
2194 | default: |
2195 | return false; |
2196 | diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c |
2197 | index f06ae43650a3..c3b28b2f4b10 100644 |
2198 | --- a/sound/soc/codecs/max98090.c |
2199 | +++ b/sound/soc/codecs/max98090.c |
2200 | @@ -1924,6 +1924,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090, |
2201 | return 0; |
2202 | } |
2203 | |
2204 | +static int max98090_dai_startup(struct snd_pcm_substream *substream, |
2205 | + struct snd_soc_dai *dai) |
2206 | +{ |
2207 | + struct snd_soc_component *component = dai->component; |
2208 | + struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); |
2209 | + unsigned int fmt = max98090->dai_fmt; |
2210 | + |
2211 | + /* Remove 24-bit format support if it is not in right justified mode. */ |
2212 | + if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) { |
2213 | + substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; |
2214 | + snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16); |
2215 | + } |
2216 | + return 0; |
2217 | +} |
2218 | + |
2219 | static int max98090_dai_hw_params(struct snd_pcm_substream *substream, |
2220 | struct snd_pcm_hw_params *params, |
2221 | struct snd_soc_dai *dai) |
2222 | @@ -2331,6 +2346,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect); |
2223 | #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) |
2224 | |
2225 | static const struct snd_soc_dai_ops max98090_dai_ops = { |
2226 | + .startup = max98090_dai_startup, |
2227 | .set_sysclk = max98090_dai_set_sysclk, |
2228 | .set_fmt = max98090_dai_set_fmt, |
2229 | .set_tdm_slot = max98090_set_tdm_slot, |
2230 | diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c |
2231 | index 18a931c25ca5..f09f2d87ac60 100644 |
2232 | --- a/sound/soc/codecs/rt274.c |
2233 | +++ b/sound/soc/codecs/rt274.c |
2234 | @@ -398,6 +398,8 @@ static int rt274_mic_detect(struct snd_soc_component *component, |
2235 | { |
2236 | struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); |
2237 | |
2238 | + rt274->jack = jack; |
2239 | + |
2240 | if (jack == NULL) { |
2241 | /* Disable jack detection */ |
2242 | regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, |
2243 | @@ -405,7 +407,6 @@ static int rt274_mic_detect(struct snd_soc_component *component, |
2244 | |
2245 | return 0; |
2246 | } |
2247 | - rt274->jack = jack; |
2248 | |
2249 | regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, |
2250 | RT274_IRQ_EN, RT274_IRQ_EN); |
2251 | diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
2252 | index 33060af18b5a..6566c8831a96 100644 |
2253 | --- a/sound/soc/soc-pcm.c |
2254 | +++ b/sound/soc/soc-pcm.c |
2255 | @@ -2451,7 +2451,8 @@ int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) |
2256 | |
2257 | if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && |
2258 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && |
2259 | - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) |
2260 | + (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && |
2261 | + (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED)) |
2262 | continue; |
2263 | |
2264 | dev_dbg(be->dev, "ASoC: prepare BE %s\n", |
2265 | diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c |
2266 | index a4aa931ebfae..6173dd86c62c 100644 |
2267 | --- a/sound/soc/sunxi/sun4i-i2s.c |
2268 | +++ b/sound/soc/sunxi/sun4i-i2s.c |
2269 | @@ -110,7 +110,7 @@ |
2270 | |
2271 | #define SUN8I_I2S_TX_CHAN_MAP_REG 0x44 |
2272 | #define SUN8I_I2S_TX_CHAN_SEL_REG 0x34 |
2273 | -#define SUN8I_I2S_TX_CHAN_OFFSET_MASK GENMASK(13, 11) |
2274 | +#define SUN8I_I2S_TX_CHAN_OFFSET_MASK GENMASK(13, 12) |
2275 | #define SUN8I_I2S_TX_CHAN_OFFSET(offset) (offset << 12) |
2276 | #define SUN8I_I2S_TX_CHAN_EN_MASK GENMASK(11, 4) |
2277 | #define SUN8I_I2S_TX_CHAN_EN(num_chan) (((1 << num_chan) - 1) << 4) |
2278 | @@ -460,6 +460,10 @@ static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
2279 | regmap_update_bits(i2s->regmap, SUN8I_I2S_TX_CHAN_SEL_REG, |
2280 | SUN8I_I2S_TX_CHAN_OFFSET_MASK, |
2281 | SUN8I_I2S_TX_CHAN_OFFSET(offset)); |
2282 | + |
2283 | + regmap_update_bits(i2s->regmap, SUN8I_I2S_RX_CHAN_SEL_REG, |
2284 | + SUN8I_I2S_TX_CHAN_OFFSET_MASK, |
2285 | + SUN8I_I2S_TX_CHAN_OFFSET(offset)); |
2286 | } |
2287 | |
2288 | regmap_field_write(i2s->field_fmt_mode, val); |
2289 | diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c |
2290 | index 72c6f8e82a7e..78c2d6cab3b5 100644 |
2291 | --- a/sound/usb/line6/pcm.c |
2292 | +++ b/sound/usb/line6/pcm.c |
2293 | @@ -560,6 +560,11 @@ int line6_init_pcm(struct usb_line6 *line6, |
2294 | line6pcm->max_packet_size_out = |
2295 | usb_maxpacket(line6->usbdev, |
2296 | usb_sndisocpipe(line6->usbdev, ep_write), 1); |
2297 | + if (!line6pcm->max_packet_size_in || !line6pcm->max_packet_size_out) { |
2298 | + dev_err(line6pcm->line6->ifcdev, |
2299 | + "cannot get proper max packet size\n"); |
2300 | + return -EINVAL; |
2301 | + } |
2302 | |
2303 | spin_lock_init(&line6pcm->out.lock); |
2304 | spin_lock_init(&line6pcm->in.lock); |
2305 | diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
2306 | index cbfb48bdea51..5b342fe30c75 100644 |
2307 | --- a/sound/usb/mixer_quirks.c |
2308 | +++ b/sound/usb/mixer_quirks.c |
2309 | @@ -753,7 +753,7 @@ static int snd_ni_control_init_val(struct usb_mixer_interface *mixer, |
2310 | return err; |
2311 | } |
2312 | |
2313 | - kctl->private_value |= (value << 24); |
2314 | + kctl->private_value |= ((unsigned int)value << 24); |
2315 | return 0; |
2316 | } |
2317 | |
2318 | @@ -914,7 +914,7 @@ static int snd_ftu_eff_switch_init(struct usb_mixer_interface *mixer, |
2319 | if (err < 0) |
2320 | return err; |
2321 | |
2322 | - kctl->private_value |= value[0] << 24; |
2323 | + kctl->private_value |= (unsigned int)value[0] << 24; |
2324 | return 0; |
2325 | } |
2326 | |
2327 | diff --git a/tools/testing/selftests/net/fib_rule_tests.sh b/tools/testing/selftests/net/fib_rule_tests.sh |
2328 | index dbd90ca73e44..1ba069967fa2 100755 |
2329 | --- a/tools/testing/selftests/net/fib_rule_tests.sh |
2330 | +++ b/tools/testing/selftests/net/fib_rule_tests.sh |
2331 | @@ -148,8 +148,8 @@ fib_rule6_test() |
2332 | |
2333 | fib_check_iproute_support "ipproto" "ipproto" |
2334 | if [ $? -eq 0 ]; then |
2335 | - match="ipproto icmp" |
2336 | - fib_rule6_test_match_n_redirect "$match" "$match" "ipproto icmp match" |
2337 | + match="ipproto ipv6-icmp" |
2338 | + fib_rule6_test_match_n_redirect "$match" "$match" "ipproto ipv6-icmp match" |
2339 | fi |
2340 | } |
2341 |