diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2024-03-05 22:31:32 +0100 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2024-03-06 01:48:53 +0100 |
commit | 2487007aa3b9fafbd2cb14068f49791ce1d7ede5 (patch) | |
tree | b3ecf09e17cc47833c8e8a196655e3924bbd911c /kernel/bpf/cpumap.c | |
parent | selftests/bpf: Fix up xdp bonding test wrt feature flags (diff) | |
download | linux-2487007aa3b9fafbd2cb14068f49791ce1d7ede5.tar.xz linux-2487007aa3b9fafbd2cb14068f49791ce1d7ede5.zip |
cpumap: Zero-initialise xdp_rxq_info struct before running XDP program
When running an XDP program that is attached to a cpumap entry, we don't
initialise the xdp_rxq_info data structure being used in the xdp_buff
that backs the XDP program invocation. Tobias noticed that this leads to
random values being returned as the xdp_md->rx_queue_index value for XDP
programs running in a cpumap.
This means we're basically returning the contents of the uninitialised
memory, which is bad. Fix this by zero-initialising the rxq data
structure before running the XDP program.
Fixes: 9216477449f3 ("bpf: cpumap: Add the possibility to attach an eBPF program to cpumap")
Reported-by: Tobias Böhm <tobias@aibor.de>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20240305213132.11955-1-toke@redhat.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | kernel/bpf/cpumap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index 8a0bb80fe48a..ef82ffc90cbe 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -178,7 +178,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu, void **frames, int n, struct xdp_cpumap_stats *stats) { - struct xdp_rxq_info rxq; + struct xdp_rxq_info rxq = {}; struct xdp_buff xdp; int i, nframes = 0; |