]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: conntrack: clamp maximum hashtable size to INT_MAX
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 8 Jan 2025 21:56:33 +0000 (22:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2025 12:34:39 +0000 (13:34 +0100)
commit5552b4fd44be3393b930434a7845d8d95a2a3c33
treee04c79b98782a6e08f84ea7b212b4b8856c0d712
parentd470b9259310f83787e7899830dfc43c9aa94e71
netfilter: conntrack: clamp maximum hashtable size to INT_MAX

[ Upstream commit b541ba7d1f5a5b7b3e2e22dc9e40e18a7d6dbc13 ]

Use INT_MAX as maximum size for the conntrack hashtable. Otherwise, it
is possible to hit WARN_ON_ONCE in __kvmalloc_node_noprof() when
resizing hashtable because __GFP_NOWARN is unset. See:

  0708a0afe291 ("mm: Consider __GFP_NOWARN flag for oversized kvmalloc() calls")

Note: hashtable resize is only possible from init_netns.

Fixes: 9cc1c73ad666 ("netfilter: conntrack: avoid integer overflow when resizing")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_conntrack_core.c