From: Alaa Hleihel Date: Wed, 19 Aug 2020 15:24:10 +0000 (+0300) Subject: net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow X-Git-Tag: v5.8.5~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c1fc05e5d6ab0af2c481721d6f2ca53d53c44ec;p=thirdparty%2Fkernel%2Fstable.git net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow [ Upstream commit eda814b97dfb8d9f4808eb2f65af9bd3705c4cae ] tcf_ct_handle_fragments() shouldn't free the skb when ip_defrag() call fails. Otherwise, we will cause a double-free bug. In such cases, just return the error to the caller. Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct") Signed-off-by: Alaa Hleihel Reviewed-by: Roi Dayan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 6ed1652d1e265..41d8440deaf14 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -704,7 +704,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, err = ip_defrag(net, skb, user); local_bh_enable(); if (err && err != -EINPROGRESS) - goto out_free; + return err; if (!err) *defrag = true;