diff mbox series

[v2,bpf-next] libbpf: Close fd in bpf_object__reuse_map

Message ID 20220319030533.3132250-1-hengqi.chen@gmail.com (mailing list archive)
State Accepted
Commit d0f325c34c2fbe15f6774f2b628224280b571ae9
Delegated to: BPF
Headers show
Series [v2,bpf-next] libbpf: Close fd in bpf_object__reuse_map | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 9 maintainers not CCed: daniel@iogearbox.net ast@kernel.org netdev@vger.kernel.org songliubraving@fb.com andrii@kernel.org yhs@fb.com john.fastabend@gmail.com kafai@fb.com kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary

Commit Message

Hengqi Chen March 19, 2022, 3:05 a.m. UTC
pin_fd is dup-ed and assigned in bpf_map__reuse_fd. Close it
in bpf_object__reuse_map after reuse.

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.25.1

Comments

patchwork-bot+netdevbpf@kernel.org March 21, 2022, 3:20 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Sat, 19 Mar 2022 11:05:33 +0800 you wrote:
> pin_fd is dup-ed and assigned in bpf_map__reuse_fd. Close it
> in bpf_object__reuse_map after reuse.
> 
> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next] libbpf: Close fd in bpf_object__reuse_map
    https://git.kernel.org/bpf/bpf-next/c/d0f325c34c2f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 43161fdd44bb..843389c24dd1 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -4800,8 +4800,8 @@  bpf_object__reuse_map(struct bpf_map *map)
 	}

 	err = bpf_map__reuse_fd(map, pin_fd);
+	close(pin_fd);
 	if (err) {
-		close(pin_fd);
 		return err;
 	}
 	map->pinned = true;