Btrfs: Check validity before setting an acl

Call posix_acl_valid() to check if an acl is valid or not.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

authored by Miao Xie and committed by Li Zefan 329c5056 3153495d

+5 -4
+5 -4
fs/btrfs/acl.c
··· 178 178 179 179 if (value) { 180 180 acl = posix_acl_from_xattr(value, size); 181 - if (acl == NULL) { 182 - value = NULL; 183 - size = 0; 181 + if (acl) { 182 + ret = posix_acl_valid(acl); 183 + if (ret) 184 + goto out; 184 185 } else if (IS_ERR(acl)) { 185 186 return PTR_ERR(acl); 186 187 } 187 188 } 188 189 189 190 ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type); 190 - 191 + out: 191 192 posix_acl_release(acl); 192 193 193 194 return ret;