Skip to content
Commit 781e6282 authored by Peng Sun's avatar Peng Sun Committed by Daniel Borkmann
Browse files

bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id()

In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero()
to increase the refcount, both map->refcnt and map->usercnt. Then, if
bpf_map_new_fd() fails, should handle map->usercnt too.

Fixes: bd5f5f4e

 ("bpf: Add BPF_MAP_GET_FD_BY_ID")
Signed-off-by: default avatarPeng Sun <sironhide0null@gmail.com>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 3da1ed7a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment