* [PATCH 3/4] nvme-pci: return error when parsing a quirk string fails
@ 2026-07-29 10:59 Guixin Liu
2026-07-29 11:33 ` Christoph Hellwig
2026-07-29 13:56 ` Daniel Wagner
0 siblings, 2 replies; 3+ messages in thread
From: Guixin Liu @ 2026-07-29 10:59 UTC (permalink / raw)
To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Maurizio Lombardi, Daniel Wagner
Cc: linux-nvme
quirks_param_set() reuses 'err', which param_set_copystring() left as 0,
as the return value of the whole function. When nvme_parse_quirk_entry()
fails to parse a field, the code jumps to out_free_qlist and returns that
stale 0, so a malformed quirks= parameter is silently accepted as valid.
Set err to -EINVAL before jumping out on a parse failure.
Fixes: 7bb8c40f5ad8 ("nvme: add support for dynamic quirk configuration via module parameter")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
drivers/nvme/host/pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 69932d640b53..560560268c05 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -213,6 +213,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
if (nvme_parse_quirk_entry(field, &qlist[i])) {
pr_err("nvme: failed to parse quirk string %s\n",
value);
+ err = -EINVAL;
goto out_free_qlist;
}
--
2.43.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/4] nvme-pci: return error when parsing a quirk string fails
2026-07-29 10:59 [PATCH 3/4] nvme-pci: return error when parsing a quirk string fails Guixin Liu
@ 2026-07-29 11:33 ` Christoph Hellwig
2026-07-29 13:56 ` Daniel Wagner
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-07-29 11:33 UTC (permalink / raw)
To: Guixin Liu
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Maurizio Lombardi, Daniel Wagner, linux-nvme
On Wed, Jul 29, 2026 at 06:59:58PM +0800, Guixin Liu wrote:
> quirks_param_set() reuses 'err', which param_set_copystring() left as 0,
> as the return value of the whole function. When nvme_parse_quirk_entry()
> fails to parse a field, the code jumps to out_free_qlist and returns that
> stale 0, so a malformed quirks= parameter is silently accepted as valid.
>
> Set err to -EINVAL before jumping out on a parse failure.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/4] nvme-pci: return error when parsing a quirk string fails
2026-07-29 10:59 [PATCH 3/4] nvme-pci: return error when parsing a quirk string fails Guixin Liu
2026-07-29 11:33 ` Christoph Hellwig
@ 2026-07-29 13:56 ` Daniel Wagner
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Wagner @ 2026-07-29 13:56 UTC (permalink / raw)
To: Guixin Liu
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Maurizio Lombardi, linux-nvme
On Wed, Jul 29, 2026 at 06:59:58PM +0800, Guixin Liu wrote:
> quirks_param_set() reuses 'err', which param_set_copystring() left as 0,
> as the return value of the whole function. When nvme_parse_quirk_entry()
> fails to parse a field, the code jumps to out_free_qlist and returns that
> stale 0, so a malformed quirks= parameter is silently accepted as valid.
>
> Set err to -EINVAL before jumping out on a parse failure.
>
> Fixes: 7bb8c40f5ad8 ("nvme: add support for dynamic quirk configuration via module parameter")
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Looks good.
Reviewed-by: Daniel Wagner <dwagner@suse.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-29 14:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 10:59 [PATCH 3/4] nvme-pci: return error when parsing a quirk string fails Guixin Liu
2026-07-29 11:33 ` Christoph Hellwig
2026-07-29 13:56 ` Daniel Wagner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.