summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Smart <james.smart@broadcom.com>2021-06-19 18:57:29 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2021-06-23 04:11:37 +0300
commitf7c95d7460e342f812eaf9b4b74f100d5afaf258 (patch)
tree12aa3c8faa53488a06cff16f0464b51075a20459
parentf6060eb1344717bf22d592a6e1b69818b07cad6e (diff)
downloadlinux-f7c95d7460e342f812eaf9b4b74f100d5afaf258.tar.xz
scsi: elx: efct: Fix vport list linkage in LIO backend
vport is linked onto the driver's vport list at allocation, but failure path fails to remove it from the list. Change location of linkage until after complete vport completion. Link: https://lore.kernel.org/r/20210619155729.20049-1-jsmart2021@gmail.com 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> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/elx/efct/efct_lio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c
index b7d69ff29c09..e0d798d6baee 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;
}