From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB73628EE for ; Mon, 2 Jan 2023 11:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 430ADC4339B; Mon, 2 Jan 2023 11:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672658977; bh=se7fISspv7/DRYCIc3rb5gevBJCZiocMrS0tBNu3TNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkz8/7Qj0YeJiYYZ7EaX49dPDrMWyb5pYCHevAx2TeCxLY8xzXE5yLAiCByp6/Mb+ 6wJCIqCGMvY+Apgdp3xDM75XY4IWhjCO/LoDER4nZrs5VGa004P9qZPUFMxV6cHWTU cq1NFBbIm1EzqhLByyAB3d0Qez7blRhHqeuTINws= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Naveen N. Rao" , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 39/74] objtool: Fix SEGFAULT Date: Mon, 2 Jan 2023 12:22:12 +0100 Message-Id: <20230102110553.760419272@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102110552.061937047@linuxfoundation.org> References: <20230102110552.061937047@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Christophe Leroy [ Upstream commit efb11fdb3e1a9f694fa12b70b21e69e55ec59c36 ] 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 Reviewed-by: Naveen N. Rao Acked-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20221114175754.1131267-9-sv@linux.ibm.com Signed-off-by: Sasha Levin --- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 67afdce3421f..274bc3d4bc3f 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -207,7 +207,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, return false; insn = find_insn(file, func->sec, func->offset); - if (!insn->func) + if (!insn || !insn->func) return false; func_for_each_insn(file, func, insn) { -- 2.35.1