diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index e7c7b92ff37b3c8da680bbef486e735847ae79e0..52ba1b278c54589757e522b08238dbadede4cb70 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -1027,6 +1027,14 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, */ if (nf_conntrack_confirm(skb) != NF_ACCEPT) goto drop; + + /* The ct may be dropped if a clash has been resolved, + * so it's necessary to retrieve it from skb again to + * prevent UAF. + */ + ct = nf_ct_get(skb, &ctinfo); + if (!ct) + skip_add = true; } if (!skip_add)