linux-stable/tools/lib
lic121 08ab406781 libbpf: Unmap rings when umem deleted
[ Upstream commit 9c6e6a80ee ]

xsk_umem__create() does mmap for fill/comp rings, but xsk_umem__delete()
doesn't do the unmap. This works fine for regular cases, because
xsk_socket__delete() does unmap for the rings. But for the case that
xsk_socket__create_shared() fails, umem rings are not unmapped.

fill_save/comp_save are checked to determine if rings have already be
unmapped by xsk. If fill_save and comp_save are NULL, it means that the
rings have already been used by xsk. Then they are supposed to be
unmapped by xsk_socket__delete(). Otherwise, xsk_umem__delete() does the
unmap.

Fixes: 2f6324a393 ("libbpf: Support shared umems between queues and devices")
Signed-off-by: Cheng Li <lic121@chinatelecom.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220301132623.GA19995@vscode.7~
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:40:20 +02:00
..
api libperf: Avoid counting of nonfilterable fdarray fds 2020-07-21 09:53:22 -03:00
bpf libbpf: Unmap rings when umem deleted 2022-04-08 14:40:20 +02:00
lockdep .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
perf libperf tests: Fix test_stat_cpu 2021-10-27 09:56:55 +02:00
subcmd libsubcmd: Fix use-after-free for realloc(..., 0) 2022-02-23 12:01:02 +01:00
symbol libsymbols kallsyms: Move hex2u64 out of header 2020-05-05 16:35:32 -03:00
traceevent tools lib traceevent: Hide non API functions 2020-10-13 11:47:38 -03:00
argv_split.c tools lib: Move argv_{split,free} from tools/perf/util/ 2019-07-01 22:50:40 -03:00
bitmap.c tools bitmap: Implement bitmap_equal() operation at bitmap API 2020-01-06 11:46:04 -03:00
ctype.c tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
find_bit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hweight.c
rbtree.c tools/: replace HTTP links with HTTPS ones 2020-08-07 11:33:21 -07:00
str_error_r.c objtool, perf: Fix GCC 8 -Wrestrict error 2018-03-19 13:51:54 -03:00
string.c tools lib: Adopt memchr_inv() from kernel 2021-09-26 14:08:57 +02:00
vsprintf.c perf script: Pad DSO name for --call-trace 2019-05-28 18:37:44 -03:00
zalloc.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00