diff mbox

[3.11.y.z,extended,stable] Patch "fs: NULL dereference in posix_acl_to_xattr()" has been added to staging queue

Message ID 1398072448-13379-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques April 21, 2014, 9:27 a.m. UTC
This is a note to let you know that I have just added a patch titled

    fs: NULL dereference in posix_acl_to_xattr()

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From ee8f288e48ae7d202b97020b48213fb25b1cfc99 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 14 Feb 2014 12:05:49 +0300
Subject: fs: NULL dereference in posix_acl_to_xattr()

commit 47ba9734403770a4c5e685b01f0a72b835dd4fff 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().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
[ luis: backported to 3.11:
  - posix_acl_to_xattr() is defined in xattr_acl.c, not in posix_acl.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/xattr_acl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
1.9.1
diff mbox

Patch

diff --git a/fs/xattr_acl.c b/fs/xattr_acl.c
index 9fbea87..cd1147c 100644
--- a/fs/xattr_acl.c
+++ b/fs/xattr_acl.c
@@ -146,7 +146,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);
@@ -154,7 +154,8 @@  posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
 		return real_size;
 	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++) {