Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0376-4.9.277-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3678 - (show annotations) (download)
Mon Oct 24 14:07:55 2022 UTC (18 months, 1 week ago) by niro
File size: 69373 byte(s)
-linux-4.9.277
1 diff --git a/Makefile b/Makefile
2 index 0668843d7b3e6..560a7e2b5efc2 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 276
9 +SUBLEVEL = 277
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/arm/boot/dts/bcm63138.dtsi b/arch/arm/boot/dts/bcm63138.dtsi
14 index 547369c69e965..aedbea8886849 100644
15 --- a/arch/arm/boot/dts/bcm63138.dtsi
16 +++ b/arch/arm/boot/dts/bcm63138.dtsi
17 @@ -174,7 +174,7 @@
18 status = "disabled";
19 };
20
21 - nand: nand@2000 {
22 + nand_controller: nand-controller@2000 {
23 #address-cells = <1>;
24 #size-cells = <0>;
25 compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.0", "brcm,brcmnand";
26 diff --git a/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts b/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts
27 index 0bb8d17e4c2d0..e51c9b079432a 100644
28 --- a/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts
29 +++ b/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts
30 @@ -13,10 +13,10 @@
31 };
32 };
33
34 -&nand {
35 +&nand_controller {
36 status = "okay";
37
38 - nandcs@1 {
39 + nand@1 {
40 compatible = "brcm,nandcs";
41 reg = <1>;
42 nand-ecc-step-size = <512>;
43 diff --git a/arch/arm/boot/dts/bcm7445.dtsi b/arch/arm/boot/dts/bcm7445.dtsi
44 index 4791321969b3f..3f002f2047f18 100644
45 --- a/arch/arm/boot/dts/bcm7445.dtsi
46 +++ b/arch/arm/boot/dts/bcm7445.dtsi
47 @@ -149,7 +149,7 @@
48 reg-names = "aon-ctrl", "aon-sram";
49 };
50
51 - nand: nand@3e2800 {
52 + nand_controller: nand-controller@3e2800 {
53 status = "disabled";
54 #address-cells = <1>;
55 #size-cells = <0>;
56 diff --git a/arch/arm/boot/dts/bcm963138dvt.dts b/arch/arm/boot/dts/bcm963138dvt.dts
57 index 370aa2cfddf20..439cff69e948f 100644
58 --- a/arch/arm/boot/dts/bcm963138dvt.dts
59 +++ b/arch/arm/boot/dts/bcm963138dvt.dts
60 @@ -29,10 +29,10 @@
61 status = "okay";
62 };
63
64 -&nand {
65 +&nand_controller {
66 status = "okay";
67
68 - nandcs@0 {
69 + nand@0 {
70 compatible = "brcm,nandcs";
71 reg = <0>;
72 nand-ecc-strength = <4>;
73 diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
74 index fed72a5f3ffab..4dede1fbfadbc 100644
75 --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
76 +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
77 @@ -307,8 +307,8 @@
78 fsl,pins = <
79 MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1
80 MX6QDL_PAD_EIM_D25__UART3_RX_DATA 0x1b0b1
81 - MX6QDL_PAD_EIM_D30__UART3_RTS_B 0x1b0b1
82 - MX6QDL_PAD_EIM_D31__UART3_CTS_B 0x1b0b1
83 + MX6QDL_PAD_EIM_D31__UART3_RTS_B 0x1b0b1
84 + MX6QDL_PAD_EIM_D30__UART3_CTS_B 0x1b0b1
85 >;
86 };
87
88 @@ -395,6 +395,7 @@
89 &uart3 {
90 pinctrl-names = "default";
91 pinctrl-0 = <&pinctrl_uart3>;
92 + uart-has-rtscts;
93 status = "disabled";
94 };
95
96 diff --git a/arch/arm/boot/dts/rk3036-kylin.dts b/arch/arm/boot/dts/rk3036-kylin.dts
97 index 1df1557a46c35..3080915cfa5f4 100644
98 --- a/arch/arm/boot/dts/rk3036-kylin.dts
99 +++ b/arch/arm/boot/dts/rk3036-kylin.dts
100 @@ -426,7 +426,7 @@
101 };
102 };
103
104 - sleep {
105 + suspend {
106 global_pwroff: global-pwroff {
107 rockchip,pins = <2 7 RK_FUNC_1 &pcfg_pull_none>;
108 };
109 diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
110 index 30f1384f619b3..7b727d738b69d 100644
111 --- a/arch/arm/boot/dts/rk3288.dtsi
112 +++ b/arch/arm/boot/dts/rk3288.dtsi
113 @@ -735,7 +735,7 @@
114 * *_HDMI HDMI
115 * *_MIPI_* MIPI
116 */
117 - pd_vio@RK3288_PD_VIO {
118 + power-domain@RK3288_PD_VIO {
119 reg = <RK3288_PD_VIO>;
120 clocks = <&cru ACLK_IEP>,
121 <&cru ACLK_ISP>,
122 @@ -768,7 +768,7 @@
123 * Note: The following 3 are HEVC(H.265) clocks,
124 * and on the ACLK_HEVC_NIU (NOC).
125 */
126 - pd_hevc@RK3288_PD_HEVC {
127 + power-domain@RK3288_PD_HEVC {
128 reg = <RK3288_PD_HEVC>;
129 clocks = <&cru ACLK_HEVC>,
130 <&cru SCLK_HEVC_CABAC>,
131 @@ -780,7 +780,7 @@
132 * (video endecoder & decoder) clocks that on the
133 * ACLK_VCODEC_NIU and HCLK_VCODEC_NIU (NOC).
134 */
135 - pd_video@RK3288_PD_VIDEO {
136 + power-domain@RK3288_PD_VIDEO {
137 reg = <RK3288_PD_VIDEO>;
138 clocks = <&cru ACLK_VCODEC>,
139 <&cru HCLK_VCODEC>;
140 @@ -790,7 +790,7 @@
141 * Note: ACLK_GPU is the GPU clock,
142 * and on the ACLK_GPU_NIU (NOC).
143 */
144 - pd_gpu@RK3288_PD_GPU {
145 + power-domain@RK3288_PD_GPU {
146 reg = <RK3288_PD_GPU>;
147 clocks = <&cru ACLK_GPU>;
148 };
149 @@ -1278,7 +1278,7 @@
150 drive-strength = <12>;
151 };
152
153 - sleep {
154 + suspend {
155 global_pwroff: global-pwroff {
156 rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>;
157 };
158 diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
159 index 336ee4fb587dd..64dc50afc3857 100644
160 --- a/arch/arm/boot/dts/stm32f429.dtsi
161 +++ b/arch/arm/boot/dts/stm32f429.dtsi
162 @@ -334,7 +334,7 @@
163 };
164 };
165
166 - rcc: rcc@40023810 {
167 + rcc: rcc@40023800 {
168 #reset-cells = <1>;
169 #clock-cells = <2>;
170 compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
171 diff --git a/arch/arm/mach-imx/suspend-imx53.S b/arch/arm/mach-imx/suspend-imx53.S
172 index 5ed078ad110aa..f12d24104075b 100644
173 --- a/arch/arm/mach-imx/suspend-imx53.S
174 +++ b/arch/arm/mach-imx/suspend-imx53.S
175 @@ -33,11 +33,11 @@
176 * ^
177 * ^
178 * imx53_suspend code
179 - * PM_INFO structure(imx53_suspend_info)
180 + * PM_INFO structure(imx5_cpu_suspend_info)
181 * ======================== low address =======================
182 */
183
184 -/* Offsets of members of struct imx53_suspend_info */
185 +/* Offsets of members of struct imx5_cpu_suspend_info */
186 #define SUSPEND_INFO_MX53_M4IF_V_OFFSET 0x0
187 #define SUSPEND_INFO_MX53_IOMUXC_V_OFFSET 0x4
188 #define SUSPEND_INFO_MX53_IO_COUNT_OFFSET 0x8
189 diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi
190 index 7d3a2acc6a553..2aa01eaa0cd1f 100644
191 --- a/arch/arm64/boot/dts/arm/juno-base.dtsi
192 +++ b/arch/arm64/boot/dts/arm/juno-base.dtsi
193 @@ -414,13 +414,13 @@
194 clocks {
195 compatible = "arm,scpi-clocks";
196
197 - scpi_dvfs: scpi-dvfs {
198 + scpi_dvfs: clocks-0 {
199 compatible = "arm,scpi-dvfs-clocks";
200 #clock-cells = <1>;
201 clock-indices = <0>, <1>, <2>;
202 clock-output-names = "atlclk", "aplclk","gpuclk";
203 };
204 - scpi_clk: scpi-clk {
205 + scpi_clk: clocks-1 {
206 compatible = "arm,scpi-variable-clocks";
207 #clock-cells = <1>;
208 clock-indices = <3>;
209 @@ -428,7 +428,7 @@
210 };
211 };
212
213 - scpi_devpd: scpi-power-domains {
214 + scpi_devpd: power-controller {
215 compatible = "arm,scpi-power-domains";
216 num-domains = <2>;
217 #power-domain-cells = <1>;
218 diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
219 index ff982d8b62f6e..a03e86969f78a 100644
220 --- a/arch/mips/include/asm/pgalloc.h
221 +++ b/arch/mips/include/asm/pgalloc.h
222 @@ -107,15 +107,11 @@ do { \
223
224 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
225 {
226 - pmd_t *pmd = NULL;
227 - struct page *pg;
228 + pmd_t *pmd;
229
230 - pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
231 - if (pg) {
232 - pgtable_pmd_page_ctor(pg);
233 - pmd = (pmd_t *)page_address(pg);
234 + pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
235 + if (pmd)
236 pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
237 - }
238 return pmd;
239 }
240
241 diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c
242 index b1b2273d1f6d3..308744830f55d 100644
243 --- a/arch/powerpc/kvm/book3s_rtas.c
244 +++ b/arch/powerpc/kvm/book3s_rtas.c
245 @@ -230,6 +230,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu)
246 * value so we can restore it on the way out.
247 */
248 orig_rets = args.rets;
249 + if (be32_to_cpu(args.nargs) >= ARRAY_SIZE(args.args)) {
250 + /*
251 + * Don't overflow our args array: ensure there is room for
252 + * at least rets[0] (even if the call specifies 0 nret).
253 + *
254 + * Each handler must then check for the correct nargs and nret
255 + * values, but they may always return failure in rets[0].
256 + */
257 + rc = -EINVAL;
258 + goto fail;
259 + }
260 args.rets = &args.args[be32_to_cpu(args.nargs)];
261
262 mutex_lock(&vcpu->kvm->arch.rtas_token_lock);
263 @@ -257,9 +268,17 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu)
264 fail:
265 /*
266 * We only get here if the guest has called RTAS with a bogus
267 - * args pointer. That means we can't get to the args, and so we
268 - * can't fail the RTAS call. So fail right out to userspace,
269 - * which should kill the guest.
270 + * args pointer or nargs/nret values that would overflow the
271 + * array. That means we can't get to the args, and so we can't
272 + * fail the RTAS call. So fail right out to userspace, which
273 + * should kill the guest.
274 + *
275 + * SLOF should actually pass the hcall return value from the
276 + * rtas handler call in r3, so enter_rtas could be modified to
277 + * return a failure indication in r3 and we could return such
278 + * errors to the guest rather than failing to host userspace.
279 + * However old guests that don't test for failure could then
280 + * continue silently after errors, so for now we won't do this.
281 */
282 return rc;
283 }
284 diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
285 index 836c56290499b..6dd874d5ba7bf 100644
286 --- a/arch/s390/include/asm/ftrace.h
287 +++ b/arch/s390/include/asm/ftrace.h
288 @@ -19,6 +19,7 @@ void ftrace_caller(void);
289
290 extern char ftrace_graph_caller_end;
291 extern unsigned long ftrace_plt;
292 +extern void *ftrace_func;
293
294 struct dyn_arch_ftrace { };
295
296 diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
297 index 60a8a4e207edb..2ed98bd074158 100644
298 --- a/arch/s390/kernel/ftrace.c
299 +++ b/arch/s390/kernel/ftrace.c
300 @@ -55,6 +55,7 @@
301 * > brasl %r0,ftrace_caller # offset 0
302 */
303
304 +void *ftrace_func __read_mostly = ftrace_stub;
305 unsigned long ftrace_plt;
306
307 static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn)
308 @@ -164,6 +165,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
309
310 int ftrace_update_ftrace_func(ftrace_func_t func)
311 {
312 + ftrace_func = func;
313 return 0;
314 }
315
316 diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
317 index e9df35249f9f0..26f4e758c4124 100644
318 --- a/arch/s390/kernel/mcount.S
319 +++ b/arch/s390/kernel/mcount.S
320 @@ -59,13 +59,13 @@ ENTRY(ftrace_caller)
321 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
322 aghik %r2,%r0,-MCOUNT_INSN_SIZE
323 lgrl %r4,function_trace_op
324 - lgrl %r1,ftrace_trace_function
325 + lgrl %r1,ftrace_func
326 #else
327 lgr %r2,%r0
328 aghi %r2,-MCOUNT_INSN_SIZE
329 larl %r4,function_trace_op
330 lg %r4,0(%r4)
331 - larl %r1,ftrace_trace_function
332 + larl %r1,ftrace_func
333 lg %r1,0(%r1)
334 #endif
335 lgr %r3,%r14
336 diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
337 index 9b15a1dc66287..ed58ebab96cd8 100644
338 --- a/arch/s390/net/bpf_jit_comp.c
339 +++ b/arch/s390/net/bpf_jit_comp.c
340 @@ -116,7 +116,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1)
341 {
342 u32 r1 = reg2hex[b1];
343
344 - if (!jit->seen_reg[r1] && r1 >= 6 && r1 <= 15)
345 + if (r1 >= 6 && r1 <= 15 && !jit->seen_reg[r1])
346 jit->seen_reg[r1] = 1;
347 }
348
349 diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
350 index 73ea64a2bff08..02a361de3dcca 100644
351 --- a/drivers/iio/accel/bma180.c
352 +++ b/drivers/iio/accel/bma180.c
353 @@ -49,7 +49,7 @@ struct bma180_part_info {
354
355 u8 int_reset_reg, int_reset_mask;
356 u8 sleep_reg, sleep_mask;
357 - u8 bw_reg, bw_mask;
358 + u8 bw_reg, bw_mask, bw_offset;
359 u8 scale_reg, scale_mask;
360 u8 power_reg, power_mask, lowpower_val;
361 u8 int_enable_reg, int_enable_mask;
362 @@ -105,6 +105,7 @@ struct bma180_part_info {
363
364 #define BMA250_RANGE_MASK GENMASK(3, 0) /* Range of accel values */
365 #define BMA250_BW_MASK GENMASK(4, 0) /* Accel bandwidth */
366 +#define BMA250_BW_OFFSET 8
367 #define BMA250_SUSPEND_MASK BIT(7) /* chip will sleep */
368 #define BMA250_LOWPOWER_MASK BIT(6)
369 #define BMA250_DATA_INTEN_MASK BIT(4)
370 @@ -242,7 +243,8 @@ static int bma180_set_bw(struct bma180_data *data, int val)
371 for (i = 0; i < data->part_info->num_bw; ++i) {
372 if (data->part_info->bw_table[i] == val) {
373 ret = bma180_set_bits(data, data->part_info->bw_reg,
374 - data->part_info->bw_mask, i);
375 + data->part_info->bw_mask,
376 + i + data->part_info->bw_offset);
377 if (ret) {
378 dev_err(&data->client->dev,
379 "failed to set bandwidth\n");
380 @@ -625,32 +627,53 @@ static const struct iio_chan_spec bma250_channels[] = {
381
382 static const struct bma180_part_info bma180_part_info[] = {
383 [BMA180] = {
384 - bma180_channels, ARRAY_SIZE(bma180_channels),
385 - bma180_scale_table, ARRAY_SIZE(bma180_scale_table),
386 - bma180_bw_table, ARRAY_SIZE(bma180_bw_table),
387 - BMA180_CTRL_REG0, BMA180_RESET_INT,
388 - BMA180_CTRL_REG0, BMA180_SLEEP,
389 - BMA180_BW_TCS, BMA180_BW,
390 - BMA180_OFFSET_LSB1, BMA180_RANGE,
391 - BMA180_TCO_Z, BMA180_MODE_CONFIG, BMA180_LOW_POWER,
392 - BMA180_CTRL_REG3, BMA180_NEW_DATA_INT,
393 - BMA180_RESET,
394 - bma180_chip_config,
395 - bma180_chip_disable,
396 + .channels = bma180_channels,
397 + .num_channels = ARRAY_SIZE(bma180_channels),
398 + .scale_table = bma180_scale_table,
399 + .num_scales = ARRAY_SIZE(bma180_scale_table),
400 + .bw_table = bma180_bw_table,
401 + .num_bw = ARRAY_SIZE(bma180_bw_table),
402 + .int_reset_reg = BMA180_CTRL_REG0,
403 + .int_reset_mask = BMA180_RESET_INT,
404 + .sleep_reg = BMA180_CTRL_REG0,
405 + .sleep_mask = BMA180_SLEEP,
406 + .bw_reg = BMA180_BW_TCS,
407 + .bw_mask = BMA180_BW,
408 + .scale_reg = BMA180_OFFSET_LSB1,
409 + .scale_mask = BMA180_RANGE,
410 + .power_reg = BMA180_TCO_Z,
411 + .power_mask = BMA180_MODE_CONFIG,
412 + .lowpower_val = BMA180_LOW_POWER,
413 + .int_enable_reg = BMA180_CTRL_REG3,
414 + .int_enable_mask = BMA180_NEW_DATA_INT,
415 + .softreset_reg = BMA180_RESET,
416 + .chip_config = bma180_chip_config,
417 + .chip_disable = bma180_chip_disable,
418 },
419 [BMA250] = {
420 - bma250_channels, ARRAY_SIZE(bma250_channels),
421 - bma250_scale_table, ARRAY_SIZE(bma250_scale_table),
422 - bma250_bw_table, ARRAY_SIZE(bma250_bw_table),
423 - BMA250_INT_RESET_REG, BMA250_INT_RESET_MASK,
424 - BMA250_POWER_REG, BMA250_SUSPEND_MASK,
425 - BMA250_BW_REG, BMA250_BW_MASK,
426 - BMA250_RANGE_REG, BMA250_RANGE_MASK,
427 - BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1,
428 - BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK,
429 - BMA250_RESET_REG,
430 - bma250_chip_config,
431 - bma250_chip_disable,
432 + .channels = bma250_channels,
433 + .num_channels = ARRAY_SIZE(bma250_channels),
434 + .scale_table = bma250_scale_table,
435 + .num_scales = ARRAY_SIZE(bma250_scale_table),
436 + .bw_table = bma250_bw_table,
437 + .num_bw = ARRAY_SIZE(bma250_bw_table),
438 + .int_reset_reg = BMA250_INT_RESET_REG,
439 + .int_reset_mask = BMA250_INT_RESET_MASK,
440 + .sleep_reg = BMA250_POWER_REG,
441 + .sleep_mask = BMA250_SUSPEND_MASK,
442 + .bw_reg = BMA250_BW_REG,
443 + .bw_mask = BMA250_BW_MASK,
444 + .bw_offset = BMA250_BW_OFFSET,
445 + .scale_reg = BMA250_RANGE_REG,
446 + .scale_mask = BMA250_RANGE_MASK,
447 + .power_reg = BMA250_POWER_REG,
448 + .power_mask = BMA250_LOWPOWER_MASK,
449 + .lowpower_val = 1,
450 + .int_enable_reg = BMA250_INT_ENABLE_REG,
451 + .int_enable_mask = BMA250_DATA_INTEN_MASK,
452 + .softreset_reg = BMA250_RESET_REG,
453 + .chip_config = bma250_chip_config,
454 + .chip_disable = bma250_chip_disable,
455 },
456 };
457
458 diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c
459 index 4e924e2d1638f..fffa3630ba2d4 100644
460 --- a/drivers/media/pci/ngene/ngene-core.c
461 +++ b/drivers/media/pci/ngene/ngene-core.c
462 @@ -402,7 +402,7 @@ static int ngene_command_config_free_buf(struct ngene *dev, u8 *config)
463
464 com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER;
465 com.cmd.hdr.Length = 6;
466 - memcpy(&com.cmd.ConfigureBuffers.config, config, 6);
467 + memcpy(&com.cmd.ConfigureFreeBuffers.config, config, 6);
468 com.in_len = 6;
469 com.out_len = 0;
470
471 diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h
472 index fa30930d70477..da154c4065459 100644
473 --- a/drivers/media/pci/ngene/ngene.h
474 +++ b/drivers/media/pci/ngene/ngene.h
475 @@ -407,12 +407,14 @@ enum _BUFFER_CONFIGS {
476
477 struct FW_CONFIGURE_FREE_BUFFERS {
478 struct FW_HEADER hdr;
479 - u8 UVI1_BufferLength;
480 - u8 UVI2_BufferLength;
481 - u8 TVO_BufferLength;
482 - u8 AUD1_BufferLength;
483 - u8 AUD2_BufferLength;
484 - u8 TVA_BufferLength;
485 + struct {
486 + u8 UVI1_BufferLength;
487 + u8 UVI2_BufferLength;
488 + u8 TVO_BufferLength;
489 + u8 AUD1_BufferLength;
490 + u8 AUD2_BufferLength;
491 + u8 TVA_BufferLength;
492 + } __packed config;
493 } __attribute__ ((__packed__));
494
495 struct FW_CONFIGURE_UART {
496 diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
497 index 2921ae13db283..fae5517770834 100644
498 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
499 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
500 @@ -1094,7 +1094,7 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
501 switch (mode) {
502 case GENET_POWER_PASSIVE:
503 reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_PHY |
504 - EXT_PWR_DOWN_BIAS);
505 + EXT_PWR_DOWN_BIAS | EXT_ENERGY_DET_MASK);
506 /* fallthrough */
507 case GENET_POWER_CABLE_SENSE:
508 /* enable APD */
509 @@ -2698,15 +2698,21 @@ static void bcmgenet_set_hw_addr(struct bcmgenet_priv *priv,
510 /* Returns a reusable dma control register value */
511 static u32 bcmgenet_dma_disable(struct bcmgenet_priv *priv)
512 {
513 + unsigned int i;
514 u32 reg;
515 u32 dma_ctrl;
516
517 /* disable DMA */
518 dma_ctrl = 1 << (DESC_INDEX + DMA_RING_BUF_EN_SHIFT) | DMA_EN;
519 + for (i = 0; i < priv->hw_params->tx_queues; i++)
520 + dma_ctrl |= (1 << (i + DMA_RING_BUF_EN_SHIFT));
521 reg = bcmgenet_tdma_readl(priv, DMA_CTRL);
522 reg &= ~dma_ctrl;
523 bcmgenet_tdma_writel(priv, reg, DMA_CTRL);
524
525 + dma_ctrl = 1 << (DESC_INDEX + DMA_RING_BUF_EN_SHIFT) | DMA_EN;
526 + for (i = 0; i < priv->hw_params->rx_queues; i++)
527 + dma_ctrl |= (1 << (i + DMA_RING_BUF_EN_SHIFT));
528 reg = bcmgenet_rdma_readl(priv, DMA_CTRL);
529 reg &= ~dma_ctrl;
530 bcmgenet_rdma_writel(priv, reg, DMA_CTRL);
531 @@ -2815,12 +2821,6 @@ static int bcmgenet_open(struct net_device *dev)
532
533 bcmgenet_set_hw_addr(priv, dev->dev_addr);
534
535 - if (priv->internal_phy) {
536 - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
537 - reg |= EXT_ENERGY_DET_MASK;
538 - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
539 - }
540 -
541 /* Disable RX/TX DMA and flush TX queues */
542 dma_ctrl = bcmgenet_dma_disable(priv);
543
544 @@ -3510,7 +3510,6 @@ static int bcmgenet_resume(struct device *d)
545 struct bcmgenet_priv *priv = netdev_priv(dev);
546 unsigned long dma_ctrl;
547 int ret;
548 - u32 reg;
549
550 if (!netif_running(dev))
551 return 0;
552 @@ -3545,12 +3544,6 @@ static int bcmgenet_resume(struct device *d)
553
554 bcmgenet_set_hw_addr(priv, dev->dev_addr);
555
556 - if (priv->internal_phy) {
557 - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
558 - reg |= EXT_ENERGY_DET_MASK;
559 - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
560 - }
561 -
562 if (priv->wolopts)
563 bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC);
564
565 diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
566 index b97122926d3aa..df107ed672206 100644
567 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
568 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
569 @@ -167,12 +167,6 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
570 reg |= CMD_RX_EN;
571 bcmgenet_umac_writel(priv, reg, UMAC_CMD);
572
573 - if (priv->hw_params->flags & GENET_HAS_EXT) {
574 - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
575 - reg &= ~EXT_ENERGY_DET_MASK;
576 - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
577 - }
578 -
579 /* Enable the MPD interrupt */
580 cpu_mask_clear = UMAC_IRQ_MPD_R;
581
582 diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
583 index 46323019aa631..5d7967c035548 100644
584 --- a/drivers/net/ethernet/intel/e1000e/netdev.c
585 +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
586 @@ -7375,6 +7375,7 @@ err_flashmap:
587 err_ioremap:
588 free_netdev(netdev);
589 err_alloc_etherdev:
590 + pci_disable_pcie_error_reporting(pdev);
591 pci_release_mem_regions(pdev);
592 err_pci_reg:
593 err_dma:
594 diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
595 index e372a58234801..8e6ad74f29d17 100644
596 --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
597 +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
598 @@ -2083,6 +2083,7 @@ err_sw_init:
599 err_ioremap:
600 free_netdev(netdev);
601 err_alloc_netdev:
602 + pci_disable_pcie_error_reporting(pdev);
603 pci_release_mem_regions(pdev);
604 err_pci_reg:
605 err_dma:
606 diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
607 index 14372810fc27a..537776a3e5de1 100644
608 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
609 +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
610 @@ -2641,6 +2641,7 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
611 err_ioremap:
612 free_netdev(netdev);
613 err_alloc_etherdev:
614 + pci_disable_pcie_error_reporting(pdev);
615 pci_release_regions(pdev);
616 err_pci_reg:
617 err_dma:
618 diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
619 index 9b7ef62ed8fbd..6bede67744864 100644
620 --- a/drivers/net/ethernet/intel/igb/igb_main.c
621 +++ b/drivers/net/ethernet/intel/igb/igb_main.c
622 @@ -948,6 +948,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
623 **/
624 static int igb_request_msix(struct igb_adapter *adapter)
625 {
626 + unsigned int num_q_vectors = adapter->num_q_vectors;
627 struct net_device *netdev = adapter->netdev;
628 int i, err = 0, vector = 0, free_vector = 0;
629
630 @@ -956,7 +957,13 @@ static int igb_request_msix(struct igb_adapter *adapter)
631 if (err)
632 goto err_out;
633
634 - for (i = 0; i < adapter->num_q_vectors; i++) {
635 + if (num_q_vectors > MAX_Q_VECTORS) {
636 + num_q_vectors = MAX_Q_VECTORS;
637 + dev_warn(&adapter->pdev->dev,
638 + "The number of queue vectors (%d) is higher than max allowed (%d)\n",
639 + adapter->num_q_vectors, MAX_Q_VECTORS);
640 + }
641 + for (i = 0; i < num_q_vectors; i++) {
642 struct igb_q_vector *q_vector = adapter->q_vector[i];
643
644 vector++;
645 @@ -2767,6 +2774,7 @@ err_sw_init:
646 err_ioremap:
647 free_netdev(netdev);
648 err_alloc_etherdev:
649 + pci_disable_pcie_error_reporting(pdev);
650 pci_release_mem_regions(pdev);
651 err_pci_reg:
652 err_dma:
653 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
654 index 8e2aaf774693f..2266552532c45 100644
655 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
656 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
657 @@ -9840,6 +9840,7 @@ err_ioremap:
658 disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state);
659 free_netdev(netdev);
660 err_alloc_etherdev:
661 + pci_disable_pcie_error_reporting(pdev);
662 pci_release_mem_regions(pdev);
663 err_pci_reg:
664 err_dma:
665 diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
666 index 6fe61d9343cb8..7f782aec3c48e 100644
667 --- a/drivers/net/ethernet/moxa/moxart_ether.c
668 +++ b/drivers/net/ethernet/moxa/moxart_ether.c
669 @@ -548,10 +548,8 @@ static int moxart_mac_probe(struct platform_device *pdev)
670 SET_NETDEV_DEV(ndev, &pdev->dev);
671
672 ret = register_netdev(ndev);
673 - if (ret) {
674 - free_netdev(ndev);
675 + if (ret)
676 goto init_fail;
677 - }
678
679 netdev_dbg(ndev, "%s: IRQ=%d address=%pM\n",
680 __func__, ndev->irq, ndev->dev_addr);
681 diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
682 index adc088033c15d..971aea538acd6 100644
683 --- a/drivers/net/ethernet/qualcomm/emac/emac.c
684 +++ b/drivers/net/ethernet/qualcomm/emac/emac.c
685 @@ -746,12 +746,13 @@ static int emac_remove(struct platform_device *pdev)
686 if (!has_acpi_companion(&pdev->dev))
687 put_device(&adpt->phydev->mdio.dev);
688 mdiobus_unregister(adpt->mii_bus);
689 - free_netdev(netdev);
690
691 if (adpt->phy.digital)
692 iounmap(adpt->phy.digital);
693 iounmap(adpt->phy.base);
694
695 + free_netdev(netdev);
696 +
697 return 0;
698 }
699
700 diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
701 index 6c7ec1ddd475a..ba6f28cf39851 100644
702 --- a/drivers/net/ethernet/ti/tlan.c
703 +++ b/drivers/net/ethernet/ti/tlan.c
704 @@ -313,9 +313,8 @@ static void tlan_remove_one(struct pci_dev *pdev)
705 pci_release_regions(pdev);
706 #endif
707
708 - free_netdev(dev);
709 -
710 cancel_work_sync(&priv->tlan_tqueue);
711 + free_netdev(dev);
712 }
713
714 static void tlan_start(struct net_device *dev)
715 diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c
716 index 1799fd423901d..54ae04333d752 100644
717 --- a/drivers/reset/reset-ti-syscon.c
718 +++ b/drivers/reset/reset-ti-syscon.c
719 @@ -58,8 +58,8 @@ struct ti_syscon_reset_data {
720 unsigned int nr_controls;
721 };
722
723 -#define to_ti_syscon_reset_data(rcdev) \
724 - container_of(rcdev, struct ti_syscon_reset_data, rcdev)
725 +#define to_ti_syscon_reset_data(_rcdev) \
726 + container_of(_rcdev, struct ti_syscon_reset_data, rcdev)
727
728 /**
729 * ti_syscon_reset_assert() - assert device reset
730 diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
731 index 182fdd00e290d..ecd61573dd315 100644
732 --- a/drivers/rtc/rtc-max77686.c
733 +++ b/drivers/rtc/rtc-max77686.c
734 @@ -718,8 +718,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
735
736 add_rtc_irq:
737 ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq,
738 - IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
739 - IRQF_SHARED, 0, info->drv_data->rtc_irq_chip,
740 + IRQF_ONESHOT | IRQF_SHARED,
741 + 0, info->drv_data->rtc_irq_chip,
742 &info->rtc_irq_data);
743 if (ret < 0) {
744 dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
745 diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
746 index def3208dd2905..9b5832b46deca 100644
747 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c
748 +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
749 @@ -500,7 +500,7 @@ ahc_inq(struct ahc_softc *ahc, u_int port)
750 return ((ahc_inb(ahc, port))
751 | (ahc_inb(ahc, port+1) << 8)
752 | (ahc_inb(ahc, port+2) << 16)
753 - | (ahc_inb(ahc, port+3) << 24)
754 + | (((uint64_t)ahc_inb(ahc, port+3)) << 24)
755 | (((uint64_t)ahc_inb(ahc, port+4)) << 32)
756 | (((uint64_t)ahc_inb(ahc, port+5)) << 40)
757 | (((uint64_t)ahc_inb(ahc, port+6)) << 48)
758 diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
759 index 337aad0660fae..8d10b35caed52 100644
760 --- a/drivers/scsi/scsi_transport_iscsi.c
761 +++ b/drivers/scsi/scsi_transport_iscsi.c
762 @@ -427,39 +427,10 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
763 struct device *dev = container_of(kobj, struct device, kobj);
764 struct iscsi_iface *iface = iscsi_dev_to_iface(dev);
765 struct iscsi_transport *t = iface->transport;
766 - int param;
767 - int param_type;
768 + int param = -1;
769
770 if (attr == &dev_attr_iface_enabled.attr)
771 param = ISCSI_NET_PARAM_IFACE_ENABLE;
772 - else if (attr == &dev_attr_iface_vlan_id.attr)
773 - param = ISCSI_NET_PARAM_VLAN_ID;
774 - else if (attr == &dev_attr_iface_vlan_priority.attr)
775 - param = ISCSI_NET_PARAM_VLAN_PRIORITY;
776 - else if (attr == &dev_attr_iface_vlan_enabled.attr)
777 - param = ISCSI_NET_PARAM_VLAN_ENABLED;
778 - else if (attr == &dev_attr_iface_mtu.attr)
779 - param = ISCSI_NET_PARAM_MTU;
780 - else if (attr == &dev_attr_iface_port.attr)
781 - param = ISCSI_NET_PARAM_PORT;
782 - else if (attr == &dev_attr_iface_ipaddress_state.attr)
783 - param = ISCSI_NET_PARAM_IPADDR_STATE;
784 - else if (attr == &dev_attr_iface_delayed_ack_en.attr)
785 - param = ISCSI_NET_PARAM_DELAYED_ACK_EN;
786 - else if (attr == &dev_attr_iface_tcp_nagle_disable.attr)
787 - param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE;
788 - else if (attr == &dev_attr_iface_tcp_wsf_disable.attr)
789 - param = ISCSI_NET_PARAM_TCP_WSF_DISABLE;
790 - else if (attr == &dev_attr_iface_tcp_wsf.attr)
791 - param = ISCSI_NET_PARAM_TCP_WSF;
792 - else if (attr == &dev_attr_iface_tcp_timer_scale.attr)
793 - param = ISCSI_NET_PARAM_TCP_TIMER_SCALE;
794 - else if (attr == &dev_attr_iface_tcp_timestamp_en.attr)
795 - param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN;
796 - else if (attr == &dev_attr_iface_cache_id.attr)
797 - param = ISCSI_NET_PARAM_CACHE_ID;
798 - else if (attr == &dev_attr_iface_redirect_en.attr)
799 - param = ISCSI_NET_PARAM_REDIRECT_EN;
800 else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)
801 param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO;
802 else if (attr == &dev_attr_iface_header_digest.attr)
803 @@ -496,6 +467,38 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
804 param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN;
805 else if (attr == &dev_attr_iface_initiator_name.attr)
806 param = ISCSI_IFACE_PARAM_INITIATOR_NAME;
807 +
808 + if (param != -1)
809 + return t->attr_is_visible(ISCSI_IFACE_PARAM, param);
810 +
811 + if (attr == &dev_attr_iface_vlan_id.attr)
812 + param = ISCSI_NET_PARAM_VLAN_ID;
813 + else if (attr == &dev_attr_iface_vlan_priority.attr)
814 + param = ISCSI_NET_PARAM_VLAN_PRIORITY;
815 + else if (attr == &dev_attr_iface_vlan_enabled.attr)
816 + param = ISCSI_NET_PARAM_VLAN_ENABLED;
817 + else if (attr == &dev_attr_iface_mtu.attr)
818 + param = ISCSI_NET_PARAM_MTU;
819 + else if (attr == &dev_attr_iface_port.attr)
820 + param = ISCSI_NET_PARAM_PORT;
821 + else if (attr == &dev_attr_iface_ipaddress_state.attr)
822 + param = ISCSI_NET_PARAM_IPADDR_STATE;
823 + else if (attr == &dev_attr_iface_delayed_ack_en.attr)
824 + param = ISCSI_NET_PARAM_DELAYED_ACK_EN;
825 + else if (attr == &dev_attr_iface_tcp_nagle_disable.attr)
826 + param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE;
827 + else if (attr == &dev_attr_iface_tcp_wsf_disable.attr)
828 + param = ISCSI_NET_PARAM_TCP_WSF_DISABLE;
829 + else if (attr == &dev_attr_iface_tcp_wsf.attr)
830 + param = ISCSI_NET_PARAM_TCP_WSF;
831 + else if (attr == &dev_attr_iface_tcp_timer_scale.attr)
832 + param = ISCSI_NET_PARAM_TCP_TIMER_SCALE;
833 + else if (attr == &dev_attr_iface_tcp_timestamp_en.attr)
834 + param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN;
835 + else if (attr == &dev_attr_iface_cache_id.attr)
836 + param = ISCSI_NET_PARAM_CACHE_ID;
837 + else if (attr == &dev_attr_iface_redirect_en.attr)
838 + param = ISCSI_NET_PARAM_REDIRECT_EN;
839 else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
840 if (attr == &dev_attr_ipv4_iface_ipaddress.attr)
841 param = ISCSI_NET_PARAM_IPV4_ADDR;
842 @@ -586,32 +589,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
843 return 0;
844 }
845
846 - switch (param) {
847 - case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO:
848 - case ISCSI_IFACE_PARAM_HDRDGST_EN:
849 - case ISCSI_IFACE_PARAM_DATADGST_EN:
850 - case ISCSI_IFACE_PARAM_IMM_DATA_EN:
851 - case ISCSI_IFACE_PARAM_INITIAL_R2T_EN:
852 - case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN:
853 - case ISCSI_IFACE_PARAM_PDU_INORDER_EN:
854 - case ISCSI_IFACE_PARAM_ERL:
855 - case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH:
856 - case ISCSI_IFACE_PARAM_FIRST_BURST:
857 - case ISCSI_IFACE_PARAM_MAX_R2T:
858 - case ISCSI_IFACE_PARAM_MAX_BURST:
859 - case ISCSI_IFACE_PARAM_CHAP_AUTH_EN:
860 - case ISCSI_IFACE_PARAM_BIDI_CHAP_EN:
861 - case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL:
862 - case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN:
863 - case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN:
864 - case ISCSI_IFACE_PARAM_INITIATOR_NAME:
865 - param_type = ISCSI_IFACE_PARAM;
866 - break;
867 - default:
868 - param_type = ISCSI_NET_PARAM;
869 - }
870 -
871 - return t->attr_is_visible(param_type, param);
872 + return t->attr_is_visible(ISCSI_NET_PARAM, param);
873 }
874
875 static struct attribute *iscsi_iface_attrs[] = {
876 diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
877 index 899d7a8f0889e..419aecb942749 100644
878 --- a/drivers/spi/spi-mt65xx.c
879 +++ b/drivers/spi/spi-mt65xx.c
880 @@ -338,13 +338,23 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
881 mtk_spi_setup_packet(master);
882
883 cnt = xfer->len / 4;
884 - iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
885 + if (xfer->tx_buf)
886 + iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
887 +
888 + if (xfer->rx_buf)
889 + ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt);
890
891 remainder = xfer->len % 4;
892 if (remainder > 0) {
893 reg_val = 0;
894 - memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder);
895 - writel(reg_val, mdata->base + SPI_TX_DATA_REG);
896 + if (xfer->tx_buf) {
897 + memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder);
898 + writel(reg_val, mdata->base + SPI_TX_DATA_REG);
899 + }
900 + if (xfer->rx_buf) {
901 + reg_val = readl(mdata->base + SPI_RX_DATA_REG);
902 + memcpy(xfer->rx_buf + (cnt * 4), &reg_val, remainder);
903 + }
904 }
905
906 mtk_spi_enable_transfer(master);
907 diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
908 index b3b1461ec60d1..6a5a089fd13ec 100644
909 --- a/drivers/target/target_core_sbc.c
910 +++ b/drivers/target/target_core_sbc.c
911 @@ -37,7 +37,7 @@
912 #include "target_core_alua.h"
913
914 static sense_reason_t
915 -sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char *, u32, bool);
916 +sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool);
917 static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd);
918
919 static sense_reason_t
920 @@ -319,14 +319,14 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb)
921 }
922
923 static sense_reason_t
924 -sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops)
925 +sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops)
926 {
927 struct se_device *dev = cmd->se_dev;
928 sector_t end_lba = dev->transport->get_blocks(dev) + 1;
929 unsigned int sectors = sbc_get_write_same_sectors(cmd);
930 sense_reason_t ret;
931
932 - if ((flags[0] & 0x04) || (flags[0] & 0x02)) {
933 + if ((flags & 0x04) || (flags & 0x02)) {
934 pr_err("WRITE_SAME PBDATA and LBDATA"
935 " bits not supported for Block Discard"
936 " Emulation\n");
937 @@ -348,7 +348,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
938 }
939
940 /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */
941 - if (flags[0] & 0x10) {
942 + if (flags & 0x10) {
943 pr_warn("WRITE SAME with ANCHOR not supported\n");
944 return TCM_INVALID_CDB_FIELD;
945 }
946 @@ -356,7 +356,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
947 * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting
948 * translated into block discard requests within backend code.
949 */
950 - if (flags[0] & 0x08) {
951 + if (flags & 0x08) {
952 if (!ops->execute_unmap)
953 return TCM_UNSUPPORTED_SCSI_OPCODE;
954
955 @@ -371,7 +371,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
956 if (!ops->execute_write_same)
957 return TCM_UNSUPPORTED_SCSI_OPCODE;
958
959 - ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true);
960 + ret = sbc_check_prot(dev, cmd, flags >> 5, sectors, true);
961 if (ret)
962 return ret;
963
964 @@ -729,10 +729,9 @@ sbc_set_prot_op_checks(u8 protect, bool fabric_prot, enum target_prot_type prot_
965 }
966
967 static sense_reason_t
968 -sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
969 +sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char protect,
970 u32 sectors, bool is_write)
971 {
972 - u8 protect = cdb[1] >> 5;
973 int sp_ops = cmd->se_sess->sup_prot_ops;
974 int pi_prot_type = dev->dev_attrib.pi_prot_type;
975 bool fabric_prot = false;
976 @@ -780,7 +779,7 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
977 /* Fallthrough */
978 default:
979 pr_err("Unable to determine pi_prot_type for CDB: 0x%02x "
980 - "PROTECT: 0x%02x\n", cdb[0], protect);
981 + "PROTECT: 0x%02x\n", cmd->t_task_cdb[0], protect);
982 return TCM_INVALID_CDB_FIELD;
983 }
984
985 @@ -855,7 +854,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
986 if (sbc_check_dpofua(dev, cmd, cdb))
987 return TCM_INVALID_CDB_FIELD;
988
989 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false);
990 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false);
991 if (ret)
992 return ret;
993
994 @@ -869,7 +868,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
995 if (sbc_check_dpofua(dev, cmd, cdb))
996 return TCM_INVALID_CDB_FIELD;
997
998 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false);
999 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false);
1000 if (ret)
1001 return ret;
1002
1003 @@ -883,7 +882,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1004 if (sbc_check_dpofua(dev, cmd, cdb))
1005 return TCM_INVALID_CDB_FIELD;
1006
1007 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false);
1008 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false);
1009 if (ret)
1010 return ret;
1011
1012 @@ -904,7 +903,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1013 if (sbc_check_dpofua(dev, cmd, cdb))
1014 return TCM_INVALID_CDB_FIELD;
1015
1016 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true);
1017 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true);
1018 if (ret)
1019 return ret;
1020
1021 @@ -918,7 +917,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1022 if (sbc_check_dpofua(dev, cmd, cdb))
1023 return TCM_INVALID_CDB_FIELD;
1024
1025 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true);
1026 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true);
1027 if (ret)
1028 return ret;
1029
1030 @@ -932,7 +931,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1031 if (sbc_check_dpofua(dev, cmd, cdb))
1032 return TCM_INVALID_CDB_FIELD;
1033
1034 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true);
1035 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true);
1036 if (ret)
1037 return ret;
1038
1039 @@ -991,7 +990,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1040 size = sbc_get_size(cmd, 1);
1041 cmd->t_task_lba = get_unaligned_be64(&cdb[12]);
1042
1043 - ret = sbc_setup_write_same(cmd, &cdb[10], ops);
1044 + ret = sbc_setup_write_same(cmd, cdb[10], ops);
1045 if (ret)
1046 return ret;
1047 break;
1048 @@ -1084,7 +1083,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1049 size = sbc_get_size(cmd, 1);
1050 cmd->t_task_lba = get_unaligned_be64(&cdb[2]);
1051
1052 - ret = sbc_setup_write_same(cmd, &cdb[1], ops);
1053 + ret = sbc_setup_write_same(cmd, cdb[1], ops);
1054 if (ret)
1055 return ret;
1056 break;
1057 @@ -1102,7 +1101,7 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
1058 * Follow sbcr26 with WRITE_SAME (10) and check for the existence
1059 * of byte 1 bit 3 UNMAP instead of original reserved field
1060 */
1061 - ret = sbc_setup_write_same(cmd, &cdb[1], ops);
1062 + ret = sbc_setup_write_same(cmd, cdb[1], ops);
1063 if (ret)
1064 return ret;
1065 break;
1066 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
1067 index 90c033b4ec98f..4c2dc3a59eb59 100644
1068 --- a/drivers/thermal/thermal_core.c
1069 +++ b/drivers/thermal/thermal_core.c
1070 @@ -2027,7 +2027,7 @@ unregister:
1071 EXPORT_SYMBOL_GPL(thermal_zone_device_register);
1072
1073 /**
1074 - * thermal_device_unregister - removes the registered thermal zone device
1075 + * thermal_zone_device_unregister - removes the registered thermal zone device
1076 * @tz: the thermal zone device to remove
1077 */
1078 void thermal_zone_device_unregister(struct thermal_zone_device *tz)
1079 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1080 index df9fd9b95f22c..92057a3f346f4 100644
1081 --- a/drivers/usb/core/hub.c
1082 +++ b/drivers/usb/core/hub.c
1083 @@ -3892,6 +3892,47 @@ static int usb_set_lpm_timeout(struct usb_device *udev,
1084 return 0;
1085 }
1086
1087 +/*
1088 + * Don't allow device intiated U1/U2 if the system exit latency + one bus
1089 + * interval is greater than the minimum service interval of any active
1090 + * periodic endpoint. See USB 3.2 section 9.4.9
1091 + */
1092 +static bool usb_device_may_initiate_lpm(struct usb_device *udev,
1093 + enum usb3_link_state state)
1094 +{
1095 + unsigned int sel; /* us */
1096 + int i, j;
1097 +
1098 + if (state == USB3_LPM_U1)
1099 + sel = DIV_ROUND_UP(udev->u1_params.sel, 1000);
1100 + else if (state == USB3_LPM_U2)
1101 + sel = DIV_ROUND_UP(udev->u2_params.sel, 1000);
1102 + else
1103 + return false;
1104 +
1105 + for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1106 + struct usb_interface *intf;
1107 + struct usb_endpoint_descriptor *desc;
1108 + unsigned int interval;
1109 +
1110 + intf = udev->actconfig->interface[i];
1111 + if (!intf)
1112 + continue;
1113 +
1114 + for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++) {
1115 + desc = &intf->cur_altsetting->endpoint[j].desc;
1116 +
1117 + if (usb_endpoint_xfer_int(desc) ||
1118 + usb_endpoint_xfer_isoc(desc)) {
1119 + interval = (1 << (desc->bInterval - 1)) * 125;
1120 + if (sel + 125 > interval)
1121 + return false;
1122 + }
1123 + }
1124 + }
1125 + return true;
1126 +}
1127 +
1128 /*
1129 * Enable the hub-initiated U1/U2 idle timeouts, and enable device-initiated
1130 * U1/U2 entry.
1131 @@ -3964,20 +4005,23 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
1132 * U1/U2_ENABLE
1133 */
1134 if (udev->actconfig &&
1135 - usb_set_device_initiated_lpm(udev, state, true) == 0) {
1136 - if (state == USB3_LPM_U1)
1137 - udev->usb3_lpm_u1_enabled = 1;
1138 - else if (state == USB3_LPM_U2)
1139 - udev->usb3_lpm_u2_enabled = 1;
1140 - } else {
1141 - /* Don't request U1/U2 entry if the device
1142 - * cannot transition to U1/U2.
1143 - */
1144 - usb_set_lpm_timeout(udev, state, 0);
1145 - hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state);
1146 + usb_device_may_initiate_lpm(udev, state)) {
1147 + if (usb_set_device_initiated_lpm(udev, state, true)) {
1148 + /*
1149 + * Request to enable device initiated U1/U2 failed,
1150 + * better to turn off lpm in this case.
1151 + */
1152 + usb_set_lpm_timeout(udev, state, 0);
1153 + hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state);
1154 + return;
1155 + }
1156 }
1157 -}
1158
1159 + if (state == USB3_LPM_U1)
1160 + udev->usb3_lpm_u1_enabled = 1;
1161 + else if (state == USB3_LPM_U2)
1162 + udev->usb3_lpm_u2_enabled = 1;
1163 +}
1164 /*
1165 * Disable the hub-initiated U1/U2 idle timeouts, and disable device-initiated
1166 * U1/U2 entry.
1167 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1168 index 3dfd584a1ef3d..2ca6ed207e26e 100644
1169 --- a/drivers/usb/core/quirks.c
1170 +++ b/drivers/usb/core/quirks.c
1171 @@ -325,10 +325,6 @@ static const struct usb_device_id usb_quirk_list[] = {
1172 /* DJI CineSSD */
1173 { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
1174
1175 - /* Fibocom L850-GL LTE Modem */
1176 - { USB_DEVICE(0x2cb7, 0x0007), .driver_info =
1177 - USB_QUIRK_IGNORE_REMOTE_WAKEUP },
1178 -
1179 /* INTEL VALUE SSD */
1180 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
1181
1182 diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
1183 index 369869a29ebd4..1654a1bc64141 100644
1184 --- a/drivers/usb/host/max3421-hcd.c
1185 +++ b/drivers/usb/host/max3421-hcd.c
1186 @@ -149,8 +149,6 @@ struct max3421_hcd {
1187 */
1188 struct urb *curr_urb;
1189 enum scheduling_pass sched_pass;
1190 - struct usb_device *loaded_dev; /* dev that's loaded into the chip */
1191 - int loaded_epnum; /* epnum whose toggles are loaded */
1192 int urb_done; /* > 0 -> no errors, < 0: errno */
1193 size_t curr_len;
1194 u8 hien;
1195 @@ -488,39 +486,17 @@ max3421_set_speed(struct usb_hcd *hcd, struct usb_device *dev)
1196 * Caller must NOT hold HCD spinlock.
1197 */
1198 static void
1199 -max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum,
1200 - int force_toggles)
1201 +max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum)
1202 {
1203 - struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1204 - int old_epnum, same_ep, rcvtog, sndtog;
1205 - struct usb_device *old_dev;
1206 + int rcvtog, sndtog;
1207 u8 hctl;
1208
1209 - old_dev = max3421_hcd->loaded_dev;
1210 - old_epnum = max3421_hcd->loaded_epnum;
1211 -
1212 - same_ep = (dev == old_dev && epnum == old_epnum);
1213 - if (same_ep && !force_toggles)
1214 - return;
1215 -
1216 - if (old_dev && !same_ep) {
1217 - /* save the old end-points toggles: */
1218 - u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL);
1219 -
1220 - rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1;
1221 - sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1;
1222 -
1223 - /* no locking: HCD (i.e., we) own toggles, don't we? */
1224 - usb_settoggle(old_dev, old_epnum, 0, rcvtog);
1225 - usb_settoggle(old_dev, old_epnum, 1, sndtog);
1226 - }
1227 /* setup new endpoint's toggle bits: */
1228 rcvtog = usb_gettoggle(dev, epnum, 0);
1229 sndtog = usb_gettoggle(dev, epnum, 1);
1230 hctl = (BIT(rcvtog + MAX3421_HCTL_RCVTOG0_BIT) |
1231 BIT(sndtog + MAX3421_HCTL_SNDTOG0_BIT));
1232
1233 - max3421_hcd->loaded_epnum = epnum;
1234 spi_wr8(hcd, MAX3421_REG_HCTL, hctl);
1235
1236 /*
1237 @@ -528,7 +504,6 @@ max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum,
1238 * address-assignment so it's best to just always load the
1239 * address whenever the end-point changed/was forced.
1240 */
1241 - max3421_hcd->loaded_dev = dev;
1242 spi_wr8(hcd, MAX3421_REG_PERADDR, dev->devnum);
1243 }
1244
1245 @@ -663,7 +638,7 @@ max3421_select_and_start_urb(struct usb_hcd *hcd)
1246 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1247 struct urb *urb, *curr_urb = NULL;
1248 struct max3421_ep *max3421_ep;
1249 - int epnum, force_toggles = 0;
1250 + int epnum;
1251 struct usb_host_endpoint *ep;
1252 struct list_head *pos;
1253 unsigned long flags;
1254 @@ -773,7 +748,6 @@ done:
1255 usb_settoggle(urb->dev, epnum, 0, 1);
1256 usb_settoggle(urb->dev, epnum, 1, 1);
1257 max3421_ep->pkt_state = PKT_STATE_SETUP;
1258 - force_toggles = 1;
1259 } else
1260 max3421_ep->pkt_state = PKT_STATE_TRANSFER;
1261 }
1262 @@ -781,7 +755,7 @@ done:
1263 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1264
1265 max3421_ep->last_active = max3421_hcd->frame_number;
1266 - max3421_set_address(hcd, urb->dev, epnum, force_toggles);
1267 + max3421_set_address(hcd, urb->dev, epnum);
1268 max3421_set_speed(hcd, urb->dev);
1269 max3421_next_transfer(hcd, 0);
1270 return 1;
1271 @@ -1376,6 +1350,16 @@ max3421_urb_done(struct usb_hcd *hcd)
1272 status = 0;
1273 urb = max3421_hcd->curr_urb;
1274 if (urb) {
1275 + /* save the old end-points toggles: */
1276 + u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL);
1277 + int rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1;
1278 + int sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1;
1279 + int epnum = usb_endpoint_num(&urb->ep->desc);
1280 +
1281 + /* no locking: HCD (i.e., we) own toggles, don't we? */
1282 + usb_settoggle(urb->dev, epnum, 0, rcvtog);
1283 + usb_settoggle(urb->dev, epnum, 1, sndtog);
1284 +
1285 max3421_hcd->curr_urb = NULL;
1286 spin_lock_irqsave(&max3421_hcd->lock, flags);
1287 usb_hcd_unlink_urb_from_ep(hcd, urb);
1288 diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
1289 index 4ad71479c4490..dc8f54a68bdbc 100644
1290 --- a/drivers/usb/host/xhci-hub.c
1291 +++ b/drivers/usb/host/xhci-hub.c
1292 @@ -1292,11 +1292,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
1293 * Inform the usbcore about resume-in-progress by returning
1294 * a non-zero value even if there are no status changes.
1295 */
1296 + spin_lock_irqsave(&xhci->lock, flags);
1297 +
1298 status = bus_state->resuming_ports;
1299
1300 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
1301
1302 - spin_lock_irqsave(&xhci->lock, flags);
1303 /* For each port, did anything change? If so, set that bit in buf. */
1304 for (i = 0; i < max_ports; i++) {
1305 temp = readl(port_array[i]);
1306 diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
1307 index 7af85c10caea1..aafecac9ba266 100644
1308 --- a/drivers/usb/renesas_usbhs/fifo.c
1309 +++ b/drivers/usb/renesas_usbhs/fifo.c
1310 @@ -115,6 +115,8 @@ static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo,
1311 #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1)
1312 #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0)
1313 static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map);
1314 +static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable);
1315 +static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable);
1316 struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
1317 {
1318 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
1319 @@ -138,6 +140,11 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
1320 dmaengine_terminate_all(chan);
1321 usbhsf_fifo_clear(pipe, fifo);
1322 usbhsf_dma_unmap(pkt);
1323 + } else {
1324 + if (usbhs_pipe_is_dir_in(pipe))
1325 + usbhsf_rx_irq_ctrl(pipe, 0);
1326 + else
1327 + usbhsf_tx_irq_ctrl(pipe, 0);
1328 }
1329
1330 usbhs_pipe_running(pipe, 0);
1331 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1332 index 7eb83a1a43c26..c5d637848f9bb 100644
1333 --- a/drivers/usb/serial/cp210x.c
1334 +++ b/drivers/usb/serial/cp210x.c
1335 @@ -153,6 +153,7 @@ static const struct usb_device_id id_table[] = {
1336 { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */
1337 { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */
1338 { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
1339 + { USB_DEVICE(0x10C4, 0x8A5B) }, /* CEL EM3588 ZigBee USB Stick */
1340 { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
1341 { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
1342 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
1343 @@ -200,8 +201,8 @@ static const struct usb_device_id id_table[] = {
1344 { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */
1345 { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */
1346 { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */
1347 - { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */
1348 - { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */
1349 + { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 M.2 Key E serial interface */
1350 + { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 Display serial interface */
1351 { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */
1352 { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */
1353 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
1354 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1355 index 6faa9ac538877..b9017e85cc1ab 100644
1356 --- a/drivers/usb/serial/option.c
1357 +++ b/drivers/usb/serial/option.c
1358 @@ -241,6 +241,7 @@ static void option_instat_callback(struct urb *urb);
1359 #define QUECTEL_PRODUCT_UC15 0x9090
1360 /* These u-blox products use Qualcomm's vendor ID */
1361 #define UBLOX_PRODUCT_R410M 0x90b2
1362 +#define UBLOX_PRODUCT_R6XX 0x90fa
1363 /* These Yuga products use Qualcomm's vendor ID */
1364 #define YUGA_PRODUCT_CLM920_NC5 0x9625
1365
1366 @@ -1098,6 +1099,8 @@ static const struct usb_device_id option_ids[] = {
1367 /* u-blox products using Qualcomm vendor ID */
1368 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
1369 .driver_info = RSVD(1) | RSVD(3) },
1370 + { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R6XX),
1371 + .driver_info = RSVD(3) },
1372 /* Quectel products using Quectel vendor ID */
1373 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1374 .driver_info = RSVD(4) },
1375 diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
1376 index 1bf15f9d4f43e..cdff7dc63f9cd 100644
1377 --- a/drivers/usb/storage/unusual_uas.h
1378 +++ b/drivers/usb/storage/unusual_uas.h
1379 @@ -55,6 +55,13 @@ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
1380 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1381 US_FL_NO_REPORT_OPCODES),
1382
1383 +/* Reported-by: Julian Sikorski <belegdol@gmail.com> */
1384 +UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999,
1385 + "LaCie",
1386 + "Rugged USB3-FW",
1387 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1388 + US_FL_IGNORE_UAS),
1389 +
1390 /*
1391 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
1392 * commands in UAS mode. Observed with the 1.28 firmware; are there others?
1393 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1394 index 4b671e5c33cec..a55d23a73cdbc 100644
1395 --- a/fs/btrfs/inode.c
1396 +++ b/fs/btrfs/inode.c
1397 @@ -484,7 +484,7 @@ again:
1398 * inode has not been flagged as nocompress. This flag can
1399 * change at any time if we discover bad compression ratios.
1400 */
1401 - if (inode_need_compress(inode)) {
1402 + if (nr_pages > 1 && inode_need_compress(inode)) {
1403 WARN_ON(pages);
1404 pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
1405 if (!pages) {
1406 diff --git a/fs/proc/base.c b/fs/proc/base.c
1407 index 0368ff9335cb5..886e408f47697 100644
1408 --- a/fs/proc/base.c
1409 +++ b/fs/proc/base.c
1410 @@ -867,7 +867,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
1411 flags |= FOLL_WRITE;
1412
1413 while (count > 0) {
1414 - int this_len = min_t(int, count, PAGE_SIZE);
1415 + size_t this_len = min_t(size_t, count, PAGE_SIZE);
1416
1417 if (write && copy_from_user(page, buf, this_len)) {
1418 copied = -EFAULT;
1419 diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h
1420 index 6965c8f68ade4..5a23535a5018d 100644
1421 --- a/include/net/dst_metadata.h
1422 +++ b/include/net/dst_metadata.h
1423 @@ -31,7 +31,9 @@ static inline struct ip_tunnel_info *skb_tunnel_info(struct sk_buff *skb)
1424 return &md_dst->u.tun_info;
1425
1426 dst = skb_dst(skb);
1427 - if (dst && dst->lwtstate)
1428 + if (dst && dst->lwtstate &&
1429 + (dst->lwtstate->type == LWTUNNEL_ENCAP_IP ||
1430 + dst->lwtstate->type == LWTUNNEL_ENCAP_IP6))
1431 return lwt_tun_info(dst->lwtstate);
1432
1433 return NULL;
1434 diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
1435 index e45b6286983c8..b97d2771b1753 100644
1436 --- a/include/net/ip6_route.h
1437 +++ b/include/net/ip6_route.h
1438 @@ -202,7 +202,7 @@ static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
1439 int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
1440 int (*output)(struct net *, struct sock *, struct sk_buff *));
1441
1442 -static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
1443 +static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb)
1444 {
1445 struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
1446 inet6_sk(skb->sk) : NULL;
1447 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
1448 index 5a349fcb634e8..39b59248d9c30 100644
1449 --- a/kernel/sched/fair.c
1450 +++ b/kernel/sched/fair.c
1451 @@ -4196,7 +4196,7 @@ static const u64 cfs_bandwidth_slack_period = 5 * NSEC_PER_MSEC;
1452 static int runtime_refresh_within(struct cfs_bandwidth *cfs_b, u64 min_expire)
1453 {
1454 struct hrtimer *refresh_timer = &cfs_b->period_timer;
1455 - u64 remaining;
1456 + s64 remaining;
1457
1458 /* if the call-back is running a quota refresh is already occurring */
1459 if (hrtimer_callback_running(refresh_timer))
1460 @@ -4204,7 +4204,7 @@ static int runtime_refresh_within(struct cfs_bandwidth *cfs_b, u64 min_expire)
1461
1462 /* is a quota refresh about to occur? */
1463 remaining = ktime_to_ns(hrtimer_expires_remaining(refresh_timer));
1464 - if (remaining < min_expire)
1465 + if (remaining < (s64)min_expire)
1466 return 1;
1467
1468 return 0;
1469 diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
1470 index 4ec8bf634f89f..c30a70ab0e7ae 100644
1471 --- a/kernel/trace/ring_buffer.c
1472 +++ b/kernel/trace/ring_buffer.c
1473 @@ -3081,10 +3081,30 @@ static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
1474 if (unlikely(!head))
1475 return true;
1476
1477 - return reader->read == rb_page_commit(reader) &&
1478 - (commit == reader ||
1479 - (commit == head &&
1480 - head->read == rb_page_commit(commit)));
1481 + /* Reader should exhaust content in reader page */
1482 + if (reader->read != rb_page_commit(reader))
1483 + return false;
1484 +
1485 + /*
1486 + * If writers are committing on the reader page, knowing all
1487 + * committed content has been read, the ring buffer is empty.
1488 + */
1489 + if (commit == reader)
1490 + return true;
1491 +
1492 + /*
1493 + * If writers are committing on a page other than reader page
1494 + * and head page, there should always be content to read.
1495 + */
1496 + if (commit != head)
1497 + return false;
1498 +
1499 + /*
1500 + * Writers are committing on the head page, we just need
1501 + * to care about there're committed data, and the reader will
1502 + * swap reader page with head page when it is to read data.
1503 + */
1504 + return rb_page_commit(commit) == 0;
1505 }
1506
1507 /**
1508 diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
1509 index 925818a053984..4718c528e1003 100644
1510 --- a/net/bridge/br_if.c
1511 +++ b/net/bridge/br_if.c
1512 @@ -486,7 +486,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
1513 struct net_bridge_port *p;
1514 int err = 0;
1515 unsigned br_hr, dev_hr;
1516 - bool changed_addr;
1517 + bool changed_addr, fdb_synced = false;
1518
1519 /* Don't allow bridging non-ethernet like devices, or DSA-enabled
1520 * master network devices since the bridge layer rx_handler prevents
1521 @@ -556,6 +556,19 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
1522 list_add_rcu(&p->list, &br->port_list);
1523
1524 nbp_update_port_count(br);
1525 + if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) {
1526 + /* When updating the port count we also update all ports'
1527 + * promiscuous mode.
1528 + * A port leaving promiscuous mode normally gets the bridge's
1529 + * fdb synced to the unicast filter (if supported), however,
1530 + * `br_port_clear_promisc` does not distinguish between
1531 + * non-promiscuous ports and *new* ports, so we need to
1532 + * sync explicitly here.
1533 + */
1534 + fdb_synced = br_fdb_sync_static(br, p) == 0;
1535 + if (!fdb_synced)
1536 + netdev_err(dev, "failed to sync bridge static fdb addresses to this port\n");
1537 + }
1538
1539 netdev_update_features(br->dev);
1540
1541 @@ -596,6 +609,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
1542 return 0;
1543
1544 err7:
1545 + if (fdb_synced)
1546 + br_fdb_unsync_static(br, p);
1547 list_del_rcu(&p->list);
1548 br_fdb_delete_by_port(br, p, 0, 1);
1549 nbp_update_port_count(br);
1550 diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
1551 index 92cbbd2afddbf..9367f260afeba 100644
1552 --- a/net/caif/caif_socket.c
1553 +++ b/net/caif/caif_socket.c
1554 @@ -539,7 +539,8 @@ static int caif_seqpkt_sendmsg(struct socket *sock, struct msghdr *msg,
1555 goto err;
1556
1557 ret = -EINVAL;
1558 - if (unlikely(msg->msg_iter.iov->iov_base == NULL))
1559 + if (unlikely(msg->msg_iter.nr_segs == 0) ||
1560 + unlikely(msg->msg_iter.iov->iov_base == NULL))
1561 goto err;
1562 noblock = msg->msg_flags & MSG_DONTWAIT;
1563
1564 diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
1565 index 9d8fcdefefc01..ee297964fcd26 100644
1566 --- a/net/decnet/af_decnet.c
1567 +++ b/net/decnet/af_decnet.c
1568 @@ -823,7 +823,7 @@ static int dn_auto_bind(struct socket *sock)
1569 static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
1570 {
1571 struct dn_scp *scp = DN_SK(sk);
1572 - DEFINE_WAIT(wait);
1573 + DEFINE_WAIT_FUNC(wait, woken_wake_function);
1574 int err;
1575
1576 if (scp->state != DN_CR)
1577 @@ -833,11 +833,11 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
1578 scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk));
1579 dn_send_conn_conf(sk, allocation);
1580
1581 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1582 + add_wait_queue(sk_sleep(sk), &wait);
1583 for(;;) {
1584 release_sock(sk);
1585 if (scp->state == DN_CC)
1586 - *timeo = schedule_timeout(*timeo);
1587 + *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
1588 lock_sock(sk);
1589 err = 0;
1590 if (scp->state == DN_RUN)
1591 @@ -851,9 +851,8 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
1592 err = -EAGAIN;
1593 if (!*timeo)
1594 break;
1595 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1596 }
1597 - finish_wait(sk_sleep(sk), &wait);
1598 + remove_wait_queue(sk_sleep(sk), &wait);
1599 if (err == 0) {
1600 sk->sk_socket->state = SS_CONNECTED;
1601 } else if (scp->state != DN_CC) {
1602 @@ -865,7 +864,7 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
1603 static int dn_wait_run(struct sock *sk, long *timeo)
1604 {
1605 struct dn_scp *scp = DN_SK(sk);
1606 - DEFINE_WAIT(wait);
1607 + DEFINE_WAIT_FUNC(wait, woken_wake_function);
1608 int err = 0;
1609
1610 if (scp->state == DN_RUN)
1611 @@ -874,11 +873,11 @@ static int dn_wait_run(struct sock *sk, long *timeo)
1612 if (!*timeo)
1613 return -EALREADY;
1614
1615 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1616 + add_wait_queue(sk_sleep(sk), &wait);
1617 for(;;) {
1618 release_sock(sk);
1619 if (scp->state == DN_CI || scp->state == DN_CC)
1620 - *timeo = schedule_timeout(*timeo);
1621 + *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
1622 lock_sock(sk);
1623 err = 0;
1624 if (scp->state == DN_RUN)
1625 @@ -892,9 +891,8 @@ static int dn_wait_run(struct sock *sk, long *timeo)
1626 err = -ETIMEDOUT;
1627 if (!*timeo)
1628 break;
1629 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1630 }
1631 - finish_wait(sk_sleep(sk), &wait);
1632 + remove_wait_queue(sk_sleep(sk), &wait);
1633 out:
1634 if (err == 0) {
1635 sk->sk_socket->state = SS_CONNECTED;
1636 @@ -1039,16 +1037,16 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt)
1637
1638 static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo)
1639 {
1640 - DEFINE_WAIT(wait);
1641 + DEFINE_WAIT_FUNC(wait, woken_wake_function);
1642 struct sk_buff *skb = NULL;
1643 int err = 0;
1644
1645 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1646 + add_wait_queue(sk_sleep(sk), &wait);
1647 for(;;) {
1648 release_sock(sk);
1649 skb = skb_dequeue(&sk->sk_receive_queue);
1650 if (skb == NULL) {
1651 - *timeo = schedule_timeout(*timeo);
1652 + *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
1653 skb = skb_dequeue(&sk->sk_receive_queue);
1654 }
1655 lock_sock(sk);
1656 @@ -1063,9 +1061,8 @@ static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo)
1657 err = -EAGAIN;
1658 if (!*timeo)
1659 break;
1660 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1661 }
1662 - finish_wait(sk_sleep(sk), &wait);
1663 + remove_wait_queue(sk_sleep(sk), &wait);
1664
1665 return skb == NULL ? ERR_PTR(err) : skb;
1666 }
1667 diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
1668 index 10c4a5fce215d..10860c089fda2 100644
1669 --- a/net/ipv4/tcp_ipv4.c
1670 +++ b/net/ipv4/tcp_ipv4.c
1671 @@ -275,7 +275,7 @@ void tcp_v4_mtu_reduced(struct sock *sk)
1672
1673 if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
1674 return;
1675 - mtu = tcp_sk(sk)->mtu_info;
1676 + mtu = READ_ONCE(tcp_sk(sk)->mtu_info);
1677 dst = inet_csk_update_pmtu(sk, mtu);
1678 if (!dst)
1679 return;
1680 @@ -442,7 +442,7 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
1681 if (sk->sk_state == TCP_LISTEN)
1682 goto out;
1683
1684 - tp->mtu_info = info;
1685 + WRITE_ONCE(tp->mtu_info, info);
1686 if (!sock_owned_by_user(sk)) {
1687 tcp_v4_mtu_reduced(sk);
1688 } else {
1689 diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
1690 index b7909160692e3..aafea53c7c068 100644
1691 --- a/net/ipv4/tcp_output.c
1692 +++ b/net/ipv4/tcp_output.c
1693 @@ -1383,6 +1383,7 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu)
1694 return __tcp_mtu_to_mss(sk, pmtu) -
1695 (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr));
1696 }
1697 +EXPORT_SYMBOL(tcp_mtu_to_mss);
1698
1699 /* Inverse of above */
1700 int tcp_mss_to_mtu(struct sock *sk, int mss)
1701 diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
1702 index dfddf2bfa7e1a..6b8da8d4d1ccf 100644
1703 --- a/net/ipv6/tcp_ipv6.c
1704 +++ b/net/ipv6/tcp_ipv6.c
1705 @@ -307,11 +307,20 @@ failure:
1706 static void tcp_v6_mtu_reduced(struct sock *sk)
1707 {
1708 struct dst_entry *dst;
1709 + u32 mtu;
1710
1711 if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
1712 return;
1713
1714 - dst = inet6_csk_update_pmtu(sk, tcp_sk(sk)->mtu_info);
1715 + mtu = READ_ONCE(tcp_sk(sk)->mtu_info);
1716 +
1717 + /* Drop requests trying to increase our current mss.
1718 + * Check done in __ip6_rt_update_pmtu() is too late.
1719 + */
1720 + if (tcp_mtu_to_mss(sk, mtu) >= tcp_sk(sk)->mss_cache)
1721 + return;
1722 +
1723 + dst = inet6_csk_update_pmtu(sk, mtu);
1724 if (!dst)
1725 return;
1726
1727 @@ -390,6 +399,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
1728 }
1729
1730 if (type == ICMPV6_PKT_TOOBIG) {
1731 + u32 mtu = ntohl(info);
1732 +
1733 /* We are not interested in TCP_LISTEN and open_requests
1734 * (SYN-ACKs send out by Linux are always <576bytes so
1735 * they should go through unfragmented).
1736 @@ -400,7 +411,11 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
1737 if (!ip6_sk_accept_pmtu(sk))
1738 goto out;
1739
1740 - tp->mtu_info = ntohl(info);
1741 + if (mtu < IPV6_MIN_MTU)
1742 + goto out;
1743 +
1744 + WRITE_ONCE(tp->mtu_info, mtu);
1745 +
1746 if (!sock_owned_by_user(sk))
1747 tcp_v6_mtu_reduced(sk);
1748 else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED,
1749 diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
1750 index b2dc9a820c6a5..ef6cc9eb0e45e 100644
1751 --- a/net/ipv6/xfrm6_output.c
1752 +++ b/net/ipv6/xfrm6_output.c
1753 @@ -141,7 +141,7 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
1754 {
1755 struct dst_entry *dst = skb_dst(skb);
1756 struct xfrm_state *x = dst->xfrm;
1757 - int mtu;
1758 + unsigned int mtu;
1759 bool toobig;
1760
1761 #ifdef CONFIG_NETFILTER
1762 diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c
1763 index f0ecaec1ff3da..d1a0b70567432 100644
1764 --- a/net/netrom/nr_timer.c
1765 +++ b/net/netrom/nr_timer.c
1766 @@ -125,11 +125,9 @@ static void nr_heartbeat_expiry(unsigned long param)
1767 is accepted() it isn't 'dead' so doesn't get removed. */
1768 if (sock_flag(sk, SOCK_DESTROY) ||
1769 (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) {
1770 - sock_hold(sk);
1771 bh_unlock_sock(sk);
1772 nr_destroy_socket(sk);
1773 - sock_put(sk);
1774 - return;
1775 + goto out;
1776 }
1777 break;
1778
1779 @@ -150,6 +148,8 @@ static void nr_heartbeat_expiry(unsigned long param)
1780
1781 nr_start_heartbeat(sk);
1782 bh_unlock_sock(sk);
1783 +out:
1784 + sock_put(sk);
1785 }
1786
1787 static void nr_t2timer_expiry(unsigned long param)
1788 @@ -163,6 +163,7 @@ static void nr_t2timer_expiry(unsigned long param)
1789 nr_enquiry_response(sk);
1790 }
1791 bh_unlock_sock(sk);
1792 + sock_put(sk);
1793 }
1794
1795 static void nr_t4timer_expiry(unsigned long param)
1796 @@ -172,6 +173,7 @@ static void nr_t4timer_expiry(unsigned long param)
1797 bh_lock_sock(sk);
1798 nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY;
1799 bh_unlock_sock(sk);
1800 + sock_put(sk);
1801 }
1802
1803 static void nr_idletimer_expiry(unsigned long param)
1804 @@ -200,6 +202,7 @@ static void nr_idletimer_expiry(unsigned long param)
1805 sock_set_flag(sk, SOCK_DEAD);
1806 }
1807 bh_unlock_sock(sk);
1808 + sock_put(sk);
1809 }
1810
1811 static void nr_t1timer_expiry(unsigned long param)
1812 @@ -212,8 +215,7 @@ static void nr_t1timer_expiry(unsigned long param)
1813 case NR_STATE_1:
1814 if (nr->n2count == nr->n2) {
1815 nr_disconnect(sk, ETIMEDOUT);
1816 - bh_unlock_sock(sk);
1817 - return;
1818 + goto out;
1819 } else {
1820 nr->n2count++;
1821 nr_write_internal(sk, NR_CONNREQ);
1822 @@ -223,8 +225,7 @@ static void nr_t1timer_expiry(unsigned long param)
1823 case NR_STATE_2:
1824 if (nr->n2count == nr->n2) {
1825 nr_disconnect(sk, ETIMEDOUT);
1826 - bh_unlock_sock(sk);
1827 - return;
1828 + goto out;
1829 } else {
1830 nr->n2count++;
1831 nr_write_internal(sk, NR_DISCREQ);
1832 @@ -234,8 +235,7 @@ static void nr_t1timer_expiry(unsigned long param)
1833 case NR_STATE_3:
1834 if (nr->n2count == nr->n2) {
1835 nr_disconnect(sk, ETIMEDOUT);
1836 - bh_unlock_sock(sk);
1837 - return;
1838 + goto out;
1839 } else {
1840 nr->n2count++;
1841 nr_requeue_frames(sk);
1842 @@ -244,5 +244,7 @@ static void nr_t1timer_expiry(unsigned long param)
1843 }
1844
1845 nr_start_t1timer(sk);
1846 +out:
1847 bh_unlock_sock(sk);
1848 + sock_put(sk);
1849 }
1850 diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
1851 index 6fdc97ef6023d..cb73747002edb 100755
1852 --- a/scripts/mkcompile_h
1853 +++ b/scripts/mkcompile_h
1854 @@ -82,15 +82,23 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
1855 # Only replace the real compile.h if the new one is different,
1856 # in order to preserve the timestamp and avoid unnecessary
1857 # recompilations.
1858 -# We don't consider the file changed if only the date/time changed.
1859 +# We don't consider the file changed if only the date/time changed,
1860 +# unless KBUILD_BUILD_TIMESTAMP was explicitly set (e.g. for
1861 +# reproducible builds with that value referring to a commit timestamp).
1862 # A kernel config change will increase the generation number, thus
1863 # causing compile.h to be updated (including date/time) due to the
1864 # changed comment in the
1865 # first line.
1866
1867 +if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
1868 + IGNORE_PATTERN="UTS_VERSION"
1869 +else
1870 + IGNORE_PATTERN="NOT_A_PATTERN_TO_BE_MATCHED"
1871 +fi
1872 +
1873 if [ -r $TARGET ] && \
1874 - grep -v 'UTS_VERSION' $TARGET > .tmpver.1 && \
1875 - grep -v 'UTS_VERSION' .tmpcompile > .tmpver.2 && \
1876 + grep -v $IGNORE_PATTERN $TARGET > .tmpver.1 && \
1877 + grep -v $IGNORE_PATTERN .tmpcompile > .tmpver.2 && \
1878 cmp -s .tmpver.1 .tmpver.2; then
1879 rm -f .tmpcompile
1880 else
1881 diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
1882 index 90fa57ad14c04..23834691f4d32 100644
1883 --- a/sound/isa/sb/sb16_csp.c
1884 +++ b/sound/isa/sb/sb16_csp.c
1885 @@ -828,6 +828,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel
1886 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1);
1887 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7);
1888 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7);
1889 + spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
1890
1891 spin_lock(&p->chip->reg_lock);
1892 set_mode_register(p->chip, 0xc0); /* c0 = STOP */
1893 @@ -867,6 +868,7 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel
1894 spin_unlock(&p->chip->reg_lock);
1895
1896 /* restore PCM volume */
1897 + spin_lock_irqsave(&p->chip->mixer_lock, flags);
1898 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL);
1899 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR);
1900 spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
1901 @@ -892,6 +894,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p)
1902 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1);
1903 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7);
1904 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7);
1905 + spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
1906
1907 spin_lock(&p->chip->reg_lock);
1908 if (p->running & SNDRV_SB_CSP_ST_QSOUND) {
1909 @@ -906,6 +909,7 @@ static int snd_sb_csp_stop(struct snd_sb_csp * p)
1910 spin_unlock(&p->chip->reg_lock);
1911
1912 /* restore PCM volume */
1913 + spin_lock_irqsave(&p->chip->mixer_lock, flags);
1914 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL);
1915 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR);
1916 spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
1917 diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
1918 index 2673e86ed50fa..900d8c25e9ab0 100644
1919 --- a/tools/perf/tests/bpf.c
1920 +++ b/tools/perf/tests/bpf.c
1921 @@ -1,4 +1,5 @@
1922 #include <stdio.h>
1923 +#include <stdlib.h>
1924 #include <sys/epoll.h>
1925 #include <util/util.h>
1926 #include <util/bpf-loader.h>
1927 @@ -231,6 +232,7 @@ static int __test__bpf(int idx)
1928 bpf_testcase_table[idx].target_func,
1929 bpf_testcase_table[idx].expect_result);
1930 out:
1931 + free(obj_buf);
1932 bpf__clear();
1933 return ret;
1934 }
1935 diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c
1936 index 9ddea5cecd94b..ba12643d2dede 100644
1937 --- a/tools/perf/util/lzma.c
1938 +++ b/tools/perf/util/lzma.c
1939 @@ -61,7 +61,7 @@ int lzma_decompress_to_file(const char *input, int output_fd)
1940
1941 if (ferror(infile)) {
1942 pr_err("lzma: read error: %s\n", strerror(errno));
1943 - goto err_fclose;
1944 + goto err_lzma_end;
1945 }
1946
1947 if (feof(infile))
1948 @@ -75,7 +75,7 @@ int lzma_decompress_to_file(const char *input, int output_fd)
1949
1950 if (writen(output_fd, buf_out, write_size) != write_size) {
1951 pr_err("lzma: write error: %s\n", strerror(errno));
1952 - goto err_fclose;
1953 + goto err_lzma_end;
1954 }
1955
1956 strm.next_out = buf_out;
1957 @@ -87,11 +87,13 @@ int lzma_decompress_to_file(const char *input, int output_fd)
1958 break;
1959
1960 pr_err("lzma: failed %s\n", lzma_strerror(ret));
1961 - goto err_fclose;
1962 + goto err_lzma_end;
1963 }
1964 }
1965
1966 err = 0;
1967 +err_lzma_end:
1968 + lzma_end(&strm);
1969 err_fclose:
1970 fclose(infile);
1971 return err;
1972 diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
1973 index b9507a8d0e304..293df9409afa5 100644
1974 --- a/tools/perf/util/probe-file.c
1975 +++ b/tools/perf/util/probe-file.c
1976 @@ -334,11 +334,11 @@ int probe_file__del_events(int fd, struct strfilter *filter)
1977
1978 ret = probe_file__get_events(fd, filter, namelist);
1979 if (ret < 0)
1980 - return ret;
1981 + goto out;
1982
1983 ret = probe_file__del_strlist(fd, namelist);
1984 +out:
1985 strlist__delete(namelist);
1986 -
1987 return ret;
1988 }
1989