Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3704427rwl; Tue, 27 Dec 2022 13:40:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXuvrzsx1zN/v64iyWLYIGuZyLl3Xy2A9L44/aTnffjQbq6d85xd/gkPTfsygUF80a/UzlI+ X-Received: by 2002:a05:6402:241b:b0:45c:b772:5f41 with SMTP id t27-20020a056402241b00b0045cb7725f41mr22217574eda.6.1672177259349; Tue, 27 Dec 2022 13:40:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672177259; cv=none; d=google.com; s=arc-20160816; b=gMvFEqgWSnkpZllQcS71IpIP5YjE+N8nQPX9gINFDS7BYctkR07KCKI1vndmio6MN9 Q0vJHKxFOQRgo9MwneqMrmGK1JOcp5PeWw+dGyMJdQItTf6y1Vn7qyzevpp5aKv+oKD6 owzUYHIabMAC2Nai3PX4laoA1ZfWbK/+QBYfRToMtxCfVgwm56aVjzmgnEW09OV43dt5 xRPQTZ81/aUyUl1myU/EdJTWxkW21lOxyg3SSrLNPdjwGbxQ1+FqnTKicN5q/mUNWBkJ DvMIHPlKFdXWtN2yHeAdC7lxgOuIPmYLjDxAyzx7qAYRjs26VXdkLBAkCS+luh7/rWf9 RVKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xTRPmY8+P5Xpr9wY8eNGqM0ADWLa8xRbIyT/TvXMraw=; b=TY0dDMYON3W6qpHhAsadTzpdlWjvfY1zele/t5N8SHqYnPldIjYGR45FhteHFEU9Jw AexFe2LlqfhE5SoJTh56aLXzDBGOSTcspQoNvpRoisSyml1GMkrMwB1W6PLIjOMY5sly ImNz3m7UWHuKe2eWCxYVHLB5e11pOY/pD8m5CgoMfMN+RPG6yfAJuHUW3EoGdZaZO/mI PM0c8mpuBNkNyroky/M+v+BYcQNNu6Sc4ayvT4QAMNyVXo5CfqsowlLRbG2hUoRtr8nd M3cbwg1460vM1CDCLMAjbMn7P7AgqmbXRz5xFAyON86W2VO7ohZmzH9usjGVozAIjDhQ XssA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="m/2YnptK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg3-20020a1709072cc300b007c0f2185e37si10894024ejc.868.2022.12.27.13.40.43; Tue, 27 Dec 2022 13:40:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="m/2YnptK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232391AbiL0UlX (ORCPT + 66 others); Tue, 27 Dec 2022 15:41:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232744AbiL0Uj0 (ORCPT ); Tue, 27 Dec 2022 15:39:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36D0FCC0; Tue, 27 Dec 2022 12:35:18 -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 dfw.source.kernel.org (Postfix) with ESMTPS id F306A6123C; Tue, 27 Dec 2022 20:35:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AE7BC433F0; Tue, 27 Dec 2022 20:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672173316; bh=NGon96pG4Ksto5VuCo0CIA3vlpxsif3GHRvzH7/8CpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/2YnptK3mpihm1Z7jWY5l/J+FzpWec+TxEPkDyZk8iTsicFw42ORau1FbM2JDJo5 TEqWxa5FKd9z8CMN0ShVCLghmh/U2TJVUrve9OYvrm1peGfD00zmN28jkowH+Lafb5 l5XAJU2fdbzC14rl0vfV5/Oiu7rNU/Op22kuH+k/ooBOLz5zFMKheF42eQ/Qy/Rpr1 0vkIvBNkcwh7LpfvY6W3ZnZECAbPhVxrPcZM2xoew7magF8TmbUr7wvvEgu1xrS25f IcLTTBvw1gfRP2DmpdniIPVK27PnNfMt1M0qR3Pu0l8JhXQB3THwkOcYQuT3MpfuIC UjdfA4xV03SPA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe Leroy , "Naveen N . Rao" , Josh Poimboeuf , Peter Zijlstra , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 5.10 2/7] objtool: Fix SEGFAULT Date: Tue, 27 Dec 2022 15:35:05 -0500 Message-Id: <20221227203512.1214527-2-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221227203512.1214527-1-sashal@kernel.org> References: <20221227203512.1214527-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 ea80b29b9913..654ffb51e1dd 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