Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool: Fix SEGFAULT

find_insn() will return NULL in case of failure. Check insn in order
to avoid a kernel Oops for NULL pointer dereference.

Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221114175754.1131267-9-sv@linux.ibm.com

authored by

Christophe Leroy and committed by
Michael Ellerman
efb11fdb d0160bd5

+1 -1
+1 -1
tools/objtool/check.c
··· 207 207 return false; 208 208 209 209 insn = find_insn(file, func->sec, func->offset); 210 - if (!insn->func) 210 + if (!insn || !insn->func) 211 211 return false; 212 212 213 213 func_for_each_insn(file, func, insn) {