]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: conntrack: convert to refcount_t api
authorFlorian Westphal <fw@strlen.de>
Fri, 7 Jan 2022 04:03:22 +0000 (05:03 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 9 Jan 2022 22:30:13 +0000 (23:30 +0100)
commit2b4b23626ef2a5b49303065bee063c8e926b650c
tree8fbe7d875fbdaf8fcd909f15b230728c8c8b5baa
parent2b773be6ca8017ce287a2c007abb7d76e5802baf
netfilter: conntrack: convert to refcount_t api

Convert nf_conn reference counting from atomic_t to refcount_t based api.
refcount_t api provides more runtime sanity checks and will warn on
certain constructs, e.g. refcount_inc() on a zero reference count, which
usually indicates use-after-free.

For this reason template allocation is changed to init the refcount to
1, the subsequenct add operations are removed.

Likewise, init_conntrack() is changed to set the initial refcount to 1
instead refcount_inc().

This is safe because the new entry is not (yet) visible to other cpus.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter/nf_conntrack_common.h
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_standalone.c
net/netfilter/nf_flow_table_core.c
net/netfilter/nf_synproxy_core.c
net/netfilter/nft_ct.c
net/netfilter/xt_CT.c
net/openvswitch/conntrack.c
net/sched/act_ct.c