public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: ram.vegesna@broadcom.com, dan.carpenter@oracle.com,
	James Smart <jsmart2021@gmail.com>,
	James Smart <james.smart@broadcom.com>
Subject: [PATCH] elx: efct: fix vport list linkage in lio backend
Date: Sat, 19 Jun 2021 08:57:29 -0700	[thread overview]
Message-ID: <20210619155729.20049-1-jsmart2021@gmail.com> (raw)

vport is linked onto the drivers vport list at allocation, but
failure path fails to removed from the list.

Change location of linkage until after complete vport completion.

Fixes: 692e5d73a811 ("scsi: elx: efct: LIO backend interface routines")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Co-developed-by: Ram Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: Ram Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/elx/efct/efct_lio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c
index e1bab2b17e4d..6ad5168a86ca 100644
--- a/drivers/scsi/elx/efct/efct_lio.c
+++ b/drivers/scsi/elx/efct/efct_lio.c
@@ -832,10 +832,6 @@ efct_lio_npiv_make_nport(struct target_fabric_configfs *tf,
 	}
 
 	vport_list->lio_vport = lio_vport;
-	spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags);
-	INIT_LIST_HEAD(&vport_list->list_entry);
-	list_add_tail(&vport_list->list_entry, &efct->tgt_efct.vport_list);
-	spin_unlock_irqrestore(&efct->tgt_efct.efct_lio_lock, flags);
 
 	memset(&vport_id, 0, sizeof(vport_id));
 	vport_id.port_name = npiv_wwpn;
@@ -853,6 +849,10 @@ efct_lio_npiv_make_nport(struct target_fabric_configfs *tf,
 	}
 
 	lio_vport->fc_vport = new_fc_vport;
+	spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags);
+	INIT_LIST_HEAD(&vport_list->list_entry);
+	list_add_tail(&vport_list->list_entry, &efct->tgt_efct.vport_list);
+	spin_unlock_irqrestore(&efct->tgt_efct.efct_lio_lock, flags);
 
 	return &lio_vport->vport_wwn;
 }
-- 
2.26.2


             reply	other threads:[~2021-06-19 15:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19 15:57 James Smart [this message]
2021-06-23  1:13 ` [PATCH] elx: efct: fix vport list linkage in lio backend Martin K. Petersen
2021-06-29  4:10 ` 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=20210619155729.20049-1-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=james.smart@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ram.vegesna@broadcom.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox