This is a note to let you know that I've just added the patch titled scsi: lpfc: Fix locking for lpfc_sli_iocbq_lookup() to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi-lpfc-fix-locking-for-lpfc_sli_iocbq_lookup.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c26bd6602e1d348bfa754dc55e5608c922dd2801 Mon Sep 17 00:00:00 2001 From: James Smart <jsmart2021@xxxxxxxxx> Date: Wed, 23 Mar 2022 13:55:45 -0700 Subject: scsi: lpfc: Fix locking for lpfc_sli_iocbq_lookup() From: James Smart <jsmart2021@xxxxxxxxx> commit c26bd6602e1d348bfa754dc55e5608c922dd2801 upstream. The rules changed for lpfc_sli_iocbq_lookup() vs locking. Prior, the routine properly took out the lock. In newly refactored code, the locks must be held when calling the routine. Fix lpfc_sli_process_sol_iocb() to take the locks before calling the routine. Fix lpfc_sli_handle_fast_ring_event() to not release the locks to call the routine. Link: https://lore.kernel.org/r/20220323205545.81814-3-jsmart2021@xxxxxxxxx Fixes: 1b64aa9eae28 ("scsi: lpfc: SLI path split: Refactor fast and slow paths to native SLI4") Co-developed-by: Dick Kennedy <dick.kennedy@xxxxxxxxxxxx> Signed-off-by: Dick Kennedy <dick.kennedy@xxxxxxxxxxxx> Signed-off-by: James Smart <jsmart2021@xxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/scsi/lpfc/lpfc_sli.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -3642,7 +3642,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hb unsigned long iflag; u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag; + if (phba->sli_rev == LPFC_SLI_REV4) + spin_lock_irqsave(&pring->ring_lock, iflag); + else + spin_lock_irqsave(&phba->hbalock, iflag); cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); + if (phba->sli_rev == LPFC_SLI_REV4) + spin_unlock_irqrestore(&pring->ring_lock, iflag); + else + spin_unlock_irqrestore(&phba->hbalock, iflag); ulp_command = get_job_cmnd(phba, saveq); ulp_status = get_job_ulpstatus(phba, saveq); @@ -3979,10 +3987,8 @@ lpfc_sli_handle_fast_ring_event(struct l break; } - spin_unlock_irqrestore(&phba->hbalock, iflag); cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, &rspiocbq); - spin_lock_irqsave(&phba->hbalock, iflag); if (unlikely(!cmdiocbq)) break; if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED) Patches currently in stable-queue which might be from jsmart2021@xxxxxxxxx are queue-5.15/scsi-lpfc-fix-eeh-support-for-nvme-i-o.patch queue-5.15/scsi-lpfc-fix-locking-for-lpfc_sli_iocbq_lookup.patch queue-5.15/scsi-lpfc-fix-element-offset-in-__lpfc_sli_release_iocbq_s4.patch queue-5.15/scsi-lpfc-remove-extra-atomic_inc-on-cmd_pending-in-.patch queue-5.15/scsi-lpfc-sli-path-split-refactor-fast-and-slow-path.patch queue-5.15/scsi-lpfc-sli-path-split-refactor-lpfc_iocbq.patch queue-5.15/scsi-lpfc-sli-path-split-refactor-scsi-paths.patch queue-5.15/scsi-lpfc-resolve-some-cleanup-issues-following-sli-path-refactoring.patch