Skip to content

Commit 91a36ec

Browse files
Florian Westphalgregkh
authored andcommitted
netfilter: conntrack: re-fetch conntrack after insertion
commit 56b14ec upstream. In case the conntrack is clashing, insertion can free skb->_nfct and set skb->_nfct to the already-confirmed entry. This wasn't found before because the conntrack entry and the extension space used to free'd after an rcu grace period, plus the race needs events enabled to trigger. Reported-by: <syzbot+793a590957d9c1b96620@syzkaller.appspotmail.com> Fixes: 71d8c47 ("netfilter: conntrack: introduce clash resolution on insertion race") Fixes: 2ad9d77 ("netfilter: conntrack: free extension area immediately") 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>
1 parent c0aff1f commit 91a36ec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include/net/netfilter/nf_conntrack_core.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
5959
int ret = NF_ACCEPT;
6060

6161
if (ct) {
62-
if (!nf_ct_is_confirmed(ct))
62+
if (!nf_ct_is_confirmed(ct)) {
6363
ret = __nf_conntrack_confirm(skb);
64+
65+
if (ret == NF_ACCEPT)
66+
ct = (struct nf_conn *)skb_nfct(skb);
67+
}
68+
6469
if (likely(ret == NF_ACCEPT))
6570
nf_ct_deliver_cached_events(ct);
6671
}

0 commit comments

Comments
 (0)