bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next] libbpf: Close fd in bpf_object__reuse_map
@ 2022-03-19  3:05 Hengqi Chen
  2022-03-21 15:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Hengqi Chen @ 2022-03-19  3:05 UTC (permalink / raw)
  To: bpf; +Cc: hengqi.chen

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(-)

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;
--
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 bpf-next] libbpf: Close fd in bpf_object__reuse_map
  2022-03-19  3:05 [PATCH v2 bpf-next] libbpf: Close fd in bpf_object__reuse_map Hengqi Chen
@ 2022-03-21 15:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-21 15:20 UTC (permalink / raw)
  To: Hengqi Chen; +Cc: bpf

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-21 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19  3:05 [PATCH v2 bpf-next] libbpf: Close fd in bpf_object__reuse_map Hengqi Chen
2022-03-21 15:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).