Re: [PATCH net] netkit: Assign missing bpf_net_context

From: Martin KaFai Lau
Date: Fri Sep 13 2024 - 13:24:36 EST


On 9/12/24 8:56 AM, Breno Leitao wrote:
During the introduction of struct bpf_net_context handling for
XDP-redirect, the netkit driver has been missed, which also requires it
because NETKIT_REDIRECT invokes skb_do_redirect() which is accessing the
per-CPU variables. Otherwise we see the following crash:

BUG: kernel NULL pointer dereference, address: 0000000000000038
bpf_redirect()
netkit_xmit()
dev_hard_start_xmit()

Set the bpf_net_context before invoking netkit_xmit() program within the
netkit driver.

Acked-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>