net: fix double-free in bpf_lwt_xmit_reroute
Subsystems (2)
PATCH 1/1 net: fix double-free in bpf_lwt_xmit_reroute
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 <[email protected]>
--- net/core/lwt_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/lwt_bpf.c +1 -1
@@ -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 ;
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
From: Peter Oskolkov <[email protected]>
Date: Sat, 23 Feb 2019 18:25:01 -0800
Quoted 5 lines
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 <[email protected]>
Applied.