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 E2B386FBB for ; Tue, 10 Jan 2023 18:24:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6163CC433D2; Tue, 10 Jan 2023 18:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673375041; bh=nkNY/YWi3BOdsEN6IBFEr4lJ+T5eCmX4rClZNjm0SkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T+PKxXU3uWNbHVXHNDoOl+zPMaJfc3twA2TkcVDlvo+NFk0wtZe6XszJNNP54jtnL 5usHtRv/c6ag+bfqLdEu5qvy5uu0P1DT+GgaeIpGaaRHsrZ44hGW8x5BHgpC2sOzbB pqqapWxE/fEUb/l9PuhicP+vbGB+zr1CFv5tYdlk= 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 5.15 031/290] objtool: Fix SEGFAULT Date: Tue, 10 Jan 2023 19:02:03 +0100 Message-Id: <20230110180032.660713488@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110180031.620810905@linuxfoundation.org> References: <20230110180031.620810905@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 edac5aaa2802..308c8806ad94 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -197,7 +197,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