Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / ext2 / acl.c
index 25f4a64..da52b4a 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de>
  */
 
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -149,7 +150,7 @@ ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl,
 }
 
 /*
- * inode->i_sem: don't care
+ * inode->i_mutex: don't care
  */
 static struct posix_acl *
 ext2_get_acl(struct inode *inode, int type)
@@ -194,8 +195,7 @@ ext2_get_acl(struct inode *inode, int type)
                acl = NULL;
        else
                acl = ERR_PTR(retval);
-       if (value)
-               kfree(value);
+       kfree(value);
 
        if (!IS_ERR(acl)) {
                switch(type) {
@@ -212,7 +212,7 @@ ext2_get_acl(struct inode *inode, int type)
 }
 
 /*
- * inode->i_sem: down
+ * inode->i_mutex: down
  */
 static int
 ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
@@ -220,7 +220,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        struct ext2_inode_info *ei = EXT2_I(inode);
        int name_index;
        void *value = NULL;
-       size_t size;
+       size_t size = 0;
        int error;
 
        if (S_ISLNK(inode->i_mode))
@@ -262,8 +262,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 
        error = ext2_xattr_set(inode, name_index, "", value, size, 0);
 
-       if (value)
-               kfree(value);
+       kfree(value);
        if (!error) {
                switch(type) {
                        case ACL_TYPE_ACCESS:
@@ -303,8 +302,8 @@ ext2_permission(struct inode *inode, int mask, struct nameidata *nd)
 /*
  * Initialize the ACLs of a new inode. Called from ext2_new_inode.
  *
- * dir->i_sem: down
- * inode->i_sem: up (access to inode is still exclusive)
+ * dir->i_mutex: down
+ * inode->i_mutex: up (access to inode is still exclusive)
  */
 int
 ext2_init_acl(struct inode *inode, struct inode *dir)
@@ -363,7 +362,7 @@ cleanup:
  * for directories) are added. There are no more bits available in the
  * file mode.
  *
- * inode->i_sem: down
+ * inode->i_mutex: down
  */
 int
 ext2_acl_chmod(struct inode *inode)
@@ -396,12 +395,12 @@ static size_t
 ext2_xattr_list_acl_access(struct inode *inode, char *list, size_t list_size,
                           const char *name, size_t name_len)
 {
-       const size_t size = sizeof(XATTR_NAME_ACL_ACCESS);
+       const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
 
        if (!test_opt(inode->i_sb, POSIX_ACL))
                return 0;
        if (list && size <= list_size)
-               memcpy(list, XATTR_NAME_ACL_ACCESS, size);
+               memcpy(list, POSIX_ACL_XATTR_ACCESS, size);
        return size;
 }
 
@@ -409,12 +408,12 @@ static size_t
 ext2_xattr_list_acl_default(struct inode *inode, char *list, size_t list_size,
                            const char *name, size_t name_len)
 {
-       const size_t size = sizeof(XATTR_NAME_ACL_DEFAULT);
+       const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
 
        if (!test_opt(inode->i_sb, POSIX_ACL))
                return 0;
        if (list && size <= list_size)
-               memcpy(list, XATTR_NAME_ACL_DEFAULT, size);
+               memcpy(list, POSIX_ACL_XATTR_DEFAULT, size);
        return size;
 }
 
@@ -506,14 +505,14 @@ ext2_xattr_set_acl_default(struct inode *inode, const char *name,
 }
 
 struct xattr_handler ext2_xattr_acl_access_handler = {
-       .prefix = XATTR_NAME_ACL_ACCESS,
+       .prefix = POSIX_ACL_XATTR_ACCESS,
        .list   = ext2_xattr_list_acl_access,
        .get    = ext2_xattr_get_acl_access,
        .set    = ext2_xattr_set_acl_access,
 };
 
 struct xattr_handler ext2_xattr_acl_default_handler = {
-       .prefix = XATTR_NAME_ACL_DEFAULT,
+       .prefix = POSIX_ACL_XATTR_DEFAULT,
        .list   = ext2_xattr_list_acl_default,
        .get    = ext2_xattr_get_acl_default,
        .set    = ext2_xattr_set_acl_default,