diff mbox

[-V5,02/24] vfs: Pass all mask flags down to iop->check_acl

Message ID 1298469131-16555-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aneesh Kumar K.V Feb. 23, 2011, 1:51 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/namei.c b/fs/namei.c
index b01eab8..f09ab1f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -174,8 +174,6 @@  static int acl_permission_check(struct inode *inode, int mask, unsigned int flag
 {
 	umode_t			mode = inode->i_mode;
 
-	mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
-
 	if (current_fsuid() == inode->i_uid)
 		mode >>= 6;
 	else {
@@ -192,7 +190,7 @@  static int acl_permission_check(struct inode *inode, int mask, unsigned int flag
 	/*
 	 * If the DACs are ok we don't need any capability check.
 	 */
-	if ((mask & ~mode) == 0)
+	if ((mask & (MAY_READ | MAY_WRITE | MAY_EXEC) & ~mode) == 0)
 		return 0;
 	return -EACCES;
 }
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index b1cf6bf..ad40df2 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -222,6 +222,8 @@  posix_acl_permission(struct inode *inode, const struct posix_acl *acl, int want)
 	const struct posix_acl_entry *pa, *pe, *mask_obj;
 	int found = 0;
 
+	want &= MAY_READ | MAY_WRITE | MAY_EXEC;
+
 	FOREACH_ACL_ENTRY(pa, acl, pe) {
                 switch(pa->e_tag) {
                         case ACL_USER_OBJ: