From: Daniel J Blueman Date: Tue, 3 May 2011 16:44:13 +0000 (+0000) Subject: Prevent oopsing in posix_acl_valid() X-Git-Tag: upstream/snapshot3+hdmi~10453^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5de93914983bf04b92a786d1d205286fc53b49b;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.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 a892bc2..827be9a 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); } }