From: Daniel J Blueman Date: Tue, 3 May 2011 16:44:13 +0000 (+0000) Subject: Prevent oopsing in posix_acl_valid() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f5de93914983bf04b92a786d1d205286fc53b49b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Prevent oopsing in posix_acl_valid() If posix_acl_from_xattr() returns an error code, a negative address is dereferenced causing an oops; fix by checking for error code first. Signed-off-by: Daniel J Blueman Reviewed-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index a892bc27f13a..827be9a6ca33 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -178,12 +178,13 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, if (value) { acl = posix_acl_from_xattr(value, size); + if (IS_ERR(acl)) + return PTR_ERR(acl); + if (acl) { ret = posix_acl_valid(acl); if (ret) goto out; - } else if (IS_ERR(acl)) { - return PTR_ERR(acl); } }