From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-nvme@lists.infradead.org, Keith Busch <kbusch@kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: Re: [PATCH] nvmet: pci-epf: fix use-after-free in nvmet_pci_epf_exec_iod_work()
Date: Tue, 14 Jul 2026 11:24:38 +0900 [thread overview]
Message-ID: <alWdxvJVXOuzCMBK@shinmob> (raw)
In-Reply-To: <43f0a5fd-e300-4d9f-b0cc-f0aab42fbb08@kernel.org>
On Jul 13, 2026 / 16:28, Damien Le Moal wrote:
> On 7/13/26 13:32, Shin'ichiro Kawasaki wrote:
> > nvmet_pci_epf_exec_iod_work() submits an I/O command with req->execute()
> > and then waits for the command to complete and transfers the data back
> > to the host. This wait is not needed for commands that do not transfer
> > data from the device to the host. To decide whether that wait is needed,
> > it reads iod->data_len and iod->dma_dir after calling req->execute().
> >
> > However, once req->execute() is called, the command may complete
> > asynchronously on another CPU. For commands that do not require a
> > device-to-host data transfer, nvmet_pci_epf_queue_response() calls
> > nvmet_pci_epf_complete_iod() directly, which can free the iod before it
> > reads iod->data_len and iod->dma_dir, resulting in the KFENCE use-after-
> > free:
> >
> > BUG: KFENCE: use-after-free read in nvmet_pci_epf_exec_iod_work+0x288/0x798 [nvmet_pci_epf]
>
> Looks good, but I would do it like this to simplify:
(snip)
Thanks. Will reflect the suggested change in v2.
prev parent reply other threads:[~2026-07-14 2:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 4:32 [PATCH] nvmet: pci-epf: fix use-after-free in nvmet_pci_epf_exec_iod_work() Shin'ichiro Kawasaki
2026-07-13 7:28 ` Damien Le Moal
2026-07-14 2:24 ` Shin'ichiro Kawasaki [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=alWdxvJVXOuzCMBK@shinmob \
--to=shinichiro.kawasaki@wdc.com \
--cc=dlemoal@kernel.org \
--cc=hch@infradead.org \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox