From: sashiko-bot@kernel.org
To: "Yuho Choi" <oss.patchbox@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: snic: Disable the devcmd2 WQ before freeing its results ring
Date: Tue, 24 Nov 2026 18:11:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-231801@kernel.org> (raw)
In-Reply-To: <20261124180234.400564-2-oss.patchbox@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] enic: DMA use-after-free in vnic_dev_deinit_devcmd2() [1]
--
commit 69fa45723f24d1ae5b1a578c30346f49638a7cfb
Author: Yuho Choi <oss.patchbox@gmail.com>
scsi: snic: Disable the devcmd2 WQ before freeing its results ring
This commit reorders vnic_dev_deinit_devcmd2() to disable the devcmd2 work
queue before freeing the devcmd2 results descriptor ring.
> diff --git a/drivers/scsi/snic/vnic_dev.c b/drivers/scsi/snic/vnic_dev.c
> index 22303f8275836..44a2cc59821c8 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);
> }
[Severity: Critical]
This problem wasn't introduced by this patch, but can the adapter still
perform DMA to freed memory [1] when svnic_wq_disable() times out, or
along the svnic_dev_init_devcmd2() error path and the matching devcmd2
teardown code in enic and fnic?
svnic_wq_disable() returns -ETIMEDOUT if the hardware does not acknowledge
stopping the queue, yet vnic_dev_deinit_devcmd2() ignores its return value
and unconditionally frees both dc2c->results_ring and dc2c->wq.ring while
the queue remains active.
In the same file, svnic_dev_init_devcmd2() also frees dc2c->results_ring
before calling svnic_wq_disable():
drivers/scsi/snic/vnic_dev.c:svnic_dev_init_devcmd2() {
...
err_free_desc_ring:
svnic_dev_free_desc_ring(vdev, &dc2c->results_ring);
err_free_wq:
svnic_wq_disable(&dc2c->wq);
svnic_wq_free(&dc2c->wq);
...
}
The identical devcmd2 init and deinit paths in
drivers/net/ethernet/cisco/enic/vnic_dev.c and
drivers/scsi/fnic/vnic_dev.c likewise free results_ring before calling
vnic_wq_disable() and ignore the disable return value before freeing the WQ
descriptor ring.
[1] https://sashiko.dev/#/bug/linux-20f156a6-d2c2-49bc-b1ee-432c3af0d669
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124180234.400564-2-oss.patchbox@gmail.com?part=1
prev parent reply other threads:[~2026-11-24 18:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 18:02 [PATCH] scsi: snic: Disable the devcmd2 WQ before freeing its results ring Yuho Choi
2026-11-24 18:11 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-231801@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=oss.patchbox@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.