Skip to content

Commit 9da49aa

Browse files
name2965davem330
authored andcommitted
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: fecef4c ("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]>
1 parent 301927d commit 9da49aa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/core/dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5150,6 +5150,7 @@ int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff **pskb)
51505150
bpf_net_ctx_clear(bpf_net_ctx);
51515151
return XDP_DROP;
51525152
}
5153+
bpf_net_ctx_clear(bpf_net_ctx);
51535154
}
51545155
return XDP_PASS;
51555156
out_redir:

0 commit comments

Comments
 (0)