Commit 9d5c12a7 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: x_tables: limit allocation requests for blob rule heads

This is a very conservative limit (134217728 rules), but good
enough to not trigger frequent oom from syzkaller.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 19926968
...@@ -894,6 +894,9 @@ EXPORT_SYMBOL(xt_check_entry_offsets); ...@@ -894,6 +894,9 @@ EXPORT_SYMBOL(xt_check_entry_offsets);
*/ */
unsigned int *xt_alloc_entry_offsets(unsigned int size) 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); return kvmalloc_array(size, sizeof(unsigned int), GFP_KERNEL | __GFP_ZERO);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment