All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, justin.tee@broadcom.com,
	Justin Tee <justintee8345@gmail.com>
Subject: [PATCH 06/12] lpfc: Remove duplicate ndlp kref decrement in lpfc_cleanup_rpis
Date: Mon,  9 Jan 2023 15:33:11 -0800	[thread overview]
Message-ID: <20230109233317.54737-7-justintee8345@gmail.com> (raw)
In-Reply-To: <20230109233317.54737-1-justintee8345@gmail.com>

With faulty cables in PT2PT topology, an unintentional ndlp double kref
decrement can occur.

If a FLOGI request is outstanding before the link goes down, the missing
FLOGI_ACC causes an F_Port ndlp to remain in the UNUSED state.  During link
down, lpfc_cleanup_rpis is called and decrements an ndlp kref.
Additionally, when the driver later decides to abort the FLOGI, the FLOGI
completion handler decrements the ndlp kref a second time.

Remove duplicate clean up logic in lpfc_cleanup_rpis because the updated
FLOGI completion handler already handles the ndlp kref decrement.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 80375d73b732..af0acf55b343 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1129,21 +1129,6 @@ lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove)
 	struct lpfc_nodelist *ndlp, *next_ndlp;
 
 	list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
-		if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) {
-			/* It's possible the FLOGI to the fabric node never
-			 * successfully completed and never registered with the
-			 * transport.  In this case there is no way to clean up
-			 * the node.
-			 */
-			if (ndlp->nlp_DID == Fabric_DID) {
-				if (ndlp->nlp_prev_state ==
-				    NLP_STE_UNUSED_NODE &&
-				    !ndlp->fc4_xpt_flags)
-					lpfc_nlp_put(ndlp);
-			}
-			continue;
-		}
-
 		if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) ||
 		    ((vport->port_type == LPFC_NPIV_PORT) &&
 		     ((ndlp->nlp_DID == NameServer_DID) ||
-- 
2.38.0


  parent reply	other threads:[~2023-01-09 23:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 23:33 [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.10 Justin Tee
2023-01-09 23:33 ` [PATCH 01/12] lpfc: Fix space indentation in lpfc_xcvr_data Justin Tee
2023-01-09 23:33 ` [PATCH 02/12] lpfc: Replace outdated strncpy with strscpy Justin Tee
2023-01-09 23:33 ` [PATCH 03/12] lpfc: Resolve miscellaneous variable set but not used compiler warnings Justin Tee
2023-01-09 23:33 ` [PATCH 04/12] lpfc: Set max dma segment size to hba supported SGE length Justin Tee
2023-01-09 23:33 ` [PATCH 05/12] lpfc: Remove redundant clean up code in disable_vport Justin Tee
2023-01-09 23:33 ` Justin Tee [this message]
2023-01-09 23:33 ` [PATCH 07/12] lpfc: Exit PRLI completion handling early if ndlp not in PRLI_ISSUE state Justin Tee
2023-01-09 23:33 ` [PATCH 08/12] lpfc: Fix use-after-free KFENCE violation during sysfs firmware write Justin Tee
2023-01-09 23:33 ` [PATCH 09/12] lpfc: Reinitialize internal VMID data structures after FLOGI completion Justin Tee
2023-01-09 23:33 ` [PATCH 10/12] lpfc: Introduce new attention types for lpfc_sli4_async_fc_evt hdlr Justin Tee
2023-01-09 23:33 ` [PATCH 11/12] lpfc: Update lpfc version to 14.2.0.10 Justin Tee
2023-01-09 23:33 ` [PATCH 12/12] Copyright updates for 14.2.0.10 patches Justin Tee
2023-01-12  5:05 ` [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.10 Martin K. Petersen
2023-01-14  3:19 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230109233317.54737-7-justintee8345@gmail.com \
    --to=justintee8345@gmail.com \
    --cc=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.