]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Sun, 23 May 2021 20:05:30 +0000 (16:05 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 23 May 2021 20:05:30 +0000 (16:05 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
15 files changed:
queue-5.4/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch [new file with mode: 0644]
queue-5.4/nvmet-seset-ns-file-when-open-fails.patch [new file with mode: 0644]
queue-5.4/openrisc-fix-a-memory-leak.patch [new file with mode: 0644]
queue-5.4/platform-mellanox-mlxbf-tmfifo-fix-a-memory-barrier-.patch [new file with mode: 0644]
queue-5.4/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch [new file with mode: 0644]
queue-5.4/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch [new file with mode: 0644]
queue-5.4/rdma-core-don-t-access-cm_id-after-its-destruction.patch [new file with mode: 0644]
queue-5.4/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch [new file with mode: 0644]
queue-5.4/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch [new file with mode: 0644]
queue-5.4/rdma-siw-properly-check-send-and-receive-cq-pointers.patch [new file with mode: 0644]
queue-5.4/rdma-siw-release-xarray-entry.patch [new file with mode: 0644]
queue-5.4/rdma-uverbs-fix-a-null-vs-is_err-bug.patch [new file with mode: 0644]
queue-5.4/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch [new file with mode: 0644]
queue-5.4/scsi-ufs-core-increase-the-usable-queue-depth.patch [new file with mode: 0644]
queue-5.4/series [new file with mode: 0644]

diff --git a/queue-5.4/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch b/queue-5.4/firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch
new file mode 100644 (file)
index 0000000..dbcc9d4
--- /dev/null
@@ -0,0 +1,49 @@
+From b238d1769c1e1377b71285335b7364d013353c40 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Apr 2021 12:02:29 +0300
+Subject: firmware: arm_scpi: Prevent the ternary sign expansion bug
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ 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 <cristian.marussi@arm.com>
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+[sudeep.holla: changed to return 0 as clock rate on error]
+Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 a80c331c3a6e..e2995ec14401 100644
+--- a/drivers/firmware/arm_scpi.c
++++ b/drivers/firmware/arm_scpi.c
+@@ -552,8 +552,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-5.4/nvmet-seset-ns-file-when-open-fails.patch b/queue-5.4/nvmet-seset-ns-file-when-open-fails.patch
new file mode 100644 (file)
index 0000000..3597514
--- /dev/null
@@ -0,0 +1,61 @@
+From d730761bc330615a29b5a4783521408cddc75b51 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 May 2021 16:50:05 +0200
+Subject: nvmet: seset ns->file when open fails
+
+From: Daniel Wagner <dwagner@suse.de>
+
+[ 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 <ematsumiya@suse.com>
+Signed-off-by: Daniel Wagner <dwagner@suse.de>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 05453f5d1448..6ca17a0babae 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-5.4/openrisc-fix-a-memory-leak.patch b/queue-5.4/openrisc-fix-a-memory-leak.patch
new file mode 100644 (file)
index 0000000..ed9e12a
--- /dev/null
@@ -0,0 +1,42 @@
+From 2412216a5b1f7710fcaa3a030a4601763c36037a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Apr 2021 17:09:28 +0200
+Subject: openrisc: Fix a memory leak
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ 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 <christophe.jaillet@wanadoo.fr>
+Signed-off-by: Stafford Horne <shorne@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 d668f5be3a99..ae104eb4becc 100644
+--- a/arch/openrisc/kernel/setup.c
++++ b/arch/openrisc/kernel/setup.c
+@@ -274,6 +274,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-5.4/platform-mellanox-mlxbf-tmfifo-fix-a-memory-barrier-.patch b/queue-5.4/platform-mellanox-mlxbf-tmfifo-fix-a-memory-barrier-.patch
new file mode 100644 (file)
index 0000000..c8d55a9
--- /dev/null
@@ -0,0 +1,66 @@
+From 73b68f79acd38141cc5d31d2c786ed9b2f720427 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 May 2021 20:30:12 -0400
+Subject: platform/mellanox: mlxbf-tmfifo: Fix a memory barrier issue
+
+From: Liming Sun <limings@nvidia.com>
+
+[ Upstream commit 1c0e5701c5e792c090aef0e5b9b8923c334d9324 ]
+
+The virtio framework uses wmb() when updating avail->idx. It
+guarantees the write order, but not necessarily loading order
+for the code accessing the memory. This commit adds a load barrier
+after reading the avail->idx to make sure all the data in the
+descriptor is visible. It also adds a barrier when returning the
+packet to virtio framework to make sure read/writes are visible to
+the virtio code.
+
+Fixes: 1357dfd7261f ("platform/mellanox: Add TmFifo driver for Mellanox BlueField Soc")
+Signed-off-by: Liming Sun <limings@nvidia.com>
+Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
+Link: https://lore.kernel.org/r/1620433812-17911-1-git-send-email-limings@nvidia.com
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/mellanox/mlxbf-tmfifo.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c
+index 5739a9669b29..92bda873d44a 100644
+--- a/drivers/platform/mellanox/mlxbf-tmfifo.c
++++ b/drivers/platform/mellanox/mlxbf-tmfifo.c
+@@ -294,6 +294,9 @@ mlxbf_tmfifo_get_next_desc(struct mlxbf_tmfifo_vring *vring)
+       if (vring->next_avail == virtio16_to_cpu(vdev, vr->avail->idx))
+               return NULL;
++      /* Make sure 'avail->idx' is visible already. */
++      virtio_rmb(false);
++
+       idx = vring->next_avail % vr->num;
+       head = virtio16_to_cpu(vdev, vr->avail->ring[idx]);
+       if (WARN_ON(head >= vr->num))
+@@ -322,7 +325,7 @@ static void mlxbf_tmfifo_release_desc(struct mlxbf_tmfifo_vring *vring,
+        * done or not. Add a memory barrier here to make sure the update above
+        * completes before updating the idx.
+        */
+-      mb();
++      virtio_mb(false);
+       vr->used->idx = cpu_to_virtio16(vdev, vr_idx + 1);
+ }
+@@ -730,6 +733,12 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring,
+               desc = NULL;
+               fifo->vring[is_rx] = NULL;
++              /*
++               * Make sure the load/store are in order before
++               * returning back to virtio.
++               */
++              virtio_mb(false);
++
+               /* Notify upper layer that packet is done. */
+               spin_lock_irqsave(&fifo->spin_lock[is_rx], flags);
+               vring_interrupt(0, vring->vq);
+-- 
+2.30.2
+
diff --git a/queue-5.4/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch b/queue-5.4/platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch
new file mode 100644 (file)
index 0000000..49f3cf5
--- /dev/null
@@ -0,0 +1,53 @@
+From 5155a14e20bbdfc9d66b1f57adc66e4eea31c463 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+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 <hdegoede@redhat.com>
+
+[ 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 <mario.limonciello@outlook.com>
+Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Mario Limonciello <mario.limonciello@outlook.com>
+Reviewed-by: Mark Gross <mgross@linux.intel.com>
+Link: https://lore.kernel.org/r/20210518125027.21824-1-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 27a298b7c541..c97bd4a45242 100644
+--- a/drivers/platform/x86/dell-smbios-wmi.c
++++ b/drivers/platform/x86/dell-smbios-wmi.c
+@@ -271,7 +271,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_DEVICE_TABLE(wmi, dell_smbios_wmi_id_table);
+-- 
+2.30.2
+
diff --git a/queue-5.4/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch b/queue-5.4/ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch
new file mode 100644 (file)
index 0000000..9c8c243
--- /dev/null
@@ -0,0 +1,161 @@
+From 703c1e57211e565acbeaed0e98e89c51fdf13109 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 May 2021 15:33:08 +0200
+Subject: ptrace: make ptrace() fail if the tracee changed its pid unexpectedly
+
+From: Oleg Nesterov <oleg@redhat.com>
+
+[ 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 <stdio.h>
+       #include <unistd.h>
+       #include <signal.h>
+       #include <sys/ptrace.h>
+       #include <sys/wait.h>
+       #include <errno.h>
+       #include <pthread.h>
+       #include <assert.h>
+
+       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 <oleg@redhat.com>
+Reported-by: Simon Marchi <simon.marchi@efficios.com>
+Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
+Acked-by: Pedro Alves <palves@redhat.com>
+Acked-by: Simon Marchi <simon.marchi@efficios.com>
+Acked-by: Jan Kratochvil <jan.kratochvil@redhat.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/ptrace.c | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/ptrace.c b/kernel/ptrace.c
+index 79de1294f8eb..eb4d04cb3aaf 100644
+--- a/kernel/ptrace.c
++++ b/kernel/ptrace.c
+@@ -169,6 +169,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)
+ {
+@@ -179,7 +194,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-5.4/rdma-core-don-t-access-cm_id-after-its-destruction.patch b/queue-5.4/rdma-core-don-t-access-cm_id-after-its-destruction.patch
new file mode 100644 (file)
index 0000000..d7ff36d
--- /dev/null
@@ -0,0 +1,98 @@
+From 7fbaeb1944edbef2d0417948168608f8ae6e2cf8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 May 2021 08:48:28 +0300
+Subject: RDMA/core: Don't access cm_id after its destruction
+
+From: Shay Drory <shayd@nvidia.com>
+
+[ Upstream commit 889d916b6f8a48b8c9489fffcad3b78eedd01a51 ]
+
+restrack should only be attached to a cm_id while the ID has a valid
+device pointer. It is set up when the device is first loaded, but not
+cleared when the device is removed. There is also two copies of the device
+pointer, one private and one in the public API, and these were left out of
+sync.
+
+Make everything go to NULL together and manipulate restrack right around
+the device assignments.
+
+Found by syzcaller:
+BUG: KASAN: wild-memory-access in __list_del include/linux/list.h:112 [inline]
+BUG: KASAN: wild-memory-access in __list_del_entry include/linux/list.h:135 [inline]
+BUG: KASAN: wild-memory-access in list_del include/linux/list.h:146 [inline]
+BUG: KASAN: wild-memory-access in cma_cancel_listens drivers/infiniband/core/cma.c:1767 [inline]
+BUG: KASAN: wild-memory-access in cma_cancel_operation drivers/infiniband/core/cma.c:1795 [inline]
+BUG: KASAN: wild-memory-access in cma_cancel_operation+0x1f4/0x4b0 drivers/infiniband/core/cma.c:1783
+Write of size 8 at addr dead000000000108 by task syz-executor716/334
+
+CPU: 0 PID: 334 Comm: syz-executor716 Not tainted 5.11.0+ #271
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
+rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
+Call Trace:
+ __dump_stack lib/dump_stack.c:79 [inline]
+ dump_stack+0xbe/0xf9 lib/dump_stack.c:120
+ __kasan_report mm/kasan/report.c:400 [inline]
+ kasan_report.cold+0x5f/0xd5 mm/kasan/report.c:413
+ __list_del include/linux/list.h:112 [inline]
+ __list_del_entry include/linux/list.h:135 [inline]
+ list_del include/linux/list.h:146 [inline]
+ cma_cancel_listens drivers/infiniband/core/cma.c:1767 [inline]
+ cma_cancel_operation drivers/infiniband/core/cma.c:1795 [inline]
+ cma_cancel_operation+0x1f4/0x4b0 drivers/infiniband/core/cma.c:1783
+ _destroy_id+0x29/0x460 drivers/infiniband/core/cma.c:1862
+ ucma_close_id+0x36/0x50 drivers/infiniband/core/ucma.c:185
+ ucma_destroy_private_ctx+0x58d/0x5b0 drivers/infiniband/core/ucma.c:576
+ ucma_close+0x91/0xd0 drivers/infiniband/core/ucma.c:1797
+ __fput+0x169/0x540 fs/file_table.c:280
+ task_work_run+0xb7/0x100 kernel/task_work.c:140
+ exit_task_work include/linux/task_work.h:30 [inline]
+ do_exit+0x7da/0x17f0 kernel/exit.c:825
+ do_group_exit+0x9e/0x190 kernel/exit.c:922
+ __do_sys_exit_group kernel/exit.c:933 [inline]
+ __se_sys_exit_group kernel/exit.c:931 [inline]
+ __x64_sys_exit_group+0x2d/0x30 kernel/exit.c:931
+ do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46
+ entry_SYSCALL_64_after_hwframe+0x44/0xa9
+
+Fixes: 255d0c14b375 ("RDMA/cma: rdma_bind_addr() leaks a cma_dev reference count")
+Link: https://lore.kernel.org/r/3352ee288fe34f2b44220457a29bfc0548686363.1620711734.git.leonro@nvidia.com
+Signed-off-by: Shay Drory <shayd@nvidia.com>
+Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/core/cma.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
+index ecac62a7b59e..92428990f0cc 100644
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -530,6 +530,7 @@ static void cma_release_dev(struct rdma_id_private *id_priv)
+       list_del(&id_priv->list);
+       cma_deref_dev(id_priv->cma_dev);
+       id_priv->cma_dev = NULL;
++      id_priv->id.device = NULL;
+       if (id_priv->id.route.addr.dev_addr.sgid_attr) {
+               rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr);
+               id_priv->id.route.addr.dev_addr.sgid_attr = NULL;
+@@ -1871,6 +1872,7 @@ void rdma_destroy_id(struct rdma_cm_id *id)
+                               iw_destroy_cm_id(id_priv->cm_id.iw);
+               }
+               cma_leave_mc_groups(id_priv);
++              rdma_restrack_del(&id_priv->res);
+               cma_release_dev(id_priv);
+       }
+@@ -3580,7 +3582,7 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
+       }
+       id_priv->backlog = backlog;
+-      if (id->device) {
++      if (id_priv->cma_dev) {
+               if (rdma_cap_ib_cm(id->device, 1)) {
+                       ret = cma_ib_listen(id_priv);
+                       if (ret)
+-- 
+2.30.2
+
diff --git a/queue-5.4/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch b/queue-5.4/rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch
new file mode 100644 (file)
index 0000000..bf55a94
--- /dev/null
@@ -0,0 +1,38 @@
+From 7b5db7dcd1d09d120011680940941b6df5e4a908 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 May 2021 08:48:29 +0300
+Subject: RDMA/mlx5: Recover from fatal event in dual port mode
+
+From: Maor Gottlieb <maorg@nvidia.com>
+
+[ 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 <maorg@nvidia.com>
+Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 e2656b68ec22..a173737cb022 100644
+--- a/drivers/infiniband/hw/mlx5/main.c
++++ b/drivers/infiniband/hw/mlx5/main.c
+@@ -6879,6 +6879,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-5.4/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch b/queue-5.4/rdma-rxe-clear-all-qp-fields-if-creation-failed.patch
new file mode 100644 (file)
index 0000000..d9562e6
--- /dev/null
@@ -0,0 +1,117 @@
+From 7b40cf3501515263cbd32fdc5754ca7fe0c1418c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 May 2021 10:26:03 +0300
+Subject: RDMA/rxe: Clear all QP fields if creation failed
+
+From: Leon Romanovsky <leonro@nvidia.com>
+
+[ 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 <leonro@nvidia.com>
+Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 f85273883794..d427a343c09f 100644
+--- a/drivers/infiniband/sw/rxe/rxe_qp.c
++++ b/drivers/infiniband/sw/rxe/rxe_qp.c
+@@ -260,6 +260,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;
+       }
+@@ -313,6 +314,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;
+               }
+       }
+@@ -373,6 +375,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-5.4/rdma-siw-properly-check-send-and-receive-cq-pointers.patch b/queue-5.4/rdma-siw-properly-check-send-and-receive-cq-pointers.patch
new file mode 100644 (file)
index 0000000..6e70fdb
--- /dev/null
@@ -0,0 +1,62 @@
+From c48f6fb3326d855b26378171a5a78a381036dbfc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 9 May 2021 14:39:21 +0300
+Subject: RDMA/siw: Properly check send and receive CQ pointers
+
+From: Leon Romanovsky <leonro@nvidia.com>
+
+[ Upstream commit a568814a55a0e82bbc7c7b51333d0c38e8fb5520 ]
+
+The check for the NULL of pointer received from container_of() is
+incorrect by definition as it points to some offset from NULL.
+
+Change such check with proper NULL check of SIW QP attributes.
+
+Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
+Link: https://lore.kernel.org/r/a7535a82925f6f4c1f062abaa294f3ae6e54bdd2.1620560310.git.leonro@nvidia.com
+Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
+Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/sw/siw/siw_verbs.c | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
+index 2c3704f0f10f..daa71469269e 100644
+--- a/drivers/infiniband/sw/siw/siw_verbs.c
++++ b/drivers/infiniband/sw/siw/siw_verbs.c
+@@ -314,7 +314,6 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
+       struct siw_ucontext *uctx =
+               rdma_udata_to_drv_context(udata, struct siw_ucontext,
+                                         base_ucontext);
+-      struct siw_cq *scq = NULL, *rcq = NULL;
+       unsigned long flags;
+       int num_sqe, num_rqe, rv = 0;
+@@ -353,10 +352,8 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
+               rv = -EINVAL;
+               goto err_out;
+       }
+-      scq = to_siw_cq(attrs->send_cq);
+-      rcq = to_siw_cq(attrs->recv_cq);
+-      if (!scq || (!rcq && !attrs->srq)) {
++      if (!attrs->send_cq || (!attrs->recv_cq && !attrs->srq)) {
+               siw_dbg(base_dev, "send CQ or receive CQ invalid\n");
+               rv = -EINVAL;
+               goto err_out;
+@@ -423,8 +420,8 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
+               }
+       }
+       qp->pd = pd;
+-      qp->scq = scq;
+-      qp->rcq = rcq;
++      qp->scq = to_siw_cq(attrs->send_cq);
++      qp->rcq = to_siw_cq(attrs->recv_cq);
+       if (attrs->srq) {
+               /*
+-- 
+2.30.2
+
diff --git a/queue-5.4/rdma-siw-release-xarray-entry.patch b/queue-5.4/rdma-siw-release-xarray-entry.patch
new file mode 100644 (file)
index 0000000..295f9c7
--- /dev/null
@@ -0,0 +1,38 @@
+From 7cfe66b9768cd43a26575872c2f8361154cea4af Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 9 May 2021 14:41:38 +0300
+Subject: RDMA/siw: Release xarray entry
+
+From: Leon Romanovsky <leonro@nvidia.com>
+
+[ Upstream commit a3d83276d98886879b5bf7b30b7c29882754e4df ]
+
+The xarray entry is allocated in siw_qp_add(), but release was
+missed in case zero-sized SQ was discovered.
+
+Fixes: 661f385961f0 ("RDMA/siw: Fix handling of zero-sized Read and Receive Queues.")
+Link: https://lore.kernel.org/r/f070b59d5a1114d5a4e830346755c2b3f141cde5.1620560472.git.leonro@nvidia.com
+Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
+Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
+index daa71469269e..b9ca54e372b4 100644
+--- a/drivers/infiniband/sw/siw/siw_verbs.c
++++ b/drivers/infiniband/sw/siw/siw_verbs.c
+@@ -397,7 +397,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
+       else {
+               /* Zero sized SQ is not supported */
+               rv = -EINVAL;
+-              goto err_out;
++              goto err_out_xa;
+       }
+       if (num_rqe)
+               num_rqe = roundup_pow_of_two(num_rqe);
+-- 
+2.30.2
+
diff --git a/queue-5.4/rdma-uverbs-fix-a-null-vs-is_err-bug.patch b/queue-5.4/rdma-uverbs-fix-a-null-vs-is_err-bug.patch
new file mode 100644 (file)
index 0000000..231ea35
--- /dev/null
@@ -0,0 +1,40 @@
+From b1a0b6ff6c5c0497ce2ae05093205686aa8834ee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 May 2021 17:18:10 +0300
+Subject: RDMA/uverbs: Fix a NULL vs IS_ERR() bug
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 463a3f66473b58d71428a1c3ce69ea52c05440e5 ]
+
+The uapi_get_object() function returns error pointers, it never returns
+NULL.
+
+Fixes: 149d3845f4a5 ("RDMA/uverbs: Add a method to introspect handles in a context")
+Link: https://lore.kernel.org/r/YJ6Got+U7lz+3n9a@mwanda
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c
+index 2a3f2f01028d..fd351bdec3f6 100644
+--- a/drivers/infiniband/core/uverbs_std_types_device.c
++++ b/drivers/infiniband/core/uverbs_std_types_device.c
+@@ -110,8 +110,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_INFO_HANDLES)(
+               return ret;
+       uapi_object = uapi_get_object(attrs->ufile->device->uapi, object_id);
+-      if (!uapi_object)
+-              return -EINVAL;
++      if (IS_ERR(uapi_object))
++              return PTR_ERR(uapi_object);
+       handles = gather_objects_handle(attrs->ufile, uapi_object, attrs,
+                                       out_len, &total);
+-- 
+2.30.2
+
diff --git a/queue-5.4/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch b/queue-5.4/scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch
new file mode 100644 (file)
index 0000000..6f01761
--- /dev/null
@@ -0,0 +1,40 @@
+From 9de03fe090abf4af1970aa6b9244a803d0f230a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 May 2021 17:09:52 +0800
+Subject: scsi: qla2xxx: Fix error return code in qla82xx_write_flash_dword()
+
+From: Zhen Lei <thunder.leizhen@huawei.com>
+
+[ 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 <hulkci@huawei.com>
+Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
+Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 c855d013ba8a..de567a025133 100644
+--- a/drivers/scsi/qla2xxx/qla_nx.c
++++ b/drivers/scsi/qla2xxx/qla_nx.c
+@@ -1113,7 +1113,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-5.4/scsi-ufs-core-increase-the-usable-queue-depth.patch b/queue-5.4/scsi-ufs-core-increase-the-usable-queue-depth.patch
new file mode 100644 (file)
index 0000000..951387e
--- /dev/null
@@ -0,0 +1,71 @@
+From 28aec93aaa53b23b0ac9190aab1883a68d643246 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 May 2021 09:49:12 -0700
+Subject: scsi: ufs: core: Increase the usable queue depth
+
+From: Bart Van Assche <bvanassche@acm.org>
+
+[ Upstream commit d0b2b70eb12e9ffaf95e11b16b230a4e015a536c ]
+
+With the current implementation of the UFS driver active_queues is 1
+instead of 0 if all UFS request queues are idle. That causes
+hctx_may_queue() to divide the queue depth by 2 when queueing a request and
+hence reduces the usable queue depth.
+
+The shared tag set code in the block layer keeps track of the number of
+active request queues. blk_mq_tag_busy() is called before a request is
+queued onto a hwq and blk_mq_tag_idle() is called some time after the hwq
+became idle. blk_mq_tag_idle() is called from inside blk_mq_timeout_work().
+Hence, blk_mq_tag_idle() is only called if a timer is associated with each
+request that is submitted to a request queue that shares a tag set with
+another request queue.
+
+Adds a blk_mq_start_request() call in ufshcd_exec_dev_cmd(). This doubles
+the queue depth on my test setup from 16 to 32.
+
+In addition to increasing the usable queue depth, also fix the
+documentation of the 'timeout' parameter in the header above
+ufshcd_exec_dev_cmd().
+
+Link: https://lore.kernel.org/r/20210513164912.5683-1-bvanassche@acm.org
+Fixes: 7252a3603015 ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts")
+Cc: Can Guo <cang@codeaurora.org>
+Cc: Alim Akhtar <alim.akhtar@samsung.com>
+Cc: Avri Altman <avri.altman@wdc.com>
+Cc: Stanley Chu <stanley.chu@mediatek.com>
+Cc: Bean Huo <beanhuo@micron.com>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Reviewed-by: Can Guo <cang@codeaurora.org>
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/ufs/ufshcd.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
+index 25112c2fe2db..0429ba5d7d23 100644
+--- a/drivers/scsi/ufs/ufshcd.c
++++ b/drivers/scsi/ufs/ufshcd.c
+@@ -2615,7 +2615,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
+  * ufshcd_exec_dev_cmd - API for sending device management requests
+  * @hba: UFS hba
+  * @cmd_type: specifies the type (NOP, Query...)
+- * @timeout: time in seconds
++ * @timeout: timeout in milliseconds
+  *
+  * NOTE: Since there is only one available tag for device management commands,
+  * it is expected you hold the hba->dev_cmd.lock mutex.
+@@ -2645,6 +2645,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
+       }
+       tag = req->tag;
+       WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag));
++      /* Set the timeout such that the SCSI error handler is not activated. */
++      req->timeout = msecs_to_jiffies(2 * timeout);
++      blk_mq_start_request(req);
+       init_completion(&wait);
+       lrbp = &hba->lrb[tag];
+-- 
+2.30.2
+
diff --git a/queue-5.4/series b/queue-5.4/series
new file mode 100644 (file)
index 0000000..9bd5159
--- /dev/null
@@ -0,0 +1,14 @@
+firmware-arm_scpi-prevent-the-ternary-sign-expansion.patch
+openrisc-fix-a-memory-leak.patch
+rdma-siw-properly-check-send-and-receive-cq-pointers.patch
+rdma-siw-release-xarray-entry.patch
+rdma-rxe-clear-all-qp-fields-if-creation-failed.patch
+scsi-ufs-core-increase-the-usable-queue-depth.patch
+scsi-qla2xxx-fix-error-return-code-in-qla82xx_write_.patch
+rdma-mlx5-recover-from-fatal-event-in-dual-port-mode.patch
+rdma-core-don-t-access-cm_id-after-its-destruction.patch
+platform-mellanox-mlxbf-tmfifo-fix-a-memory-barrier-.patch
+platform-x86-dell-smbios-wmi-fix-oops-on-rmmod-dell_.patch
+rdma-uverbs-fix-a-null-vs-is_err-bug.patch
+ptrace-make-ptrace-fail-if-the-tracee-changed-its-pi.patch
+nvmet-seset-ns-file-when-open-fails.patch