summaryrefslogtreecommitdiff
path: root/net/netfilter/nft_connlimit.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-12-28 03:24:45 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2018-12-29 04:45:20 +0300
commite8cfb372b38a1b8979aa7f7631fb5e7b11c3793c (patch)
treef909dc3dafddbba1af23dcfdf81302171ba1e9d9 /net/netfilter/nft_connlimit.c
parentf7fcc98dfc2d136722007fec0debbed761679b94 (diff)
downloadlinux-e8cfb372b38a1b8979aa7f7631fb5e7b11c3793c.tar.xz
netfilter: nf_conncount: restart search when nodes have been erased
Shawn Bohrer reported a following crash: |RIP: 0010:rb_erase+0xae/0x360 [..] Call Trace: nf_conncount_destroy+0x59/0xc0 [nf_conncount] cleanup_match+0x45/0x70 [ip_tables] ... Shawn tracked this down to bogus 'parent' pointer: Problem is that when we insert a new node, then there is a chance that the 'parent' that we found was also passed to tree_nodes_free() (because that node was empty) for erase+free. Instead of trying to be clever and detect when this happens, restart the search if we have evicted one or more nodes. To prevent frequent restarts, do not perform gc on the second round. Also, unconditionally schedule the gc worker. The condition gc_count > ARRAY_SIZE(gc_nodes)) cannot be true unless tree grows very large, as the height of the tree will be low even with hundreds of nodes present. Fixes: 5c789e131cbb9 ("netfilter: nf_conncount: Add list lock and gc worker, and RCU for init tree search") Reported-by: Shawn Bohrer <sbohrer@cloudflare.com> Reviewed-by: Shawn Bohrer <sbohrer@cloudflare.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_connlimit.c')
0 files changed, 0 insertions, 0 deletions