diff options
author | Florian Westphal <fw@strlen.de> | 2018-02-27 21:42:32 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-26 12:02:21 +0300 |
commit | 5bcf169444540cbb8646cb415087f5ec83f60432 (patch) | |
tree | 25c6024dd85b0228d7b8b964a298329bd67fa07e /net/netfilter | |
parent | 764f2162d97a498269c9b67607fe163692a79aa7 (diff) | |
download | linux-5bcf169444540cbb8646cb415087f5ec83f60432.tar.xz |
netfilter: x_tables: limit allocation requests for blob rule heads
commit 9d5c12a7c08f67999772065afd50fb222072114e upstream.
This is a very conservative limit (134217728 rules), but good
enough to not trigger frequent oom from syzkaller.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/x_tables.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 926e7d76ac2e..8e054c63b54e 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -819,6 +819,9 @@ EXPORT_SYMBOL(xt_check_entry_offsets); */ unsigned int *xt_alloc_entry_offsets(unsigned int size) { + if (size > XT_MAX_TABLE_SIZE / sizeof(unsigned int)) + return NULL; + return kvmalloc_array(size, sizeof(unsigned int), GFP_KERNEL | __GFP_ZERO); } |