Patch Upstream: do_mount(): fix a leak introduced in 3.9 ("mount: consolidate permission checks")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit: 0d5cadb87e0fa764db7fa0b78d8a6f173cb475a1
From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Date: Sat, 4 May 2013 14:40:51 -0400
Subject: do_mount(): fix a leak introduced in 3.9 ("mount: consolidate
 permission checks")

Cc: stable@xxxxxxxxxxxxxxx
Bisected-by: Michael Leun <lkml20130126@xxxxxxxxxxxxxxx>
Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
 fs/namespace.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index b4f96a5..b68eef2d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2284,12 +2284,11 @@ long do_mount(const char *dev_name, const char *dir_name,
 
 	retval = security_sb_mount(dev_name, &path,
 				   type_page, flags, data_page);
+	if (!retval && !may_mount())
+		retval = -EPERM;
 	if (retval)
 		goto dput_out;
 
-	if (!may_mount())
-		return -EPERM;
-
 	/* Default to relatime unless overriden */
 	if (!(flags & MS_NOATIME))
 		mnt_flags |= MNT_RELATIME;
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]