Message ID | 20240229-freq-table-terminator-v1-1-074334f0905c@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-87233-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp584152dyb; Thu, 29 Feb 2024 10:09:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXUDzYTzpnMJrNg6Na0SS85Nq3Y7GJuanfD9VD7ywubShylrcofS/bPg4lB3czN8P4i7iOybWTxgAQM5AEZ51fh0Vvl9w== X-Google-Smtp-Source: AGHT+IEjrWSzLd+hygKBizJh6uAh9/39acJ2tH3h/9oSSocXER59mBq4CI/RQhZnn2kLbC2KSOT7 X-Received: by 2002:a17:903:228e:b0:1dc:7923:aa17 with SMTP id b14-20020a170903228e00b001dc7923aa17mr3549679plh.64.1709230142542; Thu, 29 Feb 2024 10:09:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709230142; cv=pass; d=google.com; s=arc-20160816; b=ULV+6jVs2oCRijFV56hqDHnWy6bt18OLfBqLHm/Z45y2TByDOi6TqdupcdyzShGTqF gbZeG2KBSDnqh9f1WuH9/Q5Lnhy2nCeKDr9OMfx0IktbQtr/RuobtKgmJQDmXx/Mk+Ca /Xm7kXyd2NR5d0FYh4UvCTjk+i1+MkzgwSoDXcsJsBS6Q6B1FSC4LhG7/G2m55sq0ghE S8ciohCVboaEPC8WuM8h1wPNToHx4XGh5S+N2mSTK7pnnftXtVLl1ukPg7SiNEH+lkTS Zkn00UqyyigXq6oQhHABZxNy6BV4LmSSak+74jvtzt6gQPiB1/JYFxklgsoZZ0dWmj4v x42Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=kH08pUQU08Y2ZLx4/JDTMu/sqhpXrAaQNeadE+HITMA=; fh=3yOoSrJH449bR203AMQnC11yMKcwWH27BOwFmUAq6wM=; b=Smb/uMSyGVhRuPCcq1ti2yxe7SOJN7pMbtHku8hnxh4R5kJZ2ciUYVwLgyBrXN3Ssq /Lu6w462WGlCDtAF/xgGBMzxHyoPddECrdPapDXJWG5fi0p1BFVF0UYOF5Lx8amVWza5 5OdKXAioLQYa/Yy3nftOC1kITPSriMQo9Kp4sR0IGsN3c1b4Y3cG5FvXn5kwE2GCNgAb Xb878jFWlA2qLo/kIaVmaVu+abCxA3vknaNIupHnZn/Dp689Nm+YDij2h1cU69uLOa/7 i2SiwwHm/Y+9XJt7mv+/RTZFYuAApi5J+7Q5w9iS6Up6Y55uwRvTsY8Gym+j1NpGxuKO /GVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hVBq1Kss; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-87233-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87233-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id iw4-20020a170903044400b001d917fa8be8si1704747plb.257.2024.02.29.10.09.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:09:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87233-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hVBq1Kss; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-87233-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87233-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5BE4F285BD9 for <ouuuleilei@gmail.com>; Thu, 29 Feb 2024 18:09:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 469DC7A15E; Thu, 29 Feb 2024 18:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hVBq1Kss" Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2C8578261; Thu, 29 Feb 2024 18:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230105; cv=none; b=sUdyLp0x/x8gQ2bGnir5We29xw+YHNKv7F1/AmtF4Othl3f3no5IhDI2/suhkrJGzqdMnz+ZemjZyCMvHBGnNFllAG947nW4RYPelxDrmCEnno8h3D5ASeZQNAAFtGdrwE0INOHHdwuQr3rSmVTvogyMmnA+r9ELR8YEU4skc4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709230105; c=relaxed/simple; bh=GaTSHoEdQQZfdVPgGu4OC9tyNlKXbXyeqwoMC3yFiEk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rWir/VVH1Tnqb8ecGzwpouvJnH0gHaV0glrIstMlE/+w1Ol2aple2TJDybBC9Am1h/Ep5+F+ru6I5cbeJGbx3MInw88fV3yS5z//IqWwTMxvRGd4zwuiZcqaCxkD2rLzmQYx72vXyxXEBO1tshidwMsoNRr6Y/EOkAwzB3xbd2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hVBq1Kss; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-412bb23e5c5so6894015e9.1; Thu, 29 Feb 2024 10:08:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709230102; x=1709834902; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kH08pUQU08Y2ZLx4/JDTMu/sqhpXrAaQNeadE+HITMA=; b=hVBq1Kss7t8GRpNIqwb7NBnqPiHg4nhnl4dciO7YD5mSiLcLF/Ug3OJuDlvUbP4x2r BsJSwiB4nw9P1s/HR8N8YLgDRwCVImxIVM9qxxJpmiTHnUmPC8vKrnCPUJo+aGGFI/xX IiYnRh9RpbZotbmgRLkYMwNiIiZcxeJVIL1IeoX1XOeQo5VflRiN9oMVywvEGZUtBNsv Lwc0yP2FG/dJuTx5ZJGxclm1gbBo1Yj9xRzqAahq+PoNEPwwv4tPMtDIlB8sqHo91yQB jgAOET/62oIuOPDk65xk6+FOr7V3m68ByunKeckZayfG6JSDhnkhe1tTcS21YPuentBL JM3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709230102; x=1709834902; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kH08pUQU08Y2ZLx4/JDTMu/sqhpXrAaQNeadE+HITMA=; b=LxEXy8sCpBnZqfBpRQv85L7XT/HnskizFNbM2n9FL+PBK5GQI8fkhiiGVVM/NuSKQ/ XDzXyastoAlgtSXaGy7mO5XWvS82RHV3xZT4+cNPMwJkPKoA0Vw/35AKPtMMJVRQ1Mwy +c/tCsDnsZRNY3A60vvTEXrHq9IQRSsUxHpmIQnSmaLlYYSTa1hKpoxtW3ztDxrANunk WftKPp1vmvJfhb+O+PJ2yZvapXhUs6OeX/6N4YW0sCZGviLd2LG+T5galV8Tarqr80WN w6M3aPKamtCTxNBW0BVQIUwjKr+kMX/WQqMDjq16lyX/IfqwrQsZdP5pgw8bGpxboovd c/1A== X-Forwarded-Encrypted: i=1; AJvYcCXOuQswpqjQcmpPsX0C4sQKB87dM4PdH4hm+mfzDyhMidwfT9oE1BQ4RuYDfX9jQJaq1UiNJsjcsReTliWZkJc4uYAXEclZD85yzQgaXWIjVWcShPMIaic2naMi6XcCuYCXeaXxxQ2C X-Gm-Message-State: AOJu0YzJphcalU4Lmb0vQL2gVnf4ideZ/q9rcIioPnH3URm+4Gly+knf 3wKaZjwIJQ6Nzl00TyFmC/sUpcl8zcZtfYwnmRQ6yyP0GjxkqCxM X-Received: by 2002:adf:cb82:0:b0:33d:b312:2130 with SMTP id q2-20020adfcb82000000b0033db3122130mr3449072wrh.11.1709230102255; Thu, 29 Feb 2024 10:08:22 -0800 (PST) Received: from [192.168.20.102] (57657817.catv.pool.telekom.hu. [87.101.120.23]) by smtp.googlemail.com with ESMTPSA id z11-20020a1c4c0b000000b00412ba5cda16sm3100620wmf.33.2024.02.29.10.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 10:08:21 -0800 (PST) From: Gabor Juhos <j4g8y7@gmail.com> Date: Thu, 29 Feb 2024 19:07:46 +0100 Subject: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240229-freq-table-terminator-v1-1-074334f0905c@gmail.com> References: <20240229-freq-table-terminator-v1-0-074334f0905c@gmail.com> In-Reply-To: <20240229-freq-table-terminator-v1-0-074334f0905c@gmail.com> To: Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Sricharan Ramabadhran <quic_srichara@quicinc.com>, Varadarajan Narayanan <quic_varada@quicinc.com>, Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>, Devi Priya <quic_devipriy@quicinc.com>, Anusha Rao <quic_anusha@quicinc.com>, Bryan O'Donoghue <bryan.odonoghue@linaro.org>, Georgi Djakov <gdjakov@mm-sol.com> Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Gabor Juhos <j4g8y7@gmail.com> X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792257706208658829 X-GMAIL-MSGID: 1792257706208658829 |
Series |
clk: qcom: fix frequency table termination in several drivers
|
|
Commit Message
Gabor Juhos
Feb. 29, 2024, 6:07 p.m. UTC
The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().
Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
drivers/clk/qcom/gcc-ipq5018.c | 3 +++
1 file changed, 3 insertions(+)
Comments
Quoting Gabor Juhos (2024-02-29 10:07:46) > The frequency table arrays are supposed to be terminated with an > empty element. Add such entry to the end of the arrays where it > is missing in order to avoid possible out-of-bound access when > the table is traversed by functions like qcom_find_freq() or > qcom_find_freq_floor(). > > Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018") > Signed-off-by: Gabor Juhos <j4g8y7@gmail.com> > --- Reviewed-by: Stephen Boyd <sboyd@kernel.org>
On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote: > The frequency table arrays are supposed to be terminated with an > empty element. Add such entry to the end of the arrays where it > is missing in order to avoid possible out-of-bound access when > the table is traversed by functions like qcom_find_freq() or > qcom_find_freq_floor(). > > Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018") Good find! Looks like these should be backported to the stable kernels as well so someone should add: Cc: stable@vger.kernel.org to all patches except possibly the sc8280xp one (that camera clock controller was added in 6.8-rc1 so that patch does not need it in case you can these fixes in before 6.8 is released). Johan
Hi Johan, 2024. 03. 01. 10:40 keltezéssel, Johan Hovold írta: > On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote: >> The frequency table arrays are supposed to be terminated with an >> empty element. Add such entry to the end of the arrays where it >> is missing in order to avoid possible out-of-bound access when >> the table is traversed by functions like qcom_find_freq() or >> qcom_find_freq_floor(). >> >> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018") > > Good find! > > Looks like these should be backported to the stable kernels as well so > someone should add: > > Cc: stable@vger.kernel.org > > to all patches except possibly the sc8280xp one (that camera clock > controller was added in 6.8-rc1 so that patch does not need it in case > you can these fixes in before 6.8 is released). You are right maybe, although I did not find strong enough reasons for adding the stable tags. Only the changes of the gcc-ipq5018 driver has been tested on real hardware the others are not. So those does not fit into the "It must be obviously correct and tested." rule. Since the support for the IPQ5018 platform is quite incomplete as several drivers are missing even in 6.8-rc6, it is quite unlikely that anyone uses a stable kernel for something serious on such boards. Hence backporting the gcc-ipq5018 changes would not help too much in itself. Regards, Gabor
On Fri, Mar 01, 2024 at 02:37:01PM +0100, Gabor Juhos wrote: > Hi Johan, > > 2024. 03. 01. 10:40 keltezéssel, Johan Hovold írta: > > On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote: > >> The frequency table arrays are supposed to be terminated with an > >> empty element. Add such entry to the end of the arrays where it > >> is missing in order to avoid possible out-of-bound access when > >> the table is traversed by functions like qcom_find_freq() or > >> qcom_find_freq_floor(). > >> > >> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018") > > > > Good find! > > > > Looks like these should be backported to the stable kernels as well so > > someone should add: > > > > Cc: stable@vger.kernel.org > > > > to all patches except possibly the sc8280xp one (that camera clock > > controller was added in 6.8-rc1 so that patch does not need it in case > > you can these fixes in before 6.8 is released). > > You are right maybe, although I did not find strong enough reasons for adding > the stable tags. > > Only the changes of the gcc-ipq5018 driver has been tested on real hardware the > others are not. So those does not fit into the "It must be obviously correct and > tested." rule. Since this looks like a straight-forward and obviously correct fix for a bug which could have bad consequences, not being able to test each patch on actual hardware is not a problem. Johan
On Fri, Mar 01, 2024 at 03:03:15PM +0100, Johan Hovold wrote: > On Fri, Mar 01, 2024 at 02:37:01PM +0100, Gabor Juhos wrote: > > Hi Johan, > > > > 2024. 03. 01. 10:40 keltezéssel, Johan Hovold írta: > > > On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote: > > >> The frequency table arrays are supposed to be terminated with an > > >> empty element. Add such entry to the end of the arrays where it > > >> is missing in order to avoid possible out-of-bound access when > > >> the table is traversed by functions like qcom_find_freq() or > > >> qcom_find_freq_floor(). > > >> > > >> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018") > > > > > > Good find! > > > > > > Looks like these should be backported to the stable kernels as well so > > > someone should add: > > > > > > Cc: stable@vger.kernel.org > > > > > > to all patches except possibly the sc8280xp one (that camera clock > > > controller was added in 6.8-rc1 so that patch does not need it in case > > > you can these fixes in before 6.8 is released). > > > > You are right maybe, although I did not find strong enough reasons for adding > > the stable tags. > > > > Only the changes of the gcc-ipq5018 driver has been tested on real hardware the > > others are not. So those does not fit into the "It must be obviously correct and > > tested." rule. > > Since this looks like a straight-forward and obviously correct fix for a > bug which could have bad consequences, not being able to test each patch > on actual hardware is not a problem. > I agree, and I'm adding the Cc: stable while applying the patches. Thanks, Bjorn
diff --git a/drivers/clk/qcom/gcc-ipq5018.c b/drivers/clk/qcom/gcc-ipq5018.c index 4aba47e8700d2..856a2b30e2a8e 100644 --- a/drivers/clk/qcom/gcc-ipq5018.c +++ b/drivers/clk/qcom/gcc-ipq5018.c @@ -857,6 +857,7 @@ static struct clk_rcg2 lpass_sway_clk_src = { static const struct freq_tbl ftbl_pcie0_aux_clk_src[] = { F(2000000, P_XO, 12, 0, 0), + { } }; static struct clk_rcg2 pcie0_aux_clk_src = { @@ -1099,6 +1100,7 @@ static const struct freq_tbl ftbl_qpic_io_macro_clk_src[] = { F(100000000, P_GPLL0, 8, 0, 0), F(200000000, P_GPLL0, 4, 0, 0), F(320000000, P_GPLL0, 2.5, 0, 0), + { } }; static struct clk_rcg2 qpic_io_macro_clk_src = { @@ -1194,6 +1196,7 @@ static struct clk_rcg2 ubi0_axi_clk_src = { static const struct freq_tbl ftbl_ubi0_core_clk_src[] = { F(850000000, P_UBI32_PLL, 1, 0, 0), F(1000000000, P_UBI32_PLL, 1, 0, 0), + { } }; static struct clk_rcg2 ubi0_core_clk_src = {