summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/net/bpf_dbg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/net/bpf_dbg.c b/tools/net/bpf_dbg.c
index 0fdcb707a2e7..65dc757f7f7b 100644
--- a/tools/net/bpf_dbg.c
+++ b/tools/net/bpf_dbg.c
@@ -512,11 +512,11 @@ static bool bpf_runnable(struct sock_filter *f, unsigned int len)
return false;
}
ret = setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &bpf, sizeof(bpf));
+ close(sock);
if (ret < 0) {
rl_printf("program not allowed to run by kernel!\n");
return false;
}
- close(sock);
for (i = 0; i < len; i++) {
if (BPF_CLASS(f[i].code) == BPF_LD &&
f[i].k > SKF_AD_OFF) {