scsi: fnic: Use GFP_ATOMIC for VLAN alloc under spinlock

fnic_fcoe_process_vlan_resp() allocates a VLAN descriptor with
kzalloc_obj() (default GFP_KERNEL) while holding vlans_lock via
spin_lock_irqsave(). GFP_KERNEL may sleep, which is not allowed in this
atomic context and can trigger a sleeping-from-invalid-context warning
or deadlock.

Pass GFP_ATOMIC so the allocation is safe under the IRQ-safe spinlock.

Fixes: 098585aa8a ("scsi: fnic: Add and integrate support for FIP")
Cc: stable@vger.kernel.org
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://patch.msgid.link/20260731073820.16449-1-gonglinkai@kylinos.cn
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
Linkai Gong 2026-07-31 15:38:20 +08:00 committed by Martin K. Petersen (Oracle)
parent 4c84c2e08a
commit 9639c63245

View File

@ -137,7 +137,7 @@ void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct fip_header *fiph)
vid = be16_to_cpu(vlan_desc->fd_vlan);
FNIC_FIP_DBG(KERN_INFO, fnic,
"process_vlan_resp: FIP VLAN %d\n", vid);
vlan = kzalloc_obj(*vlan);
vlan = kzalloc_obj(*vlan, GFP_ATOMIC);
if (!vlan) {
/* retry from timer */