X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fnamespace.c;h=fbba8b17330d40d4daff7cf61763853cfd414395;hb=d5dbc0245a7da65b95fc14f99ccfc5f1fad078f0;hp=348562f14e93b712dfe4f2e335eb39d632c63f28;hpb=1ee07ef6b5db7235b133ee257a3adf507697e6b3;p=karo-tx-linux.git diff --git a/fs/namespace.c b/fs/namespace.c index 348562f14e93..fbba8b17330d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1439,6 +1439,8 @@ static int do_umount(struct mount *mnt, int flags) * Special case for "unmounting" root ... * we just try to remount it readonly. */ + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; down_write(&sb->s_umount); if (!(sb->s_flags & MS_RDONLY)) retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); @@ -2913,6 +2915,9 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, /* make sure we can reach put_old from new_root */ if (!is_path_reachable(old_mnt, old.dentry, &new)) goto out4; + /* make certain new is below the root */ + if (!is_path_reachable(new_mnt, new.dentry, &root)) + goto out4; root_mp->m_count++; /* pin it so it won't go away */ lock_mount_hash(); detach_mnt(new_mnt, &parent_path);