[PATCH] scsi: snic: Disable the devcmd2 WQ before freeing its results ring

From: Yuho Choi

Date: Tue Nov 24 2026 - 13:03:07 EST


vnic_dev_deinit_devcmd2() frees the devcmd2 results ring before it
disables the devcmd2 WQ. The adapter writes the result of each devcmd2
command into that ring. When a command times out in _svnic_dev_cmd2(),
its descriptor stays posted on the WQ, and snic_remove() ignores the
error from svnic_dev_close(), so the adapter can still complete the
command and write its result after the ring has been freed.

Disable the WQ first, so that the adapter has acknowledged stopping the
queue before the results ring is freed.

Fixes: c8806b6c9e82 ("snic: driver for Cisco SCSI HBA")
Signed-off-by: Yuho Choi <oss.patchbox@xxxxxxxxx>
---
Compile-tested only (x86_64, SCSI_SNIC=m, W=1). I have no Cisco VIC
adapter, and the late write would come from the adapter, so I could not
reproduce it.

drivers/scsi/snic/vnic_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/snic/vnic_dev.c b/drivers/scsi/snic/vnic_dev.c
index 22303f827583..44a2cc59821c 100644
--- a/drivers/scsi/snic/vnic_dev.c
+++ b/drivers/scsi/snic/vnic_dev.c
@@ -421,8 +421,8 @@ static void vnic_dev_deinit_devcmd2(struct vnic_dev *vdev)
vdev->devcmd2 = NULL;
vdev->devcmd_rtn = NULL;

- svnic_dev_free_desc_ring(vdev, &dc2c->results_ring);
svnic_wq_disable(&dc2c->wq);
+ svnic_dev_free_desc_ring(vdev, &dc2c->results_ring);
svnic_wq_free(&dc2c->wq);
kfree(dc2c);
}

base-commit: 8dac6df92a2e66e2098bbc69061964cfe7e8375b
--
2.56.1