From patchwork Mon Nov 14 08:13:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2029097wru; Mon, 14 Nov 2022 00:19:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xeuHXLgB+DEudneyAJGqr8EVwEAIKD+iteRJEDMw4nhvwRbU7g4CxhBCcHpqzDYVupRNj X-Received: by 2002:a17:907:88cc:b0:7ae:d58e:3a4a with SMTP id rq12-20020a17090788cc00b007aed58e3a4amr8415710ejc.332.1668413940502; Mon, 14 Nov 2022 00:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413940; cv=none; d=google.com; s=arc-20160816; b=tFVa1qj8qgUGbMxWOc9Q7EPgYZRJ/4zqLPho0Xd0eph0bsH8CI9C7CARu4086G8Uez cjuxTYh6XaazIMI6S5a7RMtuRN/47shUReUzuhVxAq302r/qxYqARBVWqDaBpNiiVvrI NS9DlEzYMzQ048SA3jqz/0ixx8NuSmV7Ut5dej1Eb9h/5ffXUgqk8y6XGCHEctT8ffvG GzZl03JKSL/PZDDWVaP3iVnAsd5giPzupNJ+eFr2w6TOup21skZUqZs7MUUh2tpmzuZN HpObG148ZExK6029FQeOJ9/L3bWOUvMXMJIxronGmgaOWc9YNk1vDhnUn0rb9Snm033m jAYQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jpzyL3PrpJ2DlPgoCe7jkffmCzZ18s2i09n1NUMFGlw=; b=t10X7CSKYTgoWq6lcObRJJ6gcGDrmou/WTf2Z1h8SWW57+wvD82EgW5xR2dvk1CEJk CGAagpzNgs7ucl0IZoclR9qkYp30rZLabuxNt0+qrFiP01qWjNmfKVnXJBKglwERjL1L O1iPHGkL/ycwAM3fOcVHdM2g5RyWjfMZsHOoqFdwYOEP7WKNwaweFSjeT8mFczPGV/Uw Z2ZmXkleqPt/f0EdVpwkWwuipnmG0x4t7jVKO0pM32CssTt7l2XmVZNJlCHgYvkMdAMm 4oIjXa4cx91pZ1lZf1QC3bYqpKmrh8jApgcqv0MXD5IlvMe7lmFxtzXCDX1wf4k0oVp2 6ndg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NYZ7QyZy; 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 dz10-20020a0564021d4a00b004635dccd3casi9367110edb.57.2022.11.14.00.18.36; Mon, 14 Nov 2022 00:19:00 -0800 (PST) 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=NYZ7QyZy; 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 S236293AbiKNIOk (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236257AbiKNIOc (ORCPT ); Mon, 14 Nov 2022 03:14:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFCE19298; Mon, 14 Nov 2022 00:14:31 -0800 (PST) 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 5C49FB80D3A; Mon, 14 Nov 2022 08:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2967C433C1; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=7DSO9Gw0gcP3qm2ojYnCecGJVIZo7r1rdwoBiR4mUlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYZ7QyZynJDa3KOfDTKvV0O41UPk+gMW0rphp7pSC2N3OMEq1GlWYBRhVkA61rRGH e5M1CA8+MzsTgK8LjmK9riGUP0EnGqpKUOrlG/Dp1URt4Q552UiSRVfZW0K8/IE4qS Z+UueWeqRkWI4S9PUlEWRoIPmiN1z2X1lZj1fG8T4uTgtvFynx02IewAh44U8GuJN/ DEmb4NNMKPko1BmUv84RvJ7kJlCMjH0iPV9AJOZFwgBcXfNelr0rTR2Ad6HnY8UHCA yIP4rvNXJv1pVQWbtZqQ3u+TWitvvjW1sDaKP4glf9LllRh/XR1UMmw0uaNlgLdGMw UfvgOhDbmIN7w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbM-0001Ky-LB; Mon, 14 Nov 2022 09:13:56 +0100 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 v2 1/6] phy: qcom-qmp-combo: fix out-of-bounds clock access Date: Mon, 14 Nov 2022 09:13:41 +0100 Message-Id: <20221114081346.5116-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 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?1749458816244751481?= X-GMAIL-MSGID: =?utf-8?q?1749458816244751481?= The SM8250 only uses three clocks but the DP configuration erroneously described four clocks. In case the DP part of the PHY is initialised before the USB part, this would lead to uninitialised memory beyond the bulk-clocks array to be treated as a clock pointer as the clocks are requested based on the USB configuration. Fixes: aff188feb5e1 ("phy: qcom-qmp: add support for sm8250-usb3-dp phy") Cc: stable@vger.kernel.org # 5.13 Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 5e11b6a1d189..bb38b18258ca 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -1270,8 +1270,8 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v4_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), + .clk_list = qmp_v4_sm8250_usbphy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), .reset_list = msm8996_usb3phy_reset_l, .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), .vreg_list = qmp_phy_vreg_l,