Re: [PATCH] cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 5, 2022 at 10:14 AM David Howells <dhowells@xxxxxxxxxx> wrote:
>
> Dave Wysochanski <dwysocha@xxxxxxxxxx> 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!

--
Linux-cachefs mailing list
Linux-cachefs@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/linux-cachefs




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux