aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongjun Park <[email protected]>2024-07-26 06:40:49 +0900
committerDavid S. Miller <[email protected]>2024-07-29 10:55:15 +0100
commit9da49aa80d686582bc3a027112a30484c9be6b6e (patch)
tree6ac72bf26a011a6d42b1fbba48233bb86bba59d3
parent301927d2d2eb8e541357ba850bc7a1a74dbbd670 (diff)
tun: Add missing bpf_net_ctx_clear() in do_xdp_generic()
There are cases where do_xdp_generic returns bpf_net_context without clearing it. This causes various memory corruptions, so the missing bpf_net_ctx_clear must be added. Reported-by: [email protected] Fixes: fecef4cd42c6 ("tun: Assign missing bpf_net_context.") Signed-off-by: Jeongjun Park <[email protected]> Acked-by: Jason Wang <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Reported-by: [email protected] Reported-by: [email protected] Reported-by: [email protected] Reported-by: [email protected] Reported-by: [email protected] Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--net/core/dev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 6ea1d20676fb..751d9b70e6ad 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5150,6 +5150,7 @@ int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff **pskb)
bpf_net_ctx_clear(bpf_net_ctx);
return XDP_DROP;
}
+ bpf_net_ctx_clear(bpf_net_ctx);
}
return XDP_PASS;
out_redir: