From: Al Viro <viro@zeniv.linux.org.uk>
To: Ian Kent <raven@themaw.net>
Cc: Christian Brauner <brauner@kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
autofs mailing list <autofs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 2/2] autofs: dont trigger mount if it cant succeed
Date: Tue, 11 Nov 2025 06:59:51 +0000 [thread overview]
Message-ID: <20251111065951.GQ2441659@ZenIV> (raw)
In-Reply-To: <20251111060439.19593-3-raven@themaw.net>
On Tue, Nov 11, 2025 at 02:04:39PM +0800, Ian Kent wrote:
> diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
> index f5c16ffba013..0a29761f39c0 100644
> --- a/fs/autofs/inode.c
> +++ b/fs/autofs/inode.c
> @@ -251,6 +251,7 @@ static struct autofs_sb_info *autofs_alloc_sbi(void)
> sbi->min_proto = AUTOFS_MIN_PROTO_VERSION;
> sbi->max_proto = AUTOFS_MAX_PROTO_VERSION;
> sbi->pipefd = -1;
> + sbi->owner = current->nsproxy->mnt_ns;
>
> set_autofs_type_indirect(&sbi->type);
> mutex_init(&sbi->wq_mutex);
> diff --git a/fs/autofs/root.c b/fs/autofs/root.c
> index 174c7205fee4..8cce86158f20 100644
> --- a/fs/autofs/root.c
> +++ b/fs/autofs/root.c
> @@ -341,6 +341,14 @@ static struct vfsmount *autofs_d_automount(struct path *path)
> if (autofs_oz_mode(sbi))
> return NULL;
>
> + /* Refuse to trigger mount if current namespace is not the owner
> + * and the mount is propagation private.
> + */
> + if (sbi->owner != current->nsproxy->mnt_ns) {
> + if (vfsmount_to_propagation_flags(path->mnt) & MS_PRIVATE)
> + return ERR_PTR(-EPERM);
> + }
> +
Huh? What's to guarantee that superblock won't outlive the namespace?
That looks seriously bogus.
next prev parent reply other threads:[~2025-11-11 6:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 6:04 [PATCH 0/2] autofs: fairly minor fixes Ian Kent
2025-11-11 6:04 ` [PATCH 1/2] autofs: fix per-dentry timeout warning Ian Kent
2025-12-02 23:19 ` Ian Kent
2025-11-11 6:04 ` [PATCH 2/2] autofs: dont trigger mount if it cant succeed Ian Kent
2025-11-11 6:59 ` Al Viro [this message]
2025-11-11 8:25 ` Ian Kent
2025-11-11 9:04 ` Al Viro
2025-11-11 10:13 ` Ian Kent
2025-11-11 10:16 ` Al Viro
2025-11-11 10:19 ` Christian Brauner
2025-11-11 10:24 ` Al Viro
2025-11-11 10:55 ` Christian Brauner
2025-11-11 12:27 ` Ian Kent
2025-11-12 11:01 ` Christian Brauner
2025-11-13 0:14 ` Ian Kent
2025-11-13 13:19 ` Christian Brauner
2025-11-13 23:49 ` Ian Kent
2025-11-14 0:07 ` Ian Kent
2025-11-14 11:44 ` Christian Brauner
2025-11-14 13:42 ` Ian Kent
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=20251111065951.GQ2441659@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=autofs@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=raven@themaw.net \
/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;
as well as URLs for NNTP newsgroup(s).