* [PATCH] nvmet: reject namespace enable without device path
@ 2026-08-27 7:52 Seokgyu Choi
2026-08-30 21:28 ` Sagi Grimberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Seokgyu Choi @ 2026-08-27 7:52 UTC (permalink / raw)
To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
Cc: linux-nvme, linux-kernel, syzbot+f613f9f010ec98eb9d86, Seokgyu Choi
A newly allocated namespace has a NULL device_path until userspace
configures the device_path attribute.
If buffered_io is enabled before device_path is configured,
nvmet_bdev_ns_enable() returns -ENOTBLK and nvmet_ns_enable() falls
back to nvmet_file_ns_enable(). The latter passes the NULL
device_path to filp_open(), causing a NULL pointer dereference in
getname_kernel().
Reject namespace enable when device_path has not been configured.
Reported-by: syzbot+f613f9f010ec98eb9d86@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f613f9f010ec98eb9d86
Signed-off-by: Seokgyu Choi <tjrrb0313@gmail.com>
---
drivers/nvme/target/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index d74c01c98f19..336013139ef6 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -591,6 +591,11 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
if (ns->enabled)
goto out_unlock;
+ if (!ns->device_path) {
+ ret = -EINVAL;
+ goto out_unlock;
+ }
+
ret = nvmet_bdev_ns_enable(ns);
if (ret == -ENOTBLK)
ret = nvmet_file_ns_enable(ns);
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] nvmet: reject namespace enable without device path
2026-08-27 7:52 [PATCH] nvmet: reject namespace enable without device path Seokgyu Choi
@ 2026-08-30 21:28 ` Sagi Grimberg
2026-09-02 14:03 ` Christoph Hellwig
2026-09-02 22:31 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2026-08-30 21:28 UTC (permalink / raw)
To: Seokgyu Choi, Christoph Hellwig, Chaitanya Kulkarni
Cc: linux-nvme, linux-kernel, syzbot+f613f9f010ec98eb9d86
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvmet: reject namespace enable without device path
2026-08-27 7:52 [PATCH] nvmet: reject namespace enable without device path Seokgyu Choi
2026-08-30 21:28 ` Sagi Grimberg
@ 2026-09-02 14:03 ` Christoph Hellwig
2026-09-02 22:31 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-09-02 14:03 UTC (permalink / raw)
To: Seokgyu Choi
Cc: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, linux-nvme,
linux-kernel, syzbot+f613f9f010ec98eb9d86
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvmet: reject namespace enable without device path
2026-08-27 7:52 [PATCH] nvmet: reject namespace enable without device path Seokgyu Choi
2026-08-30 21:28 ` Sagi Grimberg
2026-09-02 14:03 ` Christoph Hellwig
@ 2026-09-02 22:31 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2026-09-02 22:31 UTC (permalink / raw)
To: Seokgyu Choi
Cc: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, linux-nvme,
linux-kernel, syzbot+f613f9f010ec98eb9d86
On Thu, Aug 27, 2026 at 07:52:21AM +0000, Seokgyu Choi wrote:
> A newly allocated namespace has a NULL device_path until userspace
> configures the device_path attribute.
>
> If buffered_io is enabled before device_path is configured,
> nvmet_bdev_ns_enable() returns -ENOTBLK and nvmet_ns_enable() falls
> back to nvmet_file_ns_enable(). The latter passes the NULL
> device_path to filp_open(), causing a NULL pointer dereference in
> getname_kernel().
>
> Reject namespace enable when device_path has not been configured.
Thanks, applied to nvme-7.3.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-02 22:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-27 7:52 [PATCH] nvmet: reject namespace enable without device path Seokgyu Choi
2026-08-30 21:28 ` Sagi Grimberg
2026-09-02 14:03 ` Christoph Hellwig
2026-09-02 22:31 ` Keith Busch
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®