]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Deref map in BPF_PROG_BIND_MAP when it's already used
authorStanislav Fomichev <sdf@google.com>
Sat, 3 Oct 2020 00:25:44 +0000 (17:25 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 3 Oct 2020 02:21:25 +0000 (19:21 -0700)
commit50e26bf6464b84b79deb20bdc6860cc8bf0d73f5
tree3515e99b6d9dafa966d02e423f092d6379d7998f
parentf167f1a8816b1b671b4ef3acd2de636ff709a042
bpf: Deref map in BPF_PROG_BIND_MAP when it's already used

We are missing a deref for the case when we are doing BPF_PROG_BIND_MAP
on a map that's being already held by the program.
There is 'if (ret) bpf_map_put(map)' below which doesn't trigger
because we don't consider this an error.
Let's add missing bpf_map_put() for this specific condition.

Fixes: 198684d0372c ("bpf: Add BPF_PROG_BIND_MAP syscall")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20201003002544.3601440-1-sdf@google.com
kernel/bpf/syscall.c