]> git.itanic.dy.fi Git - linux-stable/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)
commit2e25c46c6eef4acb9156c1e2fb00e8330273288c
tree78824a8bfa2f9b87b812a527e303b83846880d4d
parent2b273d1fd18ebebdc5e99139f0c89b142d40ea9c
netfilter: nft_ct: fix use after free when attaching zone template

commit 34243b9ec856309339172b1507379074156947e8 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: 719774377622 ("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