Commit 71703ac
bpf, xdp: move offload check into dev_xdp_install()
bpf_xdp_link_update() calls dev_xdp_install() directly and bypasses
dev_xdp_attach(), so the offload check that lived in dev_xdp_attach()
does not apply. A user can create an XDP link in SKB or native mode
with a regular program and then replace it via BPF_LINK_UPDATE with an
offloaded program, whose bpf_func is bpf_prog_warn_on_exec(), tripping
the WARN on the first packet.
Move the check from dev_xdp_attach() into dev_xdp_install() so both
the attach path and the link update path are covered by a single check
at the actual install site.
Fixes: 026a4c2 ("bpf, xdp: Implement LINK_UPDATE for BPF XDP link")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>1 parent f3c1ada commit 71703ac
1 file changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10359 | 10359 | | |
10360 | 10360 | | |
10361 | 10361 | | |
| 10362 | + | |
| 10363 | + | |
| 10364 | + | |
| 10365 | + | |
| 10366 | + | |
10362 | 10367 | | |
10363 | 10368 | | |
10364 | 10369 | | |
| |||
10510 | 10515 | | |
10511 | 10516 | | |
10512 | 10517 | | |
10513 | | - | |
10514 | | - | |
10515 | | - | |
10516 | | - | |
10517 | 10518 | | |
10518 | 10519 | | |
10519 | 10520 | | |
| |||
0 commit comments