[PATCH] nvme-fc: fix reference leak in nvme_fc_nvme_discovery_store()

Keith Busch kbusch at kernel.org
Fri Oct 23 15:06:49 PDT 2026


On Fri, Oct 23, 2026 at 07:30:57PM +0530, Martin George wrote:
> nvme_fc_nvme_discovery_store() takes an lport and rport reference before
> checking whether the rport is already queued on the local discovery
> list. On the retry path (goto restart), rports that were queued in an
> earlier pass are skipped by the list_empty() check, but the references
> taken for them in the current pass are never dropped, leaking one lport
> and one rport reference per retry.
> 
> Check list_empty() first and only take references for rports that are
> actually added to the local discovery list.

Thanks, applied to nvme-7.4.



More information about the Linux-nvme mailing list