[PATCH] nvme: fix memory leak in quirks_param_set()
Daniel Wagner
dwagner at suse.de
Wed Feb 11 09:01:34 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.
>
> Fixes: b4247c8317c5 ("nvme: add support for dynamic quirk configuration via module parameter")
> Signed-off-by: Maurizio Lombardi <mlombard at redhat.com>
Looks good.
Reviewed-by: Daniel Wagner <dwagner at suse.de>
More information about the Linux-nvme
mailing list