From: Jeff Layton <jlayton@kernel.org>
To: Miklos Szeredi <mszeredi@redhat.com>,
Christian Brauner <christian@brauner.io>
Cc: linux-fsdevel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] fs: fix is_mnt_ns_file()
Date: Wed, 11 Dec 2024 10:36:06 -0500 [thread overview]
Message-ID: <8e5ceeb5b3e006e0ef720edcde44c477606a87b1.camel@kernel.org> (raw)
In-Reply-To: <20241211121118.85268-1-mszeredi@redhat.com>
On Wed, 2024-12-11 at 13:11 +0100, Miklos Szeredi wrote:
> Commit 1fa08aece425 ("nsfs: convert to path_from_stashed() helper") reused
> nsfs dentry's d_fsdata, which no longer contains a pointer to
> proc_ns_operations.
>
> Fix the remaining use in is_mnt_ns_file().
>
> Fixes: 1fa08aece425 ("nsfs: convert to path_from_stashed() helper")
> Cc: <stable@vger.kernel.org> # v6.9
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> ---
>
> Came across this while getting the mnt_ns in fsnotify_mark(), tested the
> fix in that context. I don't have a test for mainline, though.
>
> fs/namespace.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 23e81c2a1e3f..6eec7794f707 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -2055,9 +2055,15 @@ SYSCALL_DEFINE1(oldumount, char __user *, name)
>
> static bool is_mnt_ns_file(struct dentry *dentry)
> {
> + struct ns_common *ns;
> +
> /* Is this a proxy for a mount namespace? */
> - return dentry->d_op == &ns_dentry_operations &&
> - dentry->d_fsdata == &mntns_operations;
> + if (dentry->d_op != &ns_dentry_operations)
> + return false;
> +
> + ns = d_inode(dentry)->i_private;
> +
> + return ns->ops == &mntns_operations;
> }
>
> struct ns_common *from_mnt_ns(struct mnt_namespace *mnt)
Took me a min to figure out how i_private gets set, but this looks
correct.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-12-11 15:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 12:11 [PATCH] fs: fix is_mnt_ns_file() Miklos Szeredi
2024-12-11 15:36 ` Jeff Layton [this message]
2024-12-11 16:30 ` Al Viro
2024-12-13 12:48 ` Christian Brauner
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=8e5ceeb5b3e006e0ef720edcde44c477606a87b1.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=christian@brauner.io \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mszeredi@redhat.com \
--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