summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorYun Lu <luyun@kylinos.cn>2026-10-13 11:01:14 +0800
committerDaniel Borkmann <daniel@iogearbox.net>2026-10-15 18:41:04 +0200
commitd3c9ecb8765d4befbc46ee325c8d76efd523eece (patch)
tree30fc165b309bebe825b6999ee4c4bdfe3713fd7e /kernel
parent33cbc5c2cadfe3b43f024e89880dd8fe2efb3a2e (diff)
selftests/bpf: Fix map fd leak in no-BTF wq test
bpf_map__reuse_fd() duplicates the supplied file descriptor instead of taking ownership of it. test_failure_map_no_btf() closes the original map_fd only when reuse fails, leaking it when reuse succeeds, including when the test passes. Destroying the skeleton closes its own descriptor but leaves the original descriptor and its map reference alive. Close map_fd immediately after bpf_map__reuse_fd(), before checking its return value, to release the original descriptor on both success and failure. The skeleton retains its own descriptor for the subsequent program load. Fixes: bca2b74ea9a8 ("selftests/bpf: Add more bpf_wq tests") Reported-by: Jackie Liu <liuyun01@kylinos.cn> Signed-off-by: Yun Lu <luyun@kylinos.cn> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20261013030114.292157-1-luyun_611@163.com
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions