netfilter: flowtable: prefer refcount_inc
authorFlorian Westphal <fw@strlen.de>
Thu, 7 Jul 2022 19:30:56 +0000 (21:30 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 20 Jul 2022 22:55:39 +0000 (00:55 +0200)
commitf02e7dc4cff80ee882dbc6e207e054f841e4c2e1
tree7a0230e3e7290b04d7cc41b0acf49a4ffb34d7a5
parent5787db7c905323cb303a7c39d15fb2067e948adf
netfilter: flowtable: prefer refcount_inc

With refcount_inc_not_zero, we'd also need a smp_rmb or similar,
followed by a test of the CONFIRMED bit.

However, the ct pointer is taken from skb->_nfct, its refcount must
not be 0 (else, we'd already have a use-after-free bug).

Use refcount_inc() instead to clarify the ct refcount is expected to
be at least 1.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_flow_table_core.c