linux-brain/kernel/bpf
Peng Sun ebf233fd40 bpf: drop refcount if bpf_map_new_fd() fails in map_create()
[ Upstream commit 352d20d611 ]

In bpf/syscall.c, map_create() first set map->usercnt to 1, a file
descriptor is supposed to return to userspace. When bpf_map_new_fd()
fails, drop the refcount.

Fixes: bd5f5f4ecb ("bpf: Add BPF_MAP_GET_FD_BY_ID")
Signed-off-by: Peng Sun <sironhide0null@gmail.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-05 15:38:00 +01:00
..
arraymap.c bpf: sockmap, map_release does not hold refcnt for pinned maps 2018-11-04 14:52:44 +01:00
bpf_lru_list.c bpf: lru: Lower the PERCPU_NR_SCANS from 16 to 4 2017-04-17 13:55:52 -04:00
bpf_lru_list.h bpf: Only set node->ref = 1 if it has not been set 2017-09-01 09:57:39 -07:00
cgroup.c bpf: BPF support for sock_ops 2017-07-01 16:15:13 -07:00
core.c bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K 2019-08-25 10:50:23 +02:00
devmap.c bpf: devmap: fix wrong interface selection in notifier_call 2019-12-01 09:13:47 +01:00
hashtab.c bpf, lru: avoid messing with eviction heuristics upon syscall lookup 2019-05-25 18:25:38 +02:00
helpers.c bpf: rename ARG_PTR_TO_STACK 2017-01-09 16:56:27 -05:00
inode.c bpf: fix use after free in bpf_evict_inode 2019-04-20 09:15:07 +02:00
lpm_trie.c bpf: fix rcu lockdep warning for lpm_trie map_free callback 2018-03-11 16:23:21 +01:00
Makefile bpf: silence warning messages in core 2019-07-31 07:28:25 +02:00
map_in_map.c bpf: fix inner map masking to prevent oob under speculation 2019-04-20 09:15:09 +02:00
map_in_map.h bpf: Add syscall lookup support for fd array and htab 2017-06-29 13:13:25 -04:00
percpu_freelist.c bpf: fix lockdep false positive in percpu_freelist 2019-03-13 14:03:20 -07:00
percpu_freelist.h bpf: fix lockdep false positive in percpu_freelist 2019-03-13 14:03:20 -07:00
sockmap.c bpf: sockmap, map_release does not hold refcnt for pinned maps 2018-11-04 14:52:44 +01:00
stackmap.c bpf: Allow selecting numa node during map creation 2017-08-19 21:35:43 -07:00
syscall.c bpf: drop refcount if bpf_map_new_fd() fails in map_create() 2019-12-05 15:38:00 +01:00
tnum.c bpf/verifier: track signed and unsigned min/max values 2017-08-08 17:51:34 -07:00
verifier.c bpf: fix sanitation rewrite in case of non-pointers 2019-04-20 09:15:09 +02:00