]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow
authorAlaa Hleihel <alaa@mellanox.com>
Wed, 19 Aug 2020 15:24:10 +0000 (18:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Aug 2020 23:39:31 +0000 (16:39 -0700)
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: 213cbf44d25b ("net/sched: Introduce action ct")
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_ct.c

index e6ad42b11835f8d35d2c96604c910985a5f44325..2c3619165680fd5abfcd73b353f8dd3f675fc0c3 100644 (file)
@@ -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;