[SRU][N][PATCH 1/1] do_change_type(): refuse to operate on unmounted/not ours mounts

Cengiz Can cengiz.can at canonical.com
Fri Sep 11 05:11:08 UTC 2026


From: Al Viro <viro at zeniv.linux.org.uk>

Ensure that propagation settings can only be changed for mounts located
in the caller's mount namespace. This change aligns permission checking
with the rest of mount(2).

Reviewed-by: Christian Brauner <brauner at kernel.org>
Fixes: 07b20889e305 ("beginning of the shared-subtree proper")
Reported-by: "Orlando, Noah" <Noah.Orlando at deshaw.com>
Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
(cherry picked from commit 12f147ddd6de7382dad54812e65f3f08d05809fc)
CVE-2025-38498
Assisted-by: kybele:claude-opus-4.8
Signed-off-by: Cengiz Can <cengiz.can at canonical.com>
---
 fs/namespace.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index 5f785175b544..ca8648ac02a7 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2585,6 +2585,10 @@ static int do_change_type(struct path *path, int ms_flags)
 		return -EINVAL;
 
 	namespace_lock();
+	if (!check_mnt(mnt)) {
+		err = -EINVAL;
+		goto out_unlock;
+	}
 	if (type == MS_SHARED) {
 		err = invent_group_ids(mnt, recurse);
 		if (err)
-- 
2.53.0




More information about the kernel-team mailing list