[Devel] [PATCH RHEL7 COMMIT] fs: do not allow rootfs umount

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 15 02:16:38 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.14
------>
commit 0ae9e4e30b14404b570f62f83220637506be6376
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Wed Jun 15 13:16:38 2016 +0400

    fs: do not allow rootfs umount
    
    In mainline rootfs is marked always as MNT_LOCKED,
    sys_umount checks this flag and fails its processing.
    Our kernels lacks for MNT_LOCKED flag, so we use another kind of check
    to prevent incorrect operation.
    
    v2: use mnt_has_parent()
    
    https://jira.sw.ru/browse/PSBM-46437
    
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
    Acked-by: Andrey Vagin <avagin at virtuozzo.com>
---
 fs/namespace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index 988320b..4fb935a 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1355,6 +1355,8 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
 		goto dput_and_out;
 	if (!check_mnt(mnt))
 		goto dput_and_out;
+	if (!mnt_has_parent(mnt))
+		goto dput_and_out;
 
 	retval = do_umount(mnt, flags);
 dput_and_out:


More information about the Devel mailing list