aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-02-14 04:05:49 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2014-02-25 05:01:09 -0500
commit47ba9734403770a4c5e685b01f0a72b835dd4fff (patch)
treeac4badd94ef5153496a4159e1bc6614333771d90
parent022ef4feed0c648aeb72d0c8ad06d266de08f525 (diff)
fs: NULL dereference in posix_acl_to_xattr()
This patch moves the dereference of "buffer" after the check for NULL. The only place which passes a NULL parameter is gfs2_set_acl(). Cc: stable <stable@vger.kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/posix_acl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 38bae5a0ea25..202b84fd3310 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -717,7 +717,7 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
717 void *buffer, size_t size) 717 void *buffer, size_t size)
718{ 718{
719 posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer; 719 posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer;
720 posix_acl_xattr_entry *ext_entry = ext_acl->a_entries; 720 posix_acl_xattr_entry *ext_entry;
721 int real_size, n; 721 int real_size, n;
722 722
723 real_size = posix_acl_xattr_size(acl->a_count); 723 real_size = posix_acl_xattr_size(acl->a_count);
@@ -725,7 +725,8 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
725 return real_size; 725 return real_size;
726 if (real_size > size) 726 if (real_size > size)
727 return -ERANGE; 727 return -ERANGE;
728 728
729 ext_entry = ext_acl->a_entries;
729 ext_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION); 730 ext_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION);
730 731
731 for (n=0; n < acl->a_count; n++, ext_entry++) { 732 for (n=0; n < acl->a_count; n++, ext_entry++) {