Skip to content

Commit

Permalink
netfilter: conntrack: re-fetch conntrack after insertion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Westphal authored and gregkh committed Jun 6, 2022
1 parent c0aff1f commit 91a36ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/net/netfilter/nf_conntrack_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
int ret = NF_ACCEPT;

if (ct) {
if (!nf_ct_is_confirmed(ct))
if (!nf_ct_is_confirmed(ct)) {
ret = __nf_conntrack_confirm(skb);

if (ret == NF_ACCEPT)
ct = (struct nf_conn *)skb_nfct(skb);
}

if (likely(ret == NF_ACCEPT))
nf_ct_deliver_cached_events(ct);
}
Expand Down

0 comments on commit 91a36ec

Please sign in to comment.