Gentoo Archives: gentoo-commits

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