Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4374495imw; Tue, 19 Jul 2022 05:35:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2tx8ik2DmBKC1VTUZ1Im+F9MFvq029/cawA0fxp5Q82jvNz9DQr/1/fLCHSkUEll8tqXB X-Received: by 2002:a05:6870:c227:b0:10b:f184:e12 with SMTP id z39-20020a056870c22700b0010bf1840e12mr17184600oae.199.1658234134085; Tue, 19 Jul 2022 05:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234134; cv=none; d=google.com; s=arc-20160816; b=d2BBohOEy2eiEA1izy9W+/OCH34GTPvUQMjQRMFAgewX+h9DmuLOjP9avWpUHwsDIf b7iIZUgCswdXj5DzjidJbT2EMxla7NnCzZuM+km4aVPsB9/Oi8M2+ErUYjZ6VIH7dEHA O0YELS5HpdfOZraLkzp9IQGB/nUf71WNnw7zn0K0zcF+7RrKmRNwz9PGFI2CDSRNCUzV TjXABZbxRVNCq6Q6LThNbmpMm6dSTC5dZkO2bIY2W5dOGgrJgcK0rAwFm7iZ5dbPCA1Q z5FGR2RZDJZWmQ3L4fcSn86jLLdN9AiNY7VUMu0H8CrGyygblyFv073UWcxZoqQFroGA ISZg== 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=3Lj0F//oh0u1d7GR68XhiAAhhtz/IvbcvXSwF6vQ044=; b=SRWpvC9bmR7pXtABw9ekp6KDwbi1ViV66NzuTwPwiUggkwwF7GoiAfu4hcnfIDKfr0 CbM3hIZghSGH3sE+lIUwgyihF2CI5oqBsFq/hgqgKBnbGZDM7kHbcBGN0yedpNYEBG8F QYiJ5a7WT8GJ4QmV7F2/58zXxqAnMAJryDIswxbFd2XcmOPfyWQjl5AdnLe0u02X2vIV rHR5MIQaiLOkyXeM8/qZzzD8x5tMghl07TjD+lTJR2LWnyLjs6RikiKz3F6+bB7H6WvQ zO2u1ZRqQjErLOpYv/ejiAtEHJ+1O/EqVeSg6u4P9eDtaew8d+KLZmrr5b//LBWbYYh5 PR1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VcussHJS; 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 n37-20020a05687055a500b0010c41e7bff1si11248114oao.212.2022.07.19.05.35.21; Tue, 19 Jul 2022 05:35:34 -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=VcussHJS; 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 S239806AbiGSMZz (ORCPT + 99 others); Tue, 19 Jul 2022 08:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240027AbiGSMY3 (ORCPT ); Tue, 19 Jul 2022 08:24:29 -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 15C0A61D55; Tue, 19 Jul 2022 05:09:20 -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 C8F13B81B81; Tue, 19 Jul 2022 12:08:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E394C341C6; Tue, 19 Jul 2022 12:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232533; bh=i8j8lN8pZ+HBk9c+r3zEGf+7yulVsOuUqHCIcEWp5X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VcussHJSiSg8BpJYjoeOxWCz6yFN1edrqduHXkVj67+3Nckua2t8BS66i88f9su4w N/1lAO9Vbney/ryMTny73zyOGmBB7ixmkNZdXv7mTSTH3WiccGgnwKlY/ozClCOM96 KkP2m7B8cmidSDX3SyApY0MEEMoHDKfOlFMqlwWE= 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.10 089/112] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Date: Tue, 19 Jul 2022 13:54:22 +0200 Message-Id: <20220719114635.320856805@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 9c65d560d48f..e792318c3894 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c @@ -235,11 +235,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