Patch "scsi: lpfc: Fix duplicate unreg_rpi error in port offline flow" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: lpfc: Fix duplicate unreg_rpi error in port offline flow

to the 4.4-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-duplicate-unreg_rpi-error-in-port-offl.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 640b5f42dee6e640d1ae524905f78f02db82635d
Author: James Smart <jsmart2021@xxxxxxxxx>
Date:   Mon Nov 4 16:56:58 2019 -0800

    scsi: lpfc: Fix duplicate unreg_rpi error in port offline flow
    
    [ Upstream commit 7cfd5639d99bec0d27af089d0c8c114330e43a72 ]
    
    If the driver receives a login that is later then LOGO'd by the remote port
    (aka ndlp), the driver, upon the completion of the LOGO ACC transmission,
    will logout the node and unregister the rpi that is being used for the
    node.  As part of the unreg, the node's rpi value is replaced by the
    LPFC_RPI_ALLOC_ERROR value.  If the port is subsequently offlined, the
    offline walks the nodes and ensures they are logged out, which possibly
    entails unreg'ing their rpi values.  This path does not validate the node's
    rpi value, thus doesn't detect that it has been unreg'd already.  The
    replaced rpi value is then used when accessing the rpi bitmask array which
    tracks active rpi values.  As the LPFC_RPI_ALLOC_ERROR value is not a valid
    index for the bitmask, it may fault the system.
    
    Revise the rpi release code to detect when the rpi value is the replaced
    RPI_ALLOC_ERROR value and ignore further release steps.
    
    Link: https://lore.kernel.org/r/20191105005708.7399-2-jsmart2021@xxxxxxxxx
    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: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 9b8867c023b9..065fdc17bbfb 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -15792,6 +15792,13 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba)
 static void
 __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi)
 {
+	/*
+	 * if the rpi value indicates a prior unreg has already
+	 * been done, skip the unreg.
+	 */
+	if (rpi == LPFC_RPI_ALLOC_ERROR)
+		return;
+
 	if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) {
 		phba->sli4_hba.rpi_count--;
 		phba->sli4_hba.max_cfg_param.rpi_used--;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux