Message ID | 20221026162116.26462-1-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp371225wru; Wed, 26 Oct 2022 09:37:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Vpxsu5yhvqvmMUtcxyRI1jrD/GtTwgb2O145TE66s4ew6jBYtmdyvb/ROhnzCGWfrQziD X-Received: by 2002:a05:6a00:acb:b0:555:ac02:433e with SMTP id c11-20020a056a000acb00b00555ac02433emr45242621pfl.3.1666802246825; Wed, 26 Oct 2022 09:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666802246; cv=none; d=google.com; s=arc-20160816; b=bWTRY3I/IUrA4QNyL2urkUbC1iIl3ojeMdPTsDB67jiQeZSewOapTRjN1piCPKVWqr NaAscvuK4iB522kTj8u9zHLF+hRrAwKRRHeWABK64Ic+EAy0uH55Rdw4jr+LAbW2B20q OMWGTAK1PFzShmgiAB6popDEENS3A0k+MSecerHgl3srEWsXKyoP1o8nxMXBoT9haljF CVJvoFE0LXDKmtMN/tkM8p1XdQ5oikRYOYdhYJGpqGOwrX2ioUmyuUxoNZrqemqt736/ mebs3bdOyO3V3YwRB8VLQpYROhnnJndjWKHMJHwXEoMg9JHGetoTHokBvQIYvPo9rUJH GGMQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=m8kQMFzIRqr6jrUqneSV6qPYb2nF1CKISw3fi0G+XR0=; b=F7qB34BP9RHkBRULtAD71Fv+3Carp2qkeHF8Xg8zqsYtDbEFjbYcrlK4R+FzSSbYoc 5QBHFuzDgZnhraGSP8NIqbsaPM+tpSwNlNgdxqntkJpWJ/2SI7UnUxSF0HSVWoBmrhH3 H+tcsQjRtCj1u1LxYkb3zP0CmbWhuFyfp1apk0JOtsuHdYJV9Osq51c90enTSXSZeDX2 yI2G6L2sJb0gsGn/LbonZp0gqxN1RI4F+3Jrz9NX8Xsmi4emGlBG4CevYuqoeXN5kli3 +QGcLXdE+7kdbQcW/3Oapkb1UBMQ+xkntHHNTmFpSKIUXQCXurX2jwSLEYLIn8+YyG/K qpKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SRvZW8S3; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w33-20020a634921000000b0046b0e168b1asi6642149pga.222.2022.10.26.09.37.13; Wed, 26 Oct 2022 09:37:26 -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=@kernel.org header.s=k20201202 header.b=SRvZW8S3; 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 S233244AbiJZQXF (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Wed, 26 Oct 2022 12:23:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbiJZQXD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 26 Oct 2022 12:23:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC5FA10EA27; Wed, 26 Oct 2022 09:23:02 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5477461F8A; Wed, 26 Oct 2022 16:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8F73C433D7; Wed, 26 Oct 2022 16:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666801381; bh=NoVmt4lw5dBehEnWuBhKo9Ma1EMADExTiZUi93ce3vQ=; h=From:To:Cc:Subject:Date:From; b=SRvZW8S3ytnUt5NLSB1BE547CW9CDCQyuLxToUfMqYCN5q09KoXQn48p6awu7QmoL NsRZU9+Epy1tIRPtOIBinq4F440RQ5KxYMR+WFj4U5QRkjp2w6YuAWlgzW9M0nF+h7 62eYv3oTWUtbRyHcft24m7SILOPH1P+Q3iNxIpLoXIIPPcgJvXgZoK0onnWE776W1z 4KL/ACSIxynSLN2Ky8+yFPMjQk4myP8qVtwtrjFDPfccdAlZG5u8sleSQTJh33ysWP OIJCZUJmPzWkynXZOAuvbVhUAB4MAmpguX0I9nmfvM0FSt6eAsjMlkcnJDnTJgJsoB 8LOEaZ00+smOg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from <johan+linaro@kernel.org>) id 1onjAz-0006uI-DF; Wed, 26 Oct 2022 18:22:45 +0200 From: Johan Hovold <johan+linaro@kernel.org> To: Vinod Koul <vkoul@kernel.org> Cc: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@somainline.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org>, stable@vger.kernel.org Subject: [PATCH] phy: qcom-qmp-combo: fix NULL-deref on runtime resume Date: Wed, 26 Oct 2022 18:21:16 +0200 Message-Id: <20221026162116.26462-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747768833104912622?= X-GMAIL-MSGID: =?utf-8?q?1747768833104912622?= |
Series |
phy: qcom-qmp-combo: fix NULL-deref on runtime resume
|
|
Commit Message
Johan Hovold
Oct. 26, 2022, 4:21 p.m. UTC
Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate
PCS_USB region") started treating the PCS_USB registers as potentially
separate from the PCS registers but used the wrong base when no PCS_USB
offset has been provided.
Fix the PCS_USB base used at runtime resume to prevent dereferencing a
NULL pointer on platforms that do not provide a PCS_USB offset (e.g.
SC7180).
Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")
Cc: stable@vger.kernel.org # 5.20
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Oct 26, 2022 at 06:21:16PM +0200, Johan Hovold wrote: > Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate > PCS_USB region") started treating the PCS_USB registers as potentially > separate from the PCS registers but used the wrong base when no PCS_USB > offset has been provided. > > Fix the PCS_USB base used at runtime resume to prevent dereferencing a > NULL pointer on platforms that do not provide a PCS_USB offset (e.g. > SC7180). > > Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") > Cc: stable@vger.kernel.org # 5.20 > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Andrew Halaney <ahalaney@redhat.com> For what it is worth, I double checked and phy-qcom-qmp-usb.c has this done properly already. Thanks, Andrew > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > index f6328434c61e..ad6a0fd7ba8e 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > @@ -2144,7 +2144,7 @@ static void qmp_combo_enable_autonomous_mode(struct qmp_phy *qphy) > static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy) > { > const struct qmp_phy_cfg *cfg = qphy->cfg; > - void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs_usb; > + void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; > void __iomem *pcs_misc = qphy->pcs_misc; > > /* Disable i/o clamp_n on resume for normal mode */ > -- > 2.37.3 >
On 26/10/2022 19:21, Johan Hovold wrote: > Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate > PCS_USB region") started treating the PCS_USB registers as potentially > separate from the PCS registers but used the wrong base when no PCS_USB > offset has been provided. > > Fix the PCS_USB base used at runtime resume to prevent dereferencing a > NULL pointer on platforms that do not provide a PCS_USB offset (e.g. > SC7180). > > Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") > Cc: stable@vger.kernel.org # 5.20 > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
On 26-10-22, 18:21, Johan Hovold wrote: > Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate > PCS_USB region") started treating the PCS_USB registers as potentially > separate from the PCS registers but used the wrong base when no PCS_USB > offset has been provided. > > Fix the PCS_USB base used at runtime resume to prevent dereferencing a > NULL pointer on platforms that do not provide a PCS_USB offset (e.g. > SC7180). Applied, thanks
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index f6328434c61e..ad6a0fd7ba8e 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -2144,7 +2144,7 @@ static void qmp_combo_enable_autonomous_mode(struct qmp_phy *qphy) static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy) { const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs_usb; + void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; void __iomem *pcs_misc = qphy->pcs_misc; /* Disable i/o clamp_n on resume for normal mode */