* [patch] fs: NULL dereference in posix_acl_to_xattr()
@ 2014-02-14 9:05 Dan Carpenter
2014-02-17 10:16 ` Steven Whitehouse
2014-02-25 10:07 ` Steven Whitehouse
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-02-14 9:05 UTC (permalink / raw)
To: Alexander Viro
Cc: linux-fsdevel, Steven Whitehouse, cluster-devel, kernel-janitors
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>
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++) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] fs: NULL dereference in posix_acl_to_xattr()
2014-02-14 9:05 [patch] fs: NULL dereference in posix_acl_to_xattr() Dan Carpenter
@ 2014-02-17 10:16 ` Steven Whitehouse
2014-02-25 10:07 ` Steven Whitehouse
1 sibling, 0 replies; 3+ messages in thread
From: Steven Whitehouse @ 2014-02-17 10:16 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexander Viro, linux-fsdevel, cluster-devel, kernel-janitors
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++) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] fs: NULL dereference in posix_acl_to_xattr()
2014-02-14 9:05 [patch] fs: NULL dereference in posix_acl_to_xattr() Dan Carpenter
2014-02-17 10:16 ` Steven Whitehouse
@ 2014-02-25 10:07 ` Steven Whitehouse
1 sibling, 0 replies; 3+ messages in thread
From: Steven Whitehouse @ 2014-02-25 10:07 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexander Viro, linux-fsdevel, cluster-devel, kernel-janitors
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>
>
I've not heard anything from Al, so at least for the time being, I'm
putting this in the GFS2 tree, that way it will at least get some
exposure in -next,
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++) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-25 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-14 9:05 [patch] fs: NULL dereference in posix_acl_to_xattr() Dan Carpenter
2014-02-17 10:16 ` Steven Whitehouse
2014-02-25 10:07 ` Steven Whitehouse
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).