[PATCH] nvme-pci: return -EINVAL when failing to parse quirk parameter

Keith Busch kbusch at kernel.org
Wed Aug 19 08:02:05 PDT 2026


On Sat, Aug 15, 2026 at 01:47:45PM +0000, Sreeraj S Kurup wrote:
> In quirks_param_set(), if nvme_parse_quirk_entry() fails to parse an
> entry from the user-provided quirks string, the function prints an
> error message with pr_err() and jumps to out_free_qlist to free
> resources.
> 
> However, the variable 'err' is not updated upon parse failure,
> retaining the value '0' from the preceding call to
> param_set_copystring(). As a result, quirks_param_set() frees the
> allocated memory but returns 0 (success) to the kernel parameter
> subsystem, silently masking the parsing failure and incorrectly
> reporting success to the caller.
> 
> Fix this by explicitly setting 'err = -EINVAL;' before jumping to
> out_free_qlist, ensuring that parse failures are correctly propagated
> to the caller.

This fix was submitted earlier:

https://lore.kernel.org/linux-nvme/20260729105958.1403095-1-kanie@linux.alibaba.com/



More information about the Linux-nvme mailing list