Contents of /trunk/kernel-alx/patches-5.4/0282-5.4.183-all-fixes.patch
Parent Directory | Revision Log
Revision 3635 -
(show annotations)
(download)
Mon Oct 24 12:34:12 2022 UTC (18 months, 1 week ago) by niro
File size: 63800 byte(s)
Mon Oct 24 12:34:12 2022 UTC (18 months, 1 week ago) by niro
File size: 63800 byte(s)
-sync kernel patches
1 | diff --git a/Makefile b/Makefile |
2 | index 8750309fc42ac..a94b5ea499e13 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 182 |
10 | +SUBLEVEL = 183 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c |
15 | index 6a95b92966406..183a6f2f165ad 100644 |
16 | --- a/arch/arm/kernel/kgdb.c |
17 | +++ b/arch/arm/kernel/kgdb.c |
18 | @@ -154,22 +154,38 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) |
19 | return 0; |
20 | } |
21 | |
22 | -static struct undef_hook kgdb_brkpt_hook = { |
23 | +static struct undef_hook kgdb_brkpt_arm_hook = { |
24 | .instr_mask = 0xffffffff, |
25 | .instr_val = KGDB_BREAKINST, |
26 | - .cpsr_mask = MODE_MASK, |
27 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
28 | .cpsr_val = SVC_MODE, |
29 | .fn = kgdb_brk_fn |
30 | }; |
31 | |
32 | -static struct undef_hook kgdb_compiled_brkpt_hook = { |
33 | +static struct undef_hook kgdb_brkpt_thumb_hook = { |
34 | + .instr_mask = 0xffff, |
35 | + .instr_val = KGDB_BREAKINST & 0xffff, |
36 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
37 | + .cpsr_val = PSR_T_BIT | SVC_MODE, |
38 | + .fn = kgdb_brk_fn |
39 | +}; |
40 | + |
41 | +static struct undef_hook kgdb_compiled_brkpt_arm_hook = { |
42 | .instr_mask = 0xffffffff, |
43 | .instr_val = KGDB_COMPILED_BREAK, |
44 | - .cpsr_mask = MODE_MASK, |
45 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
46 | .cpsr_val = SVC_MODE, |
47 | .fn = kgdb_compiled_brk_fn |
48 | }; |
49 | |
50 | +static struct undef_hook kgdb_compiled_brkpt_thumb_hook = { |
51 | + .instr_mask = 0xffff, |
52 | + .instr_val = KGDB_COMPILED_BREAK & 0xffff, |
53 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
54 | + .cpsr_val = PSR_T_BIT | SVC_MODE, |
55 | + .fn = kgdb_compiled_brk_fn |
56 | +}; |
57 | + |
58 | static int __kgdb_notify(struct die_args *args, unsigned long cmd) |
59 | { |
60 | struct pt_regs *regs = args->regs; |
61 | @@ -210,8 +226,10 @@ int kgdb_arch_init(void) |
62 | if (ret != 0) |
63 | return ret; |
64 | |
65 | - register_undef_hook(&kgdb_brkpt_hook); |
66 | - register_undef_hook(&kgdb_compiled_brkpt_hook); |
67 | + register_undef_hook(&kgdb_brkpt_arm_hook); |
68 | + register_undef_hook(&kgdb_brkpt_thumb_hook); |
69 | + register_undef_hook(&kgdb_compiled_brkpt_arm_hook); |
70 | + register_undef_hook(&kgdb_compiled_brkpt_thumb_hook); |
71 | |
72 | return 0; |
73 | } |
74 | @@ -224,8 +242,10 @@ int kgdb_arch_init(void) |
75 | */ |
76 | void kgdb_arch_exit(void) |
77 | { |
78 | - unregister_undef_hook(&kgdb_brkpt_hook); |
79 | - unregister_undef_hook(&kgdb_compiled_brkpt_hook); |
80 | + unregister_undef_hook(&kgdb_brkpt_arm_hook); |
81 | + unregister_undef_hook(&kgdb_brkpt_thumb_hook); |
82 | + unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook); |
83 | + unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook); |
84 | unregister_die_notifier(&kgdb_notifier); |
85 | } |
86 | |
87 | diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c |
88 | index 538d5da741b09..6e7f841f67ff1 100644 |
89 | --- a/arch/arm/mm/mmu.c |
90 | +++ b/arch/arm/mm/mmu.c |
91 | @@ -229,12 +229,14 @@ early_param("ecc", early_ecc); |
92 | static int __init early_cachepolicy(char *p) |
93 | { |
94 | pr_warn("cachepolicy kernel parameter not supported without cp15\n"); |
95 | + return 0; |
96 | } |
97 | early_param("cachepolicy", early_cachepolicy); |
98 | |
99 | static int __init noalign_setup(char *__unused) |
100 | { |
101 | pr_warn("noalign kernel parameter not supported without cp15\n"); |
102 | + return 1; |
103 | } |
104 | __setup("noalign", noalign_setup); |
105 | |
106 | diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi |
107 | index dd5624975c9b4..b7e7bb3517c03 100644 |
108 | --- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi |
109 | +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi |
110 | @@ -281,7 +281,7 @@ |
111 | |
112 | sound: sound { |
113 | compatible = "rockchip,rk3399-gru-sound"; |
114 | - rockchip,cpu = <&i2s0 &i2s2>; |
115 | + rockchip,cpu = <&i2s0 &spdif>; |
116 | }; |
117 | }; |
118 | |
119 | @@ -432,10 +432,6 @@ ap_i2c_audio: &i2c8 { |
120 | status = "okay"; |
121 | }; |
122 | |
123 | -&i2s2 { |
124 | - status = "okay"; |
125 | -}; |
126 | - |
127 | &io_domains { |
128 | status = "okay"; |
129 | |
130 | @@ -532,6 +528,17 @@ ap_i2c_audio: &i2c8 { |
131 | vqmmc-supply = <&ppvar_sd_card_io>; |
132 | }; |
133 | |
134 | +&spdif { |
135 | + status = "okay"; |
136 | + |
137 | + /* |
138 | + * SPDIF is routed internally to DP; we either don't use these pins, or |
139 | + * mux them to something else. |
140 | + */ |
141 | + /delete-property/ pinctrl-0; |
142 | + /delete-property/ pinctrl-names; |
143 | +}; |
144 | + |
145 | &spi1 { |
146 | status = "okay"; |
147 | |
148 | diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c |
149 | index 70d1587ddcd46..361b109933725 100644 |
150 | --- a/arch/ia64/kernel/acpi.c |
151 | +++ b/arch/ia64/kernel/acpi.c |
152 | @@ -448,7 +448,8 @@ void __init acpi_numa_fixup(void) |
153 | if (srat_num_cpus == 0) { |
154 | node_set_online(0); |
155 | node_cpuid[0].phys_id = hard_smp_processor_id(); |
156 | - return; |
157 | + slit_distance(0, 0) = LOCAL_DISTANCE; |
158 | + goto out; |
159 | } |
160 | |
161 | /* |
162 | @@ -491,7 +492,7 @@ void __init acpi_numa_fixup(void) |
163 | for (j = 0; j < MAX_NUMNODES; j++) |
164 | slit_distance(i, j) = i == j ? |
165 | LOCAL_DISTANCE : REMOTE_DISTANCE; |
166 | - return; |
167 | + goto out; |
168 | } |
169 | |
170 | memset(numa_slit, -1, sizeof(numa_slit)); |
171 | @@ -516,6 +517,8 @@ void __init acpi_numa_fixup(void) |
172 | printk("\n"); |
173 | } |
174 | #endif |
175 | +out: |
176 | + node_possible_map = node_online_map; |
177 | } |
178 | #endif /* CONFIG_ACPI_NUMA */ |
179 | |
180 | diff --git a/block/blk-flush.c b/block/blk-flush.c |
181 | index 5aa6fada22598..f66ff16855310 100644 |
182 | --- a/block/blk-flush.c |
183 | +++ b/block/blk-flush.c |
184 | @@ -222,8 +222,10 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error) |
185 | return; |
186 | } |
187 | |
188 | - if (fq->rq_status != BLK_STS_OK) |
189 | + if (fq->rq_status != BLK_STS_OK) { |
190 | error = fq->rq_status; |
191 | + fq->rq_status = BLK_STS_OK; |
192 | + } |
193 | |
194 | hctx = flush_rq->mq_hctx; |
195 | if (!q->elevator) { |
196 | diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c |
197 | index 499a947d56ddb..fef46de2f6b23 100644 |
198 | --- a/drivers/ata/pata_hpt37x.c |
199 | +++ b/drivers/ata/pata_hpt37x.c |
200 | @@ -962,14 +962,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
201 | |
202 | if ((freq >> 12) != 0xABCDE) { |
203 | int i; |
204 | - u8 sr; |
205 | + u16 sr; |
206 | u32 total = 0; |
207 | |
208 | pr_warn("BIOS has not set timing clocks\n"); |
209 | |
210 | /* This is the process the HPT371 BIOS is reported to use */ |
211 | for (i = 0; i < 128; i++) { |
212 | - pci_read_config_byte(dev, 0x78, &sr); |
213 | + pci_read_config_word(dev, 0x78, &sr); |
214 | total += sr & 0x1FF; |
215 | udelay(15); |
216 | } |
217 | diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c |
218 | index c51de498b5b4b..19eee3d0900b0 100644 |
219 | --- a/drivers/dma/sh/shdma-base.c |
220 | +++ b/drivers/dma/sh/shdma-base.c |
221 | @@ -115,8 +115,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) |
222 | ret = pm_runtime_get(schan->dev); |
223 | |
224 | spin_unlock_irq(&schan->chan_lock); |
225 | - if (ret < 0) |
226 | + if (ret < 0) { |
227 | dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret); |
228 | + pm_runtime_put(schan->dev); |
229 | + } |
230 | |
231 | pm_runtime_barrier(schan->dev); |
232 | |
233 | diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c |
234 | index 4e43bdfa041f5..f0b055bc027c4 100644 |
235 | --- a/drivers/firmware/arm_scmi/driver.c |
236 | +++ b/drivers/firmware/arm_scmi/driver.c |
237 | @@ -983,7 +983,7 @@ static struct platform_driver scmi_driver = { |
238 | |
239 | module_platform_driver(scmi_driver); |
240 | |
241 | -MODULE_ALIAS("platform: arm-scmi"); |
242 | +MODULE_ALIAS("platform:arm-scmi"); |
243 | MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>"); |
244 | MODULE_DESCRIPTION("ARM SCMI protocol driver"); |
245 | MODULE_LICENSE("GPL v2"); |
246 | diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c |
247 | index 436d1776bc7be..a32d15b2928f7 100644 |
248 | --- a/drivers/firmware/efi/vars.c |
249 | +++ b/drivers/firmware/efi/vars.c |
250 | @@ -750,6 +750,7 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, |
251 | { |
252 | const struct efivar_operations *ops; |
253 | efi_status_t status; |
254 | + unsigned long varsize; |
255 | |
256 | if (!__efivars) |
257 | return -EINVAL; |
258 | @@ -772,15 +773,17 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, |
259 | return efivar_entry_set_nonblocking(name, vendor, attributes, |
260 | size, data); |
261 | |
262 | + varsize = size + ucs2_strsize(name, 1024); |
263 | if (!block) { |
264 | if (down_trylock(&efivars_lock)) |
265 | return -EBUSY; |
266 | + status = check_var_size_nonblocking(attributes, varsize); |
267 | } else { |
268 | if (down_interruptible(&efivars_lock)) |
269 | return -EINTR; |
270 | + status = check_var_size(attributes, varsize); |
271 | } |
272 | |
273 | - status = check_var_size(attributes, size + ucs2_strsize(name, 1024)); |
274 | if (status != EFI_SUCCESS) { |
275 | up(&efivars_lock); |
276 | return -ENOSPC; |
277 | diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c |
278 | index 01135713e8f9b..419d8dec7e498 100644 |
279 | --- a/drivers/hid/hid-debug.c |
280 | +++ b/drivers/hid/hid-debug.c |
281 | @@ -823,7 +823,9 @@ static const char *keys[KEY_MAX + 1] = { |
282 | [KEY_F22] = "F22", [KEY_F23] = "F23", |
283 | [KEY_F24] = "F24", [KEY_PLAYCD] = "PlayCD", |
284 | [KEY_PAUSECD] = "PauseCD", [KEY_PROG3] = "Prog3", |
285 | - [KEY_PROG4] = "Prog4", [KEY_SUSPEND] = "Suspend", |
286 | + [KEY_PROG4] = "Prog4", |
287 | + [KEY_ALL_APPLICATIONS] = "AllApplications", |
288 | + [KEY_SUSPEND] = "Suspend", |
289 | [KEY_CLOSE] = "Close", [KEY_PLAY] = "Play", |
290 | [KEY_FASTFORWARD] = "FastForward", [KEY_BASSBOOST] = "BassBoost", |
291 | [KEY_PRINT] = "Print", [KEY_HP] = "HP", |
292 | @@ -930,6 +932,7 @@ static const char *keys[KEY_MAX + 1] = { |
293 | [KEY_SCREENSAVER] = "ScreenSaver", |
294 | [KEY_VOICECOMMAND] = "VoiceCommand", |
295 | [KEY_EMOJI_PICKER] = "EmojiPicker", |
296 | + [KEY_DICTATE] = "Dictate", |
297 | [KEY_BRIGHTNESS_MIN] = "BrightnessMin", |
298 | [KEY_BRIGHTNESS_MAX] = "BrightnessMax", |
299 | [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", |
300 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
301 | index 749558aa27e78..d1ba6fafe960f 100644 |
302 | --- a/drivers/hid/hid-input.c |
303 | +++ b/drivers/hid/hid-input.c |
304 | @@ -956,6 +956,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel |
305 | case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; |
306 | case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; |
307 | |
308 | + case 0x0d8: map_key_clear(KEY_DICTATE); break; |
309 | case 0x0d9: map_key_clear(KEY_EMOJI_PICKER); break; |
310 | |
311 | case 0x0e0: map_abs_clear(ABS_VOLUME); break; |
312 | @@ -1047,6 +1048,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel |
313 | |
314 | case 0x29d: map_key_clear(KEY_KBD_LAYOUT_NEXT); break; |
315 | |
316 | + case 0x2a2: map_key_clear(KEY_ALL_APPLICATIONS); break; |
317 | + |
318 | case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; |
319 | case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; |
320 | case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; |
321 | diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig |
322 | index 2d08a8719506c..854f1b2658b82 100644 |
323 | --- a/drivers/i2c/busses/Kconfig |
324 | +++ b/drivers/i2c/busses/Kconfig |
325 | @@ -483,7 +483,7 @@ config I2C_BRCMSTB |
326 | |
327 | config I2C_CADENCE |
328 | tristate "Cadence I2C Controller" |
329 | - depends on ARCH_ZYNQ || ARM64 || XTENSA |
330 | + depends on ARCH_ZYNQ || ARM64 || XTENSA || COMPILE_TEST |
331 | help |
332 | Say yes here to select Cadence I2C Host Controller. This controller is |
333 | e.g. used by Xilinx Zynq. |
334 | @@ -894,7 +894,7 @@ config I2C_QCOM_GENI |
335 | |
336 | config I2C_QUP |
337 | tristate "Qualcomm QUP based I2C controller" |
338 | - depends on ARCH_QCOM |
339 | + depends on ARCH_QCOM || COMPILE_TEST |
340 | help |
341 | If you say yes to this option, support will be included for the |
342 | built-in I2C interface on the Qualcomm SoCs. |
343 | diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c |
344 | index 5ab901ad615dd..c265fe4621621 100644 |
345 | --- a/drivers/i2c/busses/i2c-bcm2835.c |
346 | +++ b/drivers/i2c/busses/i2c-bcm2835.c |
347 | @@ -23,6 +23,11 @@ |
348 | #define BCM2835_I2C_FIFO 0x10 |
349 | #define BCM2835_I2C_DIV 0x14 |
350 | #define BCM2835_I2C_DEL 0x18 |
351 | +/* |
352 | + * 16-bit field for the number of SCL cycles to wait after rising SCL |
353 | + * before deciding the slave is not responding. 0 disables the |
354 | + * timeout detection. |
355 | + */ |
356 | #define BCM2835_I2C_CLKT 0x1c |
357 | |
358 | #define BCM2835_I2C_C_READ BIT(0) |
359 | @@ -479,6 +484,12 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) |
360 | adap->dev.of_node = pdev->dev.of_node; |
361 | adap->quirks = of_device_get_match_data(&pdev->dev); |
362 | |
363 | + /* |
364 | + * Disable the hardware clock stretching timeout. SMBUS |
365 | + * specifies a limit for how long the device can stretch the |
366 | + * clock, but core I2C doesn't. |
367 | + */ |
368 | + bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_CLKT, 0); |
369 | bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0); |
370 | |
371 | ret = i2c_add_adapter(adap); |
372 | diff --git a/drivers/input/input.c b/drivers/input/input.c |
373 | index e2eb9b9b8363d..f7398b996bacf 100644 |
374 | --- a/drivers/input/input.c |
375 | +++ b/drivers/input/input.c |
376 | @@ -2181,6 +2181,12 @@ int input_register_device(struct input_dev *dev) |
377 | /* KEY_RESERVED is not supposed to be transmitted to userspace. */ |
378 | __clear_bit(KEY_RESERVED, dev->keybit); |
379 | |
380 | + /* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */ |
381 | + if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) { |
382 | + __clear_bit(BTN_RIGHT, dev->keybit); |
383 | + __clear_bit(BTN_MIDDLE, dev->keybit); |
384 | + } |
385 | + |
386 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
387 | input_cleanse_bitmasks(dev); |
388 | |
389 | diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
390 | index 196e8505dd8d7..aaef8847f8862 100644 |
391 | --- a/drivers/input/mouse/elan_i2c_core.c |
392 | +++ b/drivers/input/mouse/elan_i2c_core.c |
393 | @@ -139,55 +139,21 @@ static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count, |
394 | return 0; |
395 | } |
396 | |
397 | -static int elan_enable_power(struct elan_tp_data *data) |
398 | +static int elan_set_power(struct elan_tp_data *data, bool on) |
399 | { |
400 | int repeat = ETP_RETRY_COUNT; |
401 | int error; |
402 | |
403 | - error = regulator_enable(data->vcc); |
404 | - if (error) { |
405 | - dev_err(&data->client->dev, |
406 | - "failed to enable regulator: %d\n", error); |
407 | - return error; |
408 | - } |
409 | - |
410 | do { |
411 | - error = data->ops->power_control(data->client, true); |
412 | + error = data->ops->power_control(data->client, on); |
413 | if (error >= 0) |
414 | return 0; |
415 | |
416 | msleep(30); |
417 | } while (--repeat > 0); |
418 | |
419 | - dev_err(&data->client->dev, "failed to enable power: %d\n", error); |
420 | - return error; |
421 | -} |
422 | - |
423 | -static int elan_disable_power(struct elan_tp_data *data) |
424 | -{ |
425 | - int repeat = ETP_RETRY_COUNT; |
426 | - int error; |
427 | - |
428 | - do { |
429 | - error = data->ops->power_control(data->client, false); |
430 | - if (!error) { |
431 | - error = regulator_disable(data->vcc); |
432 | - if (error) { |
433 | - dev_err(&data->client->dev, |
434 | - "failed to disable regulator: %d\n", |
435 | - error); |
436 | - /* Attempt to power the chip back up */ |
437 | - data->ops->power_control(data->client, true); |
438 | - break; |
439 | - } |
440 | - |
441 | - return 0; |
442 | - } |
443 | - |
444 | - msleep(30); |
445 | - } while (--repeat > 0); |
446 | - |
447 | - dev_err(&data->client->dev, "failed to disable power: %d\n", error); |
448 | + dev_err(&data->client->dev, "failed to set power %s: %d\n", |
449 | + on ? "on" : "off", error); |
450 | return error; |
451 | } |
452 | |
453 | @@ -1316,9 +1282,19 @@ static int __maybe_unused elan_suspend(struct device *dev) |
454 | /* Enable wake from IRQ */ |
455 | data->irq_wake = (enable_irq_wake(client->irq) == 0); |
456 | } else { |
457 | - ret = elan_disable_power(data); |
458 | + ret = elan_set_power(data, false); |
459 | + if (ret) |
460 | + goto err; |
461 | + |
462 | + ret = regulator_disable(data->vcc); |
463 | + if (ret) { |
464 | + dev_err(dev, "error %d disabling regulator\n", ret); |
465 | + /* Attempt to power the chip back up */ |
466 | + elan_set_power(data, true); |
467 | + } |
468 | } |
469 | |
470 | +err: |
471 | mutex_unlock(&data->sysfs_mutex); |
472 | return ret; |
473 | } |
474 | @@ -1329,12 +1305,18 @@ static int __maybe_unused elan_resume(struct device *dev) |
475 | struct elan_tp_data *data = i2c_get_clientdata(client); |
476 | int error; |
477 | |
478 | - if (device_may_wakeup(dev) && data->irq_wake) { |
479 | + if (!device_may_wakeup(dev)) { |
480 | + error = regulator_enable(data->vcc); |
481 | + if (error) { |
482 | + dev_err(dev, "error %d enabling regulator\n", error); |
483 | + goto err; |
484 | + } |
485 | + } else if (data->irq_wake) { |
486 | disable_irq_wake(client->irq); |
487 | data->irq_wake = false; |
488 | } |
489 | |
490 | - error = elan_enable_power(data); |
491 | + error = elan_set_power(data, true); |
492 | if (error) { |
493 | dev_err(dev, "power up when resuming failed: %d\n", error); |
494 | goto err; |
495 | diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c |
496 | index eb7f76753c9c0..9f44e2e458df1 100644 |
497 | --- a/drivers/net/arcnet/com20020-pci.c |
498 | +++ b/drivers/net/arcnet/com20020-pci.c |
499 | @@ -136,6 +136,9 @@ static int com20020pci_probe(struct pci_dev *pdev, |
500 | return -ENOMEM; |
501 | |
502 | ci = (struct com20020_pci_card_info *)id->driver_data; |
503 | + if (!ci) |
504 | + return -EINVAL; |
505 | + |
506 | priv->ci = ci; |
507 | mm = &ci->misc_map; |
508 | |
509 | diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
510 | index 8b4c1bb77c334..76747d94c7602 100644 |
511 | --- a/drivers/net/can/usb/gs_usb.c |
512 | +++ b/drivers/net/can/usb/gs_usb.c |
513 | @@ -190,8 +190,8 @@ struct gs_can { |
514 | struct gs_usb { |
515 | struct gs_can *canch[GS_MAX_INTF]; |
516 | struct usb_anchor rx_submitted; |
517 | - atomic_t active_channels; |
518 | struct usb_device *udev; |
519 | + u8 active_channels; |
520 | }; |
521 | |
522 | /* 'allocate' a tx context. |
523 | @@ -588,7 +588,7 @@ static int gs_can_open(struct net_device *netdev) |
524 | if (rc) |
525 | return rc; |
526 | |
527 | - if (atomic_add_return(1, &parent->active_channels) == 1) { |
528 | + if (!parent->active_channels) { |
529 | for (i = 0; i < GS_MAX_RX_URBS; i++) { |
530 | struct urb *urb; |
531 | u8 *buf; |
532 | @@ -689,6 +689,7 @@ static int gs_can_open(struct net_device *netdev) |
533 | |
534 | dev->can.state = CAN_STATE_ERROR_ACTIVE; |
535 | |
536 | + parent->active_channels++; |
537 | if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) |
538 | netif_start_queue(netdev); |
539 | |
540 | @@ -704,7 +705,8 @@ static int gs_can_close(struct net_device *netdev) |
541 | netif_stop_queue(netdev); |
542 | |
543 | /* Stop polling */ |
544 | - if (atomic_dec_and_test(&parent->active_channels)) |
545 | + parent->active_channels--; |
546 | + if (!parent->active_channels) |
547 | usb_kill_anchored_urbs(&parent->rx_submitted); |
548 | |
549 | /* Stop sending URBs */ |
550 | @@ -983,8 +985,6 @@ static int gs_usb_probe(struct usb_interface *intf, |
551 | |
552 | init_usb_anchor(&dev->rx_submitted); |
553 | |
554 | - atomic_set(&dev->active_channels, 0); |
555 | - |
556 | usb_set_intfdata(intf, dev); |
557 | dev->udev = interface_to_usbdev(intf); |
558 | |
559 | diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c |
560 | index 0a9f2c5966242..d3e11fe1eabcc 100644 |
561 | --- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c |
562 | +++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c |
563 | @@ -3677,6 +3677,8 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, |
564 | MAC_STATS_ACCUM_SECS : (MAC_STATS_ACCUM_SECS * 10); |
565 | adapter->params.pci.vpd_cap_addr = |
566 | pci_find_capability(adapter->pdev, PCI_CAP_ID_VPD); |
567 | + if (!adapter->params.pci.vpd_cap_addr) |
568 | + return -ENODEV; |
569 | ret = get_vpd_params(adapter, &adapter->params.vpd); |
570 | if (ret < 0) |
571 | return ret; |
572 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
573 | index 26d49dcdbeb3e..34bf6f4eef4ab 100644 |
574 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
575 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
576 | @@ -2248,8 +2248,10 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, |
577 | * flush reset queue and process this reset |
578 | */ |
579 | if (adapter->force_reset_recovery && !list_empty(&adapter->rwi_list)) { |
580 | - list_for_each_safe(entry, tmp_entry, &adapter->rwi_list) |
581 | + list_for_each_safe(entry, tmp_entry, &adapter->rwi_list) { |
582 | list_del(entry); |
583 | + kfree(list_entry(entry, struct ibmvnic_rwi, list)); |
584 | + } |
585 | } |
586 | rwi->reset_reason = reason; |
587 | list_add_tail(&rwi->list, &adapter->rwi_list); |
588 | diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
589 | index 309e953ed1e44..e8850ba5604c4 100644 |
590 | --- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
591 | +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
592 | @@ -3323,8 +3323,11 @@ static int iavf_change_mtu(struct net_device *netdev, int new_mtu) |
593 | iavf_notify_client_l2_params(&adapter->vsi); |
594 | adapter->flags |= IAVF_FLAG_SERVICE_CLIENT_REQUESTED; |
595 | } |
596 | - adapter->flags |= IAVF_FLAG_RESET_NEEDED; |
597 | - queue_work(iavf_wq, &adapter->reset_task); |
598 | + |
599 | + if (netif_running(netdev)) { |
600 | + adapter->flags |= IAVF_FLAG_RESET_NEEDED; |
601 | + queue_work(iavf_wq, &adapter->reset_task); |
602 | + } |
603 | |
604 | return 0; |
605 | } |
606 | diff --git a/drivers/net/ethernet/intel/igc/igc_phy.c b/drivers/net/ethernet/intel/igc/igc_phy.c |
607 | index f4b05af0dd2f6..1a4947e6933c3 100644 |
608 | --- a/drivers/net/ethernet/intel/igc/igc_phy.c |
609 | +++ b/drivers/net/ethernet/intel/igc/igc_phy.c |
610 | @@ -734,8 +734,6 @@ s32 igc_write_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 data) |
611 | if (ret_val) |
612 | return ret_val; |
613 | ret_val = igc_write_phy_reg_mdic(hw, offset, data); |
614 | - if (ret_val) |
615 | - return ret_val; |
616 | hw->phy.ops.release(hw); |
617 | } else { |
618 | ret_val = igc_write_xmdio_reg(hw, (u16)offset, dev_addr, |
619 | @@ -767,8 +765,6 @@ s32 igc_read_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 *data) |
620 | if (ret_val) |
621 | return ret_val; |
622 | ret_val = igc_read_phy_reg_mdic(hw, offset, data); |
623 | - if (ret_val) |
624 | - return ret_val; |
625 | hw->phy.ops.release(hw); |
626 | } else { |
627 | ret_val = igc_read_xmdio_reg(hw, (u16)offset, dev_addr, |
628 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |
629 | index b43be9f141053..921a2ddb497e1 100644 |
630 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |
631 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |
632 | @@ -583,12 +583,14 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget) |
633 | u32 cmd_type; |
634 | |
635 | while (budget-- > 0) { |
636 | - if (unlikely(!ixgbe_desc_unused(xdp_ring)) || |
637 | - !netif_carrier_ok(xdp_ring->netdev)) { |
638 | + if (unlikely(!ixgbe_desc_unused(xdp_ring))) { |
639 | work_done = false; |
640 | break; |
641 | } |
642 | |
643 | + if (!netif_carrier_ok(xdp_ring->netdev)) |
644 | + break; |
645 | + |
646 | if (!xsk_umem_consume_tx(xdp_ring->xsk_umem, &desc)) |
647 | break; |
648 | |
649 | diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |
650 | index 38767d7979147..431146b391d0c 100644 |
651 | --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |
652 | +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c |
653 | @@ -2277,18 +2277,18 @@ static int __init sxgbe_cmdline_opt(char *str) |
654 | char *opt; |
655 | |
656 | if (!str || !*str) |
657 | - return -EINVAL; |
658 | + return 1; |
659 | while ((opt = strsep(&str, ",")) != NULL) { |
660 | if (!strncmp(opt, "eee_timer:", 10)) { |
661 | if (kstrtoint(opt + 10, 0, &eee_timer)) |
662 | goto err; |
663 | } |
664 | } |
665 | - return 0; |
666 | + return 1; |
667 | |
668 | err: |
669 | pr_err("%s: ERROR broken module parameter conversion\n", __func__); |
670 | - return -EINVAL; |
671 | + return 1; |
672 | } |
673 | |
674 | __setup("sxgbeeth=", sxgbe_cmdline_opt); |
675 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
676 | index 94c652b9a0a8b..9cbc0179d24ec 100644 |
677 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
678 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
679 | @@ -4890,7 +4890,7 @@ static int __init stmmac_cmdline_opt(char *str) |
680 | char *opt; |
681 | |
682 | if (!str || !*str) |
683 | - return -EINVAL; |
684 | + return 1; |
685 | while ((opt = strsep(&str, ",")) != NULL) { |
686 | if (!strncmp(opt, "debug:", 6)) { |
687 | if (kstrtoint(opt + 6, 0, &debug)) |
688 | @@ -4921,11 +4921,11 @@ static int __init stmmac_cmdline_opt(char *str) |
689 | goto err; |
690 | } |
691 | } |
692 | - return 0; |
693 | + return 1; |
694 | |
695 | err: |
696 | pr_err("%s: ERROR broken module parameter conversion", __func__); |
697 | - return -EINVAL; |
698 | + return 1; |
699 | } |
700 | |
701 | __setup("stmmaceth=", stmmac_cmdline_opt); |
702 | diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c |
703 | index d2eb33f53993b..43aab2835f8ff 100644 |
704 | --- a/drivers/net/hamradio/mkiss.c |
705 | +++ b/drivers/net/hamradio/mkiss.c |
706 | @@ -31,6 +31,8 @@ |
707 | |
708 | #define AX_MTU 236 |
709 | |
710 | +/* some arch define END as assembly function ending, just undef it */ |
711 | +#undef END |
712 | /* SLIP/KISS protocol characters. */ |
713 | #define END 0300 /* indicates end of frame */ |
714 | #define ESC 0333 /* indicates byte stuffing */ |
715 | diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c |
716 | index 77ac5a721e7b6..414341c9cf5ae 100644 |
717 | --- a/drivers/net/usb/cdc_mbim.c |
718 | +++ b/drivers/net/usb/cdc_mbim.c |
719 | @@ -658,6 +658,11 @@ static const struct usb_device_id mbim_devs[] = { |
720 | .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, |
721 | }, |
722 | |
723 | + /* Telit FN990 */ |
724 | + { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1071, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
725 | + .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, |
726 | + }, |
727 | + |
728 | /* default entry */ |
729 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
730 | .driver_info = (unsigned long)&cdc_mbim_info_zlp, |
731 | diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c |
732 | index 07b070b14d75d..6e1721d533846 100644 |
733 | --- a/drivers/net/wireless/mac80211_hwsim.c |
734 | +++ b/drivers/net/wireless/mac80211_hwsim.c |
735 | @@ -2062,6 +2062,15 @@ static void hw_scan_work(struct work_struct *work) |
736 | if (req->ie_len) |
737 | skb_put_data(probe, req->ie, req->ie_len); |
738 | |
739 | + if (!ieee80211_tx_prepare_skb(hwsim->hw, |
740 | + hwsim->hw_scan_vif, |
741 | + probe, |
742 | + hwsim->tmp_chan->band, |
743 | + NULL)) { |
744 | + kfree_skb(probe); |
745 | + continue; |
746 | + } |
747 | + |
748 | local_bh_disable(); |
749 | mac80211_hwsim_tx_frame(hwsim->hw, probe, |
750 | hwsim->tmp_chan); |
751 | @@ -3316,6 +3325,10 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, |
752 | } |
753 | txi->flags |= IEEE80211_TX_STAT_ACK; |
754 | } |
755 | + |
756 | + if (hwsim_flags & HWSIM_TX_CTL_NO_ACK) |
757 | + txi->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; |
758 | + |
759 | ieee80211_tx_status_irqsafe(data2->hw, skb); |
760 | return 0; |
761 | out: |
762 | diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
763 | index d2b3381f71825..d45d83968e769 100644 |
764 | --- a/drivers/net/xen-netfront.c |
765 | +++ b/drivers/net/xen-netfront.c |
766 | @@ -761,6 +761,28 @@ static int xennet_close(struct net_device *dev) |
767 | return 0; |
768 | } |
769 | |
770 | +static void xennet_destroy_queues(struct netfront_info *info) |
771 | +{ |
772 | + unsigned int i; |
773 | + |
774 | + for (i = 0; i < info->netdev->real_num_tx_queues; i++) { |
775 | + struct netfront_queue *queue = &info->queues[i]; |
776 | + |
777 | + if (netif_running(info->netdev)) |
778 | + napi_disable(&queue->napi); |
779 | + netif_napi_del(&queue->napi); |
780 | + } |
781 | + |
782 | + kfree(info->queues); |
783 | + info->queues = NULL; |
784 | +} |
785 | + |
786 | +static void xennet_uninit(struct net_device *dev) |
787 | +{ |
788 | + struct netfront_info *np = netdev_priv(dev); |
789 | + xennet_destroy_queues(np); |
790 | +} |
791 | + |
792 | static void xennet_set_rx_rsp_cons(struct netfront_queue *queue, RING_IDX val) |
793 | { |
794 | unsigned long flags; |
795 | @@ -1373,6 +1395,7 @@ static void xennet_poll_controller(struct net_device *dev) |
796 | #endif |
797 | |
798 | static const struct net_device_ops xennet_netdev_ops = { |
799 | + .ndo_uninit = xennet_uninit, |
800 | .ndo_open = xennet_open, |
801 | .ndo_stop = xennet_close, |
802 | .ndo_start_xmit = xennet_start_xmit, |
803 | @@ -1860,22 +1883,6 @@ error: |
804 | return err; |
805 | } |
806 | |
807 | -static void xennet_destroy_queues(struct netfront_info *info) |
808 | -{ |
809 | - unsigned int i; |
810 | - |
811 | - for (i = 0; i < info->netdev->real_num_tx_queues; i++) { |
812 | - struct netfront_queue *queue = &info->queues[i]; |
813 | - |
814 | - if (netif_running(info->netdev)) |
815 | - napi_disable(&queue->napi); |
816 | - netif_napi_del(&queue->napi); |
817 | - } |
818 | - |
819 | - kfree(info->queues); |
820 | - info->queues = NULL; |
821 | -} |
822 | - |
823 | static int xennet_create_queues(struct netfront_info *info, |
824 | unsigned int *num_queues) |
825 | { |
826 | diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c |
827 | index 3657e296a8a27..058c2fec9a4b4 100644 |
828 | --- a/drivers/soc/fsl/qe/qe_io.c |
829 | +++ b/drivers/soc/fsl/qe/qe_io.c |
830 | @@ -37,6 +37,8 @@ int par_io_init(struct device_node *np) |
831 | if (ret) |
832 | return ret; |
833 | par_io = ioremap(res.start, resource_size(&res)); |
834 | + if (!par_io) |
835 | + return -ENOMEM; |
836 | |
837 | num_ports = of_get_property(np, "num-ports", NULL); |
838 | if (num_ports) |
839 | diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
840 | index 5f1e15172403e..9cd80ad075bd2 100644 |
841 | --- a/drivers/usb/gadget/legacy/inode.c |
842 | +++ b/drivers/usb/gadget/legacy/inode.c |
843 | @@ -1829,8 +1829,9 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) |
844 | spin_lock_irq (&dev->lock); |
845 | value = -EINVAL; |
846 | if (dev->buf) { |
847 | + spin_unlock_irq(&dev->lock); |
848 | kfree(kbuf); |
849 | - goto fail; |
850 | + return value; |
851 | } |
852 | dev->buf = kbuf; |
853 | |
854 | @@ -1877,8 +1878,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) |
855 | |
856 | value = usb_gadget_probe_driver(&gadgetfs_driver); |
857 | if (value != 0) { |
858 | - kfree (dev->buf); |
859 | - dev->buf = NULL; |
860 | + spin_lock_irq(&dev->lock); |
861 | + goto fail; |
862 | } else { |
863 | /* at this point "good" hardware has for the first time |
864 | * let the USB the host see us. alternatively, if users |
865 | @@ -1895,6 +1896,9 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) |
866 | return value; |
867 | |
868 | fail: |
869 | + dev->config = NULL; |
870 | + dev->hs_config = NULL; |
871 | + dev->dev = NULL; |
872 | spin_unlock_irq (&dev->lock); |
873 | pr_debug ("%s: %s fail %zd, %p\n", shortname, __func__, value, dev); |
874 | kfree (dev->buf); |
875 | diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
876 | index a5041bf0d5db1..5a3006c75d63f 100644 |
877 | --- a/fs/btrfs/qgroup.c |
878 | +++ b/fs/btrfs/qgroup.c |
879 | @@ -1116,6 +1116,14 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) |
880 | if (!fs_info->quota_root) |
881 | goto out; |
882 | |
883 | + /* |
884 | + * Unlock the qgroup_ioctl_lock mutex before waiting for the rescan worker to |
885 | + * complete. Otherwise we can deadlock because btrfs_remove_qgroup() needs |
886 | + * to lock that mutex while holding a transaction handle and the rescan |
887 | + * worker needs to commit a transaction. |
888 | + */ |
889 | + mutex_unlock(&fs_info->qgroup_ioctl_lock); |
890 | + |
891 | /* |
892 | * Request qgroup rescan worker to complete and wait for it. This wait |
893 | * must be done before transaction start for quota disable since it may |
894 | @@ -1123,7 +1131,6 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) |
895 | */ |
896 | clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
897 | btrfs_qgroup_wait_for_completion(fs_info, false); |
898 | - mutex_unlock(&fs_info->qgroup_ioctl_lock); |
899 | |
900 | /* |
901 | * 1 For the root item |
902 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
903 | index 7bc4477d7ee7d..9b703c0db9796 100644 |
904 | --- a/fs/btrfs/tree-log.c |
905 | +++ b/fs/btrfs/tree-log.c |
906 | @@ -1308,6 +1308,15 @@ again: |
907 | inode, name, namelen); |
908 | kfree(name); |
909 | iput(dir); |
910 | + /* |
911 | + * Whenever we need to check if a name exists or not, we |
912 | + * check the subvolume tree. So after an unlink we must |
913 | + * run delayed items, so that future checks for a name |
914 | + * during log replay see that the name does not exists |
915 | + * anymore. |
916 | + */ |
917 | + if (!ret) |
918 | + ret = btrfs_run_delayed_items(trans); |
919 | if (ret) |
920 | goto out; |
921 | goto again; |
922 | @@ -1559,6 +1568,15 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, |
923 | */ |
924 | if (!ret && inode->i_nlink == 0) |
925 | inc_nlink(inode); |
926 | + /* |
927 | + * Whenever we need to check if a name exists or |
928 | + * not, we check the subvolume tree. So after an |
929 | + * unlink we must run delayed items, so that future |
930 | + * checks for a name during log replay see that the |
931 | + * name does not exists anymore. |
932 | + */ |
933 | + if (!ret) |
934 | + ret = btrfs_run_delayed_items(trans); |
935 | } |
936 | if (ret < 0) |
937 | goto out; |
938 | @@ -4249,7 +4267,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans, |
939 | |
940 | /* |
941 | * Log all prealloc extents beyond the inode's i_size to make sure we do not |
942 | - * lose them after doing a fast fsync and replaying the log. We scan the |
943 | + * lose them after doing a full/fast fsync and replaying the log. We scan the |
944 | * subvolume's root instead of iterating the inode's extent map tree because |
945 | * otherwise we can log incorrect extent items based on extent map conversion. |
946 | * That can happen due to the fact that extent maps are merged when they |
947 | @@ -5042,6 +5060,7 @@ static int copy_inode_items_to_log(struct btrfs_trans_handle *trans, |
948 | struct btrfs_log_ctx *ctx, |
949 | bool *need_log_inode_item) |
950 | { |
951 | + const u64 i_size = i_size_read(&inode->vfs_inode); |
952 | struct btrfs_root *root = inode->root; |
953 | int ins_start_slot = 0; |
954 | int ins_nr = 0; |
955 | @@ -5062,13 +5081,21 @@ again: |
956 | if (min_key->type > max_key->type) |
957 | break; |
958 | |
959 | - if (min_key->type == BTRFS_INODE_ITEM_KEY) |
960 | + if (min_key->type == BTRFS_INODE_ITEM_KEY) { |
961 | *need_log_inode_item = false; |
962 | - |
963 | - if ((min_key->type == BTRFS_INODE_REF_KEY || |
964 | - min_key->type == BTRFS_INODE_EXTREF_KEY) && |
965 | - inode->generation == trans->transid && |
966 | - !recursive_logging) { |
967 | + } else if (min_key->type == BTRFS_EXTENT_DATA_KEY && |
968 | + min_key->offset >= i_size) { |
969 | + /* |
970 | + * Extents at and beyond eof are logged with |
971 | + * btrfs_log_prealloc_extents(). |
972 | + * Only regular files have BTRFS_EXTENT_DATA_KEY keys, |
973 | + * and no keys greater than that, so bail out. |
974 | + */ |
975 | + break; |
976 | + } else if ((min_key->type == BTRFS_INODE_REF_KEY || |
977 | + min_key->type == BTRFS_INODE_EXTREF_KEY) && |
978 | + inode->generation == trans->transid && |
979 | + !recursive_logging) { |
980 | u64 other_ino = 0; |
981 | u64 other_parent = 0; |
982 | |
983 | @@ -5099,10 +5126,8 @@ again: |
984 | btrfs_release_path(path); |
985 | goto next_key; |
986 | } |
987 | - } |
988 | - |
989 | - /* Skip xattrs, we log them later with btrfs_log_all_xattrs() */ |
990 | - if (min_key->type == BTRFS_XATTR_ITEM_KEY) { |
991 | + } else if (min_key->type == BTRFS_XATTR_ITEM_KEY) { |
992 | + /* Skip xattrs, logged later with btrfs_log_all_xattrs() */ |
993 | if (ins_nr == 0) |
994 | goto next_slot; |
995 | ret = copy_items(trans, inode, dst_path, path, |
996 | @@ -5155,9 +5180,21 @@ next_key: |
997 | break; |
998 | } |
999 | } |
1000 | - if (ins_nr) |
1001 | + if (ins_nr) { |
1002 | ret = copy_items(trans, inode, dst_path, path, ins_start_slot, |
1003 | ins_nr, inode_only, logged_isize); |
1004 | + if (ret) |
1005 | + return ret; |
1006 | + } |
1007 | + |
1008 | + if (inode_only == LOG_INODE_ALL && S_ISREG(inode->vfs_inode.i_mode)) { |
1009 | + /* |
1010 | + * Release the path because otherwise we might attempt to double |
1011 | + * lock the same leaf with btrfs_log_prealloc_extents() below. |
1012 | + */ |
1013 | + btrfs_release_path(path); |
1014 | + ret = btrfs_log_prealloc_extents(trans, inode, dst_path); |
1015 | + } |
1016 | |
1017 | return ret; |
1018 | } |
1019 | diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c |
1020 | index 41b3c5fc958c7..f44b6f9d07776 100644 |
1021 | --- a/fs/cifs/cifsfs.c |
1022 | +++ b/fs/cifs/cifsfs.c |
1023 | @@ -855,6 +855,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, |
1024 | |
1025 | out_super: |
1026 | deactivate_locked_super(sb); |
1027 | + return root; |
1028 | out: |
1029 | cifs_cleanup_volume_info(volume_info); |
1030 | return root; |
1031 | diff --git a/include/linux/topology.h b/include/linux/topology.h |
1032 | index eb2fe6edd73c8..64e7ee0abe71c 100644 |
1033 | --- a/include/linux/topology.h |
1034 | +++ b/include/linux/topology.h |
1035 | @@ -48,6 +48,7 @@ int arch_update_cpu_topology(void); |
1036 | /* Conform to ACPI 2.0 SLIT distance definitions */ |
1037 | #define LOCAL_DISTANCE 10 |
1038 | #define REMOTE_DISTANCE 20 |
1039 | +#define DISTANCE_BITS 8 |
1040 | #ifndef node_distance |
1041 | #define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE) |
1042 | #endif |
1043 | diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h |
1044 | index 47088083667b2..c204af20c27e4 100644 |
1045 | --- a/include/net/netfilter/nf_queue.h |
1046 | +++ b/include/net/netfilter/nf_queue.h |
1047 | @@ -34,7 +34,7 @@ void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *q |
1048 | void nf_unregister_queue_handler(struct net *net); |
1049 | void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); |
1050 | |
1051 | -void nf_queue_entry_get_refs(struct nf_queue_entry *entry); |
1052 | +bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); |
1053 | void nf_queue_entry_release_refs(struct nf_queue_entry *entry); |
1054 | |
1055 | static inline void init_hashrandom(u32 *jhash_initval) |
1056 | diff --git a/include/net/xfrm.h b/include/net/xfrm.h |
1057 | index 8ce63850d6d01..614f19bbad74f 100644 |
1058 | --- a/include/net/xfrm.h |
1059 | +++ b/include/net/xfrm.h |
1060 | @@ -1543,7 +1543,6 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); |
1061 | void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
1062 | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); |
1063 | int xfrm_init_replay(struct xfrm_state *x); |
1064 | -u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu); |
1065 | u32 xfrm_state_mtu(struct xfrm_state *x, int mtu); |
1066 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload); |
1067 | int xfrm_init_state(struct xfrm_state *x); |
1068 | diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h |
1069 | index 311a57f3e01a2..7f0ae1f411e3a 100644 |
1070 | --- a/include/uapi/linux/input-event-codes.h |
1071 | +++ b/include/uapi/linux/input-event-codes.h |
1072 | @@ -278,7 +278,8 @@ |
1073 | #define KEY_PAUSECD 201 |
1074 | #define KEY_PROG3 202 |
1075 | #define KEY_PROG4 203 |
1076 | -#define KEY_DASHBOARD 204 /* AL Dashboard */ |
1077 | +#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */ |
1078 | +#define KEY_DASHBOARD KEY_ALL_APPLICATIONS |
1079 | #define KEY_SUSPEND 205 |
1080 | #define KEY_CLOSE 206 /* AC Close */ |
1081 | #define KEY_PLAY 207 |
1082 | @@ -608,6 +609,7 @@ |
1083 | #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */ |
1084 | #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ |
1085 | #define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */ |
1086 | +#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */ |
1087 | |
1088 | #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ |
1089 | #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ |
1090 | diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h |
1091 | index ff7cfdc6cb44d..90a8f968af2f9 100644 |
1092 | --- a/include/uapi/linux/xfrm.h |
1093 | +++ b/include/uapi/linux/xfrm.h |
1094 | @@ -504,6 +504,12 @@ struct xfrm_user_offload { |
1095 | int ifindex; |
1096 | __u8 flags; |
1097 | }; |
1098 | +/* This flag was exposed without any kernel code that supporting it. |
1099 | + * Unfortunately, strongswan has the code that uses sets this flag, |
1100 | + * which makes impossible to reuse this bit. |
1101 | + * |
1102 | + * So leave it here to make sure that it won't be reused by mistake. |
1103 | + */ |
1104 | #define XFRM_OFFLOAD_IPV6 1 |
1105 | #define XFRM_OFFLOAD_INBOUND 2 |
1106 | |
1107 | diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c |
1108 | index ffaa97a8d4051..e5ebaffc4fef5 100644 |
1109 | --- a/kernel/sched/topology.c |
1110 | +++ b/kernel/sched/topology.c |
1111 | @@ -1552,66 +1552,58 @@ static void init_numa_topology_type(void) |
1112 | } |
1113 | } |
1114 | |
1115 | + |
1116 | +#define NR_DISTANCE_VALUES (1 << DISTANCE_BITS) |
1117 | + |
1118 | void sched_init_numa(void) |
1119 | { |
1120 | - int next_distance, curr_distance = node_distance(0, 0); |
1121 | struct sched_domain_topology_level *tl; |
1122 | - int level = 0; |
1123 | - int i, j, k; |
1124 | - |
1125 | - sched_domains_numa_distance = kzalloc(sizeof(int) * (nr_node_ids + 1), GFP_KERNEL); |
1126 | - if (!sched_domains_numa_distance) |
1127 | - return; |
1128 | - |
1129 | - /* Includes NUMA identity node at level 0. */ |
1130 | - sched_domains_numa_distance[level++] = curr_distance; |
1131 | - sched_domains_numa_levels = level; |
1132 | + unsigned long *distance_map; |
1133 | + int nr_levels = 0; |
1134 | + int i, j; |
1135 | |
1136 | /* |
1137 | * O(nr_nodes^2) deduplicating selection sort -- in order to find the |
1138 | * unique distances in the node_distance() table. |
1139 | - * |
1140 | - * Assumes node_distance(0,j) includes all distances in |
1141 | - * node_distance(i,j) in order to avoid cubic time. |
1142 | */ |
1143 | - next_distance = curr_distance; |
1144 | + distance_map = bitmap_alloc(NR_DISTANCE_VALUES, GFP_KERNEL); |
1145 | + if (!distance_map) |
1146 | + return; |
1147 | + |
1148 | + bitmap_zero(distance_map, NR_DISTANCE_VALUES); |
1149 | for (i = 0; i < nr_node_ids; i++) { |
1150 | for (j = 0; j < nr_node_ids; j++) { |
1151 | - for (k = 0; k < nr_node_ids; k++) { |
1152 | - int distance = node_distance(i, k); |
1153 | - |
1154 | - if (distance > curr_distance && |
1155 | - (distance < next_distance || |
1156 | - next_distance == curr_distance)) |
1157 | - next_distance = distance; |
1158 | - |
1159 | - /* |
1160 | - * While not a strong assumption it would be nice to know |
1161 | - * about cases where if node A is connected to B, B is not |
1162 | - * equally connected to A. |
1163 | - */ |
1164 | - if (sched_debug() && node_distance(k, i) != distance) |
1165 | - sched_numa_warn("Node-distance not symmetric"); |
1166 | + int distance = node_distance(i, j); |
1167 | |
1168 | - if (sched_debug() && i && !find_numa_distance(distance)) |
1169 | - sched_numa_warn("Node-0 not representative"); |
1170 | + if (distance < LOCAL_DISTANCE || distance >= NR_DISTANCE_VALUES) { |
1171 | + sched_numa_warn("Invalid distance value range"); |
1172 | + return; |
1173 | } |
1174 | - if (next_distance != curr_distance) { |
1175 | - sched_domains_numa_distance[level++] = next_distance; |
1176 | - sched_domains_numa_levels = level; |
1177 | - curr_distance = next_distance; |
1178 | - } else break; |
1179 | + |
1180 | + bitmap_set(distance_map, distance, 1); |
1181 | } |
1182 | + } |
1183 | + /* |
1184 | + * We can now figure out how many unique distance values there are and |
1185 | + * allocate memory accordingly. |
1186 | + */ |
1187 | + nr_levels = bitmap_weight(distance_map, NR_DISTANCE_VALUES); |
1188 | |
1189 | - /* |
1190 | - * In case of sched_debug() we verify the above assumption. |
1191 | - */ |
1192 | - if (!sched_debug()) |
1193 | - break; |
1194 | + sched_domains_numa_distance = kcalloc(nr_levels, sizeof(int), GFP_KERNEL); |
1195 | + if (!sched_domains_numa_distance) { |
1196 | + bitmap_free(distance_map); |
1197 | + return; |
1198 | + } |
1199 | + |
1200 | + for (i = 0, j = 0; i < nr_levels; i++, j++) { |
1201 | + j = find_next_bit(distance_map, NR_DISTANCE_VALUES, j); |
1202 | + sched_domains_numa_distance[i] = j; |
1203 | } |
1204 | |
1205 | + bitmap_free(distance_map); |
1206 | + |
1207 | /* |
1208 | - * 'level' contains the number of unique distances |
1209 | + * 'nr_levels' contains the number of unique distances |
1210 | * |
1211 | * The sched_domains_numa_distance[] array includes the actual distance |
1212 | * numbers. |
1213 | @@ -1620,15 +1612,15 @@ void sched_init_numa(void) |
1214 | /* |
1215 | * Here, we should temporarily reset sched_domains_numa_levels to 0. |
1216 | * If it fails to allocate memory for array sched_domains_numa_masks[][], |
1217 | - * the array will contain less then 'level' members. This could be |
1218 | + * the array will contain less then 'nr_levels' members. This could be |
1219 | * dangerous when we use it to iterate array sched_domains_numa_masks[][] |
1220 | * in other functions. |
1221 | * |
1222 | - * We reset it to 'level' at the end of this function. |
1223 | + * We reset it to 'nr_levels' at the end of this function. |
1224 | */ |
1225 | sched_domains_numa_levels = 0; |
1226 | |
1227 | - sched_domains_numa_masks = kzalloc(sizeof(void *) * level, GFP_KERNEL); |
1228 | + sched_domains_numa_masks = kzalloc(sizeof(void *) * nr_levels, GFP_KERNEL); |
1229 | if (!sched_domains_numa_masks) |
1230 | return; |
1231 | |
1232 | @@ -1636,7 +1628,7 @@ void sched_init_numa(void) |
1233 | * Now for each level, construct a mask per node which contains all |
1234 | * CPUs of nodes that are that many hops away from us. |
1235 | */ |
1236 | - for (i = 0; i < level; i++) { |
1237 | + for (i = 0; i < nr_levels; i++) { |
1238 | sched_domains_numa_masks[i] = |
1239 | kzalloc(nr_node_ids * sizeof(void *), GFP_KERNEL); |
1240 | if (!sched_domains_numa_masks[i]) |
1241 | @@ -1644,12 +1636,17 @@ void sched_init_numa(void) |
1242 | |
1243 | for (j = 0; j < nr_node_ids; j++) { |
1244 | struct cpumask *mask = kzalloc(cpumask_size(), GFP_KERNEL); |
1245 | + int k; |
1246 | + |
1247 | if (!mask) |
1248 | return; |
1249 | |
1250 | sched_domains_numa_masks[i][j] = mask; |
1251 | |
1252 | for_each_node(k) { |
1253 | + if (sched_debug() && (node_distance(j, k) != node_distance(k, j))) |
1254 | + sched_numa_warn("Node-distance not symmetric"); |
1255 | + |
1256 | if (node_distance(j, k) > sched_domains_numa_distance[i]) |
1257 | continue; |
1258 | |
1259 | @@ -1661,7 +1658,7 @@ void sched_init_numa(void) |
1260 | /* Compute default topology size */ |
1261 | for (i = 0; sched_domain_topology[i].mask; i++); |
1262 | |
1263 | - tl = kzalloc((i + level + 1) * |
1264 | + tl = kzalloc((i + nr_levels + 1) * |
1265 | sizeof(struct sched_domain_topology_level), GFP_KERNEL); |
1266 | if (!tl) |
1267 | return; |
1268 | @@ -1684,7 +1681,7 @@ void sched_init_numa(void) |
1269 | /* |
1270 | * .. and append 'j' levels of NUMA goodness. |
1271 | */ |
1272 | - for (j = 1; j < level; i++, j++) { |
1273 | + for (j = 1; j < nr_levels; i++, j++) { |
1274 | tl[i] = (struct sched_domain_topology_level){ |
1275 | .mask = sd_numa_mask, |
1276 | .sd_flags = cpu_numa_flags, |
1277 | @@ -1696,8 +1693,8 @@ void sched_init_numa(void) |
1278 | |
1279 | sched_domain_topology = tl; |
1280 | |
1281 | - sched_domains_numa_levels = level; |
1282 | - sched_max_numa_distance = sched_domains_numa_distance[level - 1]; |
1283 | + sched_domains_numa_levels = nr_levels; |
1284 | + sched_max_numa_distance = sched_domains_numa_distance[nr_levels - 1]; |
1285 | |
1286 | init_numa_topology_type(); |
1287 | } |
1288 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1289 | index 615259d8fa9ad..1a89b2bf626a5 100644 |
1290 | --- a/kernel/trace/trace.c |
1291 | +++ b/kernel/trace/trace.c |
1292 | @@ -219,7 +219,7 @@ static char trace_boot_options_buf[MAX_TRACER_SIZE] __initdata; |
1293 | static int __init set_trace_boot_options(char *str) |
1294 | { |
1295 | strlcpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); |
1296 | - return 0; |
1297 | + return 1; |
1298 | } |
1299 | __setup("trace_options=", set_trace_boot_options); |
1300 | |
1301 | @@ -230,7 +230,7 @@ static int __init set_trace_boot_clock(char *str) |
1302 | { |
1303 | strlcpy(trace_boot_clock_buf, str, MAX_TRACER_SIZE); |
1304 | trace_boot_clock = trace_boot_clock_buf; |
1305 | - return 0; |
1306 | + return 1; |
1307 | } |
1308 | __setup("trace_clock=", set_trace_boot_clock); |
1309 | |
1310 | diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
1311 | index 3cef24c6391a5..413da11260f89 100644 |
1312 | --- a/kernel/trace/trace_events_hist.c |
1313 | +++ b/kernel/trace/trace_events_hist.c |
1314 | @@ -2891,9 +2891,9 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, |
1315 | /* |
1316 | * For backward compatibility, if field_name |
1317 | * was "cpu", then we treat this the same as |
1318 | - * common_cpu. |
1319 | + * common_cpu. This also works for "CPU". |
1320 | */ |
1321 | - if (strcmp(field_name, "cpu") == 0) { |
1322 | + if (field && field->filter_type == FILTER_CPU) { |
1323 | *flags |= HIST_FIELD_FL_CPU; |
1324 | } else { |
1325 | hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, |
1326 | @@ -5247,7 +5247,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data) |
1327 | |
1328 | if (hist_field->flags & HIST_FIELD_FL_STACKTRACE) |
1329 | cmp_fn = tracing_map_cmp_none; |
1330 | - else if (!field) |
1331 | + else if (!field || hist_field->flags & HIST_FIELD_FL_CPU) |
1332 | cmp_fn = tracing_map_cmp_num(hist_field->size, |
1333 | hist_field->is_signed); |
1334 | else if (is_string_field(field)) |
1335 | diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
1336 | index 13ccf2f28987e..a422cf6a0358b 100644 |
1337 | --- a/kernel/trace/trace_kprobe.c |
1338 | +++ b/kernel/trace/trace_kprobe.c |
1339 | @@ -430,7 +430,7 @@ static int disable_trace_kprobe(struct trace_event_call *call, |
1340 | */ |
1341 | trace_probe_remove_file(tp, file); |
1342 | |
1343 | - return 0; |
1344 | + return 1; |
1345 | } |
1346 | |
1347 | #if defined(CONFIG_DYNAMIC_FTRACE) && \ |
1348 | diff --git a/mm/memfd.c b/mm/memfd.c |
1349 | index 2647c898990c8..fae4142f7d254 100644 |
1350 | --- a/mm/memfd.c |
1351 | +++ b/mm/memfd.c |
1352 | @@ -31,20 +31,28 @@ |
1353 | static void memfd_tag_pins(struct xa_state *xas) |
1354 | { |
1355 | struct page *page; |
1356 | - unsigned int tagged = 0; |
1357 | + int latency = 0; |
1358 | + int cache_count; |
1359 | |
1360 | lru_add_drain(); |
1361 | |
1362 | xas_lock_irq(xas); |
1363 | xas_for_each(xas, page, ULONG_MAX) { |
1364 | - if (xa_is_value(page)) |
1365 | - continue; |
1366 | - page = find_subpage(page, xas->xa_index); |
1367 | - if (page_count(page) - page_mapcount(page) > 1) |
1368 | + cache_count = 1; |
1369 | + if (!xa_is_value(page) && |
1370 | + PageTransHuge(page) && !PageHuge(page)) |
1371 | + cache_count = HPAGE_PMD_NR; |
1372 | + |
1373 | + if (!xa_is_value(page) && |
1374 | + page_count(page) - total_mapcount(page) != cache_count) |
1375 | xas_set_mark(xas, MEMFD_TAG_PINNED); |
1376 | + if (cache_count != 1) |
1377 | + xas_set(xas, page->index + cache_count); |
1378 | |
1379 | - if (++tagged % XA_CHECK_SCHED) |
1380 | + latency += cache_count; |
1381 | + if (latency < XA_CHECK_SCHED) |
1382 | continue; |
1383 | + latency = 0; |
1384 | |
1385 | xas_pause(xas); |
1386 | xas_unlock_irq(xas); |
1387 | @@ -73,7 +81,8 @@ static int memfd_wait_for_pins(struct address_space *mapping) |
1388 | |
1389 | error = 0; |
1390 | for (scan = 0; scan <= LAST_SCAN; scan++) { |
1391 | - unsigned int tagged = 0; |
1392 | + int latency = 0; |
1393 | + int cache_count; |
1394 | |
1395 | if (!xas_marked(&xas, MEMFD_TAG_PINNED)) |
1396 | break; |
1397 | @@ -87,10 +96,14 @@ static int memfd_wait_for_pins(struct address_space *mapping) |
1398 | xas_lock_irq(&xas); |
1399 | xas_for_each_marked(&xas, page, ULONG_MAX, MEMFD_TAG_PINNED) { |
1400 | bool clear = true; |
1401 | - if (xa_is_value(page)) |
1402 | - continue; |
1403 | - page = find_subpage(page, xas.xa_index); |
1404 | - if (page_count(page) - page_mapcount(page) != 1) { |
1405 | + |
1406 | + cache_count = 1; |
1407 | + if (!xa_is_value(page) && |
1408 | + PageTransHuge(page) && !PageHuge(page)) |
1409 | + cache_count = HPAGE_PMD_NR; |
1410 | + |
1411 | + if (!xa_is_value(page) && cache_count != |
1412 | + page_count(page) - total_mapcount(page)) { |
1413 | /* |
1414 | * On the last scan, we clean up all those tags |
1415 | * we inserted; but make a note that we still |
1416 | @@ -103,8 +116,11 @@ static int memfd_wait_for_pins(struct address_space *mapping) |
1417 | } |
1418 | if (clear) |
1419 | xas_clear_mark(&xas, MEMFD_TAG_PINNED); |
1420 | - if (++tagged % XA_CHECK_SCHED) |
1421 | + |
1422 | + latency += cache_count; |
1423 | + if (latency < XA_CHECK_SCHED) |
1424 | continue; |
1425 | + latency = 0; |
1426 | |
1427 | xas_pause(&xas); |
1428 | xas_unlock_irq(&xas); |
1429 | diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c |
1430 | index 18e644f3cb309..5f44c94ad707b 100644 |
1431 | --- a/net/batman-adv/hard-interface.c |
1432 | +++ b/net/batman-adv/hard-interface.c |
1433 | @@ -151,22 +151,25 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) |
1434 | struct net *net = dev_net(net_dev); |
1435 | struct net_device *parent_dev; |
1436 | struct net *parent_net; |
1437 | + int iflink; |
1438 | bool ret; |
1439 | |
1440 | /* check if this is a batman-adv mesh interface */ |
1441 | if (batadv_softif_is_valid(net_dev)) |
1442 | return true; |
1443 | |
1444 | - /* no more parents..stop recursion */ |
1445 | - if (dev_get_iflink(net_dev) == 0 || |
1446 | - dev_get_iflink(net_dev) == net_dev->ifindex) |
1447 | + iflink = dev_get_iflink(net_dev); |
1448 | + if (iflink == 0) |
1449 | return false; |
1450 | |
1451 | parent_net = batadv_getlink_net(net_dev, net); |
1452 | |
1453 | + /* iflink to itself, most likely physical device */ |
1454 | + if (net == parent_net && iflink == net_dev->ifindex) |
1455 | + return false; |
1456 | + |
1457 | /* recurse over the parent device */ |
1458 | - parent_dev = __dev_get_by_index((struct net *)parent_net, |
1459 | - dev_get_iflink(net_dev)); |
1460 | + parent_dev = __dev_get_by_index((struct net *)parent_net, iflink); |
1461 | /* if we got a NULL parent_dev there is something broken.. */ |
1462 | if (!parent_dev) { |
1463 | pr_err("Cannot find parent device\n"); |
1464 | @@ -216,14 +219,15 @@ static struct net_device *batadv_get_real_netdevice(struct net_device *netdev) |
1465 | struct net_device *real_netdev = NULL; |
1466 | struct net *real_net; |
1467 | struct net *net; |
1468 | - int ifindex; |
1469 | + int iflink; |
1470 | |
1471 | ASSERT_RTNL(); |
1472 | |
1473 | if (!netdev) |
1474 | return NULL; |
1475 | |
1476 | - if (netdev->ifindex == dev_get_iflink(netdev)) { |
1477 | + iflink = dev_get_iflink(netdev); |
1478 | + if (iflink == 0) { |
1479 | dev_hold(netdev); |
1480 | return netdev; |
1481 | } |
1482 | @@ -233,9 +237,16 @@ static struct net_device *batadv_get_real_netdevice(struct net_device *netdev) |
1483 | goto out; |
1484 | |
1485 | net = dev_net(hard_iface->soft_iface); |
1486 | - ifindex = dev_get_iflink(netdev); |
1487 | real_net = batadv_getlink_net(netdev, net); |
1488 | - real_netdev = dev_get_by_index(real_net, ifindex); |
1489 | + |
1490 | + /* iflink to itself, most likely physical device */ |
1491 | + if (net == real_net && netdev->ifindex == iflink) { |
1492 | + real_netdev = netdev; |
1493 | + dev_hold(real_netdev); |
1494 | + goto out; |
1495 | + } |
1496 | + |
1497 | + real_netdev = dev_get_by_index(real_net, iflink); |
1498 | |
1499 | out: |
1500 | if (hard_iface) |
1501 | diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c |
1502 | index e9ecbb57df455..b53d5e1d026fe 100644 |
1503 | --- a/net/dcb/dcbnl.c |
1504 | +++ b/net/dcb/dcbnl.c |
1505 | @@ -2063,10 +2063,54 @@ u8 dcb_ieee_getapp_default_prio_mask(const struct net_device *dev) |
1506 | } |
1507 | EXPORT_SYMBOL(dcb_ieee_getapp_default_prio_mask); |
1508 | |
1509 | +static void dcbnl_flush_dev(struct net_device *dev) |
1510 | +{ |
1511 | + struct dcb_app_type *itr, *tmp; |
1512 | + |
1513 | + spin_lock_bh(&dcb_lock); |
1514 | + |
1515 | + list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) { |
1516 | + if (itr->ifindex == dev->ifindex) { |
1517 | + list_del(&itr->list); |
1518 | + kfree(itr); |
1519 | + } |
1520 | + } |
1521 | + |
1522 | + spin_unlock_bh(&dcb_lock); |
1523 | +} |
1524 | + |
1525 | +static int dcbnl_netdevice_event(struct notifier_block *nb, |
1526 | + unsigned long event, void *ptr) |
1527 | +{ |
1528 | + struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1529 | + |
1530 | + switch (event) { |
1531 | + case NETDEV_UNREGISTER: |
1532 | + if (!dev->dcbnl_ops) |
1533 | + return NOTIFY_DONE; |
1534 | + |
1535 | + dcbnl_flush_dev(dev); |
1536 | + |
1537 | + return NOTIFY_OK; |
1538 | + default: |
1539 | + return NOTIFY_DONE; |
1540 | + } |
1541 | +} |
1542 | + |
1543 | +static struct notifier_block dcbnl_nb __read_mostly = { |
1544 | + .notifier_call = dcbnl_netdevice_event, |
1545 | +}; |
1546 | + |
1547 | static int __init dcbnl_init(void) |
1548 | { |
1549 | + int err; |
1550 | + |
1551 | INIT_LIST_HEAD(&dcb_app_list); |
1552 | |
1553 | + err = register_netdevice_notifier(&dcbnl_nb); |
1554 | + if (err) |
1555 | + return err; |
1556 | + |
1557 | rtnl_register(PF_UNSPEC, RTM_GETDCB, dcb_doit, NULL, 0); |
1558 | rtnl_register(PF_UNSPEC, RTM_SETDCB, dcb_doit, NULL, 0); |
1559 | |
1560 | diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c |
1561 | index 86c836fa21459..00210e55b4cd1 100644 |
1562 | --- a/net/ipv4/esp4.c |
1563 | +++ b/net/ipv4/esp4.c |
1564 | @@ -499,7 +499,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
1565 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); |
1566 | u32 padto; |
1567 | |
1568 | - padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached)); |
1569 | + padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); |
1570 | if (skb->len < padto) |
1571 | esp.tfclen = padto - skb->len; |
1572 | } |
1573 | diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c |
1574 | index 12570a73def80..7a739f16d82b2 100644 |
1575 | --- a/net/ipv6/esp6.c |
1576 | +++ b/net/ipv6/esp6.c |
1577 | @@ -440,7 +440,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) |
1578 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); |
1579 | u32 padto; |
1580 | |
1581 | - padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached)); |
1582 | + padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); |
1583 | if (skb->len < padto) |
1584 | esp.tfclen = padto - skb->len; |
1585 | } |
1586 | diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
1587 | index d847aa32628da..918a9520d1f17 100644 |
1588 | --- a/net/ipv6/ip6_output.c |
1589 | +++ b/net/ipv6/ip6_output.c |
1590 | @@ -1361,8 +1361,6 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, |
1591 | if (np->frag_size) |
1592 | mtu = np->frag_size; |
1593 | } |
1594 | - if (mtu < IPV6_MIN_MTU) |
1595 | - return -EINVAL; |
1596 | cork->base.fragsize = mtu; |
1597 | cork->base.gso_size = ipc6->gso_size; |
1598 | cork->base.tx_flags = 0; |
1599 | @@ -1424,8 +1422,6 @@ static int __ip6_append_data(struct sock *sk, |
1600 | |
1601 | fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + |
1602 | (opt ? opt->opt_nflen : 0); |
1603 | - maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - |
1604 | - sizeof(struct frag_hdr); |
1605 | |
1606 | headersize = sizeof(struct ipv6hdr) + |
1607 | (opt ? opt->opt_flen + opt->opt_nflen : 0) + |
1608 | @@ -1433,6 +1429,13 @@ static int __ip6_append_data(struct sock *sk, |
1609 | sizeof(struct frag_hdr) : 0) + |
1610 | rt->rt6i_nfheader_len; |
1611 | |
1612 | + if (mtu < fragheaderlen || |
1613 | + ((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr)) |
1614 | + goto emsgsize; |
1615 | + |
1616 | + maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - |
1617 | + sizeof(struct frag_hdr); |
1618 | + |
1619 | /* as per RFC 7112 section 5, the entire IPv6 Header Chain must fit |
1620 | * the first fragment |
1621 | */ |
1622 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
1623 | index 464029892478f..ab91683d94596 100644 |
1624 | --- a/net/mac80211/rx.c |
1625 | +++ b/net/mac80211/rx.c |
1626 | @@ -2852,13 +2852,13 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) |
1627 | ether_addr_equal(sdata->vif.addr, hdr->addr3)) |
1628 | return RX_CONTINUE; |
1629 | |
1630 | - ac = ieee80211_select_queue_80211(sdata, skb, hdr); |
1631 | + ac = ieee802_1d_to_ac[skb->priority]; |
1632 | q = sdata->vif.hw_queue[ac]; |
1633 | if (ieee80211_queue_stopped(&local->hw, q)) { |
1634 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); |
1635 | return RX_DROP_MONITOR; |
1636 | } |
1637 | - skb_set_queue_mapping(skb, q); |
1638 | + skb_set_queue_mapping(skb, ac); |
1639 | |
1640 | if (!--mesh_hdr->ttl) { |
1641 | if (!is_multicast_ether_addr(hdr->addr1)) |
1642 | diff --git a/net/netfilter/core.c b/net/netfilter/core.c |
1643 | index 5d5bdf4500916..451b2df998ea7 100644 |
1644 | --- a/net/netfilter/core.c |
1645 | +++ b/net/netfilter/core.c |
1646 | @@ -336,14 +336,15 @@ static int __nf_register_net_hook(struct net *net, int pf, |
1647 | p = nf_entry_dereference(*pp); |
1648 | new_hooks = nf_hook_entries_grow(p, reg); |
1649 | |
1650 | - if (!IS_ERR(new_hooks)) |
1651 | + if (!IS_ERR(new_hooks)) { |
1652 | + hooks_validate(new_hooks); |
1653 | rcu_assign_pointer(*pp, new_hooks); |
1654 | + } |
1655 | |
1656 | mutex_unlock(&nf_hook_mutex); |
1657 | if (IS_ERR(new_hooks)) |
1658 | return PTR_ERR(new_hooks); |
1659 | |
1660 | - hooks_validate(new_hooks); |
1661 | #ifdef CONFIG_NETFILTER_INGRESS |
1662 | if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) |
1663 | net_inc_ingress_queue(); |
1664 | diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c |
1665 | index f8f52ff99cfb0..643dbfe7c5815 100644 |
1666 | --- a/net/netfilter/nf_queue.c |
1667 | +++ b/net/netfilter/nf_queue.c |
1668 | @@ -64,6 +64,15 @@ static void nf_queue_entry_release_br_nf_refs(struct sk_buff *skb) |
1669 | #endif |
1670 | } |
1671 | |
1672 | +static void nf_queue_sock_put(struct sock *sk) |
1673 | +{ |
1674 | +#ifdef CONFIG_INET |
1675 | + sock_gen_put(sk); |
1676 | +#else |
1677 | + sock_put(sk); |
1678 | +#endif |
1679 | +} |
1680 | + |
1681 | void nf_queue_entry_release_refs(struct nf_queue_entry *entry) |
1682 | { |
1683 | struct nf_hook_state *state = &entry->state; |
1684 | @@ -74,7 +83,7 @@ void nf_queue_entry_release_refs(struct nf_queue_entry *entry) |
1685 | if (state->out) |
1686 | dev_put(state->out); |
1687 | if (state->sk) |
1688 | - sock_put(state->sk); |
1689 | + nf_queue_sock_put(state->sk); |
1690 | |
1691 | nf_queue_entry_release_br_nf_refs(entry->skb); |
1692 | } |
1693 | @@ -99,18 +108,20 @@ static void nf_queue_entry_get_br_nf_refs(struct sk_buff *skb) |
1694 | } |
1695 | |
1696 | /* Bump dev refs so they don't vanish while packet is out */ |
1697 | -void nf_queue_entry_get_refs(struct nf_queue_entry *entry) |
1698 | +bool nf_queue_entry_get_refs(struct nf_queue_entry *entry) |
1699 | { |
1700 | struct nf_hook_state *state = &entry->state; |
1701 | |
1702 | + if (state->sk && !refcount_inc_not_zero(&state->sk->sk_refcnt)) |
1703 | + return false; |
1704 | + |
1705 | if (state->in) |
1706 | dev_hold(state->in); |
1707 | if (state->out) |
1708 | dev_hold(state->out); |
1709 | - if (state->sk) |
1710 | - sock_hold(state->sk); |
1711 | |
1712 | nf_queue_entry_get_br_nf_refs(entry->skb); |
1713 | + return true; |
1714 | } |
1715 | EXPORT_SYMBOL_GPL(nf_queue_entry_get_refs); |
1716 | |
1717 | @@ -201,7 +212,10 @@ static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, |
1718 | .size = sizeof(*entry) + route_key_size, |
1719 | }; |
1720 | |
1721 | - nf_queue_entry_get_refs(entry); |
1722 | + if (!nf_queue_entry_get_refs(entry)) { |
1723 | + kfree(entry); |
1724 | + return -ENOTCONN; |
1725 | + } |
1726 | |
1727 | switch (entry->state.pf) { |
1728 | case AF_INET: |
1729 | diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c |
1730 | index ca21f8f4a47c1..7d3ab08a5a2d0 100644 |
1731 | --- a/net/netfilter/nfnetlink_queue.c |
1732 | +++ b/net/netfilter/nfnetlink_queue.c |
1733 | @@ -712,9 +712,15 @@ static struct nf_queue_entry * |
1734 | nf_queue_entry_dup(struct nf_queue_entry *e) |
1735 | { |
1736 | struct nf_queue_entry *entry = kmemdup(e, e->size, GFP_ATOMIC); |
1737 | - if (entry) |
1738 | - nf_queue_entry_get_refs(entry); |
1739 | - return entry; |
1740 | + |
1741 | + if (!entry) |
1742 | + return NULL; |
1743 | + |
1744 | + if (nf_queue_entry_get_refs(entry)) |
1745 | + return entry; |
1746 | + |
1747 | + kfree(entry); |
1748 | + return NULL; |
1749 | } |
1750 | |
1751 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
1752 | diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
1753 | index aeea67f908415..12672019f76c5 100644 |
1754 | --- a/net/smc/smc_core.c |
1755 | +++ b/net/smc/smc_core.c |
1756 | @@ -342,8 +342,8 @@ void smc_conn_free(struct smc_connection *conn) |
1757 | } else { |
1758 | smc_cdc_tx_dismiss_slots(conn); |
1759 | } |
1760 | - smc_lgr_unregister_conn(conn); |
1761 | smc_buf_unuse(conn, lgr); /* allow buffer reuse */ |
1762 | + smc_lgr_unregister_conn(conn); |
1763 | conn->lgr = NULL; |
1764 | |
1765 | if (!lgr->conns_num) |
1766 | @@ -632,7 +632,8 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini) |
1767 | !lgr->sync_err && |
1768 | lgr->vlan_id == ini->vlan_id && |
1769 | (role == SMC_CLNT || |
1770 | - lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) { |
1771 | + (lgr->conns_num < SMC_RMBS_PER_LGR_MAX && |
1772 | + !bitmap_full(lgr->rtokens_used_mask, SMC_RMBS_PER_LGR_MAX)))) { |
1773 | /* link group found */ |
1774 | ini->cln_first_contact = SMC_REUSE_CONTACT; |
1775 | conn->lgr = lgr; |
1776 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
1777 | index 7633d6a74bc2b..f2bc465de2845 100644 |
1778 | --- a/net/wireless/nl80211.c |
1779 | +++ b/net/wireless/nl80211.c |
1780 | @@ -12320,6 +12320,9 @@ static int handle_nan_filter(struct nlattr *attr_filter, |
1781 | i = 0; |
1782 | nla_for_each_nested(attr, attr_filter, rem) { |
1783 | filter[i].filter = nla_memdup(attr, GFP_KERNEL); |
1784 | + if (!filter[i].filter) |
1785 | + goto err; |
1786 | + |
1787 | filter[i].len = nla_len(attr); |
1788 | i++; |
1789 | } |
1790 | @@ -12332,6 +12335,15 @@ static int handle_nan_filter(struct nlattr *attr_filter, |
1791 | } |
1792 | |
1793 | return 0; |
1794 | + |
1795 | +err: |
1796 | + i = 0; |
1797 | + nla_for_each_nested(attr, attr_filter, rem) { |
1798 | + kfree(filter[i].filter); |
1799 | + i++; |
1800 | + } |
1801 | + kfree(filter); |
1802 | + return -ENOMEM; |
1803 | } |
1804 | |
1805 | static int nl80211_nan_add_func(struct sk_buff *skb, |
1806 | diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c |
1807 | index bb2292b5260c2..d758e9ec3d008 100644 |
1808 | --- a/net/xfrm/xfrm_device.c |
1809 | +++ b/net/xfrm/xfrm_device.c |
1810 | @@ -206,6 +206,9 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, |
1811 | if (x->encap || x->tfcpad) |
1812 | return -EINVAL; |
1813 | |
1814 | + if (xuo->flags & ~(XFRM_OFFLOAD_IPV6 | XFRM_OFFLOAD_INBOUND)) |
1815 | + return -EINVAL; |
1816 | + |
1817 | dev = dev_get_by_index(net, xuo->ifindex); |
1818 | if (!dev) { |
1819 | if (!(xuo->flags & XFRM_OFFLOAD_INBOUND)) { |
1820 | @@ -243,7 +246,8 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, |
1821 | |
1822 | xso->dev = dev; |
1823 | xso->num_exthdrs = 1; |
1824 | - xso->flags = xuo->flags; |
1825 | + /* Don't forward bit that is not implemented */ |
1826 | + xso->flags = xuo->flags & ~XFRM_OFFLOAD_IPV6; |
1827 | |
1828 | err = dev->xfrmdev_ops->xdo_dev_state_add(x); |
1829 | if (err) { |
1830 | diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
1831 | index 08343201513a9..3932d3aaff270 100644 |
1832 | --- a/net/xfrm/xfrm_interface.c |
1833 | +++ b/net/xfrm/xfrm_interface.c |
1834 | @@ -695,12 +695,12 @@ static int xfrmi_changelink(struct net_device *dev, struct nlattr *tb[], |
1835 | struct net *net = xi->net; |
1836 | struct xfrm_if_parms p = {}; |
1837 | |
1838 | + xfrmi_netlink_parms(data, &p); |
1839 | if (!p.if_id) { |
1840 | NL_SET_ERR_MSG(extack, "if_id must be non zero"); |
1841 | return -EINVAL; |
1842 | } |
1843 | |
1844 | - xfrmi_netlink_parms(data, &p); |
1845 | xi = xfrmi_locate(net, &p); |
1846 | if (!xi) { |
1847 | xi = netdev_priv(dev); |
1848 | diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
1849 | index c6b2c99b501b9..1423e2b7cb42a 100644 |
1850 | --- a/net/xfrm/xfrm_state.c |
1851 | +++ b/net/xfrm/xfrm_state.c |
1852 | @@ -2440,7 +2440,7 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x) |
1853 | } |
1854 | EXPORT_SYMBOL(xfrm_state_delete_tunnel); |
1855 | |
1856 | -u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu) |
1857 | +u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) |
1858 | { |
1859 | const struct xfrm_type *type = READ_ONCE(x->type); |
1860 | struct crypto_aead *aead; |
1861 | @@ -2471,17 +2471,7 @@ u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu) |
1862 | return ((mtu - x->props.header_len - crypto_aead_authsize(aead) - |
1863 | net_adj) & ~(blksize - 1)) + net_adj - 2; |
1864 | } |
1865 | -EXPORT_SYMBOL_GPL(__xfrm_state_mtu); |
1866 | - |
1867 | -u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) |
1868 | -{ |
1869 | - mtu = __xfrm_state_mtu(x, mtu); |
1870 | - |
1871 | - if (x->props.family == AF_INET6 && mtu < IPV6_MIN_MTU) |
1872 | - return IPV6_MIN_MTU; |
1873 | - |
1874 | - return mtu; |
1875 | -} |
1876 | +EXPORT_SYMBOL_GPL(xfrm_state_mtu); |
1877 | |
1878 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload) |
1879 | { |
1880 | diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c |
1881 | index 2fb65f246b0cf..77af5b67b9bb4 100644 |
1882 | --- a/sound/soc/codecs/cs4265.c |
1883 | +++ b/sound/soc/codecs/cs4265.c |
1884 | @@ -150,7 +150,6 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = { |
1885 | SOC_SINGLE("E to F Buffer Disable Switch", CS4265_SPDIF_CTL1, |
1886 | 6, 1, 0), |
1887 | SOC_ENUM("C Data Access", cam_mode_enum), |
1888 | - SOC_SINGLE("SPDIF Switch", CS4265_SPDIF_CTL2, 5, 1, 1), |
1889 | SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2, |
1890 | 3, 1, 0), |
1891 | SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum), |
1892 | @@ -186,7 +185,7 @@ static const struct snd_soc_dapm_widget cs4265_dapm_widgets[] = { |
1893 | |
1894 | SND_SOC_DAPM_SWITCH("Loopback", SND_SOC_NOPM, 0, 0, |
1895 | &loopback_ctl), |
1896 | - SND_SOC_DAPM_SWITCH("SPDIF", SND_SOC_NOPM, 0, 0, |
1897 | + SND_SOC_DAPM_SWITCH("SPDIF", CS4265_SPDIF_CTL2, 5, 1, |
1898 | &spdif_switch), |
1899 | SND_SOC_DAPM_SWITCH("DAC", CS4265_PWRCTL, 1, 1, |
1900 | &dac_switch), |
1901 | diff --git a/sound/soc/codecs/rt5668.c b/sound/soc/codecs/rt5668.c |
1902 | index 5716cede99cb4..acc2b34ca334a 100644 |
1903 | --- a/sound/soc/codecs/rt5668.c |
1904 | +++ b/sound/soc/codecs/rt5668.c |
1905 | @@ -1022,11 +1022,13 @@ static void rt5668_jack_detect_handler(struct work_struct *work) |
1906 | container_of(work, struct rt5668_priv, jack_detect_work.work); |
1907 | int val, btn_type; |
1908 | |
1909 | - while (!rt5668->component) |
1910 | - usleep_range(10000, 15000); |
1911 | - |
1912 | - while (!rt5668->component->card->instantiated) |
1913 | - usleep_range(10000, 15000); |
1914 | + if (!rt5668->component || !rt5668->component->card || |
1915 | + !rt5668->component->card->instantiated) { |
1916 | + /* card not yet ready, try later */ |
1917 | + mod_delayed_work(system_power_efficient_wq, |
1918 | + &rt5668->jack_detect_work, msecs_to_jiffies(15)); |
1919 | + return; |
1920 | + } |
1921 | |
1922 | mutex_lock(&rt5668->calibrate_mutex); |
1923 | |
1924 | diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c |
1925 | index 05e883a65d7a7..a8cf4c7451304 100644 |
1926 | --- a/sound/soc/codecs/rt5682.c |
1927 | +++ b/sound/soc/codecs/rt5682.c |
1928 | @@ -1052,11 +1052,13 @@ static void rt5682_jack_detect_handler(struct work_struct *work) |
1929 | container_of(work, struct rt5682_priv, jack_detect_work.work); |
1930 | int val, btn_type; |
1931 | |
1932 | - while (!rt5682->component) |
1933 | - usleep_range(10000, 15000); |
1934 | - |
1935 | - while (!rt5682->component->card->instantiated) |
1936 | - usleep_range(10000, 15000); |
1937 | + if (!rt5682->component || !rt5682->component->card || |
1938 | + !rt5682->component->card->instantiated) { |
1939 | + /* card not yet ready, try later */ |
1940 | + mod_delayed_work(system_power_efficient_wq, |
1941 | + &rt5682->jack_detect_work, msecs_to_jiffies(15)); |
1942 | + return; |
1943 | + } |
1944 | |
1945 | mutex_lock(&rt5682->calibrate_mutex); |
1946 | |
1947 | diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c |
1948 | index f5dcd625e4355..c88bc6bb41cfe 100644 |
1949 | --- a/sound/soc/soc-ops.c |
1950 | +++ b/sound/soc/soc-ops.c |
1951 | @@ -323,7 +323,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, |
1952 | mask = BIT(sign_bit + 1) - 1; |
1953 | |
1954 | val = ucontrol->value.integer.value[0]; |
1955 | - if (mc->platform_max && val > mc->platform_max) |
1956 | + if (mc->platform_max && ((int)val + min) > mc->platform_max) |
1957 | return -EINVAL; |
1958 | if (val > max - min) |
1959 | return -EINVAL; |
1960 | @@ -336,7 +336,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, |
1961 | val = val << shift; |
1962 | if (snd_soc_volsw_is_stereo(mc)) { |
1963 | val2 = ucontrol->value.integer.value[1]; |
1964 | - if (mc->platform_max && val2 > mc->platform_max) |
1965 | + if (mc->platform_max && ((int)val2 + min) > mc->platform_max) |
1966 | return -EINVAL; |
1967 | if (val2 > max - min) |
1968 | return -EINVAL; |
1969 | diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c |
1970 | index 5fd4e32247a6d..a314f13e3292e 100644 |
1971 | --- a/sound/x86/intel_hdmi_audio.c |
1972 | +++ b/sound/x86/intel_hdmi_audio.c |
1973 | @@ -1279,7 +1279,7 @@ static int had_pcm_mmap(struct snd_pcm_substream *substream, |
1974 | { |
1975 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
1976 | return remap_pfn_range(vma, vma->vm_start, |
1977 | - substream->dma_buffer.addr >> PAGE_SHIFT, |
1978 | + substream->runtime->dma_addr >> PAGE_SHIFT, |
1979 | vma->vm_end - vma->vm_start, vma->vm_page_prot); |
1980 | } |
1981 |