mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
fs: NULL dereference in posix_acl_to_xattr()
commit 47ba973440
upstream.
This patch moves the dereference of "buffer" after the check for NULL.
The only place which passes a NULL parameter is gfs2_set_acl().
Change-Id: I7ede500c05e646e4c07238d159b8f182a1fbf80d
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b8e7518373
commit
a3a7bc82f0
1 changed files with 3 additions and 2 deletions
|
@ -686,7 +686,7 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
|
|||
void *buffer, size_t size)
|
||||
{
|
||||
posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer;
|
||||
posix_acl_xattr_entry *ext_entry = ext_acl->a_entries;
|
||||
posix_acl_xattr_entry *ext_entry;
|
||||
int real_size, n;
|
||||
|
||||
real_size = posix_acl_xattr_size(acl->a_count);
|
||||
|
@ -695,6 +695,7 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
|
|||
if (real_size > size)
|
||||
return -ERANGE;
|
||||
|
||||
ext_entry = ext_acl->a_entries;
|
||||
ext_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION);
|
||||
|
||||
for (n=0; n < acl->a_count; n++, ext_entry++) {
|
||||
|
|
Loading…
Reference in a new issue