]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nft_ct: fix use after free when attaching zone template
authorFlorian Westphal <fw@strlen.de>
Sun, 23 Jan 2022 14:24:00 +0000 (15:24 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 26 Jan 2022 23:03:09 +0000 (00:03 +0100)
commitf7b66f5d52cd1f3d36758e7d032e4c0f5b0a6a17
tree40f32185e865c11fcb4b747f044d525db466f176
parente11b9becddbe2697997676e317d6481339ea2776
netfilter: nft_ct: fix use after free when attaching zone template

The conversion erroneously removed the refcount increment.
In case we can use the percpu template, we need to increment
the refcount, else it will be released when the skb gets freed.

In case the slowpath is taken, the new template already has a
refcount of 1.

Fixes: 5d04d48f904f ("netfilter: conntrack: convert to refcount_t api")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_ct.c