From patchwork Wed Oct 26 16:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11327 Return-Path: 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 + 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 ); 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 ) id 1onjAz-0006uI-DF; Wed, 26 Oct 2022 18:22:45 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , 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 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: 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?= 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 Reviewed-by: Andrew Halaney Reviewed-by: Dmitry Baryshkov --- 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 */