]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: fix double-free in bpf_lwt_xmit_reroute
authorPeter Oskolkov <posk@google.com>
Sun, 24 Feb 2019 02:25:01 +0000 (18:25 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Feb 2019 06:24:50 +0000 (22:24 -0800)
dst_output() frees skb when it fails (see, for example,
ip_finish_output2), so it must not be freed in this case.

Fixes: 3bd0b15281af ("bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c")
Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/lwt_bpf.c

index a5c8c79d468a3b7e142f73bb84899c37eb1441db..cf2f8897ca1945ad162f4c783e74c2698c5b8cc3 100644 (file)
@@ -260,7 +260,7 @@ static int bpf_lwt_xmit_reroute(struct sk_buff *skb)
 
        err = dst_output(dev_net(skb_dst(skb)->dev), skb->sk, skb);
        if (unlikely(err))
-               goto err;
+               return err;
 
        /* ip[6]_finish_output2 understand LWTUNNEL_XMIT_DONE */
        return LWTUNNEL_XMIT_DONE;