]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: clear skb->next in NF_HOOK_LIST()
authorCong Wang <cong.wang@bytedance.com>
Sat, 21 Nov 2020 03:43:17 +0000 (19:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Dec 2020 07:48:07 +0000 (08:48 +0100)
commit5460d62d661c0fc53bfe83493821b1dc3dc969f4
tree1537d4f1aa33a943c5a57e533340a2444c72c508
parent98c9afedbfc11028c1e1b96bdb6a2401785f6941
netfilter: clear skb->next in NF_HOOK_LIST()

NF_HOOK_LIST() uses list_del() to remove skb from the linked list,
however, it is not sufficient as skb->next still points to other
skb. We should just call skb_list_del_init() to clear skb->next,
like the rest places which using skb list.

This has been fixed in upstream by commit ca58fbe06c54
("netfilter: add and use nf_hook_slow_list()").

Fixes: 9f17dbf04ddf ("netfilter: fix use-after-free in NF_HOOK_LIST")
Reported-by: liuzx@knownsec.com
Tested-by: liuzx@knownsec.com
Cc: Florian Westphal <fw@strlen.de>
Cc: Edward Cree <ecree@solarflare.com>
Cc: stable@vger.kernel.org # between 4.19 and 5.4
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/netfilter.h