From: David Miller <davem@davemloft.net>
To: daniel@iogearbox.net
Cc: ast@kernel.org, daniel@zonque.org, dh.herrmann@gmail.com,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next] bpf, lpm: fix overflows in trie_alloc checks
Date: Wed, 08 Feb 2017 14:40:38 -0500 (EST) [thread overview]
Message-ID: <20170208.144038.1724270145023687764.davem@davemloft.net> (raw)
In-Reply-To: <205e6ad77b5863daf0904e02f3cfc9a244e1ee47.1486513105.git.daniel@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Wed, 8 Feb 2017 01:19:43 +0100
> Cap the maximum (total) value size and bail out if larger than KMALLOC_MAX_SIZE
> as otherwise it doesn't make any sense to proceed further, since we're
> guaranteed to fail to allocate elements anyway in lpm_trie_node_alloc();
> likleyhood of failure is still high for large values, though, similarly
> as with htab case in non-prealloc.
>
> Next, make sure that cost vars are really u64 instead of size_t, so that we
> don't overflow on 32 bit and charge only tiny map.pages against memlock while
> allowing huge max_entries; cap also the max cost like we do with other map
> types.
>
> Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Alexei Starovoitov <ast@kernel.org>
Applied, thanks Daniel.
prev parent reply other threads:[~2017-02-08 19:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 0:19 [PATCH net-next] bpf, lpm: fix overflows in trie_alloc checks Daniel Borkmann
2017-02-08 19:40 ` David Miller [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=20170208.144038.1724270145023687764.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=daniel@zonque.org \
--cc=dh.herrmann@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).