Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: elx: libefc: Initialize the virtual port list lock
@ 2026-12-05  9:54 Shuo Qin
  2026-12-05 10:05 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Shuo Qin @ 2026-12-05  9:54 UTC (permalink / raw)
  To: Ram Vegesna
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	target-devel, stable, linux-kernel, Bin Yu, Cheng Wen,
	XinCheng Wang

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: fcd427303eb9 ("scsi: elx: libefc: SLI and FC PORT state machine interfaces")
Cc: stable@vger.kernel.org
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Shuo Qin <23159100078@stu.xidian.edu.cn>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: elx: libefc: Initialize the virtual port list lock
  2026-12-05  9:54 [PATCH] scsi: elx: libefc: Initialize the virtual port list lock Shuo Qin
@ 2026-12-05 10:05 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-05 10:05 UTC (permalink / raw)
  To: Shuo Qin; +Cc: linux-scsi, target-devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] scsi: elx: libefc: Fixes trailer cites wrong introducing commit
--

commit 680563d03aff45c04adf842e09bbb86f2fac08e5
Author: Shuo Qin <23159100078@stu.xidian.edu.cn>

> scsi: elx: libefc: Initialize the virtual port list lock
>
> 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: fcd427303eb9 ("scsi: elx: libefc: SLI and FC PORT state machine interfaces")
> Cc: stable@vger.kernel.org
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: Shuo Qin <23159100078@stu.xidian.edu.cn>

[Severity: Low]
Should the Fixes tag point to d7b71fd2195e ("scsi: elx: libefc: Emulex FC
discovery library APIs and definitions") instead?

Commit fcd427303eb9 ("scsi: elx: libefc: SLI and FC PORT state machine
interfaces") only added efc_nport.c and efc_nport.h, whereas the earlier
commit introduced vport_lock in struct efc and efcport_init() without
calling spin_lock_init(&efc->vport_lock).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205095431.114279-1-23159100078@stu.xidian.edu.cn?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-05 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  9:54 [PATCH] scsi: elx: libefc: Initialize the virtual port list lock Shuo Qin
2026-12-05 10:05 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox