]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: Add missing XDP_ABORTED handling in cpumap
authorAnand Kumar Shaw <anandkrshawheritage@gmail.com>
Wed, 18 Feb 2026 04:29:24 +0000 (09:59 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 3 Mar 2026 16:37:21 +0000 (08:37 -0800)
cpu_map_bpf_prog_run_xdp() handles XDP_PASS, XDP_REDIRECT, and
XDP_DROP but is missing an XDP_ABORTED case. Without it, XDP_ABORTED
falls into the default case which logs a misleading "invalid XDP
action" warning instead of tracing the abort via trace_xdp_exception().

Add the missing XDP_ABORTED case with trace_xdp_exception(), matching
the handling already present in the skb path (cpu_map_bpf_prog_run_skb),
devmap (dev_map_bpf_prog_run), and the generic XDP path (do_xdp_generic).

Also pass xdpf->dev_rx instead of NULL to bpf_warn_invalid_xdp_action()
in the default case, so the warning includes the actual device name.
This aligns with the generic XDP path in net/core/dev.c which already
passes the real device.

Signed-off-by: Anand Kumar Shaw <anandkrshawheritage@gmail.com>
Link: https://lore.kernel.org/r/20260218042924.42931-1-anandkrshawheritage@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/cpumap.c

index 32b43cb9061bb096da761379367a9cc768e37ad3..5e59ab896f058f67324f41a6e625970df9a13929 100644 (file)
@@ -223,7 +223,10 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
                        }
                        break;
                default:
-                       bpf_warn_invalid_xdp_action(NULL, rcpu->prog, act);
+                       bpf_warn_invalid_xdp_action(xdpf->dev_rx, rcpu->prog, act);
+                       fallthrough;
+               case XDP_ABORTED:
+                       trace_xdp_exception(xdpf->dev_rx, rcpu->prog, act);
                        fallthrough;
                case XDP_DROP:
                        xdp_return_frame(xdpf);