[PATCH] nvme: fix memory leak in quirks_param_set()

Keith Busch kbusch at kernel.org
Wed Feb 11 18:35:26 PST 2026


On Wed, Feb 11, 2026 at 05:30:28PM +0100, Maurizio Lombardi wrote:
> When loading the nvme module, if the 'quirks' parameter is specified
> via both the kernel command line (e.g., nvme.quirks=...) and the
> modprobe command line (e.g., modprobe nvme quirks=...), the
> quirks_param_set() callback is invoked twice.
> 
> Currently, in the double-invocation scenario, the second call
> overwrites the nvme_pci_quirk_list pointer, causing the memory
> allocated in the first call to leak.
> 
> Fix this by freeing the existing list before assigning the new one.

Thanks applied to nvme-7.0.



More information about the Linux-nvme mailing list