| Message ID | 20260902101515.167819-3-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers | show
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRBVPO37KAMGQEZTJDE3Q@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com
[209.85.128.70])
by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D878940D07
for <linux-amarula@patchwork.amarulasolutions.com>;
Wed, 2 Sep 2026 12:15:50 +0200 (CEST)
Received: by mail-wm1-f70.google.com with SMTP id
5b1f17b1804b1-49cc9f5bee2sf7449255e9.2
for <linux-amarula@patchwork.amarulasolutions.com>;
Wed, 02 Sep 2026 03:15:50 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1788344150; cv=pass;
d=google.com; s=arc-20260327;
b=hPEqQ1FKNGdZRNKCFUGa7pUNWvVWE7vmsln+GbpmIxeNy7chqHx5TFSYvDnhWCor8D
wCLeoMMhcyzNaCyEDmm8iZBb0ymVqVE1zTTA6mfEE3j4GPB38yKNQXT21Psqi2SsxwpT
lqLdLzAv4OIJUftwKUNUJcWO6PghVw1P8wyve2Yk5cn95LMxD7f1ntyRHH68X6DQF7As
8HElBvBQ6N7TIr0SfxsLapIBWXV9ADS/yWHPUoYfbxApxw9vCnD3IuSBg+9QmCkDXsQ+
L1oBC/ZAQm02l8Jc33l37B2XIZRJth3kzNGoemGcfCJGP0lufDlDRm54dk/Eow//u7P7
V09Q==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=jvVar7UDN6d2mxAOrqHGZ1Gz72/J1szmVwTjJyvdW4M=;
fh=EcWcOsT/nA74XMS+Ubk0PBw57txQcyBOGl7Eawg7xWg=;
b=QYwjNYo8zWf6UL8Dw13I3gv3fVVPaICGWFHi0aMG0hXN0A0h3l6c+kuOpojja1MfBY
eE9TQ01Q2Te4RTd2z3pVWyITv2618ejBGcQq9daLcpY/ZMLfNbgMsSrJe2x0pgUSPvX2
1Ot62tdOZK8cXg0pFyqtgN668ghkJVa53Ts7dVcsYJFPGZaSeyo+7stKzkEM01OTJZty
EpPCJZxFTY9zUsbxlyk0ge35FJvGYZ+7J9ZM14wCvY7zqTDZVD6kuMgr9UVGwTQUkBQH
QmnvqWVur2EH4yaIYAtwiuYSmemMIlb2rUGO/iUhk3DTHddXzDAcJfg/vfV7ojBN+EbF
DLWw==;
darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=o3RYJk2J;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amarulasolutions.com; s=google; t=1788344150; x=1788948950;
darn=patchwork.amarulasolutions.com;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:content-type
:x-original-authentication-results:x-original-sender:mime-version
:references:in-reply-to:message-id:date:subject:cc:to:from:from:to
:cc:subject:date:message-id:reply-to:content-type;
bh=jvVar7UDN6d2mxAOrqHGZ1Gz72/J1szmVwTjJyvdW4M=;
b=oYzPd6WzFSNvK7MGOro9OFPs4km/ytYcO4ezoBSbjSNoVWB8KH2jggKnOqTcqf55B0
3nw9FgxpNE6SKohBiB6zy+oCDHraktr8HIh83dlKrD7dyFMxbQRNCz8SrSnJvrJQtm0c
OAbcuJWK6tBR54cdVQyRE/rNfI3udRRc+zBrM=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1788344150; x=1788948950;
h=list-unsubscribe:list-archive:list-help:list-post
:x-spam-checked-in-group:list-id:mailing-list:precedence
:content-type:x-original-authentication-results:x-original-sender
:mime-version:references:in-reply-to:message-id:date:subject:cc:to
:from:x-gm-gg:x-beenthere:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=jvVar7UDN6d2mxAOrqHGZ1Gz72/J1szmVwTjJyvdW4M=;
b=U16YezlH77GU52wfd8BJylLouXfF1SAOq/sW2diRD3LxbQrF+c79pEm9OTiWUIK70s
bl4s8dfFjnFi+EevmbbGL2ZT2iP+AuORTWilNkOs8sj9Gh3/Q6l+WJuYt7gVMiuUcFDK
7kDr2Jn9tl0Ezolf0dC1oeCYY7s9JQQZ7m1hHI5+C6gMbgjP8P93R+joHtyD7rNme+1c
Jyf1VZ4ymEDMfzbfIPvSH+V4IgqR0kXhxiZH7IevEktLM7L7aA6tHYvHaHt9Cmr5bu+L
qJOnJgF2PfVLHQB+rEAcn6EriogwQlttUvX3/n1iZfocOh7LSNAUedxaWpFiN2ZSesQm
h0Yw==
X-Forwarded-Encrypted: i=2;
AHgh+RoTKHikuTk0APuEjReqc6D5yudRAiCQ5A33kfkF+CoG/gEF/wGVXjv9WkJ58AynDhvfdaAc01fHHh/M+8aK@patchwork.amarulasolutions.com
X-Gm-Message-State: AFuF++mkL3TvHkP6CI9AeOncGsDYRkqgqurtVCe+UEuk7Jv62oXN2z7T
t+8YEK5iMPK5rjbfoEToeCXE0h7QJsl6pgmCLH4UCXdu8xDmku555f4Tu23IVEb8dkkhlfP8knK
etw==
X-Received: by 2002:a05:600c:474c:b0:493:c47f:3c55 with SMTP id
5b1f17b1804b1-49ce581fe2dmr53267325e9.5.1788344150336;
Wed, 02 Sep 2026 03:15:50 -0700 (PDT)
X-BeenThere: linux-amarula@amarulasolutions.com;
h="ATskLdc2ubqgQLnEcJ1qcMIDyzXNjsfxjCjUDByRb8lPDAcmlw=="
Received: by 2002:a05:600c:1d01:b0:495:458f:eb16 with SMTP id
5b1f17b1804b1-49b21771791ls61176275e9.1.-pod-prod-05-eu; Wed, 02 Sep 2026
03:15:49 -0700 (PDT)
X-Received: by 2002:a05:600c:c16d:b0:49b:47b3:d6d with SMTP id
5b1f17b1804b1-49ce5842737mr72848585e9.10.1788344148637;
Wed, 02 Sep 2026 03:15:48 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1788344148; cv=none;
d=google.com; s=arc-20260327;
b=aA+nNSY5OE7hqTzSadRV7phTtYMX2etaBsVrr/tZ/f98QabTv+uB+9nmcCYNRrI7Dq
Cq3zBpw+GbYqgDrrqJ5xwIqWvjAwlTPmsKy3vqUOSxZGsWOgoa44Vx1fseVewAMJFPOw
q1RzdcpFO46bagk0VjcRpvPbsVNyZx3K7tyS/piKIMXTzCCJVV3csiS+k8PXV/MG0DTR
ynJiI5HpWPxuydKzqZrHnPpo05oLNO0WljIg4Hie7JIsp5+Q/rZxNk/ZkavyT47D9O7b
xPkGcnmza8aVNKA4KOeYEgtmYTs9XCUz8G86V6uJvTr694Sw9KRJbYDbE6xVC4UZOhv3
684Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=SfZRa8H2WDMJkcsjpztb8rt8s89URmJ5lnAVHSoTHTw=;
fh=DvNWzYUbqLDEGKkj7xR+THG6wwif/P922HrkLzuVV6A=;
b=J/wosqm/T1EsZW3hus3lO/LFZMHhZlHdbTmCD7KsmtZnTJKkHjey31nlepNIeRT4Dh
q+B0GzrZ3lpi+Yr1ZGSvgrGLgQddfryxw7rMTzM5/MasQ+fTSlcZgvr6EKh3MlVNod/w
mBLs60czhCPi8C4o8oWUJqJ9+f5huz1db/hYejR5wAgGesU7HCkwckR6efLnL2aqKjon
2KVDeFaBuigzRDuPx+ywkBcfiNd62bE30r88iwawqBSs7k/e3ftrfVGRMO+tlWeDxbnj
U5OMGwEVDCq6WLGVtAuhGEq4tybl+DaG5fllG66LyIbQKn+TvbNyfxjtxpd4gOknraFV
iPpQ==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=o3RYJk2J;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com.
[209.85.220.41])
by mx.google.com with SMTPS id
5b1f17b1804b1-49ce47abc84sor5595175e9.13.2026.09.02.03.15.48
for <linux-amarula@amarulasolutions.com>
(Google Transport Security);
Wed, 02 Sep 2026 03:15:48 -0700 (PDT)
Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Gm-Gg: AR+sD10xg2+sbB2jxc8zVbZLZqfUFU4o05oQ/8qMo/AcWLd9MCkfHhmbxEbGzbvcuDd
jIsZGeU0ml7Ps8GkFizFOjFfR56NLuyGyh7UHp0911X0cqXaVuT1u8n9LR/RJq6ev/nDMQ2tkGM
xFo7mDbSAKIE2s5ueDAPMKZRHz+AWTqIPxxpgYbMkGt2lv6YgRLyvKcra2k4sRAL6vdqVrfzOYN
NpCRbwkzkmkEAID0qM4fsHLrBTNbrzzlwzY44HlEEF/dVaL9So6uejyS9Z7vxDA2ccZbbr9qPc4
nw5hilUAJCzCw1NfM0wWg8g6UOYb4X3AqXXdwYHYC/JUXT7FFpE5lL80xLkzSHPsUswexUNrKsb
YAKSU5jZkcHu/tnJMKDY9KxhCu8T9IhB+2uZ65WAfAh66Z2O+F+Kl5FxWWzADC5ApcbklaZ8Ehz
Dq9qBskKrXwh+jtO0epOsZEt/71Rm4RqsiREyKXJxQc37dNc4zGiV2Pf9E3+oCjGNMHV026X6uz
7GVACRFiP+8AmIMgZGYRmnDVO2soEyLtiA0ftn4cxPBmMfZ66oRp0smldxMDttPQC59uc0C2BQl
AKK+DMxELlRogQ/d9D9l6PtkzOqK5WSNrkCaUVWVwinESloWK2xvySKNOfmM
X-Received: by 2002:a05:600c:8b88:b0:49c:e1cd:536 with SMTP id
5b1f17b1804b1-49ce584b899mr65032275e9.12.1788344134629;
Wed, 02 Sep 2026 03:15:34 -0700 (PDT)
Received: from dario-ThinkPad-P14s-Gen-5.homenet.telecomitalia.it
(host-87-9-102-148.retail.telecomitalia.it. [87.9.102.148])
by smtp.gmail.com with ESMTPSA id
5b1f17b1804b1-49cdd73f7a4sm139618475e9.12.2026.09.02.03.15.32
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 02 Sep 2026 03:15:33 -0700 (PDT)
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-amarula@amarulasolutions.com,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Peng Fan <peng.fan@nxp.com>,
Sebin Francis <sebin.francis@ti.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-clk@vger.kernel.org
Subject: [PATCH v12 2/3] clk: validate spread spectrum configuration
Date: Wed, 2 Sep 2026 12:07:34 +0200
Message-ID: <20260902101515.167819-3-dario.binacchi@amarulasolutions.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20260902101515.167819-1-dario.binacchi@amarulasolutions.com>
References: <20260902101515.167819-1-dario.binacchi@amarulasolutions.com>
MIME-Version: 1.0
X-Original-Sender: dario.binacchi@amarulasolutions.com
X-Original-Authentication-Results: mx.google.com; dkim=pass
header.i=@amarulasolutions.com header.s=google header.b=o3RYJk2J;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
Content-Type: text/plain; charset="UTF-8"
Precedence: list
Mailing-list: list linux-amarula@amarulasolutions.com;
contact linux-amarula+owners@amarulasolutions.com
List-ID: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
<mailto:linux-amarula@amarulasolutions.com>
List-Help:
<https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
<mailto:linux-amarula+help@amarulasolutions.com>
List-Archive:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe:
<mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe>
|
| Series |
|
| Related |
show
|
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index fef87167a60b..208caf60eeb5 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2851,6 +2851,20 @@ int clk_hw_set_spread_spectrum(struct clk_hw *hw, const struct clk_spread_spectr if (!hw) return 0; + switch (ss_conf->method) { + case CLK_SPREAD_NO: + break; + case CLK_SPREAD_CENTER: + case CLK_SPREAD_UP: + case CLK_SPREAD_DOWN: + if (!ss_conf->modfreq_hz || !ss_conf->spread_bp || + ss_conf->spread_bp > 10000) + return -EINVAL; + break; + default: + return -EINVAL; + } + core = hw->core; clk_prepare_lock();
The spread spectrum configuration is passed to the provider's set_spread_spectrum() callback without any validation, as clk-conf.c only skips all-zero triplets from "assigned-clock-sscs". An invalid device tree can hand providers a zero modulation frequency or a spread ratio above 100%, and each provider would have to add the same checks to protect e.g. divisions in its rate computations. Fixes: c86814e70390 ("clk: Introduce clk_hw_set_spread_spectrum") Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> --- (no changes since v1) drivers/clk/clk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)