]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap: Require attach_bpf_fd when detaching a program
authorLorenz Bauer <lmb@cloudflare.com>
Mon, 29 Jun 2020 09:56:28 +0000 (10:56 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 30 Jun 2020 17:46:39 +0000 (10:46 -0700)
commitf9b84cbb975f470dc5bba9a9b956850260e014e1
tree47c55a8dc2cb7703d467da1e43f35778c192097d
parentcdf362108a9c0c8baefa57c45fd5a56ef6306435
bpf: sockmap: Require attach_bpf_fd when detaching a program

The sockmap code currently ignores the value of attach_bpf_fd when
detaching a program. This is contrary to the usual behaviour of
checking that attach_bpf_fd represents the currently attached
program.

Ensure that attach_bpf_fd is indeed the currently attached
program. It turns out that all sockmap selftests already do this,
which indicates that this is unlikely to cause breakage.

Fixes: 38506f4bbc9d ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200629095630.7933-5-lmb@cloudflare.com
include/linux/bpf.h
include/linux/skmsg.h
kernel/bpf/syscall.c
net/core/sock_map.c