twx-linux/tools
Sewon Nam c487fcc632 bpf: bpftool: Setting error code in do_loader()
[ Upstream commit 02a4694107b4c830d4bd6d194e98b3ac0bc86f29 ]

We are missing setting error code in do_loader() when
bpf_object__open_file() fails. This means the command's exit status code
will be successful, even though the operation failed. So make sure to
return the correct error code. To maintain consistency with other
locations where bpf_object__open_file() is called, return -1.

  [0] Closes: https://github.com/libbpf/bpftool/issues/156

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Sewon Nam <swnam0729@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Quentin Monnet <qmo@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/d3b5b4b4-19bb-4619-b4dd-86c958c4a367@stanley.mountain/t/#u
Link: https://lore.kernel.org/bpf/20250311031238.14865-1-swnam0729@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-05-02 07:50:53 +02:00
..
accounting
arch tools/x86/kcpuid: Protect against faulty "max subleaf" values 2024-10-10 11:57:29 +02:00
bootconfig tools/bootconfig: Fix the wrong format specifier 2025-02-08 09:52:28 +01:00
bpf bpf: bpftool: Setting error code in do_loader() 2025-05-02 07:50:53 +02:00
build
certs
cgroup
counter
crypto/ccp
debugging
edid
firewire
firmware
gpio
hv tools: hv: change permissions of NetworkManager configuration file 2024-12-27 13:58:46 +01:00
iio tools/iio: Add memory allocation failure check for trigger_name 2024-10-17 15:24:20 +02:00
include memblock tests: fix implicit declaration of function 'numa_valid_node' 2025-01-17 13:36:14 +01:00
kvm/kvm_stat
laptop
leds
lib libbpf: Fix hypothetical STT_SECTION extern NULL deref case 2025-04-10 14:37:30 +02:00
memory-model tools/memory-model: Fix bug in lock.cat 2024-08-03 08:54:21 +02:00
mm tools/mm: fix compile error 2024-11-22 15:38:33 +01:00
net/ynl tools: ynl: don't ignore errors in NLMSG_DONE messages 2024-05-02 16:32:36 +02:00
objtool objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret() 2025-04-25 10:45:05 +02:00
pci
pcmcia
perf perf tools: annotate asm_pure_loop.S 2025-04-10 14:37:35 +02:00
power pm: cpupower: bench: Prevent NULL dereference on malloc failure 2025-04-25 10:45:10 +02:00
rcu
scripts tools: Override makefile ARCH variable if defined, but empty 2024-12-14 19:59:49 +01:00
spi
testing landlock: Add the errata interface 2025-04-25 10:45:57 +02:00
thermal
time
tracing rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads 2025-03-07 16:45:49 +01:00
usb usbip: tools: Fix detach_port() invalid port error path 2024-11-08 16:28:22 +01:00
verification verification/dot2: Improve dot parser robustness 2024-12-14 20:00:13 +01:00
virtio
wmi
workqueue
Makefile