[PATCH] nvme-fc: fix double free of fabrics options when nvme_add_ctrl() fails

Keith Busch kbusch at kernel.org
Thu Sep 3 13:48:42 PDT 2026


On Fri, Aug 14, 2026 at 04:38:34PM +0200, Niklas Cassel wrote:
> nvmf_create_ctrl() owns the fabrics options and frees them whenever
> ->create_ctrl() returns an error, so a transport must not free them on
> its own error paths.  nvme-fc tracks this by testing ctrl->ctrl.opts in
> nvme_fc_ctrl_free(), which requires nvme_fc_init_ctrl() to clear that
> pointer on every error exit.

Since the race condition I was previously concerned about doesn't appear
to be possible, this solution matching the other fabrics drivers looks
good to go.

Thanks, applied to nvme-7.3.



More information about the Linux-nvme mailing list