diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index d77b2f8b93641b..057970edec5f1b 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -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)) {