Skip to content

Commit 5bad873

Browse files
marceloleitnerummakynes
authored andcommitted
netfilter: x_tables: avoid warn and OOM killer on vmalloc call
Andrey Konovalov reported that this vmalloc call is based on an userspace request and that it's spewing traces, which may flood the logs and cause DoS if abused. Florian Westphal also mentioned that this call should not trigger OOM killer. This patch brings the vmalloc call in sync to kmalloc and disables the warn trace on allocation failure and also disable OOM killer invocation. Note, however, that under such stress situation, other places may trigger OOM killer invocation. Reported-by: Andrey Konovalov <andreyknvl@google.com> Cc: Florian Westphal <fw@strlen.de> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 8411b64 commit 5bad873

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/x_tables.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,9 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
959959
if (sz <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
960960
info = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
961961
if (!info) {
962-
info = vmalloc(sz);
962+
info = __vmalloc(sz, GFP_KERNEL | __GFP_NOWARN |
963+
__GFP_NORETRY | __GFP_HIGHMEM,
964+
PAGE_KERNEL);
963965
if (!info)
964966
return NULL;
965967
}

0 commit comments

Comments
 (0)