From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE1E1C5479D for ; Mon, 2 Jan 2023 11:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236141AbjABLaW (ORCPT ); Mon, 2 Jan 2023 06:30:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236144AbjABL37 (ORCPT ); Mon, 2 Jan 2023 06:29:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AF3D6353 for ; Mon, 2 Jan 2023 03:29:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D830EB80D15 for ; Mon, 2 Jan 2023 11:29:38 +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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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