From: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
To: sreekuttan2156239@gmail.com
Cc: hare@kernel.org, hare@suse.de, hch@lst.de, kbusch@kernel.org,
kch@nvidia.com, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, sagi@grimberg.me
Subject: [PATCH v2] nvmet: reject invalid write-protect feature values
Date: Mon, 9 Nov 2026 14:24:28 +0000 [thread overview]
Message-ID: <20261109142428.2612-1-sreekuttan2156239@gmail.com> (raw)
In-Reply-To: <20261109135536.2772-1-sreekuttan2156239@gmail.com>
The Set Features handler for namespace write protection currently
accepts unsupported values. The default case in the write-protect
switch leaves the status unchanged, causing the command to return
success even though no valid setting was applied.
Return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR for unsupported
values. This also prevents issuing a namespace-change notification
for an invalid request.
Fixes: 3a1f7c79ae6d ("nvmet: make nvmet_find_namespace() req based")
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
v2:
- Add Fixes trailer
drivers/nvme/target/admin-cmd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index f12d83098644..ee8be237485e 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -1223,6 +1223,7 @@ static u16 nvmet_set_feat_write_protect(struct nvmet_req *req)
status = 0;
break;
default:
+ status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
break;
}
--
2.55.0
prev parent reply other threads:[~2026-11-09 14:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 13:55 [PATCH] " Sreeraj S Kurup
2026-11-09 14:24 ` Sreeraj S Kurup [this message]
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=20261109142428.2612-1-sreekuttan2156239@gmail.com \
--to=sreekuttan2156239@gmail.com \
--cc=hare@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--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®