f2fs: check the acl's validity before setting
authorZhangZhen <zhenzhang.zhang@huawei.com>
Fri, 4 Apr 2014 01:47:16 +0000 (09:47 +0800)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 7 Apr 2014 03:18:30 +0000 (12:18 +0900)
Before setting the acl, call posix_acl_valid() to check if it is
valid or not.

Signed-off-by: zhangzhen <zhenzhang.zhang@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/acl.c

index a28571528f24e1b956e4407d79fe67880aae8435..e93e4ec7d165afe85800bf6acf68f01178d9d836 100644 (file)
@@ -203,6 +203,12 @@ static int __f2fs_set_acl(struct inode *inode, int type,
        size_t size = 0;
        int error;
 
+       if (acl) {
+               error = posix_acl_valid(acl);
+               if (error < 0)
+                       return error;
+       }
+
        switch (type) {
        case ACL_TYPE_ACCESS:
                name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;