summaryrefslogtreecommitdiff
path: root/net/netfilter/nft_set_rbtree.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2017-01-24 02:51:32 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2017-01-24 23:46:57 +0300
commit35d0ac9070ef619e3bf44324375878a1c540387b (patch)
tree7e0c00c119db64c093a68078be5a68e6d53275ec /net/netfilter/nft_set_rbtree.c
parent5ce6b04ce96896e8a79e6f60740ced911eaac7a4 (diff)
downloadlinux-35d0ac9070ef619e3bf44324375878a1c540387b.tar.xz
netfilter: nf_tables: fix set->nelems counting with no NLM_F_EXCL
If the element exists and no NLM_F_EXCL is specified, do not bump set->nelems, otherwise we leak one set element slot. This problem amplifies if the set is full since the abort path always decrements the counter for the -ENFILE case too, giving one spare extra slot. Fix this by moving set->nelems update to nft_add_set_elem() after successful element insertion. Moreover, remove the element if the set is full so there is no need to rely on the abort path to undo things anymore. Fixes: c016c7e45ddf ("netfilter: nf_tables: honor NLM_F_EXCL flag in set element insertion") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_set_rbtree.c')
0 files changed, 0 insertions, 0 deletions