From: Greg Kroah-Hartman Date: Tue, 7 Mar 2023 12:22:03 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v6.2.3~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=471ea985eba015fe2d753014501235d82b240929;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: scsi-core-remove-the-proc-scsi-proc_name-directory-earlier.patch scsi-qla2xxx-check-if-port-is-online-before-sending-els.patch scsi-qla2xxx-fix-dma-api-call-trace-on-nvme-ls-requests.patch scsi-qla2xxx-fix-erroneous-link-down.patch scsi-qla2xxx-fix-link-failure-in-npiv-environment.patch scsi-qla2xxx-remove-increment-of-interface-err-cnt.patch scsi-qla2xxx-remove-unintended-flag-clearing.patch --- diff --git a/queue-5.15/scsi-core-remove-the-proc-scsi-proc_name-directory-earlier.patch b/queue-5.15/scsi-core-remove-the-proc-scsi-proc_name-directory-earlier.patch new file mode 100644 index 00000000000..1d6deb905a9 --- /dev/null +++ b/queue-5.15/scsi-core-remove-the-proc-scsi-proc_name-directory-earlier.patch @@ -0,0 +1,74 @@ +From fc663711b94468f4e1427ebe289c9f05669699c9 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Fri, 10 Feb 2023 12:52:00 -0800 +Subject: scsi: core: Remove the /proc/scsi/${proc_name} directory earlier + +From: Bart Van Assche + +commit fc663711b94468f4e1427ebe289c9f05669699c9 upstream. + +Remove the /proc/scsi/${proc_name} directory earlier to fix a race +condition between unloading and reloading kernel modules. This fixes a bug +introduced in 2009 by commit 77c019768f06 ("[SCSI] fix /proc memory leak in +the SCSI core"). + +Fix the following kernel warning: + +proc_dir_entry 'scsi/scsi_debug' already registered +WARNING: CPU: 19 PID: 27986 at fs/proc/generic.c:376 proc_register+0x27d/0x2e0 +Call Trace: + proc_mkdir+0xb5/0xe0 + scsi_proc_hostdir_add+0xb5/0x170 + scsi_host_alloc+0x683/0x6c0 + sdebug_driver_probe+0x6b/0x2d0 [scsi_debug] + really_probe+0x159/0x540 + __driver_probe_device+0xdc/0x230 + driver_probe_device+0x4f/0x120 + __device_attach_driver+0xef/0x180 + bus_for_each_drv+0xe5/0x130 + __device_attach+0x127/0x290 + device_initial_probe+0x17/0x20 + bus_probe_device+0x110/0x130 + device_add+0x673/0xc80 + device_register+0x1e/0x30 + sdebug_add_host_helper+0x1a7/0x3b0 [scsi_debug] + scsi_debug_init+0x64f/0x1000 [scsi_debug] + do_one_initcall+0xd7/0x470 + do_init_module+0xe7/0x330 + load_module+0x122a/0x12c0 + __do_sys_finit_module+0x124/0x1a0 + __x64_sys_finit_module+0x46/0x50 + do_syscall_64+0x38/0x80 + entry_SYSCALL_64_after_hwframe+0x46/0xb0 + +Link: https://lore.kernel.org/r/20230210205200.36973-3-bvanassche@acm.org +Cc: Alan Stern +Cc: Yi Zhang +Cc: stable@vger.kernel.org +Fixes: 77c019768f06 ("[SCSI] fix /proc memory leak in the SCSI core") +Reported-by: Yi Zhang +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/hosts.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/scsi/hosts.c ++++ b/drivers/scsi/hosts.c +@@ -180,6 +180,7 @@ void scsi_remove_host(struct Scsi_Host * + scsi_forget_host(shost); + mutex_unlock(&shost->scan_mutex); + scsi_proc_host_rm(shost); ++ scsi_proc_hostdir_rm(shost->hostt); + + spin_lock_irqsave(shost->host_lock, flags); + if (scsi_host_set_state(shost, SHOST_DEL)) +@@ -321,6 +322,7 @@ static void scsi_host_dev_release(struct + struct Scsi_Host *shost = dev_to_shost(dev); + struct device *parent = dev->parent; + ++ /* In case scsi_remove_host() has not been called. */ + scsi_proc_hostdir_rm(shost->hostt); + + /* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */ diff --git a/queue-5.15/scsi-qla2xxx-check-if-port-is-online-before-sending-els.patch b/queue-5.15/scsi-qla2xxx-check-if-port-is-online-before-sending-els.patch new file mode 100644 index 00000000000..eec56a8510e --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-check-if-port-is-online-before-sending-els.patch @@ -0,0 +1,63 @@ +From 0c227dc22ca18856055983f27594feb2e0149965 Mon Sep 17 00:00:00 2001 +From: Shreyas Deodhar +Date: Mon, 19 Dec 2022 03:07:38 -0800 +Subject: scsi: qla2xxx: Check if port is online before sending ELS + +From: Shreyas Deodhar + +commit 0c227dc22ca18856055983f27594feb2e0149965 upstream. + +CT Ping and ELS cmds fail for NVMe targets. Check if port is online before +sending ELS instead of sending login. + +Cc: stable@vger.kernel.org +Signed-off-by: Shreyas Deodhar +Signed-off-by: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_bsg.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_bsg.c ++++ b/drivers/scsi/qla2xxx/qla_bsg.c +@@ -278,8 +278,8 @@ qla2x00_process_els(struct bsg_job *bsg_ + const char *type; + int req_sg_cnt, rsp_sg_cnt; + int rval = (DID_ERROR << 16); +- uint16_t nextlid = 0; + uint32_t els_cmd = 0; ++ int qla_port_allocated = 0; + + if (bsg_request->msgcode == FC_BSG_RPT_ELS) { + rport = fc_bsg_to_rport(bsg_job); +@@ -329,9 +329,9 @@ qla2x00_process_els(struct bsg_job *bsg_ + /* make sure the rport is logged in, + * if not perform fabric login + */ +- if (qla2x00_fabric_login(vha, fcport, &nextlid)) { ++ if (atomic_read(&fcport->state) != FCS_ONLINE) { + ql_dbg(ql_dbg_user, vha, 0x7003, +- "Failed to login port %06X for ELS passthru.\n", ++ "Port %06X is not online for ELS passthru.\n", + fcport->d_id.b24); + rval = -EIO; + goto done; +@@ -348,6 +348,7 @@ qla2x00_process_els(struct bsg_job *bsg_ + goto done; + } + ++ qla_port_allocated = 1; + /* Initialize all required fields of fcport */ + fcport->vha = vha; + fcport->d_id.b.al_pa = +@@ -432,7 +433,7 @@ done_unmap_sg: + goto done_free_fcport; + + done_free_fcport: +- if (bsg_request->msgcode != FC_BSG_RPT_ELS) ++ if (qla_port_allocated) + qla2x00_free_fcport(fcport); + done: + return rval; diff --git a/queue-5.15/scsi-qla2xxx-fix-dma-api-call-trace-on-nvme-ls-requests.patch b/queue-5.15/scsi-qla2xxx-fix-dma-api-call-trace-on-nvme-ls-requests.patch new file mode 100644 index 00000000000..5f2de7be22b --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-fix-dma-api-call-trace-on-nvme-ls-requests.patch @@ -0,0 +1,87 @@ +From c75e6aef5039830cce5d4cf764dd204522f89e6b Mon Sep 17 00:00:00 2001 +From: Arun Easi +Date: Mon, 19 Dec 2022 03:07:40 -0800 +Subject: scsi: qla2xxx: Fix DMA-API call trace on NVMe LS requests + +From: Arun Easi + +commit c75e6aef5039830cce5d4cf764dd204522f89e6b upstream. + +The following message and call trace was seen with debug kernels: + +DMA-API: qla2xxx 0000:41:00.0: device driver failed to check map +error [device address=0x00000002a3ff38d8] [size=1024 bytes] [mapped as +single] +WARNING: CPU: 0 PID: 2930 at kernel/dma/debug.c:1017 + check_unmap+0xf42/0x1990 + +Call Trace: + debug_dma_unmap_page+0xc9/0x100 + qla_nvme_ls_unmap+0x141/0x210 [qla2xxx] + +Remove DMA mapping from the driver altogether, as it is already done by FC +layer. This prevents the warning. + +Fixes: c85ab7d9e27a ("scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests") +Cc: stable@vger.kernel.org +Signed-off-by: Arun Easi +Signed-off-by: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_nvme.c | 19 +------------------ + 1 file changed, 1 insertion(+), 18 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -165,18 +165,6 @@ out: + qla2xxx_rel_qpair_sp(sp->qpair, sp); + } + +-static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd) +-{ +- if (sp->flags & SRB_DMA_VALID) { +- struct srb_iocb *nvme = &sp->u.iocb_cmd; +- struct qla_hw_data *ha = sp->fcport->vha->hw; +- +- dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma, +- fd->rqstlen, DMA_TO_DEVICE); +- sp->flags &= ~SRB_DMA_VALID; +- } +-} +- + static void qla_nvme_release_ls_cmd_kref(struct kref *kref) + { + struct srb *sp = container_of(kref, struct srb, cmd_kref); +@@ -194,7 +182,6 @@ static void qla_nvme_release_ls_cmd_kref + + fd = priv->fd; + +- qla_nvme_ls_unmap(sp, fd); + fd->done(fd, priv->comp_status); + out: + qla2x00_rel_sp(sp); +@@ -360,13 +347,10 @@ static int qla_nvme_ls_req(struct nvme_f + nvme->u.nvme.rsp_len = fd->rsplen; + nvme->u.nvme.rsp_dma = fd->rspdma; + nvme->u.nvme.timeout_sec = fd->timeout; +- nvme->u.nvme.cmd_dma = dma_map_single(&ha->pdev->dev, fd->rqstaddr, +- fd->rqstlen, DMA_TO_DEVICE); ++ nvme->u.nvme.cmd_dma = fd->rqstdma; + dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma, + fd->rqstlen, DMA_TO_DEVICE); + +- sp->flags |= SRB_DMA_VALID; +- + rval = qla2x00_start_sp(sp); + if (rval != QLA_SUCCESS) { + ql_log(ql_log_warn, vha, 0x700e, +@@ -374,7 +358,6 @@ static int qla_nvme_ls_req(struct nvme_f + wake_up(&sp->nvme_ls_waitq); + sp->priv = NULL; + priv->sp = NULL; +- qla_nvme_ls_unmap(sp, fd); + qla2x00_rel_sp(sp); + return rval; + } diff --git a/queue-5.15/scsi-qla2xxx-fix-erroneous-link-down.patch b/queue-5.15/scsi-qla2xxx-fix-erroneous-link-down.patch new file mode 100644 index 00000000000..fdadb6c8705 --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-fix-erroneous-link-down.patch @@ -0,0 +1,50 @@ +From 3fbc74feb642deb688cc97f76d40b7287ddd4cb1 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 19 Dec 2022 03:07:45 -0800 +Subject: scsi: qla2xxx: Fix erroneous link down + +From: Quinn Tran + +commit 3fbc74feb642deb688cc97f76d40b7287ddd4cb1 upstream. + +If after an adapter reset the appearance of link is not recovered, the +devices are not rediscovered. This is result of a race condition between +adapter reset (abort_isp) and the topology scan. During adapter reset, the +ABORT_ISP_ACTIVE flag is set. Topology scan usually occurred after adapter +reset. In this case, the topology scan came earlier than usual where it +ran into problem due to ABORT_ISP_ACTIVE flag was still set. + +kernel: qla2xxx [0000:13:00.0]-1005:1: Cmd 0x6a aborted with timeout since ISP Abort is pending +kernel: qla2xxx [0000:13:00.0]-28a0:1: MBX_GET_PORT_NAME failed, No FL Port. +kernel: qla2xxx [0000:13:00.0]-286b:1: qla2x00_configure_loop: exiting normally. local port wwpn 51402ec0123d9a80 id 012300) +kernel: qla2xxx [0000:13:00.0]-8017:1: ADAPTER RESET SUCCEEDED nexus=1:0:15. + +Allow adapter reset to complete before any scan can start. + +Cc: stable@vger.kernel.org +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_os.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -7069,9 +7069,12 @@ qla2x00_do_dpc(void *data) + } + } + loop_resync_check: +- if (test_and_clear_bit(LOOP_RESYNC_NEEDED, ++ if (!qla2x00_reset_active(base_vha) && ++ test_and_clear_bit(LOOP_RESYNC_NEEDED, + &base_vha->dpc_flags)) { +- ++ /* ++ * Allow abort_isp to complete before moving on to scanning. ++ */ + ql_dbg(ql_dbg_dpc, base_vha, 0x400f, + "Loop resync scheduled.\n"); + diff --git a/queue-5.15/scsi-qla2xxx-fix-link-failure-in-npiv-environment.patch b/queue-5.15/scsi-qla2xxx-fix-link-failure-in-npiv-environment.patch new file mode 100644 index 00000000000..a3d0f57943b --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-fix-link-failure-in-npiv-environment.patch @@ -0,0 +1,43 @@ +From b1ae65c082f74536ec292b15766f2846f0238373 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 19 Dec 2022 03:07:39 -0800 +Subject: scsi: qla2xxx: Fix link failure in NPIV environment + +From: Quinn Tran + +commit b1ae65c082f74536ec292b15766f2846f0238373 upstream. + +User experienced symptoms of adapter failure in NPIV environment. NPIV +hosts were allowed to trigger chip reset back to back due to NPIV link +state being slow to come online. + +Fix link failure in NPIV environment by removing NPIV host from directly +being able to perform chip reset. + + kernel: qla2xxx [0000:04:00.1]-6009:261: Loop down - aborting ISP. + kernel: qla2xxx [0000:04:00.1]-6009:262: Loop down - aborting ISP. + kernel: qla2xxx [0000:04:00.1]-6009:281: Loop down - aborting ISP. + kernel: qla2xxx [0000:04:00.1]-6009:285: Loop down - aborting ISP + +Fixes: 0d6e61bc6a4f ("[SCSI] qla2xxx: Correct various NPIV issues.") +Cc: stable@vger.kernel.org +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_os.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -7422,7 +7422,7 @@ qla2x00_timer(struct timer_list *t) + + /* if the loop has been down for 4 minutes, reinit adapter */ + if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { +- if (!(vha->device_flags & DFLG_NO_CABLE)) { ++ if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { + ql_log(ql_log_warn, vha, 0x6009, + "Loop down - aborting ISP.\n"); + diff --git a/queue-5.15/scsi-qla2xxx-remove-increment-of-interface-err-cnt.patch b/queue-5.15/scsi-qla2xxx-remove-increment-of-interface-err-cnt.patch new file mode 100644 index 00000000000..2f759dafd18 --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-remove-increment-of-interface-err-cnt.patch @@ -0,0 +1,34 @@ +From d676a9e3d9efb7e93df460bcf4c445496c16314f Mon Sep 17 00:00:00 2001 +From: Saurav Kashyap +Date: Mon, 19 Dec 2022 03:07:46 -0800 +Subject: scsi: qla2xxx: Remove increment of interface err cnt + +From: Saurav Kashyap + +commit d676a9e3d9efb7e93df460bcf4c445496c16314f upstream. + +Residual underrun is not an interface error, hence no need to increment +that count. + +Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port") +Cc: stable@vger.kernel.org +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_isr.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -3350,8 +3350,6 @@ qla2x00_status_entry(scsi_qla_host_t *vh + "Dropped frame(s) detected (0x%x of 0x%x bytes).\n", + resid, scsi_bufflen(cp)); + +- vha->interface_err_cnt++; +- + res = DID_ERROR << 16 | lscsi_status; + goto check_scsi_status; + } diff --git a/queue-5.15/scsi-qla2xxx-remove-unintended-flag-clearing.patch b/queue-5.15/scsi-qla2xxx-remove-unintended-flag-clearing.patch new file mode 100644 index 00000000000..9fc2556e8bb --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-remove-unintended-flag-clearing.patch @@ -0,0 +1,33 @@ +From 7e8a936a2d0f98dd6e5d05d4838affabe606cabc Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 19 Dec 2022 03:07:44 -0800 +Subject: scsi: qla2xxx: Remove unintended flag clearing + +From: Quinn Tran + +commit 7e8a936a2d0f98dd6e5d05d4838affabe606cabc upstream. + +FCF_ASYNC_SENT flag is used in session management. This flag is cleared in +task management path by accident. Remove unintended flag clearing. + +Fixes: 388a49959ee4 ("scsi: qla2xxx: Fix panic from use after free in qla2x00_async_tm_cmd") +Cc: stable@vger.kernel.org +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/qla2xxx/qla_init.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -2078,7 +2078,6 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, + done_free_sp: + /* ref: INIT */ + kref_put(&sp->cmd_kref, qla2x00_sp_release); +- fcport->flags &= ~FCF_ASYNC_SENT; + done: + return rval; + } diff --git a/queue-5.15/series b/queue-5.15/series index c0afe41ecaa..4e5040310d0 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -536,3 +536,10 @@ ktest.pl-fix-missing-end_monitor-when-machine-check-fails.patch ktest.pl-add-run_timeout-option-with-default-unlimited.patch ring-buffer-handle-race-between-rb_move_tail-and-rb_check_pages.patch tools-bootconfig-fix-single-used-for-logical-condition.patch +scsi-core-remove-the-proc-scsi-proc_name-directory-earlier.patch +scsi-qla2xxx-fix-link-failure-in-npiv-environment.patch +scsi-qla2xxx-check-if-port-is-online-before-sending-els.patch +scsi-qla2xxx-fix-dma-api-call-trace-on-nvme-ls-requests.patch +scsi-qla2xxx-remove-unintended-flag-clearing.patch +scsi-qla2xxx-fix-erroneous-link-down.patch +scsi-qla2xxx-remove-increment-of-interface-err-cnt.patch