Skip to content

Commit

Permalink
bpf: Reject replace_bpf_fd in bpf_prog_detach
Browse files Browse the repository at this point in the history
The replace_bpf_fd is not used upon bpf_prog_detach(), therefore reject any
non-zero value.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
lmb authored and borkmann committed Oct 5, 2023
1 parent 25db9f9 commit 6bd059b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/bpf/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -3871,6 +3871,8 @@ static int bpf_prog_detach(const union bpf_attr *attr)

if (CHECK_ATTR(BPF_PROG_DETACH))
return -EINVAL;
if (attr->replace_bpf_fd)
return -EINVAL;

ptype = attach_type_to_prog_type(attr->attach_type);
if (bpf_mprog_supported(ptype)) {
Expand Down

0 comments on commit 6bd059b

Please sign in to comment.