summaryrefslogtreecommitdiff
path: root/tools/testing/radix-tree/iteration_check_2.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-08-21 12:10:54 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-08-24 21:03:07 -0700
commitb474959d5afda6e341a02c85f9595d85d39189ae (patch)
treeeb61755165d1e65bdd944d7b48239392c59e31d6 /tools/testing/radix-tree/iteration_check_2.c
parent99408c422d336db32bfab5cbebc10038a70cf7d2 (diff)
bpf: Fix a buffer out-of-bound access when filling raw_tp link_info
Commit f2e10bff16a0 ("bpf: Add support for BPF_OBJ_GET_INFO_BY_FD for bpf_link") added link query for raw_tp. One of fields in link_info is to fill a user buffer with tp_name. The Scurrent checking only declares "ulen && !ubuf" as invalid. So "!ulen && ubuf" will be valid. Later on, we do "copy_to_user(ubuf, tp_name, ulen - 1)" which may overwrite user memory incorrectly. This patch fixed the problem by disallowing "!ulen && ubuf" case as well. Fixes: f2e10bff16a0 ("bpf: Add support for BPF_OBJ_GET_INFO_BY_FD for bpf_link") Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200821191054.714731-1-yhs@fb.com
Diffstat (limited to 'tools/testing/radix-tree/iteration_check_2.c')
0 files changed, 0 insertions, 0 deletions