diff options
| author | Alex Gartrell <[email protected]> | 2020-08-26 07:55:49 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2020-08-26 22:05:35 +0000 |
| commit | ef05afa66c59c2031a3798916ef3ff3778232129 (patch) | |
| tree | 19d3acfa474a5c0ad18f52ef0ac7279a2e63f7a6 /tools/lib/bpf/libbpf.c | |
| parent | Merge branch 'resolve_prog_type' (diff) | |
| download | kernel-ef05afa66c59c2031a3798916ef3ff3778232129.tar.gz kernel-ef05afa66c59c2031a3798916ef3ff3778232129.zip | |
libbpf: Fix unintentional success return code in bpf_object__load
There are code paths where EINVAL is returned directly without setting
errno. In that case, errno could be 0, which would mask the
failure. For example, if a careless programmer set log_level to 10000
out of laziness, they would have to spend a long time trying to figure
out why.
Fixes: 4f33ddb4e3e2 ("libbpf: Propagate EPERM to caller on program load")
Signed-off-by: Alex Gartrell <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
| -rw-r--r-- | tools/lib/bpf/libbpf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2e2523d8bb6d..8f9e7d281225 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -6067,7 +6067,7 @@ retry_load: free(log_buf); goto retry_load; } - ret = -errno; + ret = errno ? -errno : -LIBBPF_ERRNO__LOAD; cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg)); pr_warn("load bpf program failed: %s\n", cp); pr_perm_msg(ret); |
