[PATCH v2] scsi: elx: libefc: Initialize the virtual port list lock

From: Shuo Qin

Date: Sat Dec 05 2026 - 09:30:52 EST


The virtual port helpers protect efc->vport_list with vport_lock, but
efcport_init() initializes only the list head. The dynamically allocated
efc object therefore contains an uninitialized spinlock. Taking it during
virtual port teardown can trigger a spinlock debugging failure.

Initialize vport_lock alongside the list before any virtual port helper
can use it.

Fixes: d7b71fd2195e ("scsi: elx: libefc: Emulex FC discovery library APIs and definitions")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Shuo Qin <23159100078@xxxxxxxxxxxxxxxxx>
---

Changes in v2:
- Correct the Fixes tag to the commit introducing vport_lock and its
initialization function. No code changes.

v1: https://lore.kernel.org/r/20261205095431.114279-1-23159100078@xxxxxxxxxxxxxxxxx

drivers/scsi/elx/libefc/efclib.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/elx/libefc/efclib.c b/drivers/scsi/elx/libefc/efclib.c
index ceec0e2a0266adb3b3474e080cf0f263a744c28d..94a0022b55ea6eea9b4a8baa7fe98bae595d62da 100644
--- a/drivers/scsi/elx/libefc/efclib.c
+++ b/drivers/scsi/elx/libefc/efclib.c
@@ -26,6 +26,7 @@ int efcport_init(struct efc *efc)

spin_lock_init(&efc->lock);
INIT_LIST_HEAD(&efc->vport_list);
+ spin_lock_init(&efc->vport_lock);
efc->hold_frames = false;
spin_lock_init(&efc->pend_frames_lock);
INIT_LIST_HEAD(&efc->pend_frames);
--
2.34.1