Skip to content

Commit b2f5d4d

Browse files
committed
umount: Disallow unprivileged mount force
Forced unmount affects not just the mount namespace but the underlying superblock as well. Restrict forced unmount to the global root user for now. Otherwise it becomes possible a user in a less privileged mount namespace to force the shutdown of a superblock of a filesystem in a more privileged mount namespace, allowing a DOS attack on root. Cc: stable@vger.kernel.org Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 4a44a19 commit b2f5d4d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎fs/namespace.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
15441544
goto dput_and_out;
15451545
if (mnt->mnt.mnt_flags & MNT_LOCKED)
15461546
goto dput_and_out;
1547+
retval = -EPERM;
1548+
if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))
1549+
goto dput_and_out;
15471550

15481551
retval = do_umount(mnt, flags);
15491552
dput_and_out:

0 commit comments

Comments
 (0)