From 475cbac842ea05e24adb24014a3f804a80c4414c Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 23 May 2021 16:05:31 -0400 Subject: [PATCH] Fixes for 4.19 Signed-off-by: Sasha Levin --- ...i-prevent-the-ternary-sign-expansion.patch | 49 ++++++ .../nvmet-seset-ns-file-when-open-fails.patch | 61 +++++++ queue-4.19/openrisc-fix-a-memory-leak.patch | 42 +++++ ...l-smbios-wmi-fix-oops-on-rmmod-dell_.patch | 53 ++++++ ...ce-fail-if-the-tracee-changed-its-pi.patch | 161 ++++++++++++++++++ ...r-from-fatal-event-in-dual-port-mode.patch | 38 +++++ ...ear-all-qp-fields-if-creation-failed.patch | 117 +++++++++++++ ...-error-return-code-in-qla82xx_write_.patch | 40 +++++ queue-4.19/series | 8 + 9 files changed, 569 insertions(+) create mode 100644 queue-4.19/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch create mode 100644 queue-4.19/nvmet-seset-ns-file-when-open-fails.patch create mode 100644 queue-4.19/openrisc-fix-a-memory-leak.patch create mode 100644 queue-4.19/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch create mode 100644 queue-4.19/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch create mode 100644 queue-4.19/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch create mode 100644 queue-4.19/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch create mode 100644 queue-4.19/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch create mode 100644 queue-4.19/series diff --git a/queue-4.19/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch b/queue-4.19/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch new file mode 100644 index 00000000000..32901f03310 --- /dev/null +++ b/queue-4.19/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch @@ -0,0 +1,49 @@ +From f07f1b7b976e984a75a812e29686b1d855156c2b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Apr 2021 12:02:29 +0300 +Subject: firmware: arm_scpi: Prevent the ternary sign expansion bug + +From: Dan Carpenter + +[ Upstream commit d9cd78edb2e6b7e26747c0ec312be31e7ef196fe ] + +How the type promotion works in ternary expressions is a bit tricky. +The problem is that scpi_clk_get_val() returns longs, "ret" is a int +which holds a negative error code, and le32_to_cpu() is an unsigned int. +We want the negative error code to be cast to a negative long. But +because le32_to_cpu() is an u32 then "ret" is type promoted to u32 and +becomes a high positive and then it is promoted to long and it is still +a high positive value. + +Fix this by getting rid of the ternary. + +Link: https://lore.kernel.org/r/YIE7pdqV/h10tEAK@mwanda +Fixes: 8cb7cf56c9fe ("firmware: add support for ARM System Control and Power Interface(SCPI) protocol") +Reviewed-by: Cristian Marussi +Signed-off-by: Dan Carpenter +[sudeep.holla: changed to return 0 as clock rate on error] +Signed-off-by: Sudeep Holla +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_scpi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c +index c7d06a36b23a..baa7280eccb3 100644 +--- a/drivers/firmware/arm_scpi.c ++++ b/drivers/firmware/arm_scpi.c +@@ -563,8 +563,10 @@ static unsigned long scpi_clk_get_val(u16 clk_id) + + ret = scpi_send_message(CMD_GET_CLOCK_VALUE, &le_clk_id, + sizeof(le_clk_id), &rate, sizeof(rate)); ++ if (ret) ++ return 0; + +- return ret ? ret : le32_to_cpu(rate); ++ return le32_to_cpu(rate); + } + + static int scpi_clk_set_val(u16 clk_id, unsigned long rate) +-- +2.30.2 + diff --git a/queue-4.19/nvmet-seset-ns-file-when-open-fails.patch b/queue-4.19/nvmet-seset-ns-file-when-open-fails.patch new file mode 100644 index 00000000000..c6916485497 --- /dev/null +++ b/queue-4.19/nvmet-seset-ns-file-when-open-fails.patch @@ -0,0 +1,61 @@ +From dbb9c9a252cbbbf027052eebdab11d73742c57fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 16:50:05 +0200 +Subject: nvmet: seset ns->file when open fails + +From: Daniel Wagner + +[ Upstream commit 85428beac80dbcace5b146b218697c73e367dcf5 ] + +Reset the ns->file value to NULL also in the error case in +nvmet_file_ns_enable(). + +The ns->file variable points either to file object or contains the +error code after the filp_open() call. This can lead to following +problem: + +When the user first setups an invalid file backend and tries to enable +the ns, it will fail. Then the user switches over to a bdev backend +and enables successfully the ns. The first received I/O will crash the +system because the IO backend is chosen based on the ns->file value: + +static u16 nvmet_parse_io_cmd(struct nvmet_req *req) +{ + [...] + + if (req->ns->file) + return nvmet_file_parse_io_cmd(req); + + return nvmet_bdev_parse_io_cmd(req); +} + +Reported-by: Enzo Matsumiya +Signed-off-by: Daniel Wagner +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/target/io-cmd-file.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c +index 39d972e2595f..ad6263cf7303 100644 +--- a/drivers/nvme/target/io-cmd-file.c ++++ b/drivers/nvme/target/io-cmd-file.c +@@ -38,9 +38,11 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) + + ns->file = filp_open(ns->device_path, flags, 0); + if (IS_ERR(ns->file)) { +- pr_err("failed to open file %s: (%ld)\n", +- ns->device_path, PTR_ERR(ns->file)); +- return PTR_ERR(ns->file); ++ ret = PTR_ERR(ns->file); ++ pr_err("failed to open file %s: (%d)\n", ++ ns->device_path, ret); ++ ns->file = NULL; ++ return ret; + } + + ret = vfs_getattr(&ns->file->f_path, +-- +2.30.2 + diff --git a/queue-4.19/openrisc-fix-a-memory-leak.patch b/queue-4.19/openrisc-fix-a-memory-leak.patch new file mode 100644 index 00000000000..2966abfc35e --- /dev/null +++ b/queue-4.19/openrisc-fix-a-memory-leak.patch @@ -0,0 +1,42 @@ +From d373a7a675ddaced5e8885f924af514e33451a3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Apr 2021 17:09:28 +0200 +Subject: openrisc: Fix a memory leak + +From: Christophe JAILLET + +[ Upstream commit c019d92457826bb7b2091c86f36adb5de08405f9 ] + +'setup_find_cpu_node()' take a reference on the node it returns. +This reference must be decremented when not needed anymore, or there will +be a leak. + +Add the missing 'of_node_put(cpu)'. + +Note that 'setup_cpuinfo()' that also calls this function already has a +correct 'of_node_put(cpu)' at its end. + +Fixes: 9d02a4283e9c ("OpenRISC: Boot code") +Signed-off-by: Christophe JAILLET +Signed-off-by: Stafford Horne +Signed-off-by: Sasha Levin +--- + arch/openrisc/kernel/setup.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c +index 9d28ab14d139..f3a7375ac3cd 100644 +--- a/arch/openrisc/kernel/setup.c ++++ b/arch/openrisc/kernel/setup.c +@@ -281,6 +281,8 @@ void calibrate_delay(void) + pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n", + loops_per_jiffy / (500000 / HZ), + (loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy); ++ ++ of_node_put(cpu); + } + + void __init setup_arch(char **cmdline_p) +-- +2.30.2 + diff --git a/queue-4.19/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch b/queue-4.19/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch new file mode 100644 index 00000000000..ddcbdcf95fd --- /dev/null +++ b/queue-4.19/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch @@ -0,0 +1,53 @@ +From 7461e74eb0d1a3a9cd0e4389c0b989de1fd533e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 14:50:27 +0200 +Subject: platform/x86: dell-smbios-wmi: Fix oops on rmmod dell_smbios + +From: Hans de Goede + +[ Upstream commit 3a53587423d25c87af4b4126a806a0575104b45e ] + +init_dell_smbios_wmi() only registers the dell_smbios_wmi_driver on systems +where the Dell WMI interface is supported. While exit_dell_smbios_wmi() +unregisters it unconditionally, this leads to the following oops: + +[ 175.722921] ------------[ cut here ]------------ +[ 175.722925] Unexpected driver unregister! +[ 175.722939] WARNING: CPU: 1 PID: 3630 at drivers/base/driver.c:194 driver_unregister+0x38/0x40 +... +[ 175.723089] Call Trace: +[ 175.723094] cleanup_module+0x5/0xedd [dell_smbios] +... +[ 175.723148] ---[ end trace 064c34e1ad49509d ]--- + +Make the unregister happen on the same condition the register happens +to fix this. + +Cc: Mario Limonciello +Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver") +Signed-off-by: Hans de Goede +Reviewed-by: Mario Limonciello +Reviewed-by: Mark Gross +Link: https://lore.kernel.org/r/20210518125027.21824-1-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/dell-smbios-wmi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c +index cf2229ece9ff..ccccce9b67ef 100644 +--- a/drivers/platform/x86/dell-smbios-wmi.c ++++ b/drivers/platform/x86/dell-smbios-wmi.c +@@ -274,7 +274,8 @@ int init_dell_smbios_wmi(void) + + void exit_dell_smbios_wmi(void) + { +- wmi_driver_unregister(&dell_smbios_wmi_driver); ++ if (wmi_supported) ++ wmi_driver_unregister(&dell_smbios_wmi_driver); + } + + MODULE_ALIAS("wmi:" DELL_WMI_SMBIOS_GUID); +-- +2.30.2 + diff --git a/queue-4.19/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch b/queue-4.19/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch new file mode 100644 index 00000000000..9d83563fc65 --- /dev/null +++ b/queue-4.19/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch @@ -0,0 +1,161 @@ +From 70fef5f48f1631f8e23257d073b8ca4172568687 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 May 2021 15:33:08 +0200 +Subject: ptrace: make ptrace() fail if the tracee changed its pid unexpectedly + +From: Oleg Nesterov + +[ Upstream commit dbb5afad100a828c97e012c6106566d99f041db6 ] + +Suppose we have 2 threads, the group-leader L and a sub-theread T, +both parked in ptrace_stop(). Debugger tries to resume both threads +and does + + ptrace(PTRACE_CONT, T); + ptrace(PTRACE_CONT, L); + +If the sub-thread T execs in between, the 2nd PTRACE_CONT doesn not +resume the old leader L, it resumes the post-exec thread T which was +actually now stopped in PTHREAD_EVENT_EXEC. In this case the +PTHREAD_EVENT_EXEC event is lost, and the tracer can't know that the +tracee changed its pid. + +This patch makes ptrace() fail in this case until debugger does wait() +and consumes PTHREAD_EVENT_EXEC which reports old_pid. This affects all +ptrace requests except the "asynchronous" PTRACE_INTERRUPT/KILL. + +The patch doesn't add the new PTRACE_ option to not complicate the API, +and I _hope_ this won't cause any noticeable regression: + + - If debugger uses PTRACE_O_TRACEEXEC and the thread did an exec + and the tracer does a ptrace request without having consumed + the exec event, it's 100% sure that the thread the ptracer + thinks it is targeting does not exist anymore, or isn't the + same as the one it thinks it is targeting. + + - To some degree this patch adds nothing new. In the scenario + above ptrace(L) can fail with -ESRCH if it is called after the + execing sub-thread wakes the leader up and before it "steals" + the leader's pid. + +Test-case: + + #include + #include + #include + #include + #include + #include + #include + #include + + void *tf(void *arg) + { + execve("/usr/bin/true", NULL, NULL); + assert(0); + + return NULL; + } + + int main(void) + { + int leader = fork(); + if (!leader) { + kill(getpid(), SIGSTOP); + + pthread_t th; + pthread_create(&th, NULL, tf, NULL); + for (;;) + pause(); + + return 0; + } + + waitpid(leader, NULL, WSTOPPED); + + ptrace(PTRACE_SEIZE, leader, 0, + PTRACE_O_TRACECLONE | PTRACE_O_TRACEEXEC); + waitpid(leader, NULL, 0); + + ptrace(PTRACE_CONT, leader, 0,0); + waitpid(leader, NULL, 0); + + int status, thread = waitpid(-1, &status, 0); + assert(thread > 0 && thread != leader); + assert(status == 0x80137f); + + ptrace(PTRACE_CONT, thread, 0,0); + /* + * waitid() because waitpid(leader, &status, WNOWAIT) does not + * report status. Why ???? + * + * Why WEXITED? because we have another kernel problem connected + * to mt-exec. + */ + siginfo_t info; + assert(waitid(P_PID, leader, &info, WSTOPPED|WEXITED|WNOWAIT) == 0); + assert(info.si_pid == leader && info.si_status == 0x0405); + + /* OK, it sleeps in ptrace(PTRACE_EVENT_EXEC == 0x04) */ + assert(ptrace(PTRACE_CONT, leader, 0,0) == -1); + assert(errno == ESRCH); + + assert(leader == waitpid(leader, &status, WNOHANG)); + assert(status == 0x04057f); + + assert(ptrace(PTRACE_CONT, leader, 0,0) == 0); + + return 0; + } + +Signed-off-by: Oleg Nesterov +Reported-by: Simon Marchi +Acked-by: "Eric W. Biederman" +Acked-by: Pedro Alves +Acked-by: Simon Marchi +Acked-by: Jan Kratochvil +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/ptrace.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/kernel/ptrace.c b/kernel/ptrace.c +index ecdb7402072f..af74e843221b 100644 +--- a/kernel/ptrace.c ++++ b/kernel/ptrace.c +@@ -163,6 +163,21 @@ void __ptrace_unlink(struct task_struct *child) + spin_unlock(&child->sighand->siglock); + } + ++static bool looks_like_a_spurious_pid(struct task_struct *task) ++{ ++ if (task->exit_code != ((PTRACE_EVENT_EXEC << 8) | SIGTRAP)) ++ return false; ++ ++ if (task_pid_vnr(task) == task->ptrace_message) ++ return false; ++ /* ++ * The tracee changed its pid but the PTRACE_EVENT_EXEC event ++ * was not wait()'ed, most probably debugger targets the old ++ * leader which was destroyed in de_thread(). ++ */ ++ return true; ++} ++ + /* Ensure that nothing can wake it up, even SIGKILL */ + static bool ptrace_freeze_traced(struct task_struct *task) + { +@@ -173,7 +188,8 @@ static bool ptrace_freeze_traced(struct task_struct *task) + return ret; + + spin_lock_irq(&task->sighand->siglock); +- if (task_is_traced(task) && !__fatal_signal_pending(task)) { ++ if (task_is_traced(task) && !looks_like_a_spurious_pid(task) && ++ !__fatal_signal_pending(task)) { + task->state = __TASK_TRACED; + ret = true; + } +-- +2.30.2 + diff --git a/queue-4.19/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch b/queue-4.19/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch new file mode 100644 index 00000000000..1163bbb2d69 --- /dev/null +++ b/queue-4.19/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch @@ -0,0 +1,38 @@ +From 8235d374244d29ddeb3af43067bdca2cedf4a1df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 08:48:29 +0300 +Subject: RDMA/mlx5: Recover from fatal event in dual port mode + +From: Maor Gottlieb + +[ Upstream commit 97f30d324ce6645a4de4ffb71e4ae9b8ca36ff04 ] + +When there is fatal event on the slave port, the device is marked as not +active. We need to mark it as active again when the slave is recovered to +regain full functionality. + +Fixes: d69a24e03659 ("IB/mlx5: Move IB event processing onto a workqueue") +Link: https://lore.kernel.org/r/8906754455bb23019ef223c725d2c0d38acfb80b.1620711734.git.leonro@nvidia.com +Signed-off-by: Maor Gottlieb +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/mlx5/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c +index 1695605eeb52..13513466df01 100644 +--- a/drivers/infiniband/hw/mlx5/main.c ++++ b/drivers/infiniband/hw/mlx5/main.c +@@ -6339,6 +6339,7 @@ static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev) + + if (bound) { + rdma_roce_rescan_device(&dev->ib_dev); ++ mpi->ibdev->ib_active = true; + break; + } + } +-- +2.30.2 + diff --git a/queue-4.19/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch b/queue-4.19/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch new file mode 100644 index 00000000000..1c916d34975 --- /dev/null +++ b/queue-4.19/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch @@ -0,0 +1,117 @@ +From b05f19396add67231381712b76631301833e9ddf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 May 2021 10:26:03 +0300 +Subject: RDMA/rxe: Clear all QP fields if creation failed + +From: Leon Romanovsky + +[ Upstream commit 67f29896fdc83298eed5a6576ff8f9873f709228 ] + +rxe_qp_do_cleanup() relies on valid pointer values in QP for the properly +created ones, but in case rxe_qp_from_init() failed it was filled with +garbage and caused tot the following error. + + refcount_t: underflow; use-after-free. + WARNING: CPU: 1 PID: 12560 at lib/refcount.c:28 refcount_warn_saturate+0x1d1/0x1e0 lib/refcount.c:28 + Modules linked in: + CPU: 1 PID: 12560 Comm: syz-executor.4 Not tainted 5.12.0-syzkaller #0 + Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 + RIP: 0010:refcount_warn_saturate+0x1d1/0x1e0 lib/refcount.c:28 + Code: e9 db fe ff ff 48 89 df e8 2c c2 ea fd e9 8a fe ff ff e8 72 6a a7 fd 48 c7 c7 e0 b2 c1 89 c6 05 dc 3a e6 09 01 e8 ee 74 fb 04 <0f> 0b e9 af fe ff ff 0f 1f 84 00 00 00 00 00 41 56 41 55 41 54 55 + RSP: 0018:ffffc900097ceba8 EFLAGS: 00010286 + RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 + RDX: 0000000000040000 RSI: ffffffff815bb075 RDI: fffff520012f9d67 + RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000 + R10: ffffffff815b4eae R11: 0000000000000000 R12: ffff8880322a4800 + R13: ffff8880322a4940 R14: ffff888033044e00 R15: 0000000000000000 + FS: 00007f6eb2be3700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 00007fdbe5d41000 CR3: 000000001d181000 CR4: 00000000001506e0 + DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 + DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 + Call Trace: + __refcount_sub_and_test include/linux/refcount.h:283 [inline] + __refcount_dec_and_test include/linux/refcount.h:315 [inline] + refcount_dec_and_test include/linux/refcount.h:333 [inline] + kref_put include/linux/kref.h:64 [inline] + rxe_qp_do_cleanup+0x96f/0xaf0 drivers/infiniband/sw/rxe/rxe_qp.c:805 + execute_in_process_context+0x37/0x150 kernel/workqueue.c:3327 + rxe_elem_release+0x9f/0x180 drivers/infiniband/sw/rxe/rxe_pool.c:391 + kref_put include/linux/kref.h:65 [inline] + rxe_create_qp+0x2cd/0x310 drivers/infiniband/sw/rxe/rxe_verbs.c:425 + _ib_create_qp drivers/infiniband/core/core_priv.h:331 [inline] + ib_create_named_qp+0x2ad/0x1370 drivers/infiniband/core/verbs.c:1231 + ib_create_qp include/rdma/ib_verbs.h:3644 [inline] + create_mad_qp+0x177/0x2d0 drivers/infiniband/core/mad.c:2920 + ib_mad_port_open drivers/infiniband/core/mad.c:3001 [inline] + ib_mad_init_device+0xd6f/0x1400 drivers/infiniband/core/mad.c:3092 + add_client_context+0x405/0x5e0 drivers/infiniband/core/device.c:717 + enable_device_and_get+0x1cd/0x3b0 drivers/infiniband/core/device.c:1331 + ib_register_device drivers/infiniband/core/device.c:1413 [inline] + ib_register_device+0x7c7/0xa50 drivers/infiniband/core/device.c:1365 + rxe_register_device+0x3d5/0x4a0 drivers/infiniband/sw/rxe/rxe_verbs.c:1147 + rxe_add+0x12fe/0x16d0 drivers/infiniband/sw/rxe/rxe.c:247 + rxe_net_add+0x8c/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:503 + rxe_newlink drivers/infiniband/sw/rxe/rxe.c:269 [inline] + rxe_newlink+0xb7/0xe0 drivers/infiniband/sw/rxe/rxe.c:250 + nldev_newlink+0x30e/0x550 drivers/infiniband/core/nldev.c:1555 + rdma_nl_rcv_msg+0x36d/0x690 drivers/infiniband/core/netlink.c:195 + rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline] + rdma_nl_rcv+0x2ee/0x430 drivers/infiniband/core/netlink.c:259 + netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] + netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338 + netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927 + sock_sendmsg_nosec net/socket.c:654 [inline] + sock_sendmsg+0xcf/0x120 net/socket.c:674 + ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350 + ___sys_sendmsg+0xf3/0x170 net/socket.c:2404 + __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433 + do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 + entry_SYSCALL_64_after_hwframe+0x44/0xae + +Fixes: 8700e3e7c485 ("Soft RoCE driver") +Link: https://lore.kernel.org/r/7bf8d548764d406dbbbaf4b574960ebfd5af8387.1620717918.git.leonro@nvidia.com +Reported-by: syzbot+36a7f280de4e11c6f04e@syzkaller.appspotmail.com +Signed-off-by: Leon Romanovsky +Reviewed-by: Zhu Yanjun +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_qp.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c +index 8a22ab8b29e9..41c9ede98c26 100644 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c +@@ -250,6 +250,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, + if (err) { + vfree(qp->sq.queue->buf); + kfree(qp->sq.queue); ++ qp->sq.queue = NULL; + return err; + } + +@@ -303,6 +304,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, + if (err) { + vfree(qp->rq.queue->buf); + kfree(qp->rq.queue); ++ qp->rq.queue = NULL; + return err; + } + } +@@ -363,6 +365,11 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd, + err2: + rxe_queue_cleanup(qp->sq.queue); + err1: ++ qp->pd = NULL; ++ qp->rcq = NULL; ++ qp->scq = NULL; ++ qp->srq = NULL; ++ + if (srq) + rxe_drop_ref(srq); + rxe_drop_ref(scq); +-- +2.30.2 + diff --git a/queue-4.19/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch b/queue-4.19/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch new file mode 100644 index 00000000000..0482ccc07fc --- /dev/null +++ b/queue-4.19/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch @@ -0,0 +1,40 @@ +From 8fb02e37341d3f06b376aefae714d4146af45f79 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 May 2021 17:09:52 +0800 +Subject: scsi: qla2xxx: Fix error return code in qla82xx_write_flash_dword() + +From: Zhen Lei + +[ Upstream commit 5cb289bf2d7c34ca1abd794ce116c4f19185a1d4 ] + +Fix to return a negative error code from the error handling case instead of +0 as done elsewhere in this function. + +Link: https://lore.kernel.org/r/20210514090952.6715-1-thunder.leizhen@huawei.com +Fixes: a9083016a531 ("[SCSI] qla2xxx: Add ISP82XX support.") +Reported-by: Hulk Robot +Reviewed-by: Himanshu Madhani +Signed-off-by: Zhen Lei +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_nx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c +index 3007eecfa509..7451355f20e0 100644 +--- a/drivers/scsi/qla2xxx/qla_nx.c ++++ b/drivers/scsi/qla2xxx/qla_nx.c +@@ -1107,7 +1107,8 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr, + return ret; + } + +- if (qla82xx_flash_set_write_enable(ha)) ++ ret = qla82xx_flash_set_write_enable(ha); ++ if (ret < 0) + goto done_write; + + qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, data); +-- +2.30.2 + diff --git a/queue-4.19/series b/queue-4.19/series new file mode 100644 index 00000000000..3e778042c56 --- /dev/null +++ b/queue-4.19/series @@ -0,0 +1,8 @@ +firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch +openrisc-fix-a-memory-leak.patch +rdma-rxe-clear-all-qp-fields-if-creation-failed.patch +scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch +rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch +platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch +ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch +nvmet-seset-ns-file-when-open-fails.patch -- 2.47.3