Contents of /trunk/kernel-alx/patches-4.19/0175-4.19.76-all-fixes.patch
Parent Directory | Revision Log
Revision 3472 -
(show annotations)
(download)
Tue Oct 29 10:31:32 2019 UTC (4 years, 7 months ago) by niro
File size: 84518 byte(s)
Tue Oct 29 10:31:32 2019 UTC (4 years, 7 months ago) by niro
File size: 84518 byte(s)
-linux-4.19.76
1 | diff --git a/Makefile b/Makefile |
2 | index 4bf6f24916bf..9cb471a75a1b 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 4 |
8 | PATCHLEVEL = 19 |
9 | -SUBLEVEL = 75 |
10 | +SUBLEVEL = 76 |
11 | EXTRAVERSION = |
12 | NAME = "People's Front" |
13 | |
14 | diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h |
15 | index ff3866473afe..d8d886dee54e 100644 |
16 | --- a/arch/powerpc/include/asm/opal.h |
17 | +++ b/arch/powerpc/include/asm/opal.h |
18 | @@ -275,7 +275,7 @@ int64_t opal_xive_get_vp_info(uint64_t vp, |
19 | int64_t opal_xive_set_vp_info(uint64_t vp, |
20 | uint64_t flags, |
21 | uint64_t report_cl_pair); |
22 | -int64_t opal_xive_allocate_irq(uint32_t chip_id); |
23 | +int64_t opal_xive_allocate_irq_raw(uint32_t chip_id); |
24 | int64_t opal_xive_free_irq(uint32_t girq); |
25 | int64_t opal_xive_sync(uint32_t type, uint32_t id); |
26 | int64_t opal_xive_dump(uint32_t type, uint32_t id); |
27 | diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S |
28 | index f4875fe3f8ff..74215ebda142 100644 |
29 | --- a/arch/powerpc/platforms/powernv/opal-wrappers.S |
30 | +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S |
31 | @@ -303,7 +303,7 @@ OPAL_CALL(opal_xive_set_queue_info, OPAL_XIVE_SET_QUEUE_INFO); |
32 | OPAL_CALL(opal_xive_donate_page, OPAL_XIVE_DONATE_PAGE); |
33 | OPAL_CALL(opal_xive_alloc_vp_block, OPAL_XIVE_ALLOCATE_VP_BLOCK); |
34 | OPAL_CALL(opal_xive_free_vp_block, OPAL_XIVE_FREE_VP_BLOCK); |
35 | -OPAL_CALL(opal_xive_allocate_irq, OPAL_XIVE_ALLOCATE_IRQ); |
36 | +OPAL_CALL(opal_xive_allocate_irq_raw, OPAL_XIVE_ALLOCATE_IRQ); |
37 | OPAL_CALL(opal_xive_free_irq, OPAL_XIVE_FREE_IRQ); |
38 | OPAL_CALL(opal_xive_get_vp_info, OPAL_XIVE_GET_VP_INFO); |
39 | OPAL_CALL(opal_xive_set_vp_info, OPAL_XIVE_SET_VP_INFO); |
40 | diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c |
41 | index 5b20a678d755..6d5b28022452 100644 |
42 | --- a/arch/powerpc/sysdev/xive/native.c |
43 | +++ b/arch/powerpc/sysdev/xive/native.c |
44 | @@ -235,6 +235,17 @@ static bool xive_native_match(struct device_node *node) |
45 | return of_device_is_compatible(node, "ibm,opal-xive-vc"); |
46 | } |
47 | |
48 | +static s64 opal_xive_allocate_irq(u32 chip_id) |
49 | +{ |
50 | + s64 irq = opal_xive_allocate_irq_raw(chip_id); |
51 | + |
52 | + /* |
53 | + * Old versions of skiboot can incorrectly return 0xffffffff to |
54 | + * indicate no space, fix it up here. |
55 | + */ |
56 | + return irq == 0xffffffff ? OPAL_RESOURCE : irq; |
57 | +} |
58 | + |
59 | #ifdef CONFIG_SMP |
60 | static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc) |
61 | { |
62 | diff --git a/block/blk-core.c b/block/blk-core.c |
63 | index af635f878f96..074ae9376189 100644 |
64 | --- a/block/blk-core.c |
65 | +++ b/block/blk-core.c |
66 | @@ -1165,7 +1165,7 @@ int blk_init_allocated_queue(struct request_queue *q) |
67 | { |
68 | WARN_ON_ONCE(q->mq_ops); |
69 | |
70 | - q->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size); |
71 | + q->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size, GFP_KERNEL); |
72 | if (!q->fq) |
73 | return -ENOMEM; |
74 | |
75 | diff --git a/block/blk-flush.c b/block/blk-flush.c |
76 | index 76487948a27f..87fc49daa2b4 100644 |
77 | --- a/block/blk-flush.c |
78 | +++ b/block/blk-flush.c |
79 | @@ -566,12 +566,12 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, |
80 | EXPORT_SYMBOL(blkdev_issue_flush); |
81 | |
82 | struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q, |
83 | - int node, int cmd_size) |
84 | + int node, int cmd_size, gfp_t flags) |
85 | { |
86 | struct blk_flush_queue *fq; |
87 | int rq_sz = sizeof(struct request); |
88 | |
89 | - fq = kzalloc_node(sizeof(*fq), GFP_KERNEL, node); |
90 | + fq = kzalloc_node(sizeof(*fq), flags, node); |
91 | if (!fq) |
92 | goto fail; |
93 | |
94 | @@ -579,7 +579,7 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q, |
95 | spin_lock_init(&fq->mq_flush_lock); |
96 | |
97 | rq_sz = round_up(rq_sz + cmd_size, cache_line_size()); |
98 | - fq->flush_rq = kzalloc_node(rq_sz, GFP_KERNEL, node); |
99 | + fq->flush_rq = kzalloc_node(rq_sz, flags, node); |
100 | if (!fq->flush_rq) |
101 | goto fail_rq; |
102 | |
103 | diff --git a/block/blk-mq.c b/block/blk-mq.c |
104 | index 455fda99255a..7ea85ec52026 100644 |
105 | --- a/block/blk-mq.c |
106 | +++ b/block/blk-mq.c |
107 | @@ -2198,12 +2198,12 @@ static int blk_mq_init_hctx(struct request_queue *q, |
108 | * runtime |
109 | */ |
110 | hctx->ctxs = kmalloc_array_node(nr_cpu_ids, sizeof(void *), |
111 | - GFP_KERNEL, node); |
112 | + GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node); |
113 | if (!hctx->ctxs) |
114 | goto unregister_cpu_notifier; |
115 | |
116 | - if (sbitmap_init_node(&hctx->ctx_map, nr_cpu_ids, ilog2(8), GFP_KERNEL, |
117 | - node)) |
118 | + if (sbitmap_init_node(&hctx->ctx_map, nr_cpu_ids, ilog2(8), |
119 | + GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node)) |
120 | goto free_ctxs; |
121 | |
122 | hctx->nr_ctx = 0; |
123 | @@ -2216,7 +2216,8 @@ static int blk_mq_init_hctx(struct request_queue *q, |
124 | set->ops->init_hctx(hctx, set->driver_data, hctx_idx)) |
125 | goto free_bitmap; |
126 | |
127 | - hctx->fq = blk_alloc_flush_queue(q, hctx->numa_node, set->cmd_size); |
128 | + hctx->fq = blk_alloc_flush_queue(q, hctx->numa_node, set->cmd_size, |
129 | + GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY); |
130 | if (!hctx->fq) |
131 | goto exit_hctx; |
132 | |
133 | @@ -2460,8 +2461,6 @@ void blk_mq_release(struct request_queue *q) |
134 | struct blk_mq_hw_ctx *hctx; |
135 | unsigned int i; |
136 | |
137 | - cancel_delayed_work_sync(&q->requeue_work); |
138 | - |
139 | /* hctx kobj stays in hctx */ |
140 | queue_for_each_hw_ctx(q, hctx, i) { |
141 | if (!hctx) |
142 | @@ -2530,12 +2529,14 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set, |
143 | |
144 | node = blk_mq_hw_queue_to_node(q->mq_map, i); |
145 | hctxs[i] = kzalloc_node(blk_mq_hw_ctx_size(set), |
146 | - GFP_KERNEL, node); |
147 | + GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, |
148 | + node); |
149 | if (!hctxs[i]) |
150 | break; |
151 | |
152 | - if (!zalloc_cpumask_var_node(&hctxs[i]->cpumask, GFP_KERNEL, |
153 | - node)) { |
154 | + if (!zalloc_cpumask_var_node(&hctxs[i]->cpumask, |
155 | + GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, |
156 | + node)) { |
157 | kfree(hctxs[i]); |
158 | hctxs[i] = NULL; |
159 | break; |
160 | diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c |
161 | index 3772671cf2bc..bab47a17b96f 100644 |
162 | --- a/block/blk-sysfs.c |
163 | +++ b/block/blk-sysfs.c |
164 | @@ -836,6 +836,9 @@ static void __blk_release_queue(struct work_struct *work) |
165 | |
166 | blk_free_queue_stats(q->stats); |
167 | |
168 | + if (q->mq_ops) |
169 | + cancel_delayed_work_sync(&q->requeue_work); |
170 | + |
171 | blk_exit_rl(q, &q->root_rl); |
172 | |
173 | if (q->queue_tags) |
174 | diff --git a/block/blk.h b/block/blk.h |
175 | index 977d4b5d968d..11e4ca2f2cd4 100644 |
176 | --- a/block/blk.h |
177 | +++ b/block/blk.h |
178 | @@ -124,7 +124,7 @@ static inline void __blk_get_queue(struct request_queue *q) |
179 | } |
180 | |
181 | struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q, |
182 | - int node, int cmd_size); |
183 | + int node, int cmd_size, gfp_t flags); |
184 | void blk_free_flush_queue(struct blk_flush_queue *q); |
185 | |
186 | int blk_init_rl(struct request_list *rl, struct request_queue *q, |
187 | diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c |
188 | index d73afb562ad9..1a23e7aa74df 100644 |
189 | --- a/drivers/acpi/acpi_video.c |
190 | +++ b/drivers/acpi/acpi_video.c |
191 | @@ -73,6 +73,12 @@ module_param(report_key_events, int, 0644); |
192 | MODULE_PARM_DESC(report_key_events, |
193 | "0: none, 1: output changes, 2: brightness changes, 3: all"); |
194 | |
195 | +static int hw_changes_brightness = -1; |
196 | +module_param(hw_changes_brightness, int, 0644); |
197 | +MODULE_PARM_DESC(hw_changes_brightness, |
198 | + "Set this to 1 on buggy hw which changes the brightness itself when " |
199 | + "a hotkey is pressed: -1: auto, 0: normal 1: hw-changes-brightness"); |
200 | + |
201 | /* |
202 | * Whether the struct acpi_video_device_attrib::device_id_scheme bit should be |
203 | * assumed even if not actually set. |
204 | @@ -418,6 +424,14 @@ static int video_set_report_key_events(const struct dmi_system_id *id) |
205 | return 0; |
206 | } |
207 | |
208 | +static int video_hw_changes_brightness( |
209 | + const struct dmi_system_id *d) |
210 | +{ |
211 | + if (hw_changes_brightness == -1) |
212 | + hw_changes_brightness = 1; |
213 | + return 0; |
214 | +} |
215 | + |
216 | static const struct dmi_system_id video_dmi_table[] = { |
217 | /* |
218 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
219 | @@ -542,6 +556,21 @@ static const struct dmi_system_id video_dmi_table[] = { |
220 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), |
221 | }, |
222 | }, |
223 | + /* |
224 | + * Some machines change the brightness themselves when a brightness |
225 | + * hotkey gets pressed, despite us telling them not to. In this case |
226 | + * acpi_video_device_notify() should only call backlight_force_update( |
227 | + * BACKLIGHT_UPDATE_HOTKEY) and not do anything else. |
228 | + */ |
229 | + { |
230 | + /* https://bugzilla.kernel.org/show_bug.cgi?id=204077 */ |
231 | + .callback = video_hw_changes_brightness, |
232 | + .ident = "Packard Bell EasyNote MZ35", |
233 | + .matches = { |
234 | + DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"), |
235 | + DMI_MATCH(DMI_PRODUCT_NAME, "EasyNote MZ35"), |
236 | + }, |
237 | + }, |
238 | {} |
239 | }; |
240 | |
241 | @@ -1625,6 +1654,14 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) |
242 | bus = video_device->video; |
243 | input = bus->input; |
244 | |
245 | + if (hw_changes_brightness > 0) { |
246 | + if (video_device->backlight) |
247 | + backlight_force_update(video_device->backlight, |
248 | + BACKLIGHT_UPDATE_HOTKEY); |
249 | + acpi_notifier_call_chain(device, event, 0); |
250 | + return; |
251 | + } |
252 | + |
253 | switch (event) { |
254 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ |
255 | brightness_switch_event(video_device, event); |
256 | diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c |
257 | index 1342f8e6025c..8d1cd2479e36 100644 |
258 | --- a/drivers/bluetooth/btrtl.c |
259 | +++ b/drivers/bluetooth/btrtl.c |
260 | @@ -639,6 +639,26 @@ int btrtl_setup_realtek(struct hci_dev *hdev) |
261 | } |
262 | EXPORT_SYMBOL_GPL(btrtl_setup_realtek); |
263 | |
264 | +int btrtl_shutdown_realtek(struct hci_dev *hdev) |
265 | +{ |
266 | + struct sk_buff *skb; |
267 | + int ret; |
268 | + |
269 | + /* According to the vendor driver, BT must be reset on close to avoid |
270 | + * firmware crash. |
271 | + */ |
272 | + skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); |
273 | + if (IS_ERR(skb)) { |
274 | + ret = PTR_ERR(skb); |
275 | + bt_dev_err(hdev, "HCI reset during shutdown failed"); |
276 | + return ret; |
277 | + } |
278 | + kfree_skb(skb); |
279 | + |
280 | + return 0; |
281 | +} |
282 | +EXPORT_SYMBOL_GPL(btrtl_shutdown_realtek); |
283 | + |
284 | static unsigned int btrtl_convert_baudrate(u32 device_baudrate) |
285 | { |
286 | switch (device_baudrate) { |
287 | diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h |
288 | index f5e36f3993a8..852f27d4ee28 100644 |
289 | --- a/drivers/bluetooth/btrtl.h |
290 | +++ b/drivers/bluetooth/btrtl.h |
291 | @@ -65,6 +65,7 @@ void btrtl_free(struct btrtl_device_info *btrtl_dev); |
292 | int btrtl_download_firmware(struct hci_dev *hdev, |
293 | struct btrtl_device_info *btrtl_dev); |
294 | int btrtl_setup_realtek(struct hci_dev *hdev); |
295 | +int btrtl_shutdown_realtek(struct hci_dev *hdev); |
296 | int btrtl_get_uart_settings(struct hci_dev *hdev, |
297 | struct btrtl_device_info *btrtl_dev, |
298 | unsigned int *controller_baudrate, |
299 | @@ -93,6 +94,11 @@ static inline int btrtl_setup_realtek(struct hci_dev *hdev) |
300 | return -EOPNOTSUPP; |
301 | } |
302 | |
303 | +static inline int btrtl_shutdown_realtek(struct hci_dev *hdev) |
304 | +{ |
305 | + return -EOPNOTSUPP; |
306 | +} |
307 | + |
308 | static inline int btrtl_get_uart_settings(struct hci_dev *hdev, |
309 | struct btrtl_device_info *btrtl_dev, |
310 | unsigned int *controller_baudrate, |
311 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
312 | index 09c83dc2ef67..08936bf696d3 100644 |
313 | --- a/drivers/bluetooth/btusb.c |
314 | +++ b/drivers/bluetooth/btusb.c |
315 | @@ -391,6 +391,9 @@ static const struct usb_device_id blacklist_table[] = { |
316 | { USB_DEVICE(0x13d3, 0x3526), .driver_info = BTUSB_REALTEK }, |
317 | { USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK }, |
318 | |
319 | + /* Additional Realtek 8822CE Bluetooth devices */ |
320 | + { USB_DEVICE(0x04ca, 0x4005), .driver_info = BTUSB_REALTEK }, |
321 | + |
322 | /* Silicon Wave based devices */ |
323 | { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE }, |
324 | |
325 | @@ -3128,6 +3131,7 @@ static int btusb_probe(struct usb_interface *intf, |
326 | #ifdef CONFIG_BT_HCIBTUSB_RTL |
327 | if (id->driver_info & BTUSB_REALTEK) { |
328 | hdev->setup = btrtl_setup_realtek; |
329 | + hdev->shutdown = btrtl_shutdown_realtek; |
330 | |
331 | /* Realtek devices lose their updated firmware over suspend, |
332 | * but the USB hub doesn't notice any status change. |
333 | diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
334 | index 064315edd289..634ae487c372 100644 |
335 | --- a/drivers/crypto/talitos.c |
336 | +++ b/drivers/crypto/talitos.c |
337 | @@ -3124,6 +3124,7 @@ static int talitos_remove(struct platform_device *ofdev) |
338 | break; |
339 | case CRYPTO_ALG_TYPE_AEAD: |
340 | crypto_unregister_aead(&t_alg->algt.alg.aead); |
341 | + break; |
342 | case CRYPTO_ALG_TYPE_AHASH: |
343 | crypto_unregister_ahash(&t_alg->algt.alg.hash); |
344 | break; |
345 | diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile b/drivers/gpu/drm/amd/display/dc/calcs/Makefile |
346 | index 95f332ee3e7e..16614d73a5fc 100644 |
347 | --- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile |
348 | +++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile |
349 | @@ -32,6 +32,10 @@ endif |
350 | |
351 | calcs_ccflags := -mhard-float -msse $(cc_stack_align) |
352 | |
353 | +ifdef CONFIG_CC_IS_CLANG |
354 | +calcs_ccflags += -msse2 |
355 | +endif |
356 | + |
357 | CFLAGS_dcn_calcs.o := $(calcs_ccflags) |
358 | CFLAGS_dcn_calc_auto.o := $(calcs_ccflags) |
359 | CFLAGS_dcn_calc_math.o := $(calcs_ccflags) -Wno-tautological-compare |
360 | diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile |
361 | index d97ca6528f9d..934ffe1b4b00 100644 |
362 | --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile |
363 | +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile |
364 | @@ -32,6 +32,10 @@ endif |
365 | |
366 | dml_ccflags := -mhard-float -msse $(cc_stack_align) |
367 | |
368 | +ifdef CONFIG_CC_IS_CLANG |
369 | +dml_ccflags += -msse2 |
370 | +endif |
371 | + |
372 | CFLAGS_display_mode_lib.o := $(dml_ccflags) |
373 | CFLAGS_display_pipe_clocks.o := $(dml_ccflags) |
374 | CFLAGS_dml1_display_rq_dlg_calc.o := $(dml_ccflags) |
375 | diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
376 | index c9a15baf2c10..0adfc5392cd3 100644 |
377 | --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
378 | +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c |
379 | @@ -1222,17 +1222,14 @@ static int smu8_dpm_force_dpm_level(struct pp_hwmgr *hwmgr, |
380 | |
381 | static int smu8_dpm_powerdown_uvd(struct pp_hwmgr *hwmgr) |
382 | { |
383 | - if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) { |
384 | - smu8_nbdpm_pstate_enable_disable(hwmgr, true, true); |
385 | + if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) |
386 | return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_UVDPowerOFF); |
387 | - } |
388 | return 0; |
389 | } |
390 | |
391 | static int smu8_dpm_powerup_uvd(struct pp_hwmgr *hwmgr) |
392 | { |
393 | if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) { |
394 | - smu8_nbdpm_pstate_enable_disable(hwmgr, false, true); |
395 | return smum_send_msg_to_smc_with_parameter( |
396 | hwmgr, |
397 | PPSMC_MSG_UVDPowerON, |
398 | diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c |
399 | index d18b7e27ef64..c0b26135dbd5 100644 |
400 | --- a/drivers/gpu/drm/drm_probe_helper.c |
401 | +++ b/drivers/gpu/drm/drm_probe_helper.c |
402 | @@ -581,6 +581,9 @@ static void output_poll_execute(struct work_struct *work) |
403 | enum drm_connector_status old_status; |
404 | bool repoll = false, changed; |
405 | |
406 | + if (!dev->mode_config.poll_enabled) |
407 | + return; |
408 | + |
409 | /* Pick up any changes detected by the probe functions. */ |
410 | changed = dev->mode_config.delayed_event; |
411 | dev->mode_config.delayed_event = false; |
412 | @@ -735,7 +738,11 @@ EXPORT_SYMBOL(drm_kms_helper_poll_init); |
413 | */ |
414 | void drm_kms_helper_poll_fini(struct drm_device *dev) |
415 | { |
416 | - drm_kms_helper_poll_disable(dev); |
417 | + if (!dev->mode_config.poll_enabled) |
418 | + return; |
419 | + |
420 | + dev->mode_config.poll_enabled = false; |
421 | + cancel_delayed_work_sync(&dev->mode_config.output_poll_work); |
422 | } |
423 | EXPORT_SYMBOL(drm_kms_helper_poll_fini); |
424 | |
425 | diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c |
426 | index d81a99bb2ac3..b041ffb3af27 100644 |
427 | --- a/drivers/gpu/drm/nouveau/dispnv50/head.c |
428 | +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c |
429 | @@ -169,14 +169,34 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh, |
430 | */ |
431 | switch (mode) { |
432 | case DRM_MODE_SCALE_CENTER: |
433 | - asyh->view.oW = min((u16)umode->hdisplay, asyh->view.oW); |
434 | - asyh->view.oH = min((u16)umode_vdisplay, asyh->view.oH); |
435 | - /* fall-through */ |
436 | + /* NOTE: This will cause scaling when the input is |
437 | + * larger than the output. |
438 | + */ |
439 | + asyh->view.oW = min(asyh->view.iW, asyh->view.oW); |
440 | + asyh->view.oH = min(asyh->view.iH, asyh->view.oH); |
441 | + break; |
442 | case DRM_MODE_SCALE_ASPECT: |
443 | - if (asyh->view.oH < asyh->view.oW) { |
444 | + /* Determine whether the scaling should be on width or on |
445 | + * height. This is done by comparing the aspect ratios of the |
446 | + * sizes. If the output AR is larger than input AR, that means |
447 | + * we want to change the width (letterboxed on the |
448 | + * left/right), otherwise on the height (letterboxed on the |
449 | + * top/bottom). |
450 | + * |
451 | + * E.g. 4:3 (1.333) AR image displayed on a 16:10 (1.6) AR |
452 | + * screen will have letterboxes on the left/right. However a |
453 | + * 16:9 (1.777) AR image on that same screen will have |
454 | + * letterboxes on the top/bottom. |
455 | + * |
456 | + * inputAR = iW / iH; outputAR = oW / oH |
457 | + * outputAR > inputAR is equivalent to oW * iH > iW * oH |
458 | + */ |
459 | + if (asyh->view.oW * asyh->view.iH > asyh->view.iW * asyh->view.oH) { |
460 | + /* Recompute output width, i.e. left/right letterbox */ |
461 | u32 r = (asyh->view.iW << 19) / asyh->view.iH; |
462 | asyh->view.oW = ((asyh->view.oH * r) + (r / 2)) >> 19; |
463 | } else { |
464 | + /* Recompute output height, i.e. top/bottom letterbox */ |
465 | u32 r = (asyh->view.iH << 19) / asyh->view.iW; |
466 | asyh->view.oH = ((asyh->view.oW * r) + (r / 2)) >> 19; |
467 | } |
468 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
469 | index 4a2fa57ddcb8..0eeb273fb73d 100644 |
470 | --- a/drivers/hid/hid-ids.h |
471 | +++ b/drivers/hid/hid-ids.h |
472 | @@ -559,6 +559,7 @@ |
473 | #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A 0x0b4a |
474 | #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a |
475 | #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A 0x094a |
476 | +#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0941 0x0941 |
477 | #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641 0x0641 |
478 | |
479 | #define USB_VENDOR_ID_HUION 0x256c |
480 | diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c |
481 | index 596227ddb6e0..17d6123f7930 100644 |
482 | --- a/drivers/hid/hid-lg.c |
483 | +++ b/drivers/hid/hid-lg.c |
484 | @@ -763,7 +763,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) |
485 | |
486 | if (!buf) { |
487 | ret = -ENOMEM; |
488 | - goto err_free; |
489 | + goto err_stop; |
490 | } |
491 | |
492 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), |
493 | @@ -795,9 +795,12 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) |
494 | ret = lg4ff_init(hdev); |
495 | |
496 | if (ret) |
497 | - goto err_free; |
498 | + goto err_stop; |
499 | |
500 | return 0; |
501 | + |
502 | +err_stop: |
503 | + hid_hw_stop(hdev); |
504 | err_free: |
505 | kfree(drv_data); |
506 | return ret; |
507 | @@ -808,8 +811,7 @@ static void lg_remove(struct hid_device *hdev) |
508 | struct lg_drv_data *drv_data = hid_get_drvdata(hdev); |
509 | if (drv_data->quirks & LG_FF4) |
510 | lg4ff_deinit(hdev); |
511 | - else |
512 | - hid_hw_stop(hdev); |
513 | + hid_hw_stop(hdev); |
514 | kfree(drv_data); |
515 | } |
516 | |
517 | diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c |
518 | index 512d67e1aae3..4b26928cb2b6 100644 |
519 | --- a/drivers/hid/hid-lg4ff.c |
520 | +++ b/drivers/hid/hid-lg4ff.c |
521 | @@ -1483,7 +1483,6 @@ int lg4ff_deinit(struct hid_device *hid) |
522 | } |
523 | } |
524 | #endif |
525 | - hid_hw_stop(hid); |
526 | drv_data->device_props = NULL; |
527 | |
528 | kfree(entry); |
529 | diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c |
530 | index 87eda34ea2f8..d3773251b374 100644 |
531 | --- a/drivers/hid/hid-prodikeys.c |
532 | +++ b/drivers/hid/hid-prodikeys.c |
533 | @@ -555,10 +555,14 @@ static void pcmidi_setup_extra_keys( |
534 | |
535 | static int pcmidi_set_operational(struct pcmidi_snd *pm) |
536 | { |
537 | + int rc; |
538 | + |
539 | if (pm->ifnum != 1) |
540 | return 0; /* only set up ONCE for interace 1 */ |
541 | |
542 | - pcmidi_get_output_report(pm); |
543 | + rc = pcmidi_get_output_report(pm); |
544 | + if (rc < 0) |
545 | + return rc; |
546 | pcmidi_submit_output_report(pm, 0xc1); |
547 | return 0; |
548 | } |
549 | @@ -687,7 +691,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) |
550 | spin_lock_init(&pm->rawmidi_in_lock); |
551 | |
552 | init_sustain_timers(pm); |
553 | - pcmidi_set_operational(pm); |
554 | + err = pcmidi_set_operational(pm); |
555 | + if (err < 0) { |
556 | + pk_error("failed to find output report\n"); |
557 | + goto fail_register; |
558 | + } |
559 | |
560 | /* register it */ |
561 | err = snd_card_register(card); |
562 | diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
563 | index e553f6fae7a4..a407fd2399ff 100644 |
564 | --- a/drivers/hid/hid-quirks.c |
565 | +++ b/drivers/hid/hid-quirks.c |
566 | @@ -94,6 +94,7 @@ static const struct hid_device_id hid_quirks[] = { |
567 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A), HID_QUIRK_ALWAYS_POLL }, |
568 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, |
569 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A), HID_QUIRK_ALWAYS_POLL }, |
570 | + { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0941), HID_QUIRK_ALWAYS_POLL }, |
571 | { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641), HID_QUIRK_ALWAYS_POLL }, |
572 | { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT }, |
573 | { HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT }, |
574 | diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c |
575 | index 31f1023214d3..09f2c617b09f 100644 |
576 | --- a/drivers/hid/hid-sony.c |
577 | +++ b/drivers/hid/hid-sony.c |
578 | @@ -2806,7 +2806,6 @@ err_stop: |
579 | sony_cancel_work_sync(sc); |
580 | sony_remove_dev_list(sc); |
581 | sony_release_device_id(sc); |
582 | - hid_hw_stop(hdev); |
583 | return ret; |
584 | } |
585 | |
586 | @@ -2868,6 +2867,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) |
587 | */ |
588 | if (!(hdev->claimed & HID_CLAIMED_INPUT)) { |
589 | hid_err(hdev, "failed to claim input\n"); |
590 | + hid_hw_stop(hdev); |
591 | return -ENODEV; |
592 | } |
593 | |
594 | diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c |
595 | index 4a44e48e08b2..c7cff929b419 100644 |
596 | --- a/drivers/hid/hidraw.c |
597 | +++ b/drivers/hid/hidraw.c |
598 | @@ -378,7 +378,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, |
599 | |
600 | mutex_lock(&minors_lock); |
601 | dev = hidraw_table[minor]; |
602 | - if (!dev) { |
603 | + if (!dev || !dev->exist) { |
604 | ret = -ENODEV; |
605 | goto out; |
606 | } |
607 | diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c |
608 | index af5ad6a56ae4..9271f7290005 100644 |
609 | --- a/drivers/infiniband/core/cq.c |
610 | +++ b/drivers/infiniband/core/cq.c |
611 | @@ -112,12 +112,12 @@ static void ib_cq_poll_work(struct work_struct *work) |
612 | IB_POLL_BATCH); |
613 | if (completed >= IB_POLL_BUDGET_WORKQUEUE || |
614 | ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0) |
615 | - queue_work(ib_comp_wq, &cq->work); |
616 | + queue_work(cq->comp_wq, &cq->work); |
617 | } |
618 | |
619 | static void ib_cq_completion_workqueue(struct ib_cq *cq, void *private) |
620 | { |
621 | - queue_work(ib_comp_wq, &cq->work); |
622 | + queue_work(cq->comp_wq, &cq->work); |
623 | } |
624 | |
625 | /** |
626 | @@ -175,9 +175,12 @@ struct ib_cq *__ib_alloc_cq(struct ib_device *dev, void *private, |
627 | ib_req_notify_cq(cq, IB_CQ_NEXT_COMP); |
628 | break; |
629 | case IB_POLL_WORKQUEUE: |
630 | + case IB_POLL_UNBOUND_WORKQUEUE: |
631 | cq->comp_handler = ib_cq_completion_workqueue; |
632 | INIT_WORK(&cq->work, ib_cq_poll_work); |
633 | ib_req_notify_cq(cq, IB_CQ_NEXT_COMP); |
634 | + cq->comp_wq = (cq->poll_ctx == IB_POLL_WORKQUEUE) ? |
635 | + ib_comp_wq : ib_comp_unbound_wq; |
636 | break; |
637 | default: |
638 | ret = -EINVAL; |
639 | @@ -213,6 +216,7 @@ void ib_free_cq(struct ib_cq *cq) |
640 | irq_poll_disable(&cq->iop); |
641 | break; |
642 | case IB_POLL_WORKQUEUE: |
643 | + case IB_POLL_UNBOUND_WORKQUEUE: |
644 | cancel_work_sync(&cq->work); |
645 | break; |
646 | default: |
647 | diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
648 | index db3b6271f09d..6d8ac51a39cc 100644 |
649 | --- a/drivers/infiniband/core/device.c |
650 | +++ b/drivers/infiniband/core/device.c |
651 | @@ -61,6 +61,7 @@ struct ib_client_data { |
652 | }; |
653 | |
654 | struct workqueue_struct *ib_comp_wq; |
655 | +struct workqueue_struct *ib_comp_unbound_wq; |
656 | struct workqueue_struct *ib_wq; |
657 | EXPORT_SYMBOL_GPL(ib_wq); |
658 | |
659 | @@ -1166,10 +1167,19 @@ static int __init ib_core_init(void) |
660 | goto err; |
661 | } |
662 | |
663 | + ib_comp_unbound_wq = |
664 | + alloc_workqueue("ib-comp-unb-wq", |
665 | + WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM | |
666 | + WQ_SYSFS, WQ_UNBOUND_MAX_ACTIVE); |
667 | + if (!ib_comp_unbound_wq) { |
668 | + ret = -ENOMEM; |
669 | + goto err_comp; |
670 | + } |
671 | + |
672 | ret = class_register(&ib_class); |
673 | if (ret) { |
674 | pr_warn("Couldn't create InfiniBand device class\n"); |
675 | - goto err_comp; |
676 | + goto err_comp_unbound; |
677 | } |
678 | |
679 | ret = rdma_nl_init(); |
680 | @@ -1218,6 +1228,8 @@ err_ibnl: |
681 | rdma_nl_exit(); |
682 | err_sysfs: |
683 | class_unregister(&ib_class); |
684 | +err_comp_unbound: |
685 | + destroy_workqueue(ib_comp_unbound_wq); |
686 | err_comp: |
687 | destroy_workqueue(ib_comp_wq); |
688 | err: |
689 | @@ -1236,6 +1248,7 @@ static void __exit ib_core_cleanup(void) |
690 | addr_cleanup(); |
691 | rdma_nl_exit(); |
692 | class_unregister(&ib_class); |
693 | + destroy_workqueue(ib_comp_unbound_wq); |
694 | destroy_workqueue(ib_comp_wq); |
695 | /* Make sure that any pending umem accounting work is done. */ |
696 | destroy_workqueue(ib_wq); |
697 | diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c |
698 | index 7586c1dd73f1..74aa3e651bc3 100644 |
699 | --- a/drivers/infiniband/core/mad.c |
700 | +++ b/drivers/infiniband/core/mad.c |
701 | @@ -3190,7 +3190,7 @@ static int ib_mad_port_open(struct ib_device *device, |
702 | } |
703 | |
704 | port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0, |
705 | - IB_POLL_WORKQUEUE); |
706 | + IB_POLL_UNBOUND_WORKQUEUE); |
707 | if (IS_ERR(port_priv->cq)) { |
708 | dev_err(&device->dev, "Couldn't create ib_mad CQ\n"); |
709 | ret = PTR_ERR(port_priv->cq); |
710 | diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c |
711 | index f67fa24b3aff..279f0ae65912 100644 |
712 | --- a/drivers/infiniband/core/restrack.c |
713 | +++ b/drivers/infiniband/core/restrack.c |
714 | @@ -225,7 +225,9 @@ void rdma_restrack_del(struct rdma_restrack_entry *res) |
715 | up_write(&dev->res.rwsem); |
716 | |
717 | out: |
718 | - if (res->task) |
719 | + if (res->task) { |
720 | put_task_struct(res->task); |
721 | + res->task = NULL; |
722 | + } |
723 | } |
724 | EXPORT_SYMBOL(rdma_restrack_del); |
725 | diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
726 | index 9ba73e11757d..e7549a2b1482 100644 |
727 | --- a/drivers/irqchip/irq-gic-v3-its.c |
728 | +++ b/drivers/irqchip/irq-gic-v3-its.c |
729 | @@ -2514,14 +2514,13 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, |
730 | struct its_node *its = its_dev->its; |
731 | int i; |
732 | |
733 | + bitmap_release_region(its_dev->event_map.lpi_map, |
734 | + its_get_event_id(irq_domain_get_irq_data(domain, virq)), |
735 | + get_count_order(nr_irqs)); |
736 | + |
737 | for (i = 0; i < nr_irqs; i++) { |
738 | struct irq_data *data = irq_domain_get_irq_data(domain, |
739 | virq + i); |
740 | - u32 event = its_get_event_id(data); |
741 | - |
742 | - /* Mark interrupt index as unused */ |
743 | - clear_bit(event, its_dev->event_map.lpi_map); |
744 | - |
745 | /* Nuke the entry in the domain */ |
746 | irq_domain_reset_irq_data(data); |
747 | } |
748 | diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
749 | index e6c7a84bb1df..2321643974da 100644 |
750 | --- a/drivers/md/bcache/super.c |
751 | +++ b/drivers/md/bcache/super.c |
752 | @@ -1768,7 +1768,6 @@ static int run_cache_set(struct cache_set *c) |
753 | set_gc_sectors(c); |
754 | |
755 | if (CACHE_SYNC(&c->sb)) { |
756 | - LIST_HEAD(journal); |
757 | struct bkey *k; |
758 | struct jset *j; |
759 | |
760 | diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c |
761 | index 1030c42add05..3dd668f69405 100644 |
762 | --- a/drivers/md/dm-zoned-target.c |
763 | +++ b/drivers/md/dm-zoned-target.c |
764 | @@ -133,8 +133,6 @@ static int dmz_submit_bio(struct dmz_target *dmz, struct dm_zone *zone, |
765 | |
766 | atomic_inc(&bioctx->ref); |
767 | generic_make_request(clone); |
768 | - if (clone->bi_status == BLK_STS_IOERR) |
769 | - return -EIO; |
770 | |
771 | if (bio_op(bio) == REQ_OP_WRITE && dmz_is_seq(zone)) |
772 | zone->wp_block += nr_blocks; |
773 | diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c |
774 | index 8b450fc53202..15a5e98b3d45 100644 |
775 | --- a/drivers/media/i2c/tvp5150.c |
776 | +++ b/drivers/media/i2c/tvp5150.c |
777 | @@ -828,7 +828,7 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl) |
778 | return 0; |
779 | case V4L2_CID_HUE: |
780 | tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val); |
781 | - break; |
782 | + return 0; |
783 | case V4L2_CID_TEST_PATTERN: |
784 | decoder->enable = ctrl->val ? false : true; |
785 | tvp5150_selmux(sd); |
786 | diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c |
787 | index 72428b6bfc47..ba44ea6d497e 100644 |
788 | --- a/drivers/mtd/chips/cfi_cmdset_0002.c |
789 | +++ b/drivers/mtd/chips/cfi_cmdset_0002.c |
790 | @@ -1627,29 +1627,35 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, |
791 | continue; |
792 | } |
793 | |
794 | - if (time_after(jiffies, timeo) && !chip_ready(map, adr)){ |
795 | + /* |
796 | + * We check "time_after" and "!chip_good" before checking |
797 | + * "chip_good" to avoid the failure due to scheduling. |
798 | + */ |
799 | + if (time_after(jiffies, timeo) && !chip_good(map, adr, datum)) { |
800 | xip_enable(map, chip, adr); |
801 | printk(KERN_WARNING "MTD %s(): software timeout\n", __func__); |
802 | xip_disable(map, chip, adr); |
803 | + ret = -EIO; |
804 | break; |
805 | } |
806 | |
807 | - if (chip_ready(map, adr)) |
808 | + if (chip_good(map, adr, datum)) |
809 | break; |
810 | |
811 | /* Latency issues. Drop the lock, wait a while and retry */ |
812 | UDELAY(map, chip, adr, 1); |
813 | } |
814 | + |
815 | /* Did we succeed? */ |
816 | - if (!chip_good(map, adr, datum)) { |
817 | + if (ret) { |
818 | /* reset on all failures. */ |
819 | map_write(map, CMD(0xF0), chip->start); |
820 | /* FIXME - should have reset delay before continuing */ |
821 | |
822 | - if (++retry_cnt <= MAX_RETRIES) |
823 | + if (++retry_cnt <= MAX_RETRIES) { |
824 | + ret = 0; |
825 | goto retry; |
826 | - |
827 | - ret = -EIO; |
828 | + } |
829 | } |
830 | xip_enable(map, chip, adr); |
831 | op_done: |
832 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
833 | index 5a57be66a487..aa067a7a72d4 100644 |
834 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
835 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
836 | @@ -1999,8 +1999,11 @@ static void __ibmvnic_reset(struct work_struct *work) |
837 | rwi = get_next_rwi(adapter); |
838 | while (rwi) { |
839 | if (adapter->state == VNIC_REMOVING || |
840 | - adapter->state == VNIC_REMOVED) |
841 | - goto out; |
842 | + adapter->state == VNIC_REMOVED) { |
843 | + kfree(rwi); |
844 | + rc = EBUSY; |
845 | + break; |
846 | + } |
847 | |
848 | if (adapter->force_reset_recovery) { |
849 | adapter->force_reset_recovery = false; |
850 | @@ -2026,7 +2029,7 @@ static void __ibmvnic_reset(struct work_struct *work) |
851 | netdev_dbg(adapter->netdev, "Reset failed\n"); |
852 | free_all_rwi(adapter); |
853 | } |
854 | -out: |
855 | + |
856 | adapter->resetting = false; |
857 | if (we_lock_rtnl) |
858 | rtnl_unlock(); |
859 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
860 | index da52e60d4437..d79e177f8990 100644 |
861 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h |
862 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
863 | @@ -210,6 +210,7 @@ static const char mlx5e_priv_flags[][ETH_GSTRING_LEN] = { |
864 | "tx_cqe_moder", |
865 | "rx_cqe_compress", |
866 | "rx_striding_rq", |
867 | + "rx_no_csum_complete", |
868 | }; |
869 | |
870 | enum mlx5e_priv_flag { |
871 | @@ -217,6 +218,7 @@ enum mlx5e_priv_flag { |
872 | MLX5E_PFLAG_TX_CQE_BASED_MODER = (1 << 1), |
873 | MLX5E_PFLAG_RX_CQE_COMPRESS = (1 << 2), |
874 | MLX5E_PFLAG_RX_STRIDING_RQ = (1 << 3), |
875 | + MLX5E_PFLAG_RX_NO_CSUM_COMPLETE = (1 << 4), |
876 | }; |
877 | |
878 | #define MLX5E_SET_PFLAG(params, pflag, enable) \ |
879 | @@ -298,6 +300,7 @@ struct mlx5e_dcbx_dp { |
880 | enum { |
881 | MLX5E_RQ_STATE_ENABLED, |
882 | MLX5E_RQ_STATE_AM, |
883 | + MLX5E_RQ_STATE_NO_CSUM_COMPLETE, |
884 | }; |
885 | |
886 | struct mlx5e_cq { |
887 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
888 | index 2b9350f4c752..10d72c83714d 100644 |
889 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
890 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
891 | @@ -1510,6 +1510,28 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable) |
892 | return 0; |
893 | } |
894 | |
895 | +static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable) |
896 | +{ |
897 | + struct mlx5e_priv *priv = netdev_priv(netdev); |
898 | + struct mlx5e_channels *channels = &priv->channels; |
899 | + struct mlx5e_channel *c; |
900 | + int i; |
901 | + |
902 | + if (!test_bit(MLX5E_STATE_OPENED, &priv->state) || |
903 | + priv->channels.params.xdp_prog) |
904 | + return 0; |
905 | + |
906 | + for (i = 0; i < channels->num; i++) { |
907 | + c = channels->c[i]; |
908 | + if (enable) |
909 | + __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
910 | + else |
911 | + __clear_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
912 | + } |
913 | + |
914 | + return 0; |
915 | +} |
916 | + |
917 | static int mlx5e_handle_pflag(struct net_device *netdev, |
918 | u32 wanted_flags, |
919 | enum mlx5e_priv_flag flag, |
920 | @@ -1561,6 +1583,12 @@ static int mlx5e_set_priv_flags(struct net_device *netdev, u32 pflags) |
921 | err = mlx5e_handle_pflag(netdev, pflags, |
922 | MLX5E_PFLAG_RX_STRIDING_RQ, |
923 | set_pflag_rx_striding_rq); |
924 | + if (err) |
925 | + goto out; |
926 | + |
927 | + err = mlx5e_handle_pflag(netdev, pflags, |
928 | + MLX5E_PFLAG_RX_NO_CSUM_COMPLETE, |
929 | + set_pflag_rx_no_csum_complete); |
930 | |
931 | out: |
932 | mutex_unlock(&priv->state_lock); |
933 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
934 | index 83ab2c0e6b61..7e6706333fa8 100644 |
935 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
936 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
937 | @@ -934,6 +934,13 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, |
938 | if (params->rx_dim_enabled) |
939 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
940 | |
941 | + /* We disable csum_complete when XDP is enabled since |
942 | + * XDP programs might manipulate packets which will render |
943 | + * skb->checksum incorrect. |
944 | + */ |
945 | + if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) || c->xdp) |
946 | + __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
947 | + |
948 | return 0; |
949 | |
950 | err_destroy_rq: |
951 | @@ -4533,6 +4540,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev, |
952 | params->rx_cqe_compress_def = slow_pci_heuristic(mdev); |
953 | |
954 | MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS, params->rx_cqe_compress_def); |
955 | + MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE, false); |
956 | |
957 | /* RQ */ |
958 | /* Prefer Striding RQ, unless any of the following holds: |
959 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
960 | index d3f794d4fb96..df49dc143c47 100644 |
961 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
962 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
963 | @@ -37,6 +37,7 @@ |
964 | #include <net/busy_poll.h> |
965 | #include <net/ip6_checksum.h> |
966 | #include <net/page_pool.h> |
967 | +#include <net/inet_ecn.h> |
968 | #include "en.h" |
969 | #include "en_tc.h" |
970 | #include "eswitch.h" |
971 | @@ -688,27 +689,110 @@ static inline void mlx5e_skb_set_hash(struct mlx5_cqe64 *cqe, |
972 | skb_set_hash(skb, be32_to_cpu(cqe->rss_hash_result), ht); |
973 | } |
974 | |
975 | -static inline bool is_last_ethertype_ip(struct sk_buff *skb, int *network_depth) |
976 | +static inline bool is_last_ethertype_ip(struct sk_buff *skb, int *network_depth, |
977 | + __be16 *proto) |
978 | { |
979 | - __be16 ethertype = ((struct ethhdr *)skb->data)->h_proto; |
980 | + *proto = ((struct ethhdr *)skb->data)->h_proto; |
981 | + *proto = __vlan_get_protocol(skb, *proto, network_depth); |
982 | |
983 | - ethertype = __vlan_get_protocol(skb, ethertype, network_depth); |
984 | - return (ethertype == htons(ETH_P_IP) || ethertype == htons(ETH_P_IPV6)); |
985 | + if (*proto == htons(ETH_P_IP)) |
986 | + return pskb_may_pull(skb, *network_depth + sizeof(struct iphdr)); |
987 | + |
988 | + if (*proto == htons(ETH_P_IPV6)) |
989 | + return pskb_may_pull(skb, *network_depth + sizeof(struct ipv6hdr)); |
990 | + |
991 | + return false; |
992 | } |
993 | |
994 | -static u32 mlx5e_get_fcs(const struct sk_buff *skb) |
995 | +static inline void mlx5e_enable_ecn(struct mlx5e_rq *rq, struct sk_buff *skb) |
996 | { |
997 | - const void *fcs_bytes; |
998 | - u32 _fcs_bytes; |
999 | + int network_depth = 0; |
1000 | + __be16 proto; |
1001 | + void *ip; |
1002 | + int rc; |
1003 | |
1004 | - fcs_bytes = skb_header_pointer(skb, skb->len - ETH_FCS_LEN, |
1005 | - ETH_FCS_LEN, &_fcs_bytes); |
1006 | + if (unlikely(!is_last_ethertype_ip(skb, &network_depth, &proto))) |
1007 | + return; |
1008 | + |
1009 | + ip = skb->data + network_depth; |
1010 | + rc = ((proto == htons(ETH_P_IP)) ? IP_ECN_set_ce((struct iphdr *)ip) : |
1011 | + IP6_ECN_set_ce(skb, (struct ipv6hdr *)ip)); |
1012 | + |
1013 | + rq->stats->ecn_mark += !!rc; |
1014 | +} |
1015 | + |
1016 | +static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) |
1017 | +{ |
1018 | + void *ip_p = skb->data + network_depth; |
1019 | |
1020 | - return __get_unaligned_cpu32(fcs_bytes); |
1021 | + return (proto == htons(ETH_P_IP)) ? ((struct iphdr *)ip_p)->protocol : |
1022 | + ((struct ipv6hdr *)ip_p)->nexthdr; |
1023 | } |
1024 | |
1025 | #define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) |
1026 | |
1027 | +#define MAX_PADDING 8 |
1028 | + |
1029 | +static void |
1030 | +tail_padding_csum_slow(struct sk_buff *skb, int offset, int len, |
1031 | + struct mlx5e_rq_stats *stats) |
1032 | +{ |
1033 | + stats->csum_complete_tail_slow++; |
1034 | + skb->csum = csum_block_add(skb->csum, |
1035 | + skb_checksum(skb, offset, len, 0), |
1036 | + offset); |
1037 | +} |
1038 | + |
1039 | +static void |
1040 | +tail_padding_csum(struct sk_buff *skb, int offset, |
1041 | + struct mlx5e_rq_stats *stats) |
1042 | +{ |
1043 | + u8 tail_padding[MAX_PADDING]; |
1044 | + int len = skb->len - offset; |
1045 | + void *tail; |
1046 | + |
1047 | + if (unlikely(len > MAX_PADDING)) { |
1048 | + tail_padding_csum_slow(skb, offset, len, stats); |
1049 | + return; |
1050 | + } |
1051 | + |
1052 | + tail = skb_header_pointer(skb, offset, len, tail_padding); |
1053 | + if (unlikely(!tail)) { |
1054 | + tail_padding_csum_slow(skb, offset, len, stats); |
1055 | + return; |
1056 | + } |
1057 | + |
1058 | + stats->csum_complete_tail++; |
1059 | + skb->csum = csum_block_add(skb->csum, csum_partial(tail, len, 0), offset); |
1060 | +} |
1061 | + |
1062 | +static void |
1063 | +mlx5e_skb_padding_csum(struct sk_buff *skb, int network_depth, __be16 proto, |
1064 | + struct mlx5e_rq_stats *stats) |
1065 | +{ |
1066 | + struct ipv6hdr *ip6; |
1067 | + struct iphdr *ip4; |
1068 | + int pkt_len; |
1069 | + |
1070 | + switch (proto) { |
1071 | + case htons(ETH_P_IP): |
1072 | + ip4 = (struct iphdr *)(skb->data + network_depth); |
1073 | + pkt_len = network_depth + ntohs(ip4->tot_len); |
1074 | + break; |
1075 | + case htons(ETH_P_IPV6): |
1076 | + ip6 = (struct ipv6hdr *)(skb->data + network_depth); |
1077 | + pkt_len = network_depth + sizeof(*ip6) + ntohs(ip6->payload_len); |
1078 | + break; |
1079 | + default: |
1080 | + return; |
1081 | + } |
1082 | + |
1083 | + if (likely(pkt_len >= skb->len)) |
1084 | + return; |
1085 | + |
1086 | + tail_padding_csum(skb, pkt_len, stats); |
1087 | +} |
1088 | + |
1089 | static inline void mlx5e_handle_csum(struct net_device *netdev, |
1090 | struct mlx5_cqe64 *cqe, |
1091 | struct mlx5e_rq *rq, |
1092 | @@ -717,6 +801,7 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, |
1093 | { |
1094 | struct mlx5e_rq_stats *stats = rq->stats; |
1095 | int network_depth = 0; |
1096 | + __be16 proto; |
1097 | |
1098 | if (unlikely(!(netdev->features & NETIF_F_RXCSUM))) |
1099 | goto csum_none; |
1100 | @@ -727,6 +812,10 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, |
1101 | return; |
1102 | } |
1103 | |
1104 | + /* True when explicitly set via priv flag, or XDP prog is loaded */ |
1105 | + if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)) |
1106 | + goto csum_unnecessary; |
1107 | + |
1108 | /* CQE csum doesn't cover padding octets in short ethernet |
1109 | * frames. And the pad field is appended prior to calculating |
1110 | * and appending the FCS field. |
1111 | @@ -738,7 +827,10 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, |
1112 | if (short_frame(skb->len)) |
1113 | goto csum_unnecessary; |
1114 | |
1115 | - if (likely(is_last_ethertype_ip(skb, &network_depth))) { |
1116 | + if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { |
1117 | + if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) |
1118 | + goto csum_unnecessary; |
1119 | + |
1120 | skb->ip_summed = CHECKSUM_COMPLETE; |
1121 | skb->csum = csum_unfold((__force __sum16)cqe->check_sum); |
1122 | if (network_depth > ETH_HLEN) |
1123 | @@ -749,10 +841,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, |
1124 | skb->csum = csum_partial(skb->data + ETH_HLEN, |
1125 | network_depth - ETH_HLEN, |
1126 | skb->csum); |
1127 | - if (unlikely(netdev->features & NETIF_F_RXFCS)) |
1128 | - skb->csum = csum_block_add(skb->csum, |
1129 | - (__force __wsum)mlx5e_get_fcs(skb), |
1130 | - skb->len - ETH_FCS_LEN); |
1131 | + |
1132 | + mlx5e_skb_padding_csum(skb, network_depth, proto, stats); |
1133 | stats->csum_complete++; |
1134 | return; |
1135 | } |
1136 | @@ -775,6 +865,8 @@ csum_none: |
1137 | stats->csum_none++; |
1138 | } |
1139 | |
1140 | +#define MLX5E_CE_BIT_MASK 0x80 |
1141 | + |
1142 | static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, |
1143 | u32 cqe_bcnt, |
1144 | struct mlx5e_rq *rq, |
1145 | @@ -819,6 +911,10 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, |
1146 | skb->mark = be32_to_cpu(cqe->sop_drop_qpn) & MLX5E_TC_FLOW_ID_MASK; |
1147 | |
1148 | mlx5e_handle_csum(netdev, cqe, rq, skb, !!lro_num_seg); |
1149 | + /* checking CE bit in cqe - MSB in ml_path field */ |
1150 | + if (unlikely(cqe->ml_path & MLX5E_CE_BIT_MASK)) |
1151 | + mlx5e_enable_ecn(rq, skb); |
1152 | + |
1153 | skb->protocol = eth_type_trans(skb, netdev); |
1154 | } |
1155 | |
1156 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c |
1157 | index 7047cc293545..8255d797ea94 100644 |
1158 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c |
1159 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c |
1160 | @@ -53,10 +53,13 @@ static const struct counter_desc sw_stats_desc[] = { |
1161 | |
1162 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) }, |
1163 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) }, |
1164 | + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_ecn_mark) }, |
1165 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_removed_vlan_packets) }, |
1166 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) }, |
1167 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) }, |
1168 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) }, |
1169 | + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail) }, |
1170 | + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail_slow) }, |
1171 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) }, |
1172 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) }, |
1173 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_redirect) }, |
1174 | @@ -144,9 +147,12 @@ void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) |
1175 | s->rx_bytes += rq_stats->bytes; |
1176 | s->rx_lro_packets += rq_stats->lro_packets; |
1177 | s->rx_lro_bytes += rq_stats->lro_bytes; |
1178 | + s->rx_ecn_mark += rq_stats->ecn_mark; |
1179 | s->rx_removed_vlan_packets += rq_stats->removed_vlan_packets; |
1180 | s->rx_csum_none += rq_stats->csum_none; |
1181 | s->rx_csum_complete += rq_stats->csum_complete; |
1182 | + s->rx_csum_complete_tail += rq_stats->csum_complete_tail; |
1183 | + s->rx_csum_complete_tail_slow += rq_stats->csum_complete_tail_slow; |
1184 | s->rx_csum_unnecessary += rq_stats->csum_unnecessary; |
1185 | s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner; |
1186 | s->rx_xdp_drop += rq_stats->xdp_drop; |
1187 | @@ -1137,6 +1143,8 @@ static const struct counter_desc rq_stats_desc[] = { |
1188 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) }, |
1189 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) }, |
1190 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) }, |
1191 | + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail) }, |
1192 | + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail_slow) }, |
1193 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary) }, |
1194 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) }, |
1195 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) }, |
1196 | @@ -1144,6 +1152,7 @@ static const struct counter_desc rq_stats_desc[] = { |
1197 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_redirect) }, |
1198 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) }, |
1199 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) }, |
1200 | + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, ecn_mark) }, |
1201 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, removed_vlan_packets) }, |
1202 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) }, |
1203 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_cqes) }, |
1204 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h |
1205 | index 0ad7a165443a..3ea8033ed6bd 100644 |
1206 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h |
1207 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h |
1208 | @@ -66,10 +66,13 @@ struct mlx5e_sw_stats { |
1209 | u64 tx_nop; |
1210 | u64 rx_lro_packets; |
1211 | u64 rx_lro_bytes; |
1212 | + u64 rx_ecn_mark; |
1213 | u64 rx_removed_vlan_packets; |
1214 | u64 rx_csum_unnecessary; |
1215 | u64 rx_csum_none; |
1216 | u64 rx_csum_complete; |
1217 | + u64 rx_csum_complete_tail; |
1218 | + u64 rx_csum_complete_tail_slow; |
1219 | u64 rx_csum_unnecessary_inner; |
1220 | u64 rx_xdp_drop; |
1221 | u64 rx_xdp_redirect; |
1222 | @@ -179,11 +182,14 @@ struct mlx5e_rq_stats { |
1223 | u64 packets; |
1224 | u64 bytes; |
1225 | u64 csum_complete; |
1226 | + u64 csum_complete_tail; |
1227 | + u64 csum_complete_tail_slow; |
1228 | u64 csum_unnecessary; |
1229 | u64 csum_unnecessary_inner; |
1230 | u64 csum_none; |
1231 | u64 lro_packets; |
1232 | u64 lro_bytes; |
1233 | + u64 ecn_mark; |
1234 | u64 removed_vlan_packets; |
1235 | u64 xdp_drop; |
1236 | u64 xdp_redirect; |
1237 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c |
1238 | index d1c1a8069c7e..5e1e671d2002 100644 |
1239 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c |
1240 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c |
1241 | @@ -315,7 +315,7 @@ out: |
1242 | } |
1243 | |
1244 | void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
1245 | - enum nl80211_band band) |
1246 | + enum nl80211_band band, bool update) |
1247 | { |
1248 | struct ieee80211_hw *hw = mvm->hw; |
1249 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
1250 | @@ -324,7 +324,8 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
1251 | struct ieee80211_supported_band *sband; |
1252 | struct iwl_tlc_config_cmd cfg_cmd = { |
1253 | .sta_id = mvmsta->sta_id, |
1254 | - .max_ch_width = rs_fw_bw_from_sta_bw(sta), |
1255 | + .max_ch_width = update ? |
1256 | + rs_fw_bw_from_sta_bw(sta) : RATE_MCS_CHAN_WIDTH_20, |
1257 | .flags = cpu_to_le16(rs_fw_set_config_flags(mvm, sta)), |
1258 | .chains = rs_fw_set_active_chains(iwl_mvm_get_valid_tx_ant(mvm)), |
1259 | .max_mpdu_len = cpu_to_le16(sta->max_amsdu_len), |
1260 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
1261 | index 6b9c670fcef8..6f4508d62a97 100644 |
1262 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
1263 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
1264 | @@ -4113,7 +4113,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
1265 | enum nl80211_band band, bool update) |
1266 | { |
1267 | if (iwl_mvm_has_tlc_offload(mvm)) |
1268 | - rs_fw_rate_init(mvm, sta, band); |
1269 | + rs_fw_rate_init(mvm, sta, band, update); |
1270 | else |
1271 | rs_drv_rate_init(mvm, sta, band, update); |
1272 | } |
1273 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h |
1274 | index 8e7f993e2911..d0f47899f284 100644 |
1275 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h |
1276 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h |
1277 | @@ -461,7 +461,7 @@ void rs_remove_sta_debugfs(void *mvm, void *mvm_sta); |
1278 | |
1279 | void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta); |
1280 | void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
1281 | - enum nl80211_band band); |
1282 | + enum nl80211_band band, bool update); |
1283 | int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, |
1284 | bool enable); |
1285 | void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm, |
1286 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
1287 | index ffae299c3492..5615ce55cef5 100644 |
1288 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
1289 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c |
1290 | @@ -671,7 +671,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) |
1291 | if (info.control.vif->type == NL80211_IFTYPE_P2P_DEVICE || |
1292 | info.control.vif->type == NL80211_IFTYPE_AP || |
1293 | info.control.vif->type == NL80211_IFTYPE_ADHOC) { |
1294 | - if (info.control.vif->type == NL80211_IFTYPE_P2P_DEVICE) |
1295 | + if (!ieee80211_is_data(hdr->frame_control)) |
1296 | sta_id = mvmvif->bcast_sta.sta_id; |
1297 | else |
1298 | sta_id = mvmvif->mcast_sta.sta_id; |
1299 | diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c |
1300 | index 5dadc964ad3b..5c2849846641 100644 |
1301 | --- a/drivers/pci/controller/pci-hyperv.c |
1302 | +++ b/drivers/pci/controller/pci-hyperv.c |
1303 | @@ -2706,8 +2706,8 @@ static int hv_pci_remove(struct hv_device *hdev) |
1304 | /* Remove the bus from PCI's point of view. */ |
1305 | pci_lock_rescan_remove(); |
1306 | pci_stop_root_bus(hbus->pci_bus); |
1307 | - pci_remove_root_bus(hbus->pci_bus); |
1308 | hv_pci_remove_slots(hbus); |
1309 | + pci_remove_root_bus(hbus->pci_bus); |
1310 | pci_unlock_rescan_remove(); |
1311 | hbus->state = hv_pcibus_removed; |
1312 | } |
1313 | diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c |
1314 | index 78c2f548b25f..8f3468d9f848 100644 |
1315 | --- a/drivers/pinctrl/sprd/pinctrl-sprd.c |
1316 | +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c |
1317 | @@ -159,10 +159,8 @@ struct sprd_pinctrl { |
1318 | struct sprd_pinctrl_soc_info *info; |
1319 | }; |
1320 | |
1321 | -enum sprd_pinconf_params { |
1322 | - SPRD_PIN_CONFIG_CONTROL = PIN_CONFIG_END + 1, |
1323 | - SPRD_PIN_CONFIG_SLEEP_MODE = PIN_CONFIG_END + 2, |
1324 | -}; |
1325 | +#define SPRD_PIN_CONFIG_CONTROL (PIN_CONFIG_END + 1) |
1326 | +#define SPRD_PIN_CONFIG_SLEEP_MODE (PIN_CONFIG_END + 2) |
1327 | |
1328 | static int sprd_pinctrl_get_id_by_name(struct sprd_pinctrl *sprd_pctl, |
1329 | const char *name) |
1330 | diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c |
1331 | index 5a2757a7f408..5358a80d854f 100644 |
1332 | --- a/drivers/power/supply/power_supply_sysfs.c |
1333 | +++ b/drivers/power/supply/power_supply_sysfs.c |
1334 | @@ -131,7 +131,8 @@ static ssize_t power_supply_show_property(struct device *dev, |
1335 | dev_dbg(dev, "driver has no data for `%s' property\n", |
1336 | attr->attr.name); |
1337 | else if (ret != -ENODEV && ret != -EAGAIN) |
1338 | - dev_err(dev, "driver failed to report `%s' property: %zd\n", |
1339 | + dev_err_ratelimited(dev, |
1340 | + "driver failed to report `%s' property: %zd\n", |
1341 | attr->attr.name, ret); |
1342 | return ret; |
1343 | } |
1344 | diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c |
1345 | index fc08e46a93ca..34ff4bbc8de1 100644 |
1346 | --- a/drivers/scsi/qla2xxx/qla_gs.c |
1347 | +++ b/drivers/scsi/qla2xxx/qla_gs.c |
1348 | @@ -4045,6 +4045,41 @@ out: |
1349 | } |
1350 | } |
1351 | |
1352 | +static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha, |
1353 | + srb_t *sp, int cmd) |
1354 | +{ |
1355 | + struct qla_work_evt *e; |
1356 | + |
1357 | + if (cmd != QLA_EVT_GPNFT_DONE && cmd != QLA_EVT_GNNFT_DONE) |
1358 | + return QLA_PARAMETER_ERROR; |
1359 | + |
1360 | + e = qla2x00_alloc_work(vha, cmd); |
1361 | + if (!e) |
1362 | + return QLA_FUNCTION_FAILED; |
1363 | + |
1364 | + e->u.iosb.sp = sp; |
1365 | + |
1366 | + return qla2x00_post_work(vha, e); |
1367 | +} |
1368 | + |
1369 | +static int qla2x00_post_nvme_gpnft_done_work(struct scsi_qla_host *vha, |
1370 | + srb_t *sp, int cmd) |
1371 | +{ |
1372 | + struct qla_work_evt *e; |
1373 | + |
1374 | + if (cmd != QLA_EVT_GPNFT) |
1375 | + return QLA_PARAMETER_ERROR; |
1376 | + |
1377 | + e = qla2x00_alloc_work(vha, cmd); |
1378 | + if (!e) |
1379 | + return QLA_FUNCTION_FAILED; |
1380 | + |
1381 | + e->u.gpnft.fc4_type = FC4_TYPE_NVME; |
1382 | + e->u.gpnft.sp = sp; |
1383 | + |
1384 | + return qla2x00_post_work(vha, e); |
1385 | +} |
1386 | + |
1387 | static void qla2x00_find_free_fcp_nvme_slot(struct scsi_qla_host *vha, |
1388 | struct srb *sp) |
1389 | { |
1390 | @@ -4145,22 +4180,36 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) |
1391 | { |
1392 | struct srb *sp = s; |
1393 | struct scsi_qla_host *vha = sp->vha; |
1394 | - struct qla_work_evt *e; |
1395 | struct ct_sns_req *ct_req = |
1396 | (struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req; |
1397 | u16 cmd = be16_to_cpu(ct_req->command); |
1398 | u8 fc4_type = sp->gen2; |
1399 | unsigned long flags; |
1400 | + int rc; |
1401 | |
1402 | /* gen2 field is holding the fc4type */ |
1403 | ql_dbg(ql_dbg_disc, vha, 0xffff, |
1404 | "Async done-%s res %x FC4Type %x\n", |
1405 | sp->name, res, sp->gen2); |
1406 | |
1407 | + sp->rc = res; |
1408 | if (res) { |
1409 | unsigned long flags; |
1410 | + const char *name = sp->name; |
1411 | + |
1412 | + /* |
1413 | + * We are in an Interrupt context, queue up this |
1414 | + * sp for GNNFT_DONE work. This will allow all |
1415 | + * the resource to get freed up. |
1416 | + */ |
1417 | + rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, |
1418 | + QLA_EVT_GNNFT_DONE); |
1419 | + if (rc) { |
1420 | + /* Cleanup here to prevent memory leak */ |
1421 | + qla24xx_sp_unmap(vha, sp); |
1422 | + sp->free(sp); |
1423 | + } |
1424 | |
1425 | - sp->free(sp); |
1426 | spin_lock_irqsave(&vha->work_lock, flags); |
1427 | vha->scan.scan_flags &= ~SF_SCANNING; |
1428 | vha->scan.scan_retry++; |
1429 | @@ -4171,9 +4220,9 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) |
1430 | set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); |
1431 | qla2xxx_wake_dpc(vha); |
1432 | } else { |
1433 | - ql_dbg(ql_dbg_disc, sp->vha, 0xffff, |
1434 | - "Async done-%s rescan failed on all retries\n", |
1435 | - sp->name); |
1436 | + ql_dbg(ql_dbg_disc, vha, 0xffff, |
1437 | + "Async done-%s rescan failed on all retries.\n", |
1438 | + name); |
1439 | } |
1440 | return; |
1441 | } |
1442 | @@ -4188,77 +4237,31 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) |
1443 | vha->scan.scan_flags &= ~SF_SCANNING; |
1444 | spin_unlock_irqrestore(&vha->work_lock, flags); |
1445 | |
1446 | - e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT); |
1447 | - if (!e) { |
1448 | - /* |
1449 | - * please ignore kernel warning. Otherwise, |
1450 | - * we have mem leak. |
1451 | - */ |
1452 | - if (sp->u.iocb_cmd.u.ctarg.req) { |
1453 | - dma_free_coherent(&vha->hw->pdev->dev, |
1454 | - sp->u.iocb_cmd.u.ctarg.req_allocated_size, |
1455 | - sp->u.iocb_cmd.u.ctarg.req, |
1456 | - sp->u.iocb_cmd.u.ctarg.req_dma); |
1457 | - sp->u.iocb_cmd.u.ctarg.req = NULL; |
1458 | - } |
1459 | - if (sp->u.iocb_cmd.u.ctarg.rsp) { |
1460 | - dma_free_coherent(&vha->hw->pdev->dev, |
1461 | - sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, |
1462 | - sp->u.iocb_cmd.u.ctarg.rsp, |
1463 | - sp->u.iocb_cmd.u.ctarg.rsp_dma); |
1464 | - sp->u.iocb_cmd.u.ctarg.rsp = NULL; |
1465 | - } |
1466 | - |
1467 | - ql_dbg(ql_dbg_disc, vha, 0xffff, |
1468 | - "Async done-%s unable to alloc work element\n", |
1469 | - sp->name); |
1470 | - sp->free(sp); |
1471 | + sp->rc = res; |
1472 | + rc = qla2x00_post_nvme_gpnft_done_work(vha, sp, QLA_EVT_GPNFT); |
1473 | + if (!rc) { |
1474 | + qla24xx_sp_unmap(vha, sp); |
1475 | set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); |
1476 | set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); |
1477 | return; |
1478 | } |
1479 | - e->u.gpnft.fc4_type = FC4_TYPE_NVME; |
1480 | - sp->rc = res; |
1481 | - e->u.gpnft.sp = sp; |
1482 | - |
1483 | - qla2x00_post_work(vha, e); |
1484 | - return; |
1485 | } |
1486 | |
1487 | - if (cmd == GPN_FT_CMD) |
1488 | - e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT_DONE); |
1489 | - else |
1490 | - e = qla2x00_alloc_work(vha, QLA_EVT_GNNFT_DONE); |
1491 | - if (!e) { |
1492 | - /* please ignore kernel warning. Otherwise, we have mem leak. */ |
1493 | - if (sp->u.iocb_cmd.u.ctarg.req) { |
1494 | - dma_free_coherent(&vha->hw->pdev->dev, |
1495 | - sp->u.iocb_cmd.u.ctarg.req_allocated_size, |
1496 | - sp->u.iocb_cmd.u.ctarg.req, |
1497 | - sp->u.iocb_cmd.u.ctarg.req_dma); |
1498 | - sp->u.iocb_cmd.u.ctarg.req = NULL; |
1499 | - } |
1500 | - if (sp->u.iocb_cmd.u.ctarg.rsp) { |
1501 | - dma_free_coherent(&vha->hw->pdev->dev, |
1502 | - sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, |
1503 | - sp->u.iocb_cmd.u.ctarg.rsp, |
1504 | - sp->u.iocb_cmd.u.ctarg.rsp_dma); |
1505 | - sp->u.iocb_cmd.u.ctarg.rsp = NULL; |
1506 | - } |
1507 | + if (cmd == GPN_FT_CMD) { |
1508 | + del_timer(&sp->u.iocb_cmd.timer); |
1509 | + rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, |
1510 | + QLA_EVT_GPNFT_DONE); |
1511 | + } else { |
1512 | + rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, |
1513 | + QLA_EVT_GNNFT_DONE); |
1514 | + } |
1515 | |
1516 | - ql_dbg(ql_dbg_disc, vha, 0xffff, |
1517 | - "Async done-%s unable to alloc work element\n", |
1518 | - sp->name); |
1519 | - sp->free(sp); |
1520 | + if (rc) { |
1521 | + qla24xx_sp_unmap(vha, sp); |
1522 | set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); |
1523 | set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); |
1524 | return; |
1525 | } |
1526 | - |
1527 | - sp->rc = res; |
1528 | - e->u.iosb.sp = sp; |
1529 | - |
1530 | - qla2x00_post_work(vha, e); |
1531 | } |
1532 | |
1533 | /* |
1534 | @@ -4357,7 +4360,6 @@ void qla24xx_async_gpnft_done(scsi_qla_host_t *vha, srb_t *sp) |
1535 | { |
1536 | ql_dbg(ql_dbg_disc, vha, 0xffff, |
1537 | "%s enter\n", __func__); |
1538 | - del_timer(&sp->u.iocb_cmd.timer); |
1539 | qla24xx_async_gnnft(vha, sp, sp->gen2); |
1540 | } |
1541 | |
1542 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
1543 | index 39a8f4a671aa..7c1f36b69bdc 100644 |
1544 | --- a/drivers/scsi/qla2xxx/qla_init.c |
1545 | +++ b/drivers/scsi/qla2xxx/qla_init.c |
1546 | @@ -54,7 +54,7 @@ qla2x00_sp_timeout(struct timer_list *t) |
1547 | unsigned long flags; |
1548 | struct qla_hw_data *ha = sp->vha->hw; |
1549 | |
1550 | - WARN_ON(irqs_disabled()); |
1551 | + WARN_ON_ONCE(irqs_disabled()); |
1552 | spin_lock_irqsave(&ha->hardware_lock, flags); |
1553 | req = sp->qpair->req; |
1554 | req->outstanding_cmds[sp->handle] = NULL; |
1555 | @@ -796,6 +796,9 @@ qla24xx_async_gnl_sp_done(void *s, int res) |
1556 | sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1], |
1557 | sp->u.iocb_cmd.u.mbx.in_mb[2]); |
1558 | |
1559 | + if (res == QLA_FUNCTION_TIMEOUT) |
1560 | + return; |
1561 | + |
1562 | memset(&ea, 0, sizeof(ea)); |
1563 | ea.sp = sp; |
1564 | ea.rc = res; |
1565 | @@ -979,17 +982,13 @@ void qla24xx_async_gpdb_sp_done(void *s, int res) |
1566 | "Async done-%s res %x, WWPN %8phC mb[1]=%x mb[2]=%x \n", |
1567 | sp->name, res, fcport->port_name, mb[1], mb[2]); |
1568 | |
1569 | - fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); |
1570 | - |
1571 | - if (res == QLA_FUNCTION_TIMEOUT) |
1572 | - return; |
1573 | - |
1574 | if (res == QLA_FUNCTION_TIMEOUT) { |
1575 | dma_pool_free(sp->vha->hw->s_dma_pool, sp->u.iocb_cmd.u.mbx.in, |
1576 | sp->u.iocb_cmd.u.mbx.in_dma); |
1577 | return; |
1578 | } |
1579 | |
1580 | + fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); |
1581 | memset(&ea, 0, sizeof(ea)); |
1582 | ea.event = FCME_GPDB_DONE; |
1583 | ea.fcport = fcport; |
1584 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
1585 | index cc9e846a3865..094be406cde4 100644 |
1586 | --- a/fs/cifs/smb2ops.c |
1587 | +++ b/fs/cifs/smb2ops.c |
1588 | @@ -553,7 +553,50 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid) |
1589 | oparams.fid = pfid; |
1590 | oparams.reconnect = false; |
1591 | |
1592 | + /* |
1593 | + * We do not hold the lock for the open because in case |
1594 | + * SMB2_open needs to reconnect, it will end up calling |
1595 | + * cifs_mark_open_files_invalid() which takes the lock again |
1596 | + * thus causing a deadlock |
1597 | + */ |
1598 | + mutex_unlock(&tcon->crfid.fid_mutex); |
1599 | rc = SMB2_open(xid, &oparams, &srch_path, &oplock, NULL, NULL, NULL); |
1600 | + mutex_lock(&tcon->crfid.fid_mutex); |
1601 | + |
1602 | + /* |
1603 | + * Now we need to check again as the cached root might have |
1604 | + * been successfully re-opened from a concurrent process |
1605 | + */ |
1606 | + |
1607 | + if (tcon->crfid.is_valid) { |
1608 | + /* work was already done */ |
1609 | + |
1610 | + /* stash fids for close() later */ |
1611 | + struct cifs_fid fid = { |
1612 | + .persistent_fid = pfid->persistent_fid, |
1613 | + .volatile_fid = pfid->volatile_fid, |
1614 | + }; |
1615 | + |
1616 | + /* |
1617 | + * Caller expects this func to set pfid to a valid |
1618 | + * cached root, so we copy the existing one and get a |
1619 | + * reference |
1620 | + */ |
1621 | + memcpy(pfid, tcon->crfid.fid, sizeof(*pfid)); |
1622 | + kref_get(&tcon->crfid.refcount); |
1623 | + |
1624 | + mutex_unlock(&tcon->crfid.fid_mutex); |
1625 | + |
1626 | + if (rc == 0) { |
1627 | + /* close extra handle outside of critical section */ |
1628 | + SMB2_close(xid, tcon, fid.persistent_fid, |
1629 | + fid.volatile_fid); |
1630 | + } |
1631 | + return 0; |
1632 | + } |
1633 | + |
1634 | + /* Cached root is still invalid, continue normaly */ |
1635 | + |
1636 | if (rc == 0) { |
1637 | memcpy(tcon->crfid.fid, pfid, sizeof(struct cifs_fid)); |
1638 | tcon->crfid.tcon = tcon; |
1639 | @@ -561,6 +604,7 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid) |
1640 | kref_init(&tcon->crfid.refcount); |
1641 | kref_get(&tcon->crfid.refcount); |
1642 | } |
1643 | + |
1644 | mutex_unlock(&tcon->crfid.fid_mutex); |
1645 | return rc; |
1646 | } |
1647 | diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
1648 | index 59d0472013f4..388500eec729 100644 |
1649 | --- a/fs/f2fs/checkpoint.c |
1650 | +++ b/fs/f2fs/checkpoint.c |
1651 | @@ -849,6 +849,7 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
1652 | unsigned int cp_blks = 1 + __cp_payload(sbi); |
1653 | block_t cp_blk_no; |
1654 | int i; |
1655 | + int err; |
1656 | |
1657 | sbi->ckpt = f2fs_kzalloc(sbi, array_size(blk_size, cp_blks), |
1658 | GFP_KERNEL); |
1659 | @@ -876,6 +877,7 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
1660 | } else if (cp2) { |
1661 | cur_page = cp2; |
1662 | } else { |
1663 | + err = -EFSCORRUPTED; |
1664 | goto fail_no_cp; |
1665 | } |
1666 | |
1667 | @@ -888,8 +890,10 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
1668 | sbi->cur_cp_pack = 2; |
1669 | |
1670 | /* Sanity checking of checkpoint */ |
1671 | - if (f2fs_sanity_check_ckpt(sbi)) |
1672 | + if (f2fs_sanity_check_ckpt(sbi)) { |
1673 | + err = -EFSCORRUPTED; |
1674 | goto free_fail_no_cp; |
1675 | + } |
1676 | |
1677 | if (cp_blks <= 1) |
1678 | goto done; |
1679 | @@ -903,8 +907,10 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
1680 | unsigned char *ckpt = (unsigned char *)sbi->ckpt; |
1681 | |
1682 | cur_page = f2fs_get_meta_page(sbi, cp_blk_no + i); |
1683 | - if (IS_ERR(cur_page)) |
1684 | + if (IS_ERR(cur_page)) { |
1685 | + err = PTR_ERR(cur_page); |
1686 | goto free_fail_no_cp; |
1687 | + } |
1688 | sit_bitmap_ptr = page_address(cur_page); |
1689 | memcpy(ckpt + i * blk_size, sit_bitmap_ptr, blk_size); |
1690 | f2fs_put_page(cur_page, 1); |
1691 | @@ -919,7 +925,7 @@ free_fail_no_cp: |
1692 | f2fs_put_page(cp2, 1); |
1693 | fail_no_cp: |
1694 | kfree(sbi->ckpt); |
1695 | - return -EINVAL; |
1696 | + return err; |
1697 | } |
1698 | |
1699 | static void __add_dirty_inode(struct inode *inode, enum inode_type type) |
1700 | diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
1701 | index 4d02e76b648a..9511466bc785 100644 |
1702 | --- a/fs/f2fs/data.c |
1703 | +++ b/fs/f2fs/data.c |
1704 | @@ -449,7 +449,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) |
1705 | |
1706 | if (!f2fs_is_valid_blkaddr(fio->sbi, fio->new_blkaddr, |
1707 | __is_meta_io(fio) ? META_GENERIC : DATA_GENERIC)) |
1708 | - return -EFAULT; |
1709 | + return -EFSCORRUPTED; |
1710 | |
1711 | trace_f2fs_submit_page_bio(page, fio); |
1712 | f2fs_trace_ios(fio, 0); |
1713 | @@ -1071,7 +1071,7 @@ next_block: |
1714 | |
1715 | if (__is_valid_data_blkaddr(blkaddr) && |
1716 | !f2fs_is_valid_blkaddr(sbi, blkaddr, DATA_GENERIC)) { |
1717 | - err = -EFAULT; |
1718 | + err = -EFSCORRUPTED; |
1719 | goto sync_out; |
1720 | } |
1721 | |
1722 | @@ -1755,7 +1755,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) |
1723 | |
1724 | if (!f2fs_is_valid_blkaddr(fio->sbi, fio->old_blkaddr, |
1725 | DATA_GENERIC)) |
1726 | - return -EFAULT; |
1727 | + return -EFSCORRUPTED; |
1728 | |
1729 | ipu_force = true; |
1730 | fio->need_lock = LOCK_DONE; |
1731 | @@ -1781,7 +1781,7 @@ got_it: |
1732 | if (__is_valid_data_blkaddr(fio->old_blkaddr) && |
1733 | !f2fs_is_valid_blkaddr(fio->sbi, fio->old_blkaddr, |
1734 | DATA_GENERIC)) { |
1735 | - err = -EFAULT; |
1736 | + err = -EFSCORRUPTED; |
1737 | goto out_writepage; |
1738 | } |
1739 | /* |
1740 | diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
1741 | index 44ea7ac69ef4..fb216488d67a 100644 |
1742 | --- a/fs/f2fs/f2fs.h |
1743 | +++ b/fs/f2fs/f2fs.h |
1744 | @@ -3487,3 +3487,7 @@ extern void f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned int rate, |
1745 | #endif |
1746 | |
1747 | #endif |
1748 | + |
1749 | +#define EFSBADCRC EBADMSG /* Bad CRC detected */ |
1750 | +#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ |
1751 | + |
1752 | diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
1753 | index d44b57a363ff..dd29a49143f5 100644 |
1754 | --- a/fs/f2fs/gc.c |
1755 | +++ b/fs/f2fs/gc.c |
1756 | @@ -636,7 +636,7 @@ static int ra_data_block(struct inode *inode, pgoff_t index) |
1757 | |
1758 | if (unlikely(!f2fs_is_valid_blkaddr(sbi, dn.data_blkaddr, |
1759 | DATA_GENERIC))) { |
1760 | - err = -EFAULT; |
1761 | + err = -EFSCORRUPTED; |
1762 | goto put_page; |
1763 | } |
1764 | got_it: |
1765 | diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c |
1766 | index 92703efde36e..6bbb5f6801e2 100644 |
1767 | --- a/fs/f2fs/inline.c |
1768 | +++ b/fs/f2fs/inline.c |
1769 | @@ -146,7 +146,7 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) |
1770 | "%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, " |
1771 | "run fsck to fix.", |
1772 | __func__, dn->inode->i_ino, dn->data_blkaddr); |
1773 | - return -EINVAL; |
1774 | + return -EFSCORRUPTED; |
1775 | } |
1776 | |
1777 | f2fs_bug_on(F2FS_P_SB(page), PageWriteback(page)); |
1778 | @@ -389,7 +389,7 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage, |
1779 | "%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, " |
1780 | "run fsck to fix.", |
1781 | __func__, dir->i_ino, dn.data_blkaddr); |
1782 | - err = -EINVAL; |
1783 | + err = -EFSCORRUPTED; |
1784 | goto out; |
1785 | } |
1786 | |
1787 | diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c |
1788 | index 0f31df01e36c..540d45759621 100644 |
1789 | --- a/fs/f2fs/inode.c |
1790 | +++ b/fs/f2fs/inode.c |
1791 | @@ -76,7 +76,7 @@ static int __written_first_block(struct f2fs_sb_info *sbi, |
1792 | if (!__is_valid_data_blkaddr(addr)) |
1793 | return 1; |
1794 | if (!f2fs_is_valid_blkaddr(sbi, addr, DATA_GENERIC)) |
1795 | - return -EFAULT; |
1796 | + return -EFSCORRUPTED; |
1797 | return 0; |
1798 | } |
1799 | |
1800 | @@ -361,7 +361,7 @@ static int do_read_inode(struct inode *inode) |
1801 | |
1802 | if (!sanity_check_inode(inode, node_page)) { |
1803 | f2fs_put_page(node_page, 1); |
1804 | - return -EINVAL; |
1805 | + return -EFSCORRUPTED; |
1806 | } |
1807 | |
1808 | /* check data exist */ |
1809 | diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
1810 | index e2d9edad758c..aa8f19e1bdb3 100644 |
1811 | --- a/fs/f2fs/node.c |
1812 | +++ b/fs/f2fs/node.c |
1813 | @@ -40,7 +40,7 @@ int f2fs_check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) |
1814 | f2fs_msg(sbi->sb, KERN_WARNING, |
1815 | "%s: out-of-range nid=%x, run fsck to fix.", |
1816 | __func__, nid); |
1817 | - return -EINVAL; |
1818 | + return -EFSCORRUPTED; |
1819 | } |
1820 | return 0; |
1821 | } |
1822 | @@ -1284,7 +1284,7 @@ static int read_node_page(struct page *page, int op_flags) |
1823 | if (PageUptodate(page)) { |
1824 | if (!f2fs_inode_chksum_verify(sbi, page)) { |
1825 | ClearPageUptodate(page); |
1826 | - return -EBADMSG; |
1827 | + return -EFSBADCRC; |
1828 | } |
1829 | return LOCKED_PAGE; |
1830 | } |
1831 | @@ -1370,7 +1370,7 @@ repeat: |
1832 | } |
1833 | |
1834 | if (!f2fs_inode_chksum_verify(sbi, page)) { |
1835 | - err = -EBADMSG; |
1836 | + err = -EFSBADCRC; |
1837 | goto out_err; |
1838 | } |
1839 | page_hit: |
1840 | diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c |
1841 | index bf5c5f4fa77e..0b224f4a4a65 100644 |
1842 | --- a/fs/f2fs/recovery.c |
1843 | +++ b/fs/f2fs/recovery.c |
1844 | @@ -491,7 +491,7 @@ retry_dn: |
1845 | "Inconsistent ofs_of_node, ino:%lu, ofs:%u, %u", |
1846 | inode->i_ino, ofs_of_node(dn.node_page), |
1847 | ofs_of_node(page)); |
1848 | - err = -EFAULT; |
1849 | + err = -EFSCORRUPTED; |
1850 | goto err; |
1851 | } |
1852 | |
1853 | diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c |
1854 | index 92f72bb5aff4..10d5dcdb34be 100644 |
1855 | --- a/fs/f2fs/segment.c |
1856 | +++ b/fs/f2fs/segment.c |
1857 | @@ -2657,7 +2657,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range) |
1858 | if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) { |
1859 | f2fs_msg(sbi->sb, KERN_WARNING, |
1860 | "Found FS corruption, run fsck to fix."); |
1861 | - return -EIO; |
1862 | + return -EFSCORRUPTED; |
1863 | } |
1864 | |
1865 | /* start/end segment number in main_area */ |
1866 | @@ -3079,7 +3079,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio) |
1867 | |
1868 | if (!IS_DATASEG(get_seg_entry(sbi, segno)->type)) { |
1869 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
1870 | - return -EFAULT; |
1871 | + return -EFSCORRUPTED; |
1872 | } |
1873 | |
1874 | stat_inc_inplace_blocks(fio->sbi); |
1875 | @@ -3261,11 +3261,6 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi) |
1876 | seg_i = CURSEG_I(sbi, i); |
1877 | segno = le32_to_cpu(ckpt->cur_data_segno[i]); |
1878 | blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]); |
1879 | - if (blk_off > ENTRIES_IN_SUM) { |
1880 | - f2fs_bug_on(sbi, 1); |
1881 | - f2fs_put_page(page, 1); |
1882 | - return -EFAULT; |
1883 | - } |
1884 | seg_i->next_segno = segno; |
1885 | reset_curseg(sbi, i, 0); |
1886 | seg_i->alloc_type = ckpt->alloc_type[i]; |
1887 | @@ -3971,7 +3966,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi) |
1888 | "Wrong journal entry on segno %u", |
1889 | start); |
1890 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
1891 | - err = -EINVAL; |
1892 | + err = -EFSCORRUPTED; |
1893 | break; |
1894 | } |
1895 | |
1896 | @@ -4012,7 +4007,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi) |
1897 | "SIT is corrupted node# %u vs %u", |
1898 | total_node_blocks, valid_node_count(sbi)); |
1899 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
1900 | - err = -EINVAL; |
1901 | + err = -EFSCORRUPTED; |
1902 | } |
1903 | |
1904 | return err; |
1905 | @@ -4103,6 +4098,41 @@ static int build_dirty_segmap(struct f2fs_sb_info *sbi) |
1906 | return init_victim_secmap(sbi); |
1907 | } |
1908 | |
1909 | +static int sanity_check_curseg(struct f2fs_sb_info *sbi) |
1910 | +{ |
1911 | + int i; |
1912 | + |
1913 | + /* |
1914 | + * In LFS/SSR curseg, .next_blkoff should point to an unused blkaddr; |
1915 | + * In LFS curseg, all blkaddr after .next_blkoff should be unused. |
1916 | + */ |
1917 | + for (i = 0; i < NO_CHECK_TYPE; i++) { |
1918 | + struct curseg_info *curseg = CURSEG_I(sbi, i); |
1919 | + struct seg_entry *se = get_seg_entry(sbi, curseg->segno); |
1920 | + unsigned int blkofs = curseg->next_blkoff; |
1921 | + |
1922 | + if (f2fs_test_bit(blkofs, se->cur_valid_map)) |
1923 | + goto out; |
1924 | + |
1925 | + if (curseg->alloc_type == SSR) |
1926 | + continue; |
1927 | + |
1928 | + for (blkofs += 1; blkofs < sbi->blocks_per_seg; blkofs++) { |
1929 | + if (!f2fs_test_bit(blkofs, se->cur_valid_map)) |
1930 | + continue; |
1931 | +out: |
1932 | + f2fs_msg(sbi->sb, KERN_ERR, |
1933 | + "Current segment's next free block offset is " |
1934 | + "inconsistent with bitmap, logtype:%u, " |
1935 | + "segno:%u, type:%u, next_blkoff:%u, blkofs:%u", |
1936 | + i, curseg->segno, curseg->alloc_type, |
1937 | + curseg->next_blkoff, blkofs); |
1938 | + return -EFSCORRUPTED; |
1939 | + } |
1940 | + } |
1941 | + return 0; |
1942 | +} |
1943 | + |
1944 | /* |
1945 | * Update min, max modified time for cost-benefit GC algorithm |
1946 | */ |
1947 | @@ -4198,6 +4228,10 @@ int f2fs_build_segment_manager(struct f2fs_sb_info *sbi) |
1948 | if (err) |
1949 | return err; |
1950 | |
1951 | + err = sanity_check_curseg(sbi); |
1952 | + if (err) |
1953 | + return err; |
1954 | + |
1955 | init_min_max_mtime(sbi); |
1956 | return 0; |
1957 | } |
1958 | diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h |
1959 | index 5079532cb176..9c2a55ad61bc 100644 |
1960 | --- a/fs/f2fs/segment.h |
1961 | +++ b/fs/f2fs/segment.h |
1962 | @@ -684,7 +684,7 @@ static inline int check_block_count(struct f2fs_sb_info *sbi, |
1963 | "Mismatch valid blocks %d vs. %d", |
1964 | GET_SIT_VBLOCKS(raw_sit), valid_blocks); |
1965 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
1966 | - return -EINVAL; |
1967 | + return -EFSCORRUPTED; |
1968 | } |
1969 | |
1970 | /* check segment usage, and check boundary of a given segment number */ |
1971 | @@ -694,7 +694,7 @@ static inline int check_block_count(struct f2fs_sb_info *sbi, |
1972 | "Wrong valid blocks %d or segno %u", |
1973 | GET_SIT_VBLOCKS(raw_sit), segno); |
1974 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
1975 | - return -EINVAL; |
1976 | + return -EFSCORRUPTED; |
1977 | } |
1978 | return 0; |
1979 | } |
1980 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
1981 | index 1871031e2d5e..fdafcfd8b20e 100644 |
1982 | --- a/fs/f2fs/super.c |
1983 | +++ b/fs/f2fs/super.c |
1984 | @@ -2413,11 +2413,11 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) |
1985 | } |
1986 | } |
1987 | for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) { |
1988 | - for (j = i; j < NR_CURSEG_DATA_TYPE; j++) { |
1989 | + for (j = 0; j < NR_CURSEG_DATA_TYPE; j++) { |
1990 | if (le32_to_cpu(ckpt->cur_node_segno[i]) == |
1991 | le32_to_cpu(ckpt->cur_data_segno[j])) { |
1992 | f2fs_msg(sbi->sb, KERN_ERR, |
1993 | - "Data segment (%u) and Data segment (%u)" |
1994 | + "Node segment (%u) and Data segment (%u)" |
1995 | " has the same segno: %u", i, j, |
1996 | le32_to_cpu(ckpt->cur_node_segno[i])); |
1997 | return 1; |
1998 | @@ -2616,7 +2616,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, |
1999 | f2fs_msg(sb, KERN_ERR, |
2000 | "Can't find valid F2FS filesystem in %dth superblock", |
2001 | block + 1); |
2002 | - err = -EINVAL; |
2003 | + err = -EFSCORRUPTED; |
2004 | brelse(bh); |
2005 | continue; |
2006 | } |
2007 | diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c |
2008 | index 88e30f7cf9e1..1dae74f7ccca 100644 |
2009 | --- a/fs/f2fs/xattr.c |
2010 | +++ b/fs/f2fs/xattr.c |
2011 | @@ -349,7 +349,7 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage, |
2012 | |
2013 | *xe = __find_xattr(cur_addr, last_txattr_addr, index, len, name); |
2014 | if (!*xe) { |
2015 | - err = -EFAULT; |
2016 | + err = -EFSCORRUPTED; |
2017 | goto out; |
2018 | } |
2019 | check: |
2020 | @@ -625,7 +625,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, |
2021 | /* find entry with wanted name. */ |
2022 | here = __find_xattr(base_addr, last_base_addr, index, len, name); |
2023 | if (!here) { |
2024 | - error = -EFAULT; |
2025 | + error = -EFSCORRUPTED; |
2026 | goto exit; |
2027 | } |
2028 | |
2029 | diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c |
2030 | index 06a7da8dbda5..38dc0b43c366 100644 |
2031 | --- a/fs/xfs/libxfs/xfs_bmap.c |
2032 | +++ b/fs/xfs/libxfs/xfs_bmap.c |
2033 | @@ -3841,15 +3841,28 @@ xfs_bmapi_read( |
2034 | XFS_STATS_INC(mp, xs_blk_mapr); |
2035 | |
2036 | ifp = XFS_IFORK_PTR(ip, whichfork); |
2037 | + if (!ifp) { |
2038 | + /* No CoW fork? Return a hole. */ |
2039 | + if (whichfork == XFS_COW_FORK) { |
2040 | + mval->br_startoff = bno; |
2041 | + mval->br_startblock = HOLESTARTBLOCK; |
2042 | + mval->br_blockcount = len; |
2043 | + mval->br_state = XFS_EXT_NORM; |
2044 | + *nmap = 1; |
2045 | + return 0; |
2046 | + } |
2047 | |
2048 | - /* No CoW fork? Return a hole. */ |
2049 | - if (whichfork == XFS_COW_FORK && !ifp) { |
2050 | - mval->br_startoff = bno; |
2051 | - mval->br_startblock = HOLESTARTBLOCK; |
2052 | - mval->br_blockcount = len; |
2053 | - mval->br_state = XFS_EXT_NORM; |
2054 | - *nmap = 1; |
2055 | - return 0; |
2056 | + /* |
2057 | + * A missing attr ifork implies that the inode says we're in |
2058 | + * extents or btree format but failed to pass the inode fork |
2059 | + * verifier while trying to load it. Treat that as a file |
2060 | + * corruption too. |
2061 | + */ |
2062 | +#ifdef DEBUG |
2063 | + xfs_alert(mp, "%s: inode %llu missing fork %d", |
2064 | + __func__, ip->i_ino, whichfork); |
2065 | +#endif /* DEBUG */ |
2066 | + return -EFSCORRUPTED; |
2067 | } |
2068 | |
2069 | if (!(ifp->if_flags & XFS_IFEXTENTS)) { |
2070 | diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h |
2071 | index 412c2820626d..b7d63c3970d1 100644 |
2072 | --- a/include/rdma/ib_verbs.h |
2073 | +++ b/include/rdma/ib_verbs.h |
2074 | @@ -71,6 +71,7 @@ |
2075 | |
2076 | extern struct workqueue_struct *ib_wq; |
2077 | extern struct workqueue_struct *ib_comp_wq; |
2078 | +extern struct workqueue_struct *ib_comp_unbound_wq; |
2079 | |
2080 | union ib_gid { |
2081 | u8 raw[16]; |
2082 | @@ -1576,9 +1577,10 @@ struct ib_ah { |
2083 | typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context); |
2084 | |
2085 | enum ib_poll_context { |
2086 | - IB_POLL_DIRECT, /* caller context, no hw completions */ |
2087 | - IB_POLL_SOFTIRQ, /* poll from softirq context */ |
2088 | - IB_POLL_WORKQUEUE, /* poll from workqueue */ |
2089 | + IB_POLL_DIRECT, /* caller context, no hw completions */ |
2090 | + IB_POLL_SOFTIRQ, /* poll from softirq context */ |
2091 | + IB_POLL_WORKQUEUE, /* poll from workqueue */ |
2092 | + IB_POLL_UNBOUND_WORKQUEUE, /* poll from unbound workqueue */ |
2093 | }; |
2094 | |
2095 | struct ib_cq { |
2096 | @@ -1595,6 +1597,7 @@ struct ib_cq { |
2097 | struct irq_poll iop; |
2098 | struct work_struct work; |
2099 | }; |
2100 | + struct workqueue_struct *comp_wq; |
2101 | /* |
2102 | * Implementation details of the RDMA core, don't use in drivers: |
2103 | */ |
2104 | diff --git a/init/initramfs.c b/init/initramfs.c |
2105 | index cd5fb00fcb54..dab8d63459f6 100644 |
2106 | --- a/init/initramfs.c |
2107 | +++ b/init/initramfs.c |
2108 | @@ -524,7 +524,7 @@ static void __init free_initrd(void) |
2109 | unsigned long crashk_start = (unsigned long)__va(crashk_res.start); |
2110 | unsigned long crashk_end = (unsigned long)__va(crashk_res.end); |
2111 | #endif |
2112 | - if (do_retain_initrd) |
2113 | + if (do_retain_initrd || !initrd_start) |
2114 | goto skip; |
2115 | |
2116 | #ifdef CONFIG_KEXEC_CORE |
2117 | diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c |
2118 | index e810e8cb17e1..1e272f6a01e7 100644 |
2119 | --- a/kernel/locking/lockdep.c |
2120 | +++ b/kernel/locking/lockdep.c |
2121 | @@ -3605,6 +3605,9 @@ static int __lock_downgrade(struct lockdep_map *lock, unsigned long ip) |
2122 | unsigned int depth; |
2123 | int i; |
2124 | |
2125 | + if (unlikely(!debug_locks)) |
2126 | + return 0; |
2127 | + |
2128 | depth = curr->lockdep_depth; |
2129 | /* |
2130 | * This function is about (re)setting the class of a held lock, |
2131 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
2132 | index 0adcddb211fa..3e7badb3ac2d 100644 |
2133 | --- a/net/bluetooth/hci_event.c |
2134 | +++ b/net/bluetooth/hci_event.c |
2135 | @@ -5545,11 +5545,6 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev, |
2136 | return send_conn_param_neg_reply(hdev, handle, |
2137 | HCI_ERROR_UNKNOWN_CONN_ID); |
2138 | |
2139 | - if (min < hcon->le_conn_min_interval || |
2140 | - max > hcon->le_conn_max_interval) |
2141 | - return send_conn_param_neg_reply(hdev, handle, |
2142 | - HCI_ERROR_INVALID_LL_PARAMS); |
2143 | - |
2144 | if (hci_check_conn_params(min, max, latency, timeout)) |
2145 | return send_conn_param_neg_reply(hdev, handle, |
2146 | HCI_ERROR_INVALID_LL_PARAMS); |
2147 | diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
2148 | index a54dadf4a6ca..260ef5426e0c 100644 |
2149 | --- a/net/bluetooth/l2cap_core.c |
2150 | +++ b/net/bluetooth/l2cap_core.c |
2151 | @@ -5287,14 +5287,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn, |
2152 | |
2153 | memset(&rsp, 0, sizeof(rsp)); |
2154 | |
2155 | - if (min < hcon->le_conn_min_interval || |
2156 | - max > hcon->le_conn_max_interval) { |
2157 | - BT_DBG("requested connection interval exceeds current bounds."); |
2158 | - err = -EINVAL; |
2159 | - } else { |
2160 | - err = hci_check_conn_params(min, max, latency, to_multiplier); |
2161 | - } |
2162 | - |
2163 | + err = hci_check_conn_params(min, max, latency, to_multiplier); |
2164 | if (err) |
2165 | rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED); |
2166 | else |
2167 | diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c |
2168 | index c200065ef9a5..6367ecdf76c4 100644 |
2169 | --- a/net/ipv4/raw_diag.c |
2170 | +++ b/net/ipv4/raw_diag.c |
2171 | @@ -23,9 +23,6 @@ raw_get_hashinfo(const struct inet_diag_req_v2 *r) |
2172 | return &raw_v6_hashinfo; |
2173 | #endif |
2174 | } else { |
2175 | - pr_warn_once("Unexpected inet family %d\n", |
2176 | - r->sdiag_family); |
2177 | - WARN_ON_ONCE(1); |
2178 | return ERR_PTR(-EINVAL); |
2179 | } |
2180 | } |
2181 | diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c |
2182 | index d7f3776dfd71..637ce3e8c575 100644 |
2183 | --- a/net/netfilter/nft_socket.c |
2184 | +++ b/net/netfilter/nft_socket.c |
2185 | @@ -47,9 +47,6 @@ static void nft_socket_eval(const struct nft_expr *expr, |
2186 | return; |
2187 | } |
2188 | |
2189 | - /* So that subsequent socket matching not to require other lookups. */ |
2190 | - skb->sk = sk; |
2191 | - |
2192 | switch(priv->key) { |
2193 | case NFT_SOCKET_TRANSPARENT: |
2194 | nft_reg_store8(dest, inet_sk_transparent(sk)); |
2195 | @@ -66,6 +63,9 @@ static void nft_socket_eval(const struct nft_expr *expr, |
2196 | WARN_ON(1); |
2197 | regs->verdict.code = NFT_BREAK; |
2198 | } |
2199 | + |
2200 | + if (sk != skb->sk) |
2201 | + sock_gen_put(sk); |
2202 | } |
2203 | |
2204 | static const struct nla_policy nft_socket_policy[NFTA_SOCKET_MAX + 1] = { |
2205 | diff --git a/net/rds/bind.c b/net/rds/bind.c |
2206 | index 0f4398e7f2a7..93e336535d3b 100644 |
2207 | --- a/net/rds/bind.c |
2208 | +++ b/net/rds/bind.c |
2209 | @@ -1,5 +1,5 @@ |
2210 | /* |
2211 | - * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. |
2212 | + * Copyright (c) 2006, 2019 Oracle and/or its affiliates. All rights reserved. |
2213 | * |
2214 | * This software is available to you under a choice of one of two |
2215 | * licenses. You may choose to be licensed under the terms of the GNU |
2216 | @@ -239,34 +239,33 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
2217 | goto out; |
2218 | } |
2219 | |
2220 | - sock_set_flag(sk, SOCK_RCU_FREE); |
2221 | - ret = rds_add_bound(rs, binding_addr, &port, scope_id); |
2222 | - if (ret) |
2223 | - goto out; |
2224 | - |
2225 | - if (rs->rs_transport) { /* previously bound */ |
2226 | + /* The transport can be set using SO_RDS_TRANSPORT option before the |
2227 | + * socket is bound. |
2228 | + */ |
2229 | + if (rs->rs_transport) { |
2230 | trans = rs->rs_transport; |
2231 | - if (trans->laddr_check(sock_net(sock->sk), |
2232 | + if (!trans->laddr_check || |
2233 | + trans->laddr_check(sock_net(sock->sk), |
2234 | binding_addr, scope_id) != 0) { |
2235 | ret = -ENOPROTOOPT; |
2236 | - rds_remove_bound(rs); |
2237 | - } else { |
2238 | - ret = 0; |
2239 | + goto out; |
2240 | } |
2241 | - goto out; |
2242 | - } |
2243 | - trans = rds_trans_get_preferred(sock_net(sock->sk), binding_addr, |
2244 | - scope_id); |
2245 | - if (!trans) { |
2246 | - ret = -EADDRNOTAVAIL; |
2247 | - rds_remove_bound(rs); |
2248 | - pr_info_ratelimited("RDS: %s could not find a transport for %pI6c, load rds_tcp or rds_rdma?\n", |
2249 | - __func__, binding_addr); |
2250 | - goto out; |
2251 | + } else { |
2252 | + trans = rds_trans_get_preferred(sock_net(sock->sk), |
2253 | + binding_addr, scope_id); |
2254 | + if (!trans) { |
2255 | + ret = -EADDRNOTAVAIL; |
2256 | + pr_info_ratelimited("RDS: %s could not find a transport for %pI6c, load rds_tcp or rds_rdma?\n", |
2257 | + __func__, binding_addr); |
2258 | + goto out; |
2259 | + } |
2260 | + rs->rs_transport = trans; |
2261 | } |
2262 | |
2263 | - rs->rs_transport = trans; |
2264 | - ret = 0; |
2265 | + sock_set_flag(sk, SOCK_RCU_FREE); |
2266 | + ret = rds_add_bound(rs, binding_addr, &port, scope_id); |
2267 | + if (ret) |
2268 | + rs->rs_transport = NULL; |
2269 | |
2270 | out: |
2271 | release_sock(sk); |
2272 | diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c |
2273 | index be7cd140b2a3..b06cc5e50412 100644 |
2274 | --- a/net/sched/sch_api.c |
2275 | +++ b/net/sched/sch_api.c |
2276 | @@ -1831,6 +1831,8 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, |
2277 | cl = cops->find(q, portid); |
2278 | if (!cl) |
2279 | return; |
2280 | + if (!cops->tcf_block) |
2281 | + return; |
2282 | block = cops->tcf_block(q, cl, NULL); |
2283 | if (!block) |
2284 | return; |
2285 | diff --git a/sound/firewire/dice/dice-alesis.c b/sound/firewire/dice/dice-alesis.c |
2286 | index 218292bdace6..f5b325263b67 100644 |
2287 | --- a/sound/firewire/dice/dice-alesis.c |
2288 | +++ b/sound/firewire/dice/dice-alesis.c |
2289 | @@ -15,7 +15,7 @@ alesis_io14_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = { |
2290 | |
2291 | static const unsigned int |
2292 | alesis_io26_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = { |
2293 | - {10, 10, 8}, /* Tx0 = Analog + S/PDIF. */ |
2294 | + {10, 10, 4}, /* Tx0 = Analog + S/PDIF. */ |
2295 | {16, 8, 0}, /* Tx1 = ADAT1 + ADAT2. */ |
2296 | }; |
2297 | |
2298 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
2299 | index c3e3d80ff720..0b24c5ce2fd6 100644 |
2300 | --- a/sound/pci/hda/hda_intel.c |
2301 | +++ b/sound/pci/hda/hda_intel.c |
2302 | @@ -2662,8 +2662,7 @@ static const struct pci_device_id azx_ids[] = { |
2303 | AZX_DCAPS_PM_RUNTIME }, |
2304 | /* AMD Raven */ |
2305 | { PCI_DEVICE(0x1022, 0x15e3), |
2306 | - .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | |
2307 | - AZX_DCAPS_PM_RUNTIME }, |
2308 | + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB }, |
2309 | /* ATI HDMI */ |
2310 | { PCI_DEVICE(0x1002, 0x0002), |
2311 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
2312 | diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c |
2313 | index fd476fb40e1b..677dcc0aca97 100644 |
2314 | --- a/sound/pci/hda/patch_analog.c |
2315 | +++ b/sound/pci/hda/patch_analog.c |
2316 | @@ -370,6 +370,7 @@ static const struct hda_fixup ad1986a_fixups[] = { |
2317 | |
2318 | static const struct snd_pci_quirk ad1986a_fixup_tbl[] = { |
2319 | SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC), |
2320 | + SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC), |
2321 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD), |
2322 | SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD), |
2323 | SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK), |
2324 | diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c |
2325 | index 0a648229e643..09b2967befd9 100644 |
2326 | --- a/sound/soc/fsl/fsl_ssi.c |
2327 | +++ b/sound/soc/fsl/fsl_ssi.c |
2328 | @@ -1439,8 +1439,10 @@ static int fsl_ssi_probe_from_dt(struct fsl_ssi *ssi) |
2329 | * different name to register the device. |
2330 | */ |
2331 | if (!ssi->card_name[0] && of_get_property(np, "codec-handle", NULL)) { |
2332 | - sprop = of_get_property(of_find_node_by_path("/"), |
2333 | - "compatible", NULL); |
2334 | + struct device_node *root = of_find_node_by_path("/"); |
2335 | + |
2336 | + sprop = of_get_property(root, "compatible", NULL); |
2337 | + of_node_put(root); |
2338 | /* Strip "fsl," in the compatible name if applicable */ |
2339 | p = strrchr(sprop, ','); |
2340 | if (p) |
2341 | diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c |
2342 | index 08a5152e635a..e7620017e725 100644 |
2343 | --- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c |
2344 | +++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c |
2345 | @@ -42,6 +42,7 @@ struct cht_mc_private { |
2346 | struct clk *mclk; |
2347 | struct snd_soc_jack jack; |
2348 | bool ts3a227e_present; |
2349 | + int quirks; |
2350 | }; |
2351 | |
2352 | static int platform_clock_control(struct snd_soc_dapm_widget *w, |
2353 | @@ -53,6 +54,10 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, |
2354 | struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card); |
2355 | int ret; |
2356 | |
2357 | + /* See the comment in snd_cht_mc_probe() */ |
2358 | + if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) |
2359 | + return 0; |
2360 | + |
2361 | codec_dai = snd_soc_card_get_codec_dai(card, CHT_CODEC_DAI); |
2362 | if (!codec_dai) { |
2363 | dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n"); |
2364 | @@ -222,6 +227,10 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) |
2365 | "jack detection gpios not added, error %d\n", ret); |
2366 | } |
2367 | |
2368 | + /* See the comment in snd_cht_mc_probe() */ |
2369 | + if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) |
2370 | + return 0; |
2371 | + |
2372 | /* |
2373 | * The firmware might enable the clock at |
2374 | * boot (this information may or may not |
2375 | @@ -420,16 +429,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev) |
2376 | int ret_val = 0; |
2377 | struct cht_mc_private *drv; |
2378 | const char *mclk_name; |
2379 | - int quirks = 0; |
2380 | - |
2381 | - dmi_id = dmi_first_match(cht_max98090_quirk_table); |
2382 | - if (dmi_id) |
2383 | - quirks = (unsigned long)dmi_id->driver_data; |
2384 | |
2385 | drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); |
2386 | if (!drv) |
2387 | return -ENOMEM; |
2388 | |
2389 | + dmi_id = dmi_first_match(cht_max98090_quirk_table); |
2390 | + if (dmi_id) |
2391 | + drv->quirks = (unsigned long)dmi_id->driver_data; |
2392 | + |
2393 | drv->ts3a227e_present = acpi_dev_found("104C227E"); |
2394 | if (!drv->ts3a227e_present) { |
2395 | /* no need probe TI jack detection chip */ |
2396 | @@ -446,7 +454,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) |
2397 | snd_soc_card_cht.dev = &pdev->dev; |
2398 | snd_soc_card_set_drvdata(&snd_soc_card_cht, drv); |
2399 | |
2400 | - if (quirks & QUIRK_PMC_PLT_CLK_0) |
2401 | + if (drv->quirks & QUIRK_PMC_PLT_CLK_0) |
2402 | mclk_name = "pmc_plt_clk_0"; |
2403 | else |
2404 | mclk_name = "pmc_plt_clk_3"; |
2405 | @@ -459,6 +467,21 @@ static int snd_cht_mc_probe(struct platform_device *pdev) |
2406 | return PTR_ERR(drv->mclk); |
2407 | } |
2408 | |
2409 | + /* |
2410 | + * Boards which have the MAX98090's clk connected to clk_0 do not seem |
2411 | + * to like it if we muck with the clock. If we disable the clock when |
2412 | + * it is unused we get "max98090 i2c-193C9890:00: PLL unlocked" errors |
2413 | + * and the PLL never seems to lock again. |
2414 | + * So for these boards we enable it here once and leave it at that. |
2415 | + */ |
2416 | + if (drv->quirks & QUIRK_PMC_PLT_CLK_0) { |
2417 | + ret_val = clk_prepare_enable(drv->mclk); |
2418 | + if (ret_val < 0) { |
2419 | + dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val); |
2420 | + return ret_val; |
2421 | + } |
2422 | + } |
2423 | + |
2424 | ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht); |
2425 | if (ret_val) { |
2426 | dev_err(&pdev->dev, |
2427 | @@ -469,11 +492,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev) |
2428 | return ret_val; |
2429 | } |
2430 | |
2431 | +static int snd_cht_mc_remove(struct platform_device *pdev) |
2432 | +{ |
2433 | + struct snd_soc_card *card = platform_get_drvdata(pdev); |
2434 | + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card); |
2435 | + |
2436 | + if (ctx->quirks & QUIRK_PMC_PLT_CLK_0) |
2437 | + clk_disable_unprepare(ctx->mclk); |
2438 | + |
2439 | + return 0; |
2440 | +} |
2441 | + |
2442 | static struct platform_driver snd_cht_mc_driver = { |
2443 | .driver = { |
2444 | .name = "cht-bsw-max98090", |
2445 | }, |
2446 | .probe = snd_cht_mc_probe, |
2447 | + .remove = snd_cht_mc_remove, |
2448 | }; |
2449 | |
2450 | module_platform_driver(snd_cht_mc_driver) |
2451 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
2452 | index d71e01954975..60d00091f64b 100644 |
2453 | --- a/sound/usb/quirks.c |
2454 | +++ b/sound/usb/quirks.c |
2455 | @@ -1449,6 +1449,8 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
2456 | case 0x152a: /* Thesycon devices */ |
2457 | case 0x25ce: /* Mytek devices */ |
2458 | case 0x2ab6: /* T+A devices */ |
2459 | + case 0x3842: /* EVGA */ |
2460 | + case 0xc502: /* HiBy devices */ |
2461 | if (fp->dsd_raw) |
2462 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
2463 | break; |
2464 | diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c |
2465 | index dd0b68d1f4be..482025b72839 100644 |
2466 | --- a/tools/lib/bpf/bpf.c |
2467 | +++ b/tools/lib/bpf/bpf.c |
2468 | @@ -75,6 +75,17 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, |
2469 | return syscall(__NR_bpf, cmd, attr, size); |
2470 | } |
2471 | |
2472 | +static inline int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size) |
2473 | +{ |
2474 | + int fd; |
2475 | + |
2476 | + do { |
2477 | + fd = sys_bpf(BPF_PROG_LOAD, attr, size); |
2478 | + } while (fd < 0 && errno == EAGAIN); |
2479 | + |
2480 | + return fd; |
2481 | +} |
2482 | + |
2483 | int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr) |
2484 | { |
2485 | __u32 name_len = create_attr->name ? strlen(create_attr->name) : 0; |
2486 | @@ -218,7 +229,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, |
2487 | memcpy(attr.prog_name, load_attr->name, |
2488 | min(name_len, BPF_OBJ_NAME_LEN - 1)); |
2489 | |
2490 | - fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); |
2491 | + fd = sys_bpf_prog_load(&attr, sizeof(attr)); |
2492 | if (fd >= 0 || !log_buf || !log_buf_sz) |
2493 | return fd; |
2494 | |
2495 | @@ -227,7 +238,7 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, |
2496 | attr.log_size = log_buf_sz; |
2497 | attr.log_level = 1; |
2498 | log_buf[0] = 0; |
2499 | - return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); |
2500 | + return sys_bpf_prog_load(&attr, sizeof(attr)); |
2501 | } |
2502 | |
2503 | int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, |
2504 | @@ -268,7 +279,7 @@ int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, |
2505 | attr.kern_version = kern_version; |
2506 | attr.prog_flags = strict_alignment ? BPF_F_STRICT_ALIGNMENT : 0; |
2507 | |
2508 | - return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); |
2509 | + return sys_bpf_prog_load(&attr, sizeof(attr)); |
2510 | } |
2511 | |
2512 | int bpf_map_update_elem(int fd, const void *key, const void *value, |
2513 | diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile |
2514 | index 88158239622b..20f67fcf378d 100644 |
2515 | --- a/tools/objtool/Makefile |
2516 | +++ b/tools/objtool/Makefile |
2517 | @@ -35,7 +35,7 @@ INCLUDES := -I$(srctree)/tools/include \ |
2518 | -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ |
2519 | -I$(srctree)/tools/objtool/arch/$(ARCH)/include |
2520 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed |
2521 | -CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) |
2522 | +CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) |
2523 | LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) |
2524 | |
2525 | # Allow old libelf to be used: |