From: sashiko-bot@kernel.org
To: "Runyu Xiao" <runyu.xiao@seu.edu.cn>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v6 1/4] fs: configfs: add helpers for opening non-configfs paths
Date: Sat, 26 Sep 2026 09:38:20 +0000 [thread overview]
Message-ID: <20260926093820.B93E51F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260926092148.128937-2-runyu.xiao@seu.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] fs: configfs: configfs_file_open() ignores O_NOFOLLOW flag
--
commit 76452a998ac4b5def9cd38ece0706188bd3e3ed4
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
fs: configfs: add helpers for opening non-configfs paths
This commit adds configfs_open_root() and configfs_file_open() to allow
configfs store callbacks to open non-configfs paths without re-entering
configfs and acquiring the same non-recursive semaphore again.
> diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
> --- a/fs/configfs/mount.c
> +++ b/fs/configfs/mount.c
[ ... ]
> @@ -118,6 +119,58 @@ static struct file_system_type configfs_fs_type = {
[ ... ]
> +struct file *configfs_file_open(const char *filename, int flags, umode_t mode)
> +{
> + struct file *file;
> + struct path path;
> + int ret;
> +
> + ret = kern_path(filename, LOOKUP_FOLLOW, &path);
[Severity: Medium]
Does hardcoding LOOKUP_FOLLOW here bypass the caller's O_NOFOLLOW intent if
it is provided in the flags?
If a caller invokes configfs_file_open() with flags containing O_NOFOLLOW
on a symlink, kern_path() will unconditionally resolve the symlink. The
resolved target is then passed to file_open_root() via configfs_open_root().
Because file_open_root() only checks if the resolved target itself is a
symlink, this successfully bypasses the O_NOFOLLOW intent, silently
traversing the symlink instead of failing.
> + if (ret)
> + return ERR_PTR(ret);
> +
> + file = configfs_open_root(&path, "", flags, mode);
> + path_put(&path);
> + return file;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260926092148.128937-1-runyu.xiao@seu.edu.cn?part=1
next prev parent reply other threads:[~2026-09-26 9:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 9:21 [PATCH v6 0/4] nvmet: avoid recursive configfs open Runyu Xiao
2026-09-26 9:21 ` [PATCH v6 1/4] fs: configfs: add helpers for opening non-configfs paths Runyu Xiao
2026-09-26 9:38 ` sashiko-bot [this message]
2026-09-26 9:21 ` [PATCH v6 2/4] nvmet: avoid recursive configfs open for file-backed namespaces Runyu Xiao
2026-09-26 9:21 ` [PATCH v6 3/4] nvmet: avoid recursive configfs open for passthru Runyu Xiao
2026-09-28 15:50 ` Logan Gunthorpe
2026-09-26 9:21 ` [PATCH v6 4/4] scsi: target: pin db_root for metadata writes Runyu Xiao
2026-09-26 9:37 ` sashiko-bot
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=20260926093820.B93E51F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=runyu.xiao@seu.edu.cn \
--cc=sashiko-reviews@lists.linux.dev \
/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 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.