Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4448282imw; Tue, 19 Jul 2022 06:51:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tc7o3LDiNkgkPam7RAwhje2uIGAtDvKoQV7W1fLg6++Qhp89rYmp/Xc9BUpKkmR68oxwO2 X-Received: by 2002:a05:6402:1c92:b0:43b:a336:2377 with SMTP id cy18-20020a0564021c9200b0043ba3362377mr1689522edb.15.1658238671485; Tue, 19 Jul 2022 06:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238671; cv=none; d=google.com; s=arc-20160816; b=X2m+T+nmuxpVJ1CkIiobpYBDTTEmntfrciLAf5TCSaQ0YqtCksJS5CPhC5402I7wbm CdpZouLhpvPXDDBEga7nmh8/0vdx49g3cFT4cHsP68HQzaoklUDlkdju3aNQlSPJpslg EwkG6G/NuTcf9nUuskZSQyF48lhWrgPiL2Za+mpFvyllDCJe/UKqFnutvvtYhT99PrQN tsi+jo9Gdv/qE9lk8jELL/T54gOWrb2/d9o8r0f8kPjHLy8mHe1I971vqaNgM7erw/Ch u2FL5N0oucgZh9qyP4PdqVWEu+tqFKBQGnhRhy/zooJrAxL9LIRfGMviC+yqJYtrQvtx wK0Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gmYeuJJs4ignRivJtRAN2E/BvfQmj5aGRyiMgexDE8g=; b=aBdnwowU+WxXg/Y/JvoURLP06s4o6Z3w3vnjqatIaeuW0QA73XOn/pwk8qgaFLj/0Z 0AqiSUS0EUvLCOctmgewY1hUXvcqtuJ4OKPbxBJ2biK7WTCXwD1Iu4WBm/kFulqLpd39 QNr9bk9nVxrZLXKfMgVGZHnCJKlFjBQ+lRUzxHpd/MVTDCzX1LR7LG/EpkDJ+3uWuASP lkCs2ArMvDuCF91YRimwGu/W7ph6/7C+XNnGIFbACW07He4yoBzMKDF5X7mE6Ll5OP3Q HjGH8hUIEEZ25AGbaA14pGs4vKZFrit0VdFBJy14Y5bSEbDRtyuz1aN5dcunCzTruJ1H b/fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AZcpssql; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc15-20020a170907168f00b0072b592be479si22999160ejc.667.2022.07.19.06.50.47; Tue, 19 Jul 2022 06:51:11 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=AZcpssql; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238576AbiGSMmz (ORCPT + 99 others); Tue, 19 Jul 2022 08:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241266AbiGSMlp (ORCPT ); Tue, 19 Jul 2022 08:41:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD4C7E00C; Tue, 19 Jul 2022 05:16:23 -0700 (PDT) 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 5AC63B81B2E; Tue, 19 Jul 2022 12:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B47E0C341C6; Tue, 19 Jul 2022 12:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232979; bh=I/S6MXKj+pJExOorvIiThOlDOL37GW0RHtgnBej/vcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZcpssql5OSZoMR13WRaYkPCtQfDCgkvA25JPJJl3HC8l+o2J04Y8tUaOhQ9Z2CL0 5SIYglFqAZ6CSPo6FFJm4YrkkhKoMN6bWRg0UAca7Hs2sdWLNEalx40Y2gvD8ZSQnS AwK+W9220v1Eoer5ZQHios/2ctqhYeB6e6MiVXNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Linus Walleij , Sasha Levin Subject: [PATCH 5.15 132/167] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Date: Tue, 19 Jul 2022 13:54:24 +0200 Message-Id: <20220719114709.337233262@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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: Haowen Bai [ Upstream commit 84a85d3fef2e75b1fe9fc2af6f5267122555a1ed ] pdesc could be null but still dereference pdesc->name and it will lead to a null pointer access. So we move a null check before dereference. Signed-off-by: Haowen Bai Link: https://lore.kernel.org/r/1650508019-22554-1-git-send-email-baihaowen@meizu.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c index c94e24aadf92..83d47ff1cea8 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c @@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, const struct aspeed_sig_expr **funcs; const struct aspeed_sig_expr ***prios; - pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); - if (!pdesc) return -EINVAL; + pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name); + prios = pdesc->prios; if (!prios) -- 2.35.1