From: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
To: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, axboe@kernel.dk
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Subject: [PATCH] nvme-pci: return -EINVAL when failing to parse quirk parameter
Date: Sat, 15 Aug 2026 13:47:45 +0000 [thread overview]
Message-ID: <20260815134745.7263-1-sreekuttan2156239@gmail.com> (raw)
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.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.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.54.0
next reply other threads:[~2026-08-15 13:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 13:47 Sreeraj S Kurup [this message]
2026-08-17 7:00 ` Christoph Hellwig
2026-08-19 15:02 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260815134745.7263-1-sreekuttan2156239@gmail.com \
--to=sreekuttan2156239@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®