original_kernel/tools/bpf/bpftool
Pu Lehui 34de8e6e0e bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE
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
2022-11-02 12:05:42 +01:00
..
Documentation
bash-completion
skeleton
.gitignore
Makefile
btf.c bpftool: Fix error message of strerror 2022-09-30 15:40:46 -07:00
btf_dumper.c
cfg.c
cfg.h
cgroup.c
common.c bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE 2022-11-02 12:05:42 +01:00
feature.c
gen.c bpftool: Fix error message of strerror 2022-09-30 15:40:46 -07:00
iter.c
jit_disasm.c
json_writer.c
json_writer.h
link.c bpftool: Show parameters of BPF task iterators. 2022-09-28 16:30:08 -07:00
main.c
main.h
map.c
map_perf_ring.c bpftool: Fix error message of strerror 2022-09-30 15:40:46 -07:00
net.c
netlink_dumper.c
netlink_dumper.h
perf.c
pids.c
prog.c
struct_ops.c
tracelog.c
xlated_dumper.c
xlated_dumper.h