Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0306-5.4.207-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3635 - (show annotations) (download)
Mon Oct 24 12:34:12 2022 UTC (18 months ago) by niro
File size: 64355 byte(s)
-sync kernel patches
1 diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
2 index 8af3771a3ebf2..787a9c077ef1d 100644
3 --- a/Documentation/networking/ip-sysctl.txt
4 +++ b/Documentation/networking/ip-sysctl.txt
5 @@ -876,7 +876,7 @@ cipso_cache_enable - BOOLEAN
6 cipso_cache_bucket_size - INTEGER
7 The CIPSO label cache consists of a fixed size hash table with each
8 hash bucket containing a number of cache entries. This variable limits
9 - the number of entries in each hash bucket; the larger the value the
10 + the number of entries in each hash bucket; the larger the value is, the
11 more CIPSO label mappings that can be cached. When the number of
12 entries in a given hash bucket reaches this limit adding new entries
13 causes the oldest entry in the bucket to be removed to make room.
14 @@ -953,7 +953,7 @@ ip_nonlocal_bind - BOOLEAN
15 which can be quite useful - but may break some applications.
16 Default: 0
17
18 -ip_dynaddr - BOOLEAN
19 +ip_dynaddr - INTEGER
20 If set non-zero, enables support for dynamic addresses.
21 If set to a non-zero value larger than 1, a kernel log
22 message will be printed when dynamic address rewriting
23 diff --git a/Makefile b/Makefile
24 index 755123455105f..89d19f04faabf 100644
25 --- a/Makefile
26 +++ b/Makefile
27 @@ -1,7 +1,7 @@
28 # SPDX-License-Identifier: GPL-2.0
29 VERSION = 5
30 PATCHLEVEL = 4
31 -SUBLEVEL = 206
32 +SUBLEVEL = 207
33 EXTRAVERSION =
34 NAME = Kleptomaniac Octopus
35
36 diff --git a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi
37 index f0be516dc28e1..9181fbeb833d3 100644
38 --- a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi
39 +++ b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi
40 @@ -226,7 +226,7 @@
41 reg = <0x28>;
42 #gpio-cells = <2>;
43 gpio-controller;
44 - ngpio = <32>;
45 + ngpios = <62>;
46 };
47
48 sgtl5000: codec@a {
49 diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
50 index 09816a2ee3670..dbfdffd54003a 100644
51 --- a/arch/arm/boot/dts/sama5d2.dtsi
52 +++ b/arch/arm/boot/dts/sama5d2.dtsi
53 @@ -933,7 +933,7 @@
54 clocks = <&pmc PMC_TYPE_PERIPHERAL 55>, <&pmc PMC_TYPE_GCK 55>;
55 clock-names = "pclk", "gclk";
56 assigned-clocks = <&pmc PMC_TYPE_CORE PMC_I2S1_MUX>;
57 - assigned-parrents = <&pmc PMC_TYPE_GCK 55>;
58 + assigned-clock-parents = <&pmc PMC_TYPE_GCK 55>;
59 status = "disabled";
60 };
61
62 diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi
63 index a687c024daa92..0e9e930c60f06 100644
64 --- a/arch/arm/boot/dts/stm32mp157c.dtsi
65 +++ b/arch/arm/boot/dts/stm32mp157c.dtsi
66 @@ -515,7 +515,7 @@
67 compatible = "st,stm32-cec";
68 reg = <0x40016000 0x400>;
69 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
70 - clocks = <&rcc CEC_K>, <&clk_lse>;
71 + clocks = <&rcc CEC_K>, <&rcc CEC>;
72 clock-names = "cec", "hdmi-cec";
73 status = "disabled";
74 };
75 diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
76 index f19ed981da9d9..3706216ffb40b 100644
77 --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
78 +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
79 @@ -169,7 +169,7 @@
80 flash@0 {
81 #address-cells = <1>;
82 #size-cells = <1>;
83 - compatible = "mxicy,mx25l1606e", "winbond,w25q128";
84 + compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
85 reg = <0>;
86 spi-max-frequency = <40000000>;
87 };
88 diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
89 index 92282558caf7c..2b8970d8e5a2f 100644
90 --- a/arch/arm/include/asm/mach/map.h
91 +++ b/arch/arm/include/asm/mach/map.h
92 @@ -27,6 +27,7 @@ enum {
93 MT_HIGH_VECTORS,
94 MT_MEMORY_RWX,
95 MT_MEMORY_RW,
96 + MT_MEMORY_RO,
97 MT_ROM,
98 MT_MEMORY_RWX_NONCACHED,
99 MT_MEMORY_RW_DTCM,
100 diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
101 index 91d6b7856be4b..73c83f4d33b3b 100644
102 --- a/arch/arm/include/asm/ptrace.h
103 +++ b/arch/arm/include/asm/ptrace.h
104 @@ -164,5 +164,31 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
105 ((current_stack_pointer | (THREAD_SIZE - 1)) - 7) - 1; \
106 })
107
108 +
109 +/*
110 + * Update ITSTATE after normal execution of an IT block instruction.
111 + *
112 + * The 8 IT state bits are split into two parts in CPSR:
113 + * ITSTATE<1:0> are in CPSR<26:25>
114 + * ITSTATE<7:2> are in CPSR<15:10>
115 + */
116 +static inline unsigned long it_advance(unsigned long cpsr)
117 +{
118 + if ((cpsr & 0x06000400) == 0) {
119 + /* ITSTATE<2:0> == 0 means end of IT block, so clear IT state */
120 + cpsr &= ~PSR_IT_MASK;
121 + } else {
122 + /* We need to shift left ITSTATE<4:0> */
123 + const unsigned long mask = 0x06001c00; /* Mask ITSTATE<4:0> */
124 + unsigned long it = cpsr & mask;
125 + it <<= 1;
126 + it |= it >> (27 - 10); /* Carry ITSTATE<2> to correct place */
127 + it &= mask;
128 + cpsr &= ~mask;
129 + cpsr |= it;
130 + }
131 + return cpsr;
132 +}
133 +
134 #endif /* __ASSEMBLY__ */
135 #endif
136 diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
137 index 788c5cf46de59..1fc6c4810a5c3 100644
138 --- a/arch/arm/mm/alignment.c
139 +++ b/arch/arm/mm/alignment.c
140 @@ -935,6 +935,9 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
141 if (type == TYPE_LDST)
142 do_alignment_finish_ldst(addr, instr, regs, offset);
143
144 + if (thumb_mode(regs))
145 + regs->ARM_cpsr = it_advance(regs->ARM_cpsr);
146 +
147 return 0;
148
149 bad_or_fault:
150 diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
151 index 6e7f841f67ff1..463cbb0631be2 100644
152 --- a/arch/arm/mm/mmu.c
153 +++ b/arch/arm/mm/mmu.c
154 @@ -316,6 +316,13 @@ static struct mem_type mem_types[] __ro_after_init = {
155 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
156 .domain = DOMAIN_KERNEL,
157 },
158 + [MT_MEMORY_RO] = {
159 + .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
160 + L_PTE_XN | L_PTE_RDONLY,
161 + .prot_l1 = PMD_TYPE_TABLE,
162 + .prot_sect = PMD_TYPE_SECT,
163 + .domain = DOMAIN_KERNEL,
164 + },
165 [MT_ROM] = {
166 .prot_sect = PMD_TYPE_SECT,
167 .domain = DOMAIN_KERNEL,
168 @@ -515,6 +522,7 @@ static void __init build_mem_type_table(void)
169
170 /* Also setup NX memory mapping */
171 mem_types[MT_MEMORY_RW].prot_sect |= PMD_SECT_XN;
172 + mem_types[MT_MEMORY_RO].prot_sect |= PMD_SECT_XN;
173 }
174 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
175 /*
176 @@ -597,6 +605,7 @@ static void __init build_mem_type_table(void)
177 mem_types[MT_ROM].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
178 mem_types[MT_MINICLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
179 mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
180 + mem_types[MT_MEMORY_RO].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
181 #endif
182
183 /*
184 @@ -617,6 +626,8 @@ static void __init build_mem_type_table(void)
185 mem_types[MT_MEMORY_RWX].prot_pte |= L_PTE_SHARED;
186 mem_types[MT_MEMORY_RW].prot_sect |= PMD_SECT_S;
187 mem_types[MT_MEMORY_RW].prot_pte |= L_PTE_SHARED;
188 + mem_types[MT_MEMORY_RO].prot_sect |= PMD_SECT_S;
189 + mem_types[MT_MEMORY_RO].prot_pte |= L_PTE_SHARED;
190 mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED;
191 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_S;
192 mem_types[MT_MEMORY_RWX_NONCACHED].prot_pte |= L_PTE_SHARED;
193 @@ -680,6 +691,8 @@ static void __init build_mem_type_table(void)
194 mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot;
195 mem_types[MT_MEMORY_RW].prot_sect |= ecc_mask | cp->pmd;
196 mem_types[MT_MEMORY_RW].prot_pte |= kern_pgprot;
197 + mem_types[MT_MEMORY_RO].prot_sect |= ecc_mask | cp->pmd;
198 + mem_types[MT_MEMORY_RO].prot_pte |= kern_pgprot;
199 mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
200 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= ecc_mask;
201 mem_types[MT_ROM].prot_sect |= cp->pmd;
202 @@ -1361,7 +1374,7 @@ static void __init devicemaps_init(const struct machine_desc *mdesc)
203 map.pfn = __phys_to_pfn(__atags_pointer & SECTION_MASK);
204 map.virtual = FDT_FIXED_BASE;
205 map.length = FDT_FIXED_SIZE;
206 - map.type = MT_ROM;
207 + map.type = MT_MEMORY_RO;
208 create_mapping(&map);
209 }
210
211 diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c
212 index bcb9181601d9b..b09c54499f955 100644
213 --- a/arch/arm/mm/proc-v7-bugs.c
214 +++ b/arch/arm/mm/proc-v7-bugs.c
215 @@ -109,8 +109,7 @@ static unsigned int spectre_v2_install_workaround(unsigned int method)
216 #else
217 static unsigned int spectre_v2_install_workaround(unsigned int method)
218 {
219 - pr_info("CPU%u: Spectre V2: workarounds disabled by configuration\n",
220 - smp_processor_id());
221 + pr_info_once("Spectre V2: workarounds disabled by configuration\n");
222
223 return SPECTRE_VULNERABLE;
224 }
225 @@ -222,10 +221,10 @@ static int spectre_bhb_install_workaround(int method)
226 return SPECTRE_VULNERABLE;
227
228 spectre_bhb_method = method;
229 - }
230
231 - pr_info("CPU%u: Spectre BHB: using %s workaround\n",
232 - smp_processor_id(), spectre_bhb_method_name(method));
233 + pr_info("CPU%u: Spectre BHB: enabling %s workaround for all CPUs\n",
234 + smp_processor_id(), spectre_bhb_method_name(method));
235 + }
236
237 return SPECTRE_MITIGATED;
238 }
239 diff --git a/arch/arm/probes/decode.h b/arch/arm/probes/decode.h
240 index 9731735989921..facc889d05eee 100644
241 --- a/arch/arm/probes/decode.h
242 +++ b/arch/arm/probes/decode.h
243 @@ -14,6 +14,7 @@
244 #include <linux/types.h>
245 #include <linux/stddef.h>
246 #include <asm/probes.h>
247 +#include <asm/ptrace.h>
248 #include <asm/kprobes.h>
249
250 void __init arm_probes_decode_init(void);
251 @@ -35,31 +36,6 @@ void __init find_str_pc_offset(void);
252 #endif
253
254
255 -/*
256 - * Update ITSTATE after normal execution of an IT block instruction.
257 - *
258 - * The 8 IT state bits are split into two parts in CPSR:
259 - * ITSTATE<1:0> are in CPSR<26:25>
260 - * ITSTATE<7:2> are in CPSR<15:10>
261 - */
262 -static inline unsigned long it_advance(unsigned long cpsr)
263 - {
264 - if ((cpsr & 0x06000400) == 0) {
265 - /* ITSTATE<2:0> == 0 means end of IT block, so clear IT state */
266 - cpsr &= ~PSR_IT_MASK;
267 - } else {
268 - /* We need to shift left ITSTATE<4:0> */
269 - const unsigned long mask = 0x06001c00; /* Mask ITSTATE<4:0> */
270 - unsigned long it = cpsr & mask;
271 - it <<= 1;
272 - it |= it >> (27 - 10); /* Carry ITSTATE<2> to correct place */
273 - it &= mask;
274 - cpsr &= ~mask;
275 - cpsr |= it;
276 - }
277 - return cpsr;
278 -}
279 -
280 static inline void __kprobes bx_write_pc(long pcv, struct pt_regs *regs)
281 {
282 long cpsr = regs->ARM_cpsr;
283 diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
284 index 206a4b6144c2e..950286016f63c 100644
285 --- a/arch/x86/kernel/head64.c
286 +++ b/arch/x86/kernel/head64.c
287 @@ -383,6 +383,8 @@ static void __init clear_bss(void)
288 {
289 memset(__bss_start, 0,
290 (unsigned long) __bss_stop - (unsigned long) __bss_start);
291 + memset(__brk_base, 0,
292 + (unsigned long) __brk_limit - (unsigned long) __brk_base);
293 }
294
295 static unsigned long get_cmd_line_ptr(void)
296 diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
297 index 73621bc119768..3704476bb83a0 100644
298 --- a/drivers/cpufreq/pmac32-cpufreq.c
299 +++ b/drivers/cpufreq/pmac32-cpufreq.c
300 @@ -471,6 +471,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
301 if (slew_done_gpio_np)
302 slew_done_gpio = read_gpio(slew_done_gpio_np);
303
304 + of_node_put(volt_gpio_np);
305 + of_node_put(freq_gpio_np);
306 + of_node_put(slew_done_gpio_np);
307 +
308 /* If we use the frequency GPIOs, calculate the min/max speeds based
309 * on the bus frequencies
310 */
311 diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
312 index 74d45a0eecb84..c59b43fb34a8c 100644
313 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
314 +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
315 @@ -520,6 +520,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
316 ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs,
317 DRM_MODE_CONNECTOR_DisplayPort);
318 if (ret) {
319 + drm_dp_mst_put_port_malloc(port);
320 intel_connector_free(intel_connector);
321 return NULL;
322 }
323 diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
324 index c8c070375d298..f6d7f5d307d7d 100644
325 --- a/drivers/gpu/drm/i915/gt/intel_gt.c
326 +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
327 @@ -339,6 +339,20 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt)
328 mutex_lock(&gt->tlb_invalidate_lock);
329 intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
330
331 + spin_lock_irq(&uncore->lock); /* serialise invalidate with GT reset */
332 +
333 + for_each_engine(engine, gt, id) {
334 + struct reg_and_bit rb;
335 +
336 + rb = get_reg_and_bit(engine, regs == gen8_regs, regs, num);
337 + if (!i915_mmio_reg_offset(rb.reg))
338 + continue;
339 +
340 + intel_uncore_write_fw(uncore, rb.reg, rb.bit);
341 + }
342 +
343 + spin_unlock_irq(&uncore->lock);
344 +
345 for_each_engine(engine, gt, id) {
346 /*
347 * HW architecture suggest typical invalidation time at 40us,
348 @@ -353,7 +367,6 @@ void intel_gt_invalidate_tlbs(struct intel_gt *gt)
349 if (!i915_mmio_reg_offset(rb.reg))
350 continue;
351
352 - intel_uncore_write_fw(uncore, rb.reg, rb.bit);
353 if (__intel_wait_for_register_fw(uncore,
354 rb.reg, rb.bit, 0,
355 timeout_us, timeout_ms,
356 diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
357 index f57dd195dfb8e..b4bab8647f763 100644
358 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
359 +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
360 @@ -428,8 +428,8 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data,
361
362 if (args->retained) {
363 if (args->madv == PANFROST_MADV_DONTNEED)
364 - list_add_tail(&bo->base.madv_list,
365 - &pfdev->shrinker_list);
366 + list_move_tail(&bo->base.madv_list,
367 + &pfdev->shrinker_list);
368 else if (args->madv == PANFROST_MADV_WILLNEED)
369 list_del_init(&bo->base.madv_list);
370 }
371 diff --git a/drivers/irqchip/irq-or1k-pic.c b/drivers/irqchip/irq-or1k-pic.c
372 index 03d2366118dd4..d5f1fabc45d79 100644
373 --- a/drivers/irqchip/irq-or1k-pic.c
374 +++ b/drivers/irqchip/irq-or1k-pic.c
375 @@ -66,7 +66,6 @@ static struct or1k_pic_dev or1k_pic_level = {
376 .name = "or1k-PIC-level",
377 .irq_unmask = or1k_pic_unmask,
378 .irq_mask = or1k_pic_mask,
379 - .irq_mask_ack = or1k_pic_mask_ack,
380 },
381 .handle = handle_level_irq,
382 .flags = IRQ_LEVEL | IRQ_NOPROBE,
383 diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
384 index 9ae3efce0f66b..26f721664e761 100644
385 --- a/drivers/net/can/m_can/m_can.c
386 +++ b/drivers/net/can/m_can/m_can.c
387 @@ -1443,8 +1443,6 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev)
388 M_CAN_FIFO_DATA(i / 4),
389 *(u32 *)(cf->data + i));
390
391 - can_put_echo_skb(skb, dev, 0);
392 -
393 if (cdev->can.ctrlmode & CAN_CTRLMODE_FD) {
394 cccr = m_can_read(cdev, M_CAN_CCCR);
395 cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT);
396 @@ -1461,6 +1459,9 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev)
397 m_can_write(cdev, M_CAN_CCCR, cccr);
398 }
399 m_can_write(cdev, M_CAN_TXBTIE, 0x1);
400 +
401 + can_put_echo_skb(skb, dev, 0);
402 +
403 m_can_write(cdev, M_CAN_TXBAR, 0x1);
404 /* End of xmit function for version 3.0.x */
405 } else {
406 diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
407 index d7478d332820e..98e94d914597a 100644
408 --- a/drivers/net/ethernet/faraday/ftgmac100.c
409 +++ b/drivers/net/ethernet/faraday/ftgmac100.c
410 @@ -1734,6 +1734,19 @@ static void ftgmac100_setup_clk(struct ftgmac100 *priv)
411 FTGMAC_100MHZ);
412 }
413
414 +static bool ftgmac100_has_child_node(struct device_node *np, const char *name)
415 +{
416 + struct device_node *child_np = of_get_child_by_name(np, name);
417 + bool ret = false;
418 +
419 + if (child_np) {
420 + ret = true;
421 + of_node_put(child_np);
422 + }
423 +
424 + return ret;
425 +}
426 +
427 static int ftgmac100_probe(struct platform_device *pdev)
428 {
429 struct resource *res;
430 @@ -1850,7 +1863,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
431
432 /* Display what we found */
433 phy_attached_info(phy);
434 - } else if (np && !of_get_child_by_name(np, "mdio")) {
435 + } else if (np && !ftgmac100_has_child_node(np, "mdio")) {
436 /* Support legacy ASPEED devicetree descriptions that decribe a
437 * MAC with an embedded MDIO controller but have no "mdio"
438 * child node. Automatically scan the MDIO bus for available
439 diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
440 index 936e64dd81b5f..b23741d3c9be3 100644
441 --- a/drivers/net/ethernet/sfc/ef10.c
442 +++ b/drivers/net/ethernet/sfc/ef10.c
443 @@ -2056,7 +2056,10 @@ static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx)
444
445 efx_update_sw_stats(efx, stats);
446 out:
447 + /* releasing a DMA coherent buffer with BH disabled can panic */
448 + spin_unlock_bh(&efx->stats_lock);
449 efx_nic_free_buffer(efx, &stats_buf);
450 + spin_lock_bh(&efx->stats_lock);
451 return rc;
452 }
453
454 diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
455 index e7c6aa29d3232..b318ce83f5bf4 100644
456 --- a/drivers/net/ethernet/sfc/ef10_sriov.c
457 +++ b/drivers/net/ethernet/sfc/ef10_sriov.c
458 @@ -412,8 +412,9 @@ fail1:
459 static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force)
460 {
461 struct pci_dev *dev = efx->pci_dev;
462 + struct efx_ef10_nic_data *nic_data = efx->nic_data;
463 unsigned int vfs_assigned = pci_vfs_assigned(dev);
464 - int rc = 0;
465 + int i, rc = 0;
466
467 if (vfs_assigned && !force) {
468 netif_info(efx, drv, efx->net_dev, "VFs are assigned to guests; "
469 @@ -421,10 +422,13 @@ static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force)
470 return -EBUSY;
471 }
472
473 - if (!vfs_assigned)
474 + if (!vfs_assigned) {
475 + for (i = 0; i < efx->vf_count; i++)
476 + nic_data->vf[i].pci_dev = NULL;
477 pci_disable_sriov(dev);
478 - else
479 + } else {
480 rc = -EBUSY;
481 + }
482
483 efx_ef10_sriov_free_vf_vswitching(efx);
484 efx->vf_count = 0;
485 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
486 index dd9967aeda221..0f0094ced776b 100644
487 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
488 +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
489 @@ -357,6 +357,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
490 data->fix_mac_speed = tegra_eqos_fix_speed;
491 data->init = tegra_eqos_init;
492 data->bsp_priv = eqos;
493 + data->sph_disable = 1;
494
495 err = tegra_eqos_init(pdev, eqos);
496 if (err < 0)
497 diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
498 index 5657c604602e8..beaa00342a13f 100644
499 --- a/drivers/net/phy/sfp.c
500 +++ b/drivers/net/phy/sfp.c
501 @@ -1878,7 +1878,7 @@ static int sfp_probe(struct platform_device *pdev)
502
503 platform_set_drvdata(pdev, sfp);
504
505 - err = devm_add_action(sfp->dev, sfp_cleanup, sfp);
506 + err = devm_add_action_or_reset(sfp->dev, sfp_cleanup, sfp);
507 if (err < 0)
508 return err;
509
510 diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
511 index 7f68067c01745..85a5a622ec184 100644
512 --- a/drivers/net/xen-netback/rx.c
513 +++ b/drivers/net/xen-netback/rx.c
514 @@ -482,6 +482,7 @@ void xenvif_rx_action(struct xenvif_queue *queue)
515 queue->rx_copy.completed = &completed_skbs;
516
517 while (xenvif_rx_ring_slots_available(queue) &&
518 + !skb_queue_empty(&queue->rx_queue) &&
519 work_done < RX_BATCH_SIZE) {
520 xenvif_rx_skb(queue);
521 work_done++;
522 diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
523 index 3943a30053b3b..f426dcdfcdd6a 100644
524 --- a/drivers/nfc/nxp-nci/i2c.c
525 +++ b/drivers/nfc/nxp-nci/i2c.c
526 @@ -122,7 +122,9 @@ static int nxp_nci_i2c_fw_read(struct nxp_nci_i2c_phy *phy,
527 skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN);
528
529 r = i2c_master_recv(client, skb_put(*skb, frame_len), frame_len);
530 - if (r != frame_len) {
531 + if (r < 0) {
532 + goto fw_read_exit_free_skb;
533 + } else if (r != frame_len) {
534 nfc_err(&client->dev,
535 "Invalid frame length: %u (expected %zu)\n",
536 r, frame_len);
537 @@ -166,7 +168,9 @@ static int nxp_nci_i2c_nci_read(struct nxp_nci_i2c_phy *phy,
538 return 0;
539
540 r = i2c_master_recv(client, skb_put(*skb, header.plen), header.plen);
541 - if (r != header.plen) {
542 + if (r < 0) {
543 + goto nci_read_exit_free_skb;
544 + } else if (r != header.plen) {
545 nfc_err(&client->dev,
546 "Invalid frame payload length: %u (expected %u)\n",
547 r, header.plen);
548 diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
549 index 79e22618817de..d2ea6ca37c41f 100644
550 --- a/drivers/nvme/host/core.c
551 +++ b/drivers/nvme/host/core.c
552 @@ -4034,6 +4034,8 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
553 nvme_stop_keep_alive(ctrl);
554 flush_work(&ctrl->async_event_work);
555 cancel_work_sync(&ctrl->fw_act_work);
556 + if (ctrl->ops->stop_ctrl)
557 + ctrl->ops->stop_ctrl(ctrl);
558 }
559 EXPORT_SYMBOL_GPL(nvme_stop_ctrl);
560
561 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
562 index 1d1431dd4f9e3..81a5b968253ff 100644
563 --- a/drivers/nvme/host/nvme.h
564 +++ b/drivers/nvme/host/nvme.h
565 @@ -402,6 +402,7 @@ struct nvme_ctrl_ops {
566 void (*free_ctrl)(struct nvme_ctrl *ctrl);
567 void (*submit_async_event)(struct nvme_ctrl *ctrl);
568 void (*delete_ctrl)(struct nvme_ctrl *ctrl);
569 + void (*stop_ctrl)(struct nvme_ctrl *ctrl);
570 int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size);
571 };
572
573 diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
574 index 4213c71b02a4b..d5d7b2f98edc9 100644
575 --- a/drivers/nvme/host/rdma.c
576 +++ b/drivers/nvme/host/rdma.c
577 @@ -973,6 +973,14 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
578 }
579 }
580
581 +static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl)
582 +{
583 + struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
584 +
585 + cancel_work_sync(&ctrl->err_work);
586 + cancel_delayed_work_sync(&ctrl->reconnect_work);
587 +}
588 +
589 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
590 {
591 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
592 @@ -1947,9 +1955,6 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops = {
593
594 static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
595 {
596 - cancel_work_sync(&ctrl->err_work);
597 - cancel_delayed_work_sync(&ctrl->reconnect_work);
598 -
599 nvme_rdma_teardown_io_queues(ctrl, shutdown);
600 blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
601 if (shutdown)
602 @@ -1999,6 +2004,7 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = {
603 .submit_async_event = nvme_rdma_submit_async_event,
604 .delete_ctrl = nvme_rdma_delete_ctrl,
605 .get_address = nvmf_get_address,
606 + .stop_ctrl = nvme_rdma_stop_ctrl,
607 };
608
609 /*
610 diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
611 index 4378344f0e7ab..2a27ac9aedbaa 100644
612 --- a/drivers/nvme/host/tcp.c
613 +++ b/drivers/nvme/host/tcp.c
614 @@ -1973,9 +1973,6 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work)
615
616 static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown)
617 {
618 - cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work);
619 - cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work);
620 -
621 nvme_tcp_teardown_io_queues(ctrl, shutdown);
622 blk_mq_quiesce_queue(ctrl->admin_q);
623 if (shutdown)
624 @@ -2014,6 +2011,12 @@ out_fail:
625 nvme_tcp_reconnect_or_remove(ctrl);
626 }
627
628 +static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl)
629 +{
630 + cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work);
631 + cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work);
632 +}
633 +
634 static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl)
635 {
636 struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
637 @@ -2322,6 +2325,7 @@ static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = {
638 .submit_async_event = nvme_tcp_submit_async_event,
639 .delete_ctrl = nvme_tcp_delete_ctrl,
640 .get_address = nvmf_get_address,
641 + .stop_ctrl = nvme_tcp_stop_ctrl,
642 };
643
644 static bool
645 diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
646 index 63a530a3d9feb..c3fdb0ecad96e 100644
647 --- a/drivers/platform/x86/hp-wmi.c
648 +++ b/drivers/platform/x86/hp-wmi.c
649 @@ -62,6 +62,7 @@ enum hp_wmi_event_ids {
650 HPWMI_BACKLIT_KB_BRIGHTNESS = 0x0D,
651 HPWMI_PEAKSHIFT_PERIOD = 0x0F,
652 HPWMI_BATTERY_CHARGE_PERIOD = 0x10,
653 + HPWMI_SANITIZATION_MODE = 0x17,
654 };
655
656 struct bios_args {
657 @@ -629,6 +630,8 @@ static void hp_wmi_notify(u32 value, void *context)
658 break;
659 case HPWMI_BATTERY_CHARGE_PERIOD:
660 break;
661 + case HPWMI_SANITIZATION_MODE:
662 + break;
663 default:
664 pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data);
665 break;
666 diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c
667 index 6065aaab67403..8482a4892b83b 100644
668 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c
669 +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c
670 @@ -735,7 +735,7 @@ static const struct of_device_id ixp4xx_npe_of_match[] = {
671 static struct platform_driver ixp4xx_npe_driver = {
672 .driver = {
673 .name = "ixp4xx-npe",
674 - .of_match_table = of_match_ptr(ixp4xx_npe_of_match),
675 + .of_match_table = ixp4xx_npe_of_match,
676 },
677 .probe = ixp4xx_npe_probe,
678 .remove = ixp4xx_npe_remove,
679 diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
680 index cb975228726e0..f8819f72304a8 100644
681 --- a/drivers/tty/serial/8250/8250_port.c
682 +++ b/drivers/tty/serial/8250/8250_port.c
683 @@ -2828,8 +2828,10 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
684 case UPIO_MEM32BE:
685 case UPIO_MEM16:
686 case UPIO_MEM:
687 - if (!port->mapbase)
688 + if (!port->mapbase) {
689 + ret = -EINVAL;
690 break;
691 + }
692
693 if (!request_mem_region(port->mapbase, size, "serial")) {
694 ret = -EBUSY;
695 diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
696 index 0bd8c05d72d60..52b7d559b44bf 100644
697 --- a/drivers/tty/serial/amba-pl011.c
698 +++ b/drivers/tty/serial/amba-pl011.c
699 @@ -1335,6 +1335,15 @@ static void pl011_stop_rx(struct uart_port *port)
700 pl011_dma_rx_stop(uap);
701 }
702
703 +static void pl011_throttle_rx(struct uart_port *port)
704 +{
705 + unsigned long flags;
706 +
707 + spin_lock_irqsave(&port->lock, flags);
708 + pl011_stop_rx(port);
709 + spin_unlock_irqrestore(&port->lock, flags);
710 +}
711 +
712 static void pl011_enable_ms(struct uart_port *port)
713 {
714 struct uart_amba_port *uap =
715 @@ -1728,9 +1737,10 @@ static int pl011_allocate_irq(struct uart_amba_port *uap)
716 */
717 static void pl011_enable_interrupts(struct uart_amba_port *uap)
718 {
719 + unsigned long flags;
720 unsigned int i;
721
722 - spin_lock_irq(&uap->port.lock);
723 + spin_lock_irqsave(&uap->port.lock, flags);
724
725 /* Clear out any spuriously appearing RX interrupts */
726 pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR);
727 @@ -1752,7 +1762,14 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap)
728 if (!pl011_dma_rx_running(uap))
729 uap->im |= UART011_RXIM;
730 pl011_write(uap->im, uap, REG_IMSC);
731 - spin_unlock_irq(&uap->port.lock);
732 + spin_unlock_irqrestore(&uap->port.lock, flags);
733 +}
734 +
735 +static void pl011_unthrottle_rx(struct uart_port *port)
736 +{
737 + struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
738 +
739 + pl011_enable_interrupts(uap);
740 }
741
742 static int pl011_startup(struct uart_port *port)
743 @@ -2127,6 +2144,8 @@ static const struct uart_ops amba_pl011_pops = {
744 .stop_tx = pl011_stop_tx,
745 .start_tx = pl011_start_tx,
746 .stop_rx = pl011_stop_rx,
747 + .throttle = pl011_throttle_rx,
748 + .unthrottle = pl011_unthrottle_rx,
749 .enable_ms = pl011_enable_ms,
750 .break_ctl = pl011_break_ctl,
751 .startup = pl011_startup,
752 diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
753 index 6040d5a6139ab..1df74bad10630 100644
754 --- a/drivers/tty/serial/samsung.c
755 +++ b/drivers/tty/serial/samsung.c
756 @@ -238,8 +238,7 @@ static void enable_tx_dma(struct s3c24xx_uart_port *ourport)
757 /* Enable tx dma mode */
758 ucon = rd_regl(port, S3C2410_UCON);
759 ucon &= ~(S3C64XX_UCON_TXBURST_MASK | S3C64XX_UCON_TXMODE_MASK);
760 - ucon |= (dma_get_cache_alignment() >= 16) ?
761 - S3C64XX_UCON_TXBURST_16 : S3C64XX_UCON_TXBURST_1;
762 + ucon |= S3C64XX_UCON_TXBURST_1;
763 ucon |= S3C64XX_UCON_TXMODE_DMA;
764 wr_regl(port, S3C2410_UCON, ucon);
765
766 @@ -512,7 +511,7 @@ static void enable_rx_dma(struct s3c24xx_uart_port *ourport)
767 S3C64XX_UCON_DMASUS_EN |
768 S3C64XX_UCON_TIMEOUT_EN |
769 S3C64XX_UCON_RXMODE_MASK);
770 - ucon |= S3C64XX_UCON_RXBURST_16 |
771 + ucon |= S3C64XX_UCON_RXBURST_1 |
772 0xf << S3C64XX_UCON_TIMEOUT_SHIFT |
773 S3C64XX_UCON_EMPTYINT_EN |
774 S3C64XX_UCON_TIMEOUT_EN |
775 diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
776 index d5a084ffde892..5e0b9f783cacb 100644
777 --- a/drivers/tty/serial/stm32-usart.c
778 +++ b/drivers/tty/serial/stm32-usart.c
779 @@ -73,6 +73,8 @@ static void stm32_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE,
780 *cr3 |= USART_CR3_DEM;
781 over8 = *cr1 & USART_CR1_OVER8;
782
783 + *cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK);
784 +
785 if (over8)
786 rs485_deat_dedt = delay_ADE * baud * 8;
787 else
788 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
789 index 18a53a3dfac6c..80fee7ea83ca4 100644
790 --- a/drivers/usb/dwc3/gadget.c
791 +++ b/drivers/usb/dwc3/gadget.c
792 @@ -3535,7 +3535,6 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3_event_buffer *evt)
793 }
794
795 evt->count = 0;
796 - evt->flags &= ~DWC3_EVENT_PENDING;
797 ret = IRQ_HANDLED;
798
799 /* Unmask interrupt */
800 @@ -3548,6 +3547,9 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3_event_buffer *evt)
801 dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval);
802 }
803
804 + /* Keep the clearing of DWC3_EVENT_PENDING at the end */
805 + evt->flags &= ~DWC3_EVENT_PENDING;
806 +
807 return ret;
808 }
809
810 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
811 index 48323165139ad..d671e096594bb 100644
812 --- a/drivers/usb/serial/ftdi_sio.c
813 +++ b/drivers/usb/serial/ftdi_sio.c
814 @@ -1023,6 +1023,9 @@ static const struct usb_device_id id_table_combined[] = {
815 { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) },
816 { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) },
817 { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) },
818 + /* Belimo Automation devices */
819 + { USB_DEVICE(FTDI_VID, BELIMO_ZTH_PID) },
820 + { USB_DEVICE(FTDI_VID, BELIMO_ZIP_PID) },
821 /* ICP DAS I-756xU devices */
822 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) },
823 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
824 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
825 index d1a9564697a4b..4e92c165c86bf 100644
826 --- a/drivers/usb/serial/ftdi_sio_ids.h
827 +++ b/drivers/usb/serial/ftdi_sio_ids.h
828 @@ -1568,6 +1568,12 @@
829 #define CHETCO_SEASMART_LITE_PID 0xA5AE /* SeaSmart Lite USB Adapter */
830 #define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */
831
832 +/*
833 + * Belimo Automation
834 + */
835 +#define BELIMO_ZTH_PID 0x8050
836 +#define BELIMO_ZIP_PID 0xC811
837 +
838 /*
839 * Unjo AB
840 */
841 diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
842 index 526509ed92e5c..db926641b79da 100644
843 --- a/drivers/usb/typec/class.c
844 +++ b/drivers/usb/typec/class.c
845 @@ -1383,6 +1383,7 @@ void typec_set_pwr_opmode(struct typec_port *port,
846 partner->usb_pd = 1;
847 sysfs_notify(&partner_dev->kobj, NULL,
848 "supports_usb_power_delivery");
849 + kobject_uevent(&partner_dev->kobj, KOBJ_CHANGE);
850 }
851 put_device(partner_dev);
852 }
853 diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
854 index 74547323aa836..e781e5e9215f0 100644
855 --- a/drivers/virtio/virtio_mmio.c
856 +++ b/drivers/virtio/virtio_mmio.c
857 @@ -62,6 +62,7 @@
858 #include <linux/list.h>
859 #include <linux/module.h>
860 #include <linux/platform_device.h>
861 +#include <linux/pm.h>
862 #include <linux/slab.h>
863 #include <linux/spinlock.h>
864 #include <linux/virtio.h>
865 @@ -514,6 +515,28 @@ static const struct virtio_config_ops virtio_mmio_config_ops = {
866 .bus_name = vm_bus_name,
867 };
868
869 +#ifdef CONFIG_PM_SLEEP
870 +static int virtio_mmio_freeze(struct device *dev)
871 +{
872 + struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev);
873 +
874 + return virtio_device_freeze(&vm_dev->vdev);
875 +}
876 +
877 +static int virtio_mmio_restore(struct device *dev)
878 +{
879 + struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev);
880 +
881 + if (vm_dev->version == 1)
882 + writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
883 +
884 + return virtio_device_restore(&vm_dev->vdev);
885 +}
886 +
887 +static const struct dev_pm_ops virtio_mmio_pm_ops = {
888 + SET_SYSTEM_SLEEP_PM_OPS(virtio_mmio_freeze, virtio_mmio_restore)
889 +};
890 +#endif
891
892 static void virtio_mmio_release_dev(struct device *_d)
893 {
894 @@ -767,6 +790,9 @@ static struct platform_driver virtio_mmio_driver = {
895 .name = "virtio-mmio",
896 .of_match_table = virtio_mmio_match,
897 .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
898 +#ifdef CONFIG_PM_SLEEP
899 + .pm = &virtio_mmio_pm_ops,
900 +#endif
901 },
902 };
903
904 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
905 index f1bbce4350c47..d5e649e578cb1 100644
906 --- a/fs/ext4/extents.c
907 +++ b/fs/ext4/extents.c
908 @@ -4932,13 +4932,15 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
909 FALLOC_FL_INSERT_RANGE))
910 return -EOPNOTSUPP;
911
912 - if (mode & FALLOC_FL_PUNCH_HOLE)
913 - return ext4_punch_hole(inode, offset, len);
914 -
915 + inode_lock(inode);
916 ret = ext4_convert_inline_data(inode);
917 + inode_unlock(inode);
918 if (ret)
919 return ret;
920
921 + if (mode & FALLOC_FL_PUNCH_HOLE)
922 + return ext4_punch_hole(inode, offset, len);
923 +
924 if (mode & FALLOC_FL_COLLAPSE_RANGE)
925 return ext4_collapse_range(inode, offset, len);
926
927 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
928 index 1cac574911a79..d8fee911d4f4d 100644
929 --- a/fs/ext4/inode.c
930 +++ b/fs/ext4/inode.c
931 @@ -4322,15 +4322,6 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
932
933 trace_ext4_punch_hole(inode, offset, length, 0);
934
935 - ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
936 - if (ext4_has_inline_data(inode)) {
937 - down_write(&EXT4_I(inode)->i_mmap_sem);
938 - ret = ext4_convert_inline_data(inode);
939 - up_write(&EXT4_I(inode)->i_mmap_sem);
940 - if (ret)
941 - return ret;
942 - }
943 -
944 /*
945 * Write out all dirty pages to avoid race conditions
946 * Then release them.
947 diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
948 index 4895d978369a1..dc772eaa13cf1 100644
949 --- a/fs/nilfs2/nilfs.h
950 +++ b/fs/nilfs2/nilfs.h
951 @@ -198,6 +198,9 @@ static inline int nilfs_acl_chmod(struct inode *inode)
952
953 static inline int nilfs_init_acl(struct inode *inode, struct inode *dir)
954 {
955 + if (S_ISLNK(inode->i_mode))
956 + return 0;
957 +
958 inode->i_mode &= ~current_umask();
959 return 0;
960 }
961 diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
962 index 1ccfa3779e18d..d15884957e7f3 100644
963 --- a/include/linux/cgroup-defs.h
964 +++ b/include/linux/cgroup-defs.h
965 @@ -255,7 +255,8 @@ struct css_set {
966 * List of csets participating in the on-going migration either as
967 * source or destination. Protected by cgroup_mutex.
968 */
969 - struct list_head mg_preload_node;
970 + struct list_head mg_src_preload_node;
971 + struct list_head mg_dst_preload_node;
972 struct list_head mg_node;
973
974 /*
975 diff --git a/include/net/raw.h b/include/net/raw.h
976 index 8ad8df5948536..c51a635671a73 100644
977 --- a/include/net/raw.h
978 +++ b/include/net/raw.h
979 @@ -75,7 +75,7 @@ static inline bool raw_sk_bound_dev_eq(struct net *net, int bound_dev_if,
980 int dif, int sdif)
981 {
982 #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
983 - return inet_bound_dev_eq(!!net->ipv4.sysctl_raw_l3mdev_accept,
984 + return inet_bound_dev_eq(READ_ONCE(net->ipv4.sysctl_raw_l3mdev_accept),
985 bound_dev_if, dif, sdif);
986 #else
987 return inet_bound_dev_eq(true, bound_dev_if, dif, sdif);
988 diff --git a/include/net/sock.h b/include/net/sock.h
989 index 7f213cfcb3cc6..9d687070d272a 100644
990 --- a/include/net/sock.h
991 +++ b/include/net/sock.h
992 @@ -1400,7 +1400,7 @@ void __sk_mem_reclaim(struct sock *sk, int amount);
993 /* sysctl_mem values are in pages, we convert them in SK_MEM_QUANTUM units */
994 static inline long sk_prot_mem_limits(const struct sock *sk, int index)
995 {
996 - long val = sk->sk_prot->sysctl_mem[index];
997 + long val = READ_ONCE(sk->sk_prot->sysctl_mem[index]);
998
999 #if PAGE_SIZE > SK_MEM_QUANTUM
1000 val <<= PAGE_SHIFT - SK_MEM_QUANTUM_SHIFT;
1001 diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
1002 index 51fe9f6719eb1..ad11938c09725 100644
1003 --- a/include/trace/events/sock.h
1004 +++ b/include/trace/events/sock.h
1005 @@ -97,7 +97,7 @@ TRACE_EVENT(sock_exceed_buf_limit,
1006
1007 TP_STRUCT__entry(
1008 __array(char, name, 32)
1009 - __field(long *, sysctl_mem)
1010 + __array(long, sysctl_mem, 3)
1011 __field(long, allocated)
1012 __field(int, sysctl_rmem)
1013 __field(int, rmem_alloc)
1014 @@ -109,7 +109,9 @@ TRACE_EVENT(sock_exceed_buf_limit,
1015
1016 TP_fast_assign(
1017 strncpy(__entry->name, prot->name, 32);
1018 - __entry->sysctl_mem = prot->sysctl_mem;
1019 + __entry->sysctl_mem[0] = READ_ONCE(prot->sysctl_mem[0]);
1020 + __entry->sysctl_mem[1] = READ_ONCE(prot->sysctl_mem[1]);
1021 + __entry->sysctl_mem[2] = READ_ONCE(prot->sysctl_mem[2]);
1022 __entry->allocated = allocated;
1023 __entry->sysctl_rmem = sk_get_rmem0(sk, prot);
1024 __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);
1025 diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
1026 index 177d57ce90164..23f0db2900e4b 100644
1027 --- a/kernel/cgroup/cgroup.c
1028 +++ b/kernel/cgroup/cgroup.c
1029 @@ -743,7 +743,8 @@ struct css_set init_css_set = {
1030 .task_iters = LIST_HEAD_INIT(init_css_set.task_iters),
1031 .threaded_csets = LIST_HEAD_INIT(init_css_set.threaded_csets),
1032 .cgrp_links = LIST_HEAD_INIT(init_css_set.cgrp_links),
1033 - .mg_preload_node = LIST_HEAD_INIT(init_css_set.mg_preload_node),
1034 + .mg_src_preload_node = LIST_HEAD_INIT(init_css_set.mg_src_preload_node),
1035 + .mg_dst_preload_node = LIST_HEAD_INIT(init_css_set.mg_dst_preload_node),
1036 .mg_node = LIST_HEAD_INIT(init_css_set.mg_node),
1037
1038 /*
1039 @@ -1219,7 +1220,8 @@ static struct css_set *find_css_set(struct css_set *old_cset,
1040 INIT_LIST_HEAD(&cset->threaded_csets);
1041 INIT_HLIST_NODE(&cset->hlist);
1042 INIT_LIST_HEAD(&cset->cgrp_links);
1043 - INIT_LIST_HEAD(&cset->mg_preload_node);
1044 + INIT_LIST_HEAD(&cset->mg_src_preload_node);
1045 + INIT_LIST_HEAD(&cset->mg_dst_preload_node);
1046 INIT_LIST_HEAD(&cset->mg_node);
1047
1048 /* Copy the set of subsystem state objects generated in
1049 @@ -2629,21 +2631,27 @@ int cgroup_migrate_vet_dst(struct cgroup *dst_cgrp)
1050 */
1051 void cgroup_migrate_finish(struct cgroup_mgctx *mgctx)
1052 {
1053 - LIST_HEAD(preloaded);
1054 struct css_set *cset, *tmp_cset;
1055
1056 lockdep_assert_held(&cgroup_mutex);
1057
1058 spin_lock_irq(&css_set_lock);
1059
1060 - list_splice_tail_init(&mgctx->preloaded_src_csets, &preloaded);
1061 - list_splice_tail_init(&mgctx->preloaded_dst_csets, &preloaded);
1062 + list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_src_csets,
1063 + mg_src_preload_node) {
1064 + cset->mg_src_cgrp = NULL;
1065 + cset->mg_dst_cgrp = NULL;
1066 + cset->mg_dst_cset = NULL;
1067 + list_del_init(&cset->mg_src_preload_node);
1068 + put_css_set_locked(cset);
1069 + }
1070
1071 - list_for_each_entry_safe(cset, tmp_cset, &preloaded, mg_preload_node) {
1072 + list_for_each_entry_safe(cset, tmp_cset, &mgctx->preloaded_dst_csets,
1073 + mg_dst_preload_node) {
1074 cset->mg_src_cgrp = NULL;
1075 cset->mg_dst_cgrp = NULL;
1076 cset->mg_dst_cset = NULL;
1077 - list_del_init(&cset->mg_preload_node);
1078 + list_del_init(&cset->mg_dst_preload_node);
1079 put_css_set_locked(cset);
1080 }
1081
1082 @@ -2685,7 +2693,7 @@ void cgroup_migrate_add_src(struct css_set *src_cset,
1083
1084 src_cgrp = cset_cgroup_from_root(src_cset, dst_cgrp->root);
1085
1086 - if (!list_empty(&src_cset->mg_preload_node))
1087 + if (!list_empty(&src_cset->mg_src_preload_node))
1088 return;
1089
1090 WARN_ON(src_cset->mg_src_cgrp);
1091 @@ -2696,7 +2704,7 @@ void cgroup_migrate_add_src(struct css_set *src_cset,
1092 src_cset->mg_src_cgrp = src_cgrp;
1093 src_cset->mg_dst_cgrp = dst_cgrp;
1094 get_css_set(src_cset);
1095 - list_add_tail(&src_cset->mg_preload_node, &mgctx->preloaded_src_csets);
1096 + list_add_tail(&src_cset->mg_src_preload_node, &mgctx->preloaded_src_csets);
1097 }
1098
1099 /**
1100 @@ -2721,7 +2729,7 @@ int cgroup_migrate_prepare_dst(struct cgroup_mgctx *mgctx)
1101
1102 /* look up the dst cset for each src cset and link it to src */
1103 list_for_each_entry_safe(src_cset, tmp_cset, &mgctx->preloaded_src_csets,
1104 - mg_preload_node) {
1105 + mg_src_preload_node) {
1106 struct css_set *dst_cset;
1107 struct cgroup_subsys *ss;
1108 int ssid;
1109 @@ -2740,7 +2748,7 @@ int cgroup_migrate_prepare_dst(struct cgroup_mgctx *mgctx)
1110 if (src_cset == dst_cset) {
1111 src_cset->mg_src_cgrp = NULL;
1112 src_cset->mg_dst_cgrp = NULL;
1113 - list_del_init(&src_cset->mg_preload_node);
1114 + list_del_init(&src_cset->mg_src_preload_node);
1115 put_css_set(src_cset);
1116 put_css_set(dst_cset);
1117 continue;
1118 @@ -2748,8 +2756,8 @@ int cgroup_migrate_prepare_dst(struct cgroup_mgctx *mgctx)
1119
1120 src_cset->mg_dst_cset = dst_cset;
1121
1122 - if (list_empty(&dst_cset->mg_preload_node))
1123 - list_add_tail(&dst_cset->mg_preload_node,
1124 + if (list_empty(&dst_cset->mg_dst_preload_node))
1125 + list_add_tail(&dst_cset->mg_dst_preload_node,
1126 &mgctx->preloaded_dst_csets);
1127 else
1128 put_css_set(dst_cset);
1129 @@ -2980,7 +2988,8 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
1130 goto out_finish;
1131
1132 spin_lock_irq(&css_set_lock);
1133 - list_for_each_entry(src_cset, &mgctx.preloaded_src_csets, mg_preload_node) {
1134 + list_for_each_entry(src_cset, &mgctx.preloaded_src_csets,
1135 + mg_src_preload_node) {
1136 struct task_struct *task, *ntask;
1137
1138 /* all tasks in src_csets need to be migrated */
1139 diff --git a/kernel/sched/features.h b/kernel/sched/features.h
1140 index 2410db5e9a353..66c74aa4753e7 100644
1141 --- a/kernel/sched/features.h
1142 +++ b/kernel/sched/features.h
1143 @@ -77,7 +77,7 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false)
1144 SCHED_FEAT(RT_PUSH_IPI, true)
1145 #endif
1146
1147 -SCHED_FEAT(RT_RUNTIME_SHARE, true)
1148 +SCHED_FEAT(RT_RUNTIME_SHARE, false)
1149 SCHED_FEAT(LB_MIN, false)
1150 SCHED_FEAT(ATTACH_AGE_LOAD, true)
1151
1152 diff --git a/kernel/signal.c b/kernel/signal.c
1153 index 3f61367fd1685..1f4293a107b49 100644
1154 --- a/kernel/signal.c
1155 +++ b/kernel/signal.c
1156 @@ -1916,12 +1916,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
1157 bool autoreap = false;
1158 u64 utime, stime;
1159
1160 - BUG_ON(sig == -1);
1161 + WARN_ON_ONCE(sig == -1);
1162
1163 - /* do_notify_parent_cldstop should have been called instead. */
1164 - BUG_ON(task_is_stopped_or_traced(tsk));
1165 + /* do_notify_parent_cldstop should have been called instead. */
1166 + WARN_ON_ONCE(task_is_stopped_or_traced(tsk));
1167
1168 - BUG_ON(!tsk->ptrace &&
1169 + WARN_ON_ONCE(!tsk->ptrace &&
1170 (tsk->group_leader != tsk || !thread_group_empty(tsk)));
1171
1172 /* Wake up all pidfd waiters */
1173 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
1174 index 0457d36540e38..6f971807bf792 100644
1175 --- a/kernel/sysctl.c
1176 +++ b/kernel/sysctl.c
1177 @@ -1443,6 +1443,17 @@ static struct ctl_table vm_table[] = {
1178 .extra1 = SYSCTL_ZERO,
1179 .extra2 = &one_hundred,
1180 },
1181 +#ifdef CONFIG_NUMA
1182 + {
1183 + .procname = "numa_stat",
1184 + .data = &sysctl_vm_numa_stat,
1185 + .maxlen = sizeof(int),
1186 + .mode = 0644,
1187 + .proc_handler = sysctl_vm_numa_stat_handler,
1188 + .extra1 = SYSCTL_ZERO,
1189 + .extra2 = SYSCTL_ONE,
1190 + },
1191 +#endif
1192 #ifdef CONFIG_HUGETLB_PAGE
1193 {
1194 .procname = "nr_hugepages",
1195 @@ -1459,15 +1470,6 @@ static struct ctl_table vm_table[] = {
1196 .mode = 0644,
1197 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1198 },
1199 - {
1200 - .procname = "numa_stat",
1201 - .data = &sysctl_vm_numa_stat,
1202 - .maxlen = sizeof(int),
1203 - .mode = 0644,
1204 - .proc_handler = sysctl_vm_numa_stat_handler,
1205 - .extra1 = SYSCTL_ZERO,
1206 - .extra2 = SYSCTL_ONE,
1207 - },
1208 #endif
1209 {
1210 .procname = "hugetlb_shm_group",
1211 diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
1212 index 83e1810556853..b8f1f0eadd2ef 100644
1213 --- a/kernel/trace/trace_events_hist.c
1214 +++ b/kernel/trace/trace_events_hist.c
1215 @@ -4832,6 +4832,8 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
1216
1217 s = kstrdup(field_str, GFP_KERNEL);
1218 if (!s) {
1219 + kfree(hist_data->attrs->var_defs.name[n_vars]);
1220 + hist_data->attrs->var_defs.name[n_vars] = NULL;
1221 ret = -ENOMEM;
1222 goto free;
1223 }
1224 diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
1225 index 480e4111b24c1..19726d81025d5 100644
1226 --- a/net/bridge/br_netfilter_hooks.c
1227 +++ b/net/bridge/br_netfilter_hooks.c
1228 @@ -1012,9 +1012,24 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net,
1229 return okfn(net, sk, skb);
1230
1231 ops = nf_hook_entries_get_hook_ops(e);
1232 - for (i = 0; i < e->num_hook_entries &&
1233 - ops[i]->priority <= NF_BR_PRI_BRNF; i++)
1234 - ;
1235 + for (i = 0; i < e->num_hook_entries; i++) {
1236 + /* These hooks have already been called */
1237 + if (ops[i]->priority < NF_BR_PRI_BRNF)
1238 + continue;
1239 +
1240 + /* These hooks have not been called yet, run them. */
1241 + if (ops[i]->priority > NF_BR_PRI_BRNF)
1242 + break;
1243 +
1244 + /* take a closer look at NF_BR_PRI_BRNF. */
1245 + if (ops[i]->hook == br_nf_pre_routing) {
1246 + /* This hook diverted the skb to this function,
1247 + * hooks after this have not been run yet.
1248 + */
1249 + i++;
1250 + break;
1251 + }
1252 + }
1253
1254 nf_hook_state_init(&state, hook, NFPROTO_BRIDGE, indev, outdev,
1255 sk, net, okfn);
1256 diff --git a/net/core/filter.c b/net/core/filter.c
1257 index eba96343c7af9..75f53b5e63893 100644
1258 --- a/net/core/filter.c
1259 +++ b/net/core/filter.c
1260 @@ -4955,7 +4955,6 @@ static int bpf_push_seg6_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len
1261 if (err)
1262 return err;
1263
1264 - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
1265 skb_set_transport_header(skb, sizeof(struct ipv6hdr));
1266
1267 return seg6_lookup_nexthop(skb, NULL, 0);
1268 diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
1269 index a7a6b1adb698b..9ab73fcc7411c 100644
1270 --- a/net/ipv4/af_inet.c
1271 +++ b/net/ipv4/af_inet.c
1272 @@ -1215,7 +1215,7 @@ static int inet_sk_reselect_saddr(struct sock *sk)
1273 if (new_saddr == old_saddr)
1274 return 0;
1275
1276 - if (sock_net(sk)->ipv4.sysctl_ip_dynaddr > 1) {
1277 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) > 1) {
1278 pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n",
1279 __func__, &old_saddr, &new_saddr);
1280 }
1281 @@ -1270,7 +1270,7 @@ int inet_sk_rebuild_header(struct sock *sk)
1282 * Other protocols have to map its equivalent state to TCP_SYN_SENT.
1283 * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme
1284 */
1285 - if (!sock_net(sk)->ipv4.sysctl_ip_dynaddr ||
1286 + if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) ||
1287 sk->sk_state != TCP_SYN_SENT ||
1288 (sk->sk_userlocks & SOCK_BINDADDR_LOCK) ||
1289 (err = inet_sk_reselect_saddr(sk)) != 0)
1290 diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
1291 index c1ac802d6894a..42eaad5e515f8 100644
1292 --- a/net/ipv4/cipso_ipv4.c
1293 +++ b/net/ipv4/cipso_ipv4.c
1294 @@ -240,7 +240,7 @@ static int cipso_v4_cache_check(const unsigned char *key,
1295 struct cipso_v4_map_cache_entry *prev_entry = NULL;
1296 u32 hash;
1297
1298 - if (!cipso_v4_cache_enabled)
1299 + if (!READ_ONCE(cipso_v4_cache_enabled))
1300 return -ENOENT;
1301
1302 hash = cipso_v4_map_cache_hash(key, key_len);
1303 @@ -297,13 +297,14 @@ static int cipso_v4_cache_check(const unsigned char *key,
1304 int cipso_v4_cache_add(const unsigned char *cipso_ptr,
1305 const struct netlbl_lsm_secattr *secattr)
1306 {
1307 + int bkt_size = READ_ONCE(cipso_v4_cache_bucketsize);
1308 int ret_val = -EPERM;
1309 u32 bkt;
1310 struct cipso_v4_map_cache_entry *entry = NULL;
1311 struct cipso_v4_map_cache_entry *old_entry = NULL;
1312 u32 cipso_ptr_len;
1313
1314 - if (!cipso_v4_cache_enabled || cipso_v4_cache_bucketsize <= 0)
1315 + if (!READ_ONCE(cipso_v4_cache_enabled) || bkt_size <= 0)
1316 return 0;
1317
1318 cipso_ptr_len = cipso_ptr[1];
1319 @@ -323,7 +324,7 @@ int cipso_v4_cache_add(const unsigned char *cipso_ptr,
1320
1321 bkt = entry->hash & (CIPSO_V4_CACHE_BUCKETS - 1);
1322 spin_lock_bh(&cipso_v4_cache[bkt].lock);
1323 - if (cipso_v4_cache[bkt].size < cipso_v4_cache_bucketsize) {
1324 + if (cipso_v4_cache[bkt].size < bkt_size) {
1325 list_add(&entry->list, &cipso_v4_cache[bkt].list);
1326 cipso_v4_cache[bkt].size += 1;
1327 } else {
1328 @@ -1200,7 +1201,8 @@ static int cipso_v4_gentag_rbm(const struct cipso_v4_doi *doi_def,
1329 /* This will send packets using the "optimized" format when
1330 * possible as specified in section 3.4.2.6 of the
1331 * CIPSO draft. */
1332 - if (cipso_v4_rbm_optfmt && ret_val > 0 && ret_val <= 10)
1333 + if (READ_ONCE(cipso_v4_rbm_optfmt) && ret_val > 0 &&
1334 + ret_val <= 10)
1335 tag_len = 14;
1336 else
1337 tag_len = 4 + ret_val;
1338 @@ -1603,7 +1605,7 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option)
1339 * all the CIPSO validations here but it doesn't
1340 * really specify _exactly_ what we need to validate
1341 * ... so, just make it a sysctl tunable. */
1342 - if (cipso_v4_rbm_strictvalid) {
1343 + if (READ_ONCE(cipso_v4_rbm_strictvalid)) {
1344 if (cipso_v4_map_lvl_valid(doi_def,
1345 tag[3]) < 0) {
1346 err_offset = opt_iter + 3;
1347 diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
1348 index f99ad4a98907d..16fe034615635 100644
1349 --- a/net/ipv4/fib_semantics.c
1350 +++ b/net/ipv4/fib_semantics.c
1351 @@ -1217,7 +1217,7 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh,
1352
1353 nh->fib_nh_dev = in_dev->dev;
1354 dev_hold(nh->fib_nh_dev);
1355 - nh->fib_nh_scope = RT_SCOPE_HOST;
1356 + nh->fib_nh_scope = RT_SCOPE_LINK;
1357 if (!netif_carrier_ok(nh->fib_nh_dev))
1358 nh->fib_nh_flags |= RTNH_F_LINKDOWN;
1359 err = 0;
1360 diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
1361 index 51673d00bbeac..a1f830da4ad30 100644
1362 --- a/net/ipv4/fib_trie.c
1363 +++ b/net/ipv4/fib_trie.c
1364 @@ -500,7 +500,7 @@ static void tnode_free(struct key_vector *tn)
1365 tn = container_of(head, struct tnode, rcu)->kv;
1366 }
1367
1368 - if (tnode_free_size >= sysctl_fib_sync_mem) {
1369 + if (tnode_free_size >= READ_ONCE(sysctl_fib_sync_mem)) {
1370 tnode_free_size = 0;
1371 synchronize_rcu();
1372 }
1373 diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
1374 index f86f948a4b4c1..9bc01411be4cc 100644
1375 --- a/net/ipv4/icmp.c
1376 +++ b/net/ipv4/icmp.c
1377 @@ -261,11 +261,12 @@ bool icmp_global_allow(void)
1378 spin_lock(&icmp_global.lock);
1379 delta = min_t(u32, now - icmp_global.stamp, HZ);
1380 if (delta >= HZ / 50) {
1381 - incr = sysctl_icmp_msgs_per_sec * delta / HZ ;
1382 + incr = READ_ONCE(sysctl_icmp_msgs_per_sec) * delta / HZ;
1383 if (incr)
1384 WRITE_ONCE(icmp_global.stamp, now);
1385 }
1386 - credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst);
1387 + credit = min_t(u32, icmp_global.credit + incr,
1388 + READ_ONCE(sysctl_icmp_msgs_burst));
1389 if (credit) {
1390 /* We want to use a credit of one in average, but need to randomize
1391 * it for security reasons.
1392 @@ -289,7 +290,7 @@ static bool icmpv4_mask_allow(struct net *net, int type, int code)
1393 return true;
1394
1395 /* Limit if icmp type is enabled in ratemask. */
1396 - if (!((1 << type) & net->ipv4.sysctl_icmp_ratemask))
1397 + if (!((1 << type) & READ_ONCE(net->ipv4.sysctl_icmp_ratemask)))
1398 return true;
1399
1400 return false;
1401 @@ -327,7 +328,8 @@ static bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
1402
1403 vif = l3mdev_master_ifindex(dst->dev);
1404 peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif, 1);
1405 - rc = inet_peer_xrlim_allow(peer, net->ipv4.sysctl_icmp_ratelimit);
1406 + rc = inet_peer_xrlim_allow(peer,
1407 + READ_ONCE(net->ipv4.sysctl_icmp_ratelimit));
1408 if (peer)
1409 inet_putpeer(peer);
1410 out:
1411 diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
1412 index ff327a62c9ce9..a18668552d33d 100644
1413 --- a/net/ipv4/inetpeer.c
1414 +++ b/net/ipv4/inetpeer.c
1415 @@ -148,16 +148,20 @@ static void inet_peer_gc(struct inet_peer_base *base,
1416 struct inet_peer *gc_stack[],
1417 unsigned int gc_cnt)
1418 {
1419 + int peer_threshold, peer_maxttl, peer_minttl;
1420 struct inet_peer *p;
1421 __u32 delta, ttl;
1422 int i;
1423
1424 - if (base->total >= inet_peer_threshold)
1425 + peer_threshold = READ_ONCE(inet_peer_threshold);
1426 + peer_maxttl = READ_ONCE(inet_peer_maxttl);
1427 + peer_minttl = READ_ONCE(inet_peer_minttl);
1428 +
1429 + if (base->total >= peer_threshold)
1430 ttl = 0; /* be aggressive */
1431 else
1432 - ttl = inet_peer_maxttl
1433 - - (inet_peer_maxttl - inet_peer_minttl) / HZ *
1434 - base->total / inet_peer_threshold * HZ;
1435 + ttl = peer_maxttl - (peer_maxttl - peer_minttl) / HZ *
1436 + base->total / peer_threshold * HZ;
1437 for (i = 0; i < gc_cnt; i++) {
1438 p = gc_stack[i];
1439
1440 diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
1441 index 6954db1fd26e7..b626e0b62a549 100644
1442 --- a/net/ipv6/seg6_iptunnel.c
1443 +++ b/net/ipv6/seg6_iptunnel.c
1444 @@ -171,6 +171,8 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto)
1445 }
1446 #endif
1447
1448 + hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
1449 +
1450 skb_postpush_rcsum(skb, hdr, tot_len);
1451
1452 return 0;
1453 @@ -223,6 +225,8 @@ int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh)
1454 }
1455 #endif
1456
1457 + hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
1458 +
1459 skb_postpush_rcsum(skb, hdr, sizeof(struct ipv6hdr) + hdrlen);
1460
1461 return 0;
1462 @@ -284,7 +288,6 @@ static int seg6_do_srh(struct sk_buff *skb)
1463 break;
1464 }
1465
1466 - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
1467 skb_set_transport_header(skb, sizeof(struct ipv6hdr));
1468
1469 return 0;
1470 diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
1471 index 802eebf8ac4b0..ef5b5cee22017 100644
1472 --- a/net/ipv6/seg6_local.c
1473 +++ b/net/ipv6/seg6_local.c
1474 @@ -421,7 +421,6 @@ static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt)
1475 if (err)
1476 goto drop;
1477
1478 - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
1479 skb_set_transport_header(skb, sizeof(struct ipv6hdr));
1480
1481 seg6_lookup_nexthop(skb, NULL, 0);
1482 @@ -453,7 +452,6 @@ static int input_action_end_b6_encap(struct sk_buff *skb,
1483 if (err)
1484 goto drop;
1485
1486 - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
1487 skb_set_transport_header(skb, sizeof(struct ipv6hdr));
1488
1489 seg6_lookup_nexthop(skb, NULL, 0);
1490 diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
1491 index 72920d82928c4..ace44ff966358 100644
1492 --- a/net/mac80211/wme.c
1493 +++ b/net/mac80211/wme.c
1494 @@ -145,8 +145,8 @@ u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
1495 bool qos;
1496
1497 /* all mesh/ocb stations are required to support WME */
1498 - if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
1499 - sdata->vif.type == NL80211_IFTYPE_OCB)
1500 + if (sta && (sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
1501 + sdata->vif.type == NL80211_IFTYPE_OCB))
1502 qos = true;
1503 else if (sta)
1504 qos = sta->sta.wme;
1505 diff --git a/net/tipc/socket.c b/net/tipc/socket.c
1506 index d543c4556df20..58c4d61d603f6 100644
1507 --- a/net/tipc/socket.c
1508 +++ b/net/tipc/socket.c
1509 @@ -455,6 +455,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
1510 sock_init_data(sock, sk);
1511 tipc_set_sk_state(sk, TIPC_OPEN);
1512 if (tipc_sk_insert(tsk)) {
1513 + sk_free(sk);
1514 pr_warn("Socket create failed; port number exhausted\n");
1515 return -EINVAL;
1516 }
1517 diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
1518 index 25dac691491b1..ee6bd945f3d6a 100644
1519 --- a/security/integrity/evm/evm_crypto.c
1520 +++ b/security/integrity/evm/evm_crypto.c
1521 @@ -75,7 +75,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)
1522 {
1523 long rc;
1524 const char *algo;
1525 - struct crypto_shash **tfm, *tmp_tfm = NULL;
1526 + struct crypto_shash **tfm, *tmp_tfm;
1527 struct shash_desc *desc;
1528
1529 if (type == EVM_XATTR_HMAC) {
1530 @@ -120,16 +120,13 @@ unlock:
1531 alloc:
1532 desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm),
1533 GFP_KERNEL);
1534 - if (!desc) {
1535 - crypto_free_shash(tmp_tfm);
1536 + if (!desc)
1537 return ERR_PTR(-ENOMEM);
1538 - }
1539
1540 desc->tfm = *tfm;
1541
1542 rc = crypto_shash_init(desc);
1543 if (rc) {
1544 - crypto_free_shash(tmp_tfm);
1545 kfree(desc);
1546 return ERR_PTR(rc);
1547 }
1548 diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
1549 index 23b04c6521b25..9368688449b01 100644
1550 --- a/security/integrity/ima/ima_appraise.c
1551 +++ b/security/integrity/ima/ima_appraise.c
1552 @@ -352,7 +352,8 @@ int ima_appraise_measurement(enum ima_hooks func,
1553 goto out;
1554 }
1555
1556 - status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint);
1557 + status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value,
1558 + rc < 0 ? 0 : rc, iint);
1559 switch (status) {
1560 case INTEGRITY_PASS:
1561 case INTEGRITY_PASS_IMMUTABLE:
1562 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
1563 index b81b0a1bada56..d4bfb11493270 100644
1564 --- a/sound/pci/hda/patch_conexant.c
1565 +++ b/sound/pci/hda/patch_conexant.c
1566 @@ -905,6 +905,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
1567 SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK),
1568 SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
1569 SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
1570 + SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PRESENCE),
1571 SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO),
1572 SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO),
1573 SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK),
1574 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1575 index 804fc0d331b4f..145e494f776a3 100644
1576 --- a/sound/pci/hda/patch_realtek.c
1577 +++ b/sound/pci/hda/patch_realtek.c
1578 @@ -6427,6 +6427,7 @@ enum {
1579 ALC298_FIXUP_LENOVO_SPK_VOLUME,
1580 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
1581 ALC269_FIXUP_ATIV_BOOK_8,
1582 + ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
1583 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
1584 ALC256_FIXUP_ASUS_HEADSET_MODE,
1585 ALC256_FIXUP_ASUS_MIC,
1586 @@ -7305,6 +7306,16 @@ static const struct hda_fixup alc269_fixups[] = {
1587 .chained = true,
1588 .chain_id = ALC269_FIXUP_NO_SHUTUP
1589 },
1590 + [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
1591 + .type = HDA_FIXUP_PINS,
1592 + .v.pins = (const struct hda_pintbl[]) {
1593 + { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
1594 + { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
1595 + { }
1596 + },
1597 + .chained = true,
1598 + .chain_id = ALC269_FIXUP_HEADSET_MODE
1599 + },
1600 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
1601 .type = HDA_FIXUP_PINS,
1602 .v.pins = (const struct hda_pintbl[]) {
1603 @@ -8056,6 +8067,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1604 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
1605 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
1606 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
1607 + SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
1608 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
1609 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
1610 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
1611 @@ -8162,6 +8174,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1612 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
1613 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
1614 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
1615 + SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
1616 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1617 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1618 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
1619 @@ -8410,6 +8423,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1620 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
1621 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
1622 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
1623 + SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
1624 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
1625 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
1626 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
1627 @@ -10260,6 +10274,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
1628 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
1629 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
1630 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
1631 + SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
1632 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
1633 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
1634 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
1635 diff --git a/sound/soc/codecs/cs47l15.c b/sound/soc/codecs/cs47l15.c
1636 index ece1276f38eb9..1f7148794a5a9 100644
1637 --- a/sound/soc/codecs/cs47l15.c
1638 +++ b/sound/soc/codecs/cs47l15.c
1639 @@ -122,6 +122,9 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol,
1640 snd_soc_kcontrol_component(kcontrol);
1641 struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component);
1642
1643 + if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode)
1644 + return 0;
1645 +
1646 switch (ucontrol->value.integer.value[0]) {
1647 case 0:
1648 /* Set IN1 to normal mode */
1649 @@ -150,7 +153,7 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol,
1650 break;
1651 }
1652
1653 - return 0;
1654 + return 1;
1655 }
1656
1657 static const struct snd_kcontrol_new cs47l15_snd_controls[] = {
1658 diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c
1659 index 52639811cc525..4a56082a4c43a 100644
1660 --- a/sound/soc/codecs/madera.c
1661 +++ b/sound/soc/codecs/madera.c
1662 @@ -568,7 +568,13 @@ int madera_out1_demux_put(struct snd_kcontrol *kcontrol,
1663 end:
1664 snd_soc_dapm_mutex_unlock(dapm);
1665
1666 - return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
1667 + ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
1668 + if (ret < 0) {
1669 + dev_err(madera->dev, "Failed to update demux power state: %d\n", ret);
1670 + return ret;
1671 + }
1672 +
1673 + return change;
1674 }
1675 EXPORT_SYMBOL_GPL(madera_out1_demux_put);
1676
1677 @@ -847,7 +853,7 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol,
1678 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1679 const int adsp_num = e->shift_l;
1680 const unsigned int item = ucontrol->value.enumerated.item[0];
1681 - int ret;
1682 + int ret = 0;
1683
1684 if (item >= e->items)
1685 return -EINVAL;
1686 @@ -864,10 +870,10 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol,
1687 "Cannot change '%s' while in use by active audio paths\n",
1688 kcontrol->id.name);
1689 ret = -EBUSY;
1690 - } else {
1691 + } else if (priv->adsp_rate_cache[adsp_num] != e->values[item]) {
1692 /* Volatile register so defer until the codec is powered up */
1693 priv->adsp_rate_cache[adsp_num] = e->values[item];
1694 - ret = 0;
1695 + ret = 1;
1696 }
1697
1698 mutex_unlock(&priv->rate_lock);
1699 diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
1700 index 8a1e485982d81..76d3c0681f37e 100644
1701 --- a/sound/soc/codecs/sgtl5000.c
1702 +++ b/sound/soc/codecs/sgtl5000.c
1703 @@ -1788,6 +1788,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *client)
1704 {
1705 struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
1706
1707 + regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWER_DEFAULT);
1708 + regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWER_DEFAULT);
1709 +
1710 clk_disable_unprepare(sgtl5000->mclk);
1711 regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies);
1712 regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies);
1713 @@ -1795,6 +1798,11 @@ static int sgtl5000_i2c_remove(struct i2c_client *client)
1714 return 0;
1715 }
1716
1717 +static void sgtl5000_i2c_shutdown(struct i2c_client *client)
1718 +{
1719 + sgtl5000_i2c_remove(client);
1720 +}
1721 +
1722 static const struct i2c_device_id sgtl5000_id[] = {
1723 {"sgtl5000", 0},
1724 {},
1725 @@ -1815,6 +1823,7 @@ static struct i2c_driver sgtl5000_i2c_driver = {
1726 },
1727 .probe = sgtl5000_i2c_probe,
1728 .remove = sgtl5000_i2c_remove,
1729 + .shutdown = sgtl5000_i2c_shutdown,
1730 .id_table = sgtl5000_id,
1731 };
1732
1733 diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
1734 index 56ec5863f2507..3a808c762299e 100644
1735 --- a/sound/soc/codecs/sgtl5000.h
1736 +++ b/sound/soc/codecs/sgtl5000.h
1737 @@ -80,6 +80,7 @@
1738 /*
1739 * SGTL5000_CHIP_DIG_POWER
1740 */
1741 +#define SGTL5000_DIG_POWER_DEFAULT 0x0000
1742 #define SGTL5000_ADC_EN 0x0040
1743 #define SGTL5000_DAC_EN 0x0020
1744 #define SGTL5000_DAP_POWERUP 0x0010
1745 diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
1746 index 9dc215b5c5045..06ec3f48c808a 100644
1747 --- a/sound/soc/codecs/wm5110.c
1748 +++ b/sound/soc/codecs/wm5110.c
1749 @@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
1750 unsigned int rnew = (!!ucontrol->value.integer.value[1]) << mc->rshift;
1751 unsigned int lold, rold;
1752 unsigned int lena, rena;
1753 + bool change = false;
1754 int ret;
1755
1756 snd_soc_dapm_mutex_lock(dapm);
1757 @@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
1758 goto err;
1759 }
1760
1761 - ret = regmap_update_bits(arizona->regmap, ARIZONA_DRE_ENABLE,
1762 - mask, lnew | rnew);
1763 + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE,
1764 + mask, lnew | rnew, &change);
1765 if (ret) {
1766 dev_err(arizona->dev, "Failed to set DRE: %d\n", ret);
1767 goto err;
1768 @@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
1769 if (!rnew && rold)
1770 wm5110_clear_pga_volume(arizona, mc->rshift);
1771
1772 + if (change)
1773 + ret = 1;
1774 +
1775 err:
1776 snd_soc_dapm_mutex_unlock(dapm);
1777
1778 diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
1779 index 7a37312c8e0c2..453b61b42dd9e 100644
1780 --- a/sound/soc/soc-ops.c
1781 +++ b/sound/soc/soc-ops.c
1782 @@ -530,7 +530,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
1783 return -EINVAL;
1784 if (mc->platform_max && tmp > mc->platform_max)
1785 return -EINVAL;
1786 - if (tmp > mc->max - mc->min + 1)
1787 + if (tmp > mc->max - mc->min)
1788 return -EINVAL;
1789
1790 if (invert)
1791 @@ -551,7 +551,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
1792 return -EINVAL;
1793 if (mc->platform_max && tmp > mc->platform_max)
1794 return -EINVAL;
1795 - if (tmp > mc->max - mc->min + 1)
1796 + if (tmp > mc->max - mc->min)
1797 return -EINVAL;
1798
1799 if (invert)