]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Apr 2022 12:39:01 +0000 (14:39 +0200)
commit7d1497b6528fa8ea2e2d97b8aa9b2ae56182b61d
tree78824a8bfa2f9b87b812a527e303b83846880d4d
parentfdfd284d7fc356daedc152835c846810d94d790f
netfilter: nft_ct: fix use after free when attaching zone template

commit f7b66f5d52cd1f3d36758e7d032e4c0f5b0a6a17 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nft_ct.c