Btrfs: fix return value of btrfs_get_acl()
In btrfs_get_acl(), when the second __btrfs_getxattr() call fails, acl is not correctly set. Therefore, a wrong value might return to the caller. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
This commit is contained in:
parent
10b2f34d6e
commit
cfbffc39ac
|
@ -59,22 +59,19 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
|
||||||
if (!value)
|
if (!value)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
size = __btrfs_getxattr(inode, name, value, size);
|
size = __btrfs_getxattr(inode, name, value, size);
|
||||||
if (size > 0) {
|
}
|
||||||
acl = posix_acl_from_xattr(value, size);
|
if (size > 0) {
|
||||||
if (IS_ERR(acl)) {
|
acl = posix_acl_from_xattr(value, size);
|
||||||
kfree(value);
|
|
||||||
return acl;
|
|
||||||
}
|
|
||||||
set_cached_acl(inode, type, acl);
|
|
||||||
}
|
|
||||||
kfree(value);
|
|
||||||
} else if (size == -ENOENT || size == -ENODATA || size == 0) {
|
} else if (size == -ENOENT || size == -ENODATA || size == 0) {
|
||||||
/* FIXME, who returns -ENOENT? I think nobody */
|
/* FIXME, who returns -ENOENT? I think nobody */
|
||||||
acl = NULL;
|
acl = NULL;
|
||||||
set_cached_acl(inode, type, acl);
|
|
||||||
} else {
|
} else {
|
||||||
acl = ERR_PTR(-EIO);
|
acl = ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
|
kfree(value);
|
||||||
|
|
||||||
|
if (!IS_ERR(acl))
|
||||||
|
set_cached_acl(inode, type, acl);
|
||||||
|
|
||||||
return acl;
|
return acl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue