[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <651b3e3a.c20a0220.a0ffe.58a3@mx.google.com>
Date: Tue, 3 Oct 2023 01:03:35 +0300
From: Andrew Kanner <andrew.kanner@...il.com>
To: Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: bjorn@...nel.org, magnus.karlsson@...el.com,
maciej.fijalkowski@...el.com, jonathan.lemon@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, xuanzhuo@...ux.alibaba.com,
linux-kernel-mentees@...ts.linuxfoundation.org,
netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzbot+fae676d3cf469331fc89@...kaller.appspotmail.com
Subject: Re: [PATCH net-next v1] net/xdp: fix zero-size allocation warning in
xskq_create()
On Mon, Oct 02, 2023 at 03:52:44PM +0200, Alexander Lobakin wrote:
> From: Andrew Kanner <andrew.kanner@...il.com>
> Date: Thu, 28 Sep 2023 23:44:40 +0300
>
> > Syzkaller reported the following issue:
>
> [...]
>
> > PS: the initial number of entries is 0x20000000 in syzkaller repro:
> > syscall(__NR_setsockopt, (intptr_t)r[0], 0x11b, 3, 0x20000040, 0x20);
> >
> > Link: https://syzkaller.appspot.com/text?tag=ReproC&x=10910f18280000
> >
> > net/xdp/xsk_queue.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/net/xdp/xsk_queue.c b/net/xdp/xsk_queue.c
> > index f8905400ee07..1bc7fb1f14ae 100644
> > --- a/net/xdp/xsk_queue.c
> > +++ b/net/xdp/xsk_queue.c
> > @@ -34,6 +34,9 @@ struct xsk_queue *xskq_create(u32 nentries, bool umem_queue)
> > q->ring_mask = nentries - 1;
> >
> > size = xskq_get_ring_size(q, umem_queue);
> > + if (size == SIZE_MAX)
>
> unlikely().
>
> > + return NULL;
> > +
> > size = PAGE_ALIGN(size);
> >
> > q->ring = vmalloc_user(size);
>
> Thanks,
> Olek
Thanks, Olek.
That is a reasonable optimization, I'll add it in v2.
--
pw-bot: cr
Andrew Kanner
Powered by blists - more mailing lists