[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241115114507.1322910-1-amiremohamadi@yahoo.com>
Date: Fri, 15 Nov 2024 15:15:07 +0330
From: Amir Mohammadi <amirmohammadi1999.am@...il.com>
To: qmo@...nel.org,
ast@...nel.org,
daniel@...earbox.net,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Amir Mohammadi <amiremohamadi@...oo.com>
Subject: [PATCH] bpftool: fix potential NULL pointer dereferencing in prog_dump()
A NULL pointer dereference could occur if ksyms
is not properly checked before usage in the prog_dump() function.
Signed-off-by: Amir Mohammadi <amiremohamadi@...oo.com>
---
tools/bpf/bpftool/prog.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 2ff949ea8..8b5300103 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -822,11 +822,12 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
printf("%s:\n", sym_name);
}
- if (disasm_print_insn(img, lens[i], opcodes,
- name, disasm_opt, btf,
- prog_linfo, ksyms[i], i,
- linum))
- goto exit_free;
+ if (ksyms)
+ if (disasm_print_insn(img, lens[i], opcodes,
+ name, disasm_opt, btf,
+ prog_linfo, ksyms[i], i,
+ linum))
+ goto exit_free;
img += lens[i];
--
2.42.0
Powered by blists - more mailing lists