Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1005377rwi; Wed, 26 Oct 2022 09:37:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V9yswxcnB7wa9kV+Hzyy9i8gzbLh6l+VDSc1UoF0JDdCroQsNSzNdK5E9zs/jYR5/FhHf X-Received: by 2002:a65:6bd3:0:b0:42b:9117:b9d1 with SMTP id e19-20020a656bd3000000b0042b9117b9d1mr37938718pgw.238.1666802273355; Wed, 26 Oct 2022 09:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666802273; cv=none; d=google.com; s=arc-20160816; b=BdRuj1XA8ziONko81lCZcCWD0mewkmt1EqUYITDemkog/jGiiXaNkEc0xaXvZclTMR POZQqoREa8iMabdEfeE4xRwzpR6KzRJUcvAaCaAtNIwBavQ3w6RYxKC9ZZ5Lc6UzOMyU jWT4ycpF+5eLPaISZdThglANuQiAey25gaFotf8vgp8UVWbEY4+ARB1HvQCWNOlzwFnz Jx2sWdig+UKh5c9MtjflwKIg2CDU66uLByFFV1mewPrdAk1iNeZmubAHCC+orbnsQt+B 53dead9ZtYm8Rqf5Mq+/5Nmw89en2adLetLPiu2nkgBTt4H+HBXb6N5H95n2z5ITOVK5 Pwzg== 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 Return-Path: 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.40; Wed, 26 Oct 2022 09:37:53 -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 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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