From: Steven Whitehouse <swhiteho@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] fs: NULL dereference in posix_acl_to_xattr()
Date: Mon, 17 Feb 2014 10:16:21 +0000 [thread overview]
Message-ID: <1392632181.2726.9.camel@menhir> (raw)
In-Reply-To: <20140214090549.GA15629@elgon.mountain>
Hi,
On Fri, 2014-02-14 at 12:05 +0300, Dan Carpenter wrote:
> 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>
>
Al, are you going to take this, or should I put it through the GFS2 tree
instead?
I also wonder whether GFS2 should be calling posix_acl_xattr_size() like
the other filesystems, or whether in fact calling posix_acl_to_xattr()
with a NULL buffer is still accepted usage here?
Steve.
> diff --git a/fs/posix_acl.c b/fs/posix_acl.c
> index 11c54fd51e16..9e363e41dacc 100644
> --- a/fs/posix_acl.c
> +++ b/fs/posix_acl.c
> @@ -723,7 +723,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);
> @@ -731,7 +731,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++) {
next prev parent reply other threads:[~2014-02-17 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 9:05 [patch] fs: NULL dereference in posix_acl_to_xattr() Dan Carpenter
2014-02-17 10:16 ` Steven Whitehouse [this message]
2014-02-25 10:07 ` Steven Whitehouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392632181.2726.9.camel@menhir \
--to=swhiteho@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).