[PATCH v2] nvmet-fc: put queue ref after FCP IOD cleanup

Keith Busch kbusch at kernel.org
Mon Nov 30 07:56:52 PST 2026


On Thu, 26 Nov 2026 13:16:24 +0800, Bin Luo wrote:
> In nvmet_fc_free_fcp_iod(), the completing IO's queue lookup reference
> is dropped before locking queue->qlock, checking queue->pending_cmd_list,
> returning or reusing the embedded fod, and queuing defer_work on
> queue->work_q.
> 
> Because nvmet_req_complete() releases the nvme_sq percpu reference as
> soon as queue_response() submits the asynchronous LLDD fcp_op() for
> READDATA or RSP, association teardown in nvmet_fc_delete_target_queue()
> can drop the queue owner reference before the LLDD completion reaches
> nvmet_fc_free_fcp_iod(). In that case, dropping the completing IO's
> reference early frees the queue (and its embedded fod array) before the
> subsequent queue->qlock and list accesses, causing a use-after-free.
> 
> [...]

Thanks, applied to nvme-7.4.

[1/1] nvmet-fc: put queue ref after FCP IOD cleanup
      commit: 6d92304f976ec23a7bfcefd505f0993ab5056ef8
--
Keith Busch <kbusch at kernel.org>




More information about the Linux-nvme mailing list