]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: add test for xdp_master_redirect with bond not up
authorJiayuan Chen <jiayuan.chen@linux.dev>
Sat, 11 Apr 2026 00:55:20 +0000 (08:55 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 14 Apr 2026 08:39:24 +0000 (10:39 +0200)
commit8dd1bdde38af8418889ba322a3663c401a60fe28
tree9378284c85b231f988619ec4a25a0ddfb8522821
parent1921f91298d1388a0bb9db8f83800c998b649cb3
selftests/bpf: add test for xdp_master_redirect with bond not up

Add a selftest that reproduces the null-ptr-deref in
bond_rr_gen_slave_id() when XDP redirect targets a bond device in
round-robin mode that was never brought up. The test verifies the fix
by ensuring no crash occurs.

Test setup:
- bond0: active-backup mode, UP, with native XDP (enables
  bpf_master_redirect_enabled_key globally)
- bond1: round-robin mode, never UP
- veth1: slave of bond1, with generic XDP (XDP_TX)
- BPF_PROG_TEST_RUN with live frames triggers the redirect path

Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20260411005524.201200-3-jiayuan.chen@linux.dev
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c