From: David Wysochanski <dwysocha@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-cachefs <linux-cachefs@redhat.com>,
Jeff Layton <jlayton@kernel.org>,
Steve French <smfrench@gmail.com>,
linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH] cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr
Date: Tue, 5 Apr 2022 10:24:50 -0400 [thread overview]
Message-ID: <CALF+zOn+JEB7F30wMEcs3Zm=2HFMXS+8vfiQP9HW26OtwXUHGg@mail.gmail.com> (raw)
In-Reply-To: <1788451.1649168050@warthog.procyon.org.uk>
On Tue, Apr 5, 2022 at 10:14 AM David Howells <dhowells@redhat.com> wrote:
>
> Dave Wysochanski <dwysocha@redhat.com> wrote:
>
> > @@ -203,7 +203,7 @@ bool cachefiles_set_volume_xattr(struct cachefiles_volume *volume)
> > if (!buf)
> > return false;
> > buf->reserved = cpu_to_be32(0);
> > - memcpy(buf->data, p, len);
> > + memcpy(buf->data, p, volume->vcookie->coherency_len);
>
> Good catch. However, I think it's probably better to change things a bit
> further up, eg.:
>
> - len += sizeof(*buf);
> - buf = kmalloc(len, GFP_KERNEL);
> + buf = kmalloc(sizeof(*buf) + len, GFP_KERNEL);
>
> David
>
Agree with the above. I'll send a v2. Thanks!
next prev parent reply other threads:[~2022-04-05 23:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 13:46 [PATCH] cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr Dave Wysochanski
2022-04-05 14:14 ` David Howells
2022-04-05 14:24 ` David Wysochanski [this message]
2022-04-05 15:54 ` David Wysochanski
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='CALF+zOn+JEB7F30wMEcs3Zm=2HFMXS+8vfiQP9HW26OtwXUHGg@mail.gmail.com' \
--to=dwysocha@redhat.com \
--cc=dhowells@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-cachefs@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.