linux-stable/tools
Pu Lehui 6dcdd1b68b bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE
[ Upstream commit 34de8e6e0e ]

When using bpftool to pin {PROG, MAP, LINK} without FILE,
segmentation fault will occur. The reson is that the lack
of FILE will cause strlen to trigger NULL pointer dereference.
The corresponding stacktrace is shown below:

do_pin
  do_pin_any
    do_pin_fd
      mount_bpffs_for_pin
        strlen(name) <- NULL pointer dereference

Fix it by adding validation to the common process.

Fixes: 75a1e792c3 ("tools: bpftool: Allow all prog/map handles for pinning objects")
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20221102084034.3342995-1-pulehui@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-16 09:58:15 +01:00
..
accounting
arch x86/speculation: Add RSB VM Exit protections 2022-08-11 13:07:54 +02:00
bootconfig tools/bootconfig: Define memblock_free_ptr() to fix build error 2021-09-15 09:49:48 -07:00
bpf bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE 2022-11-16 09:58:15 +01:00
build tools build: Switch to new openssl API for test-libcrypto 2022-08-25 11:40:14 +02:00
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio tools: iio: iio_utils: fix digit calculation 2022-11-03 23:59:11 +09:00
include tools/nolibc/string: Fix memcmp() implementation 2022-11-10 18:15:38 +01:00
io_uring tools/io_uring/io_uring-cp: sync with liburing example 2021-08-13 08:58:11 -06:00
kvm/kvm_stat tools/kvm_stat: fix display of error when multiple processes are found 2022-08-11 13:07:51 +02:00
laptop
leds
lib selftests/xsk: Avoid use-after-free on ctx 2022-10-26 12:34:41 +02:00
memory-model
objtool objtool: Preserve special st_shndx indexes in elf_update_symbol 2022-10-26 12:34:37 +02:00
pci
pcmcia
perf perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics 2022-11-03 23:59:18 +09:00
power tools/power turbostat: fix ICX DRAM power numbers 2022-06-09 10:22:32 +02:00
rcu
scripts
spi
testing KVM: selftests: Fix number of pages for memory slot in memslot_modification_stress_test 2022-11-03 23:59:15 +09:00
thermal/tmon tools/thermal: Fix possible path truncations 2022-08-17 14:24:15 +02:00
time
tracing tools/latency-collector: Use correct size when writing queue_full_warning 2021-11-18 19:16:19 +01:00
usb usb: testusb: Fix for showing the connection speed 2021-09-14 10:31:41 +02:00
virtio tools/virtio: compile with -pthread 2022-05-25 09:57:25 +02:00
vm tools/vm/slabinfo: use alphabetic order when two values are equal 2022-08-25 11:40:13 +02:00
wmi
Makefile