On Tue, Aug 04, 2020 at 09:47:47AM +0100, Lorenz Bauer wrote:
commit bb0de3131f4c60a9bf976681e0fe4d1e55c7a821 upstream.
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: 604326b41a6f ("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
The 5.4 tree needs a dedicated backport, since some headers have changed sufficiently to cause the patch to fail. bpf_prog_detach needs further massaging to pass the correct program type to sock_map_prog_detach. Please queue this patch together with commit f43cb0d672aa ("selftests: bpf: Fix detach from sockmap tests").
Thanks for the backport, now queued up.
greg k-h