[PATCH 01/11] lpfc: Fix duplicate unreg_rpi error in port offline flow

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

 



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, the 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 nodes 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.

Signed-off-by: Dick Kennedy <dick.kennedy@xxxxxxxxxxxx>
Signed-off-by: James Smart <jsmart2021@xxxxxxxxx>
---
 drivers/scsi/lpfc/lpfc_sli.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 294f041961a8..660f96218b25 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -18247,6 +18247,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--;
-- 
2.13.7




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux