lkml.org 
[lkml]   [2020]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH bpf] tools: bpftool: Add missing close before bpftool net attach exit
Date
progfd is created by prog_parse_fd(), before 'bpftool net attach' exit,
it should be closed.

Fixes: 04949ccc273e ("tools: bpftool: add net attach command to attach XDP on interface")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
tools/bpf/bpftool/net.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c
index 910e7bac6e9e..3e9b40e64fb0 100644
--- a/tools/bpf/bpftool/net.c
+++ b/tools/bpf/bpftool/net.c
@@ -600,12 +600,14 @@ static int do_attach(int argc, char **argv)
if (err < 0) {
p_err("interface %s attach failed: %s",
attach_type_strings[attach_type], strerror(-err));
+ close(progfd);
return err;
}

if (json_output)
jsonw_null(json_wtr);

+ close(progfd);
return 0;
}

--
2.17.1
\
 
 \ /
  Last update: 2022-09-17 16:09    [W:0.160 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site