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 2D21E79C9 for ; Thu, 12 Jan 2023 14:29:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88649C433EF; Thu, 12 Jan 2023 14:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673533749; bh=LuZn2RqzSXx3XOC4kUIZiZSn0tUE2XyN+LbOcrot9OI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fu57VfNoxY6wiyVfRb09ZbjnV3HCwC+LldVKPKYk42VUmSM4Yhzsapcg/octiQkCf A+03PSgMG2896lkXKrH7Sp/9orupAX+jqWtWr7enVDj8+uRtjXlskxQVRe1glbDTgU nUbt/2o/ZqgXj1Dx7rKqDIs2J3lwbl249+dQDC5M= 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.10 580/783] objtool: Fix SEGFAULT Date: Thu, 12 Jan 2023 14:54:56 +0100 Message-Id: <20230112135551.136276978@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112135524.143670746@linuxfoundation.org> References: <20230112135524.143670746@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 5d64b673da2d..700984e7f5ba 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -196,7 +196,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