]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 16 Sep 2020 09:15:01 +0000 (05:15 -0400)
BugLink: https://bugs.launchpad.net/bugs/1895174
[ 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 <alaa@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/sched/act_ct.c

index e0060aefbf9d8d1df5ad57e7e2c828e80985af89..e32c4732ddf831669413a95810a9ec0604aa164d 100644 (file)
@@ -186,7 +186,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb,
                memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
                err = nf_ct_frag6_gather(net, skb, user);
                if (err && err != -EINPROGRESS)
-                       goto out_free;
+                       return err;
 #else
                err = -EOPNOTSUPP;
                goto out_free;