summaryrefslogtreecommitdiff
path: root/fs/autofs/root.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2025-11-18 10:46:31 +0800
committerChristian Brauner <brauner@kernel.org>2025-11-19 11:14:02 +0100
commit922a6f34c1756d2b0c35d9b2d915b8af19e85965 (patch)
treec3eb198458480d3de60abd556e21039fc5b988de /fs/autofs/root.c
parent3a8660878839faadb4f1a6dd72c3179c1df56787 (diff)
autofs: dont trigger mount if it cant succeed
If a mount namespace contains autofs mounts, and they are propagation private, and there is no namespace specific automount daemon to handle possible automounting then attempted path resolution will loop until MAXSYMLINKS is reached before failing causing quite a bit of noise in the log. Add a check for this in autofs ->d_automount() so that the VFS can immediately return an error in this case. Since the mount is propagation private an EPERM return seems most appropriate. Suggested by: Christian Brauner <brauner@kernel.org> Signed-off-by: Ian Kent <raven@themaw.net> Link: https://patch.msgid.link/20251118024631.10854-2-raven@themaw.net Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/autofs/root.c')
-rw-r--r--fs/autofs/root.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 174c7205fee4..d10df9d89d1c 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->mnt_ns_id != to_ns_common(current->nsproxy->mnt_ns)->ns_id) {
+ if (vfsmount_to_propagation_flags(path->mnt) & MS_PRIVATE)
+ return ERR_PTR(-EPERM);
+ }
+
/*
* If an expire request is pending everyone must wait.
* If the expire fails we're still mounted so continue