From: Andrew Kanner <andrew.kanner@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: bjorn@kernel.org, magnus.karlsson@intel.com,
maciej.fijalkowski@intel.com, jonathan.lemon@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, aleksander.lobakin@intel.com,
xuanzhuo@linux.alibaba.com, ast@kernel.org, hawk@kernel.org,
john.fastabend@gmail.com,
linux-kernel-mentees@lists.linuxfoundation.org,
netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+fae676d3cf469331fc89@syzkaller.appspotmail.com
Subject: Re: [PATCH net-next v2] net/xdp: fix zero-size allocation warning in xskq_create()
Date: Thu, 5 Oct 2023 10:35:56 +0300 [thread overview]
Message-ID: <651e6933.170a0220.f6f76.1a12@mx.google.com> (raw)
In-Reply-To: <2f5abbf8-8d50-3deb-19cd-9bfd654e1ceb@iogearbox.net>
On Thu, Oct 05, 2023 at 12:49:23AM +0200, Daniel Borkmann wrote:
[...]
> >
> > Reported-and-tested-by: syzbot+fae676d3cf469331fc89@syzkaller.appspotmail.com
> > Closes: https://lore.kernel.org/all/000000000000c84b4705fb31741e@google.com/T/
> > Link: https://syzkaller.appspot.com/bug?extid=fae676d3cf469331fc89
> > Fixes: 9f78bf330a66 ("xsk: support use vaddr as ring")
> > Signed-off-by: Andrew Kanner <andrew.kanner@gmail.com>
>
> I guess also:
>
> Reported-by: syzbot+b132693e925cbbd89e26@syzkaller.appspotmail.com
>
> Moreover, this fix is needed in bpf/net tree (as opposed to *-next tree), right?
>
Seems, so - I will check.
> > 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..b03d1bfb6978 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 (unlikely(size == SIZE_MAX))
> > + return NULL;
>
> Doesn't this leak q here ?
>
> > size = PAGE_ALIGN(size);
> > q->ring = vmalloc_user(size);
> >
>
It is.
Thanks, Daniel, I will fix it in v3.
pw-bot: cr
--
Andrew Kanner
prev parent reply other threads:[~2023-10-05 7:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 22:29 [PATCH net-next v2] net/xdp: fix zero-size allocation warning in xskq_create() Andrew Kanner
2023-10-03 10:26 ` Alexander Lobakin
2023-10-04 22:49 ` Daniel Borkmann
2023-10-05 7:35 ` Andrew Kanner [this message]
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=651e6933.170a0220.f6f76.1a12@mx.google.com \
--to=andrew.kanner@gmail.com \
--cc=aleksander.lobakin@intel.com \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+fae676d3cf469331fc89@syzkaller.appspotmail.com \
--cc=xuanzhuo@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox