From: Runyu Xiao <runyu.xiao@seu.edu.cn>
To: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
Andreas Hindborg <a.hindborg@kernel.org>,
Breno Leitao <leitao@debian.org>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Runyu Xiao <runyu.xiao@seu.edu.cn>,
Jianhao Xu <jianhao.xu@seu.edu.cn>
Subject: [PATCH v4 3/3] nvmet: avoid recursive configfs open for passthru
Date: Mon, 21 Sep 2026 17:05:59 +0800 [thread overview]
Message-ID: <20260921090559.41364-4-runyu.xiao@seu.edu.cn> (raw)
In-Reply-To: <20260921090559.41364-1-runyu.xiao@seu.edu.cn>
nvmet_passthru_enable_store() runs as a configfs store callback while
configfs holds the item frag_sem. Passthru enable used filp_open() on the
configured controller path, so a path into configfs could re-enter
__configfs_open_file() and try to acquire the same semaphore again.
Use configfs_file_open() so the path is resolved before opening,
configfs-backed paths are rejected, and the resolved path is opened with
file_open_root() while retaining the normal open-time permission and
security checks.
Fixes: cae5b01a2afc ("nvmet: introduce the passthru configfs interface")
Cc: stable@vger.kernel.org
Assisted-by: LLM Codex
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
drivers/nvme/target/passthru.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
index fa6527c537e26..d60256004e6cf 100644
--- a/drivers/nvme/target/passthru.c
+++ b/drivers/nvme/target/passthru.c
@@ -9,6 +9,7 @@
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
+#include <linux/configfs.h>
#include "../host/nvme.h"
#include "nvmet.h"
@@ -602,7 +603,7 @@ int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys)
goto out_unlock;
}
- file = filp_open(subsys->passthru_ctrl_path, O_RDWR, 0);
+ file = configfs_file_open(subsys->passthru_ctrl_path, O_RDWR, 0);
if (IS_ERR(file)) {
ret = PTR_ERR(file);
goto out_unlock;
--
2.34.1
next prev parent reply other threads:[~2026-09-21 9:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 9:05 [PATCH v4 0/3] nvmet: avoid recursive configfs open Runyu Xiao
2026-09-21 9:05 ` [PATCH v4 1/3] fs: configfs: add helpers for opening non-configfs paths Runyu Xiao
2026-09-22 13:29 ` Christoph Hellwig
2026-09-23 2:39 ` Runyu Xiao
2026-09-25 6:40 ` Christoph Hellwig
2026-09-21 9:05 ` [PATCH v4 2/3] nvmet: avoid recursive configfs open for file-backed namespaces Runyu Xiao
2026-09-22 13:29 ` Christoph Hellwig
2026-09-21 9:05 ` Runyu Xiao [this message]
2026-09-22 13:29 ` [PATCH v4 3/3] nvmet: avoid recursive configfs open for passthru Christoph Hellwig
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=20260921090559.41364-4-runyu.xiao@seu.edu.cn \
--to=runyu.xiao@seu.edu.cn \
--cc=a.hindborg@kernel.org \
--cc=hch@lst.de \
--cc=jianhao.xu@seu.edu.cn \
--cc=kch@nvidia.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=stable@vger.kernel.org \
/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®