Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795047161; b=zqMZzkr3ys3oCdB6HiLaOWULUJq3xvKuHxTV+jMNyy2S9Au7FbS5++r6t+5Aj8ZZXSPQ RnPdU6KpKrbl+yPAyOVV2HWxksnzwnuAJv/kMusvQAeCtTs6RwS5ZKrt7GPWnZLw3oCgq IFhX/J5NHd74SBMAVqIYYQg8mvMkCMw/2I8WTNeWHTlPNvCYddvA6Q+6R7w5VUwgwOA1v Opm7IVibijTDny1y5i7mERgiNodw5hDI2g506UBXLlQOicWlDFN0H39gkAiRuf771Wp9t yyJY2CctxQ9/nZNGdxQEz1AZHONg0pVIWWRKFHhE6SQHXvzOm5J+qXtOK6PyXW1jUrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795047161; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=V3hIF8BhBgANBoEUv8ehqm5OK5v/QiCdASFVnftPf2g=; b=uGnnMLv0BqDgfYnpfpBRsAB4+wTyZHuqYBdFg/BIqKJ0rMNQF+/Myjcqs7EP1Aa7Q9J7 rSsm6X6Hat1b52l0J9b+MC89DDlXQ3dbiI1S95uuhjzNVEFDPcPkmg2untNAlyW1g3Nam rrDyBGcd0GlFtv0qkeGsng2GR/Fc+wtKEdDxEoNL3nh95cthclOQuUH4YLdLQaihL0PBx pB8K53cH+HMTi83NNMrRqHShYwAtJ50mBDAJYab69ojGiNoSQX1GyC2ruk9aze/v6MoK4 yQRMotjOXyAnwImUttNJceTNdhqYbdvJSkb+DAlkie6Z4W/V4ZDcyDqkTEewZlYajoQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=e5unoWeN; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3590606A325; Thu, 19 Nov 2026 00:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=e5unoWeN Received: by smtp.kernel.org (Postfix) with ESMTPSA id F34A71F000C4; Thu, 19 Nov 2026 00:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795047161; bh=V3hIF8BhBgANBoEUv8ehqm5OK5v/QiCdASFVnftPf2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e5unoWeNNLqByqBvAB7Yv5Lqq7ncD2RulORMi+0mU8gSqKNxdfntcCpFeAYaiEmn/ mmhjWvwFdjPyrxhYxebE1o1frVORFY7ClqBmI1LVV1kas33bv2hnCQgwwWYeItYyHG kilyfUTlrOTe6isTesNW057U6xMyrvFjPyTR5BLo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alex Kazinsky , Mark Brown , Sasha Levin Subject: [PATCH 6.1 1539/2857] ASoC: tlv320aic32x4: Prevent division by zero in divider callbacks Date: Wed, 18 Nov 2026 15:42:53 +0100 Message-ID: <20261118150256.734929986@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Kazinsky [ Upstream commit 8cf9607d2d855629260fc78e6b54ea7a98525708 ] A zero rate requested through clk_set_rate() or clk_round_rate() reaches clk_aic32x4_div_determine_rate() when the minimum rate is zero. Clamping the requested rate to the allowed range leaves it unchanged, causing division by zero when calculating the divisor. A zero parent rate can also cause division by zero in determine_rate(). For example, if reading a parent divider's register fails, clk_aic32x4_div_recalc_rate() returns zero, which the clock framework caches as the parent's rate. A subsequent rate request for a child divider receives this value in best_parent_rate. With a nonzero requested rate, the calculated divisor is zero. It passes the existing upper-bound check and causes division by zero in the resulting rate calculation. The set_rate callback can receive a zero rate when an ancestor's rate changes. clk_calc_subtree() calculates descendant rates through recalc_rate() without calling their determine_rate callbacks. If reading a descendant divider's register fails, clk_aic32x4_div_recalc_rate() returns zero. This becomes the descendant's new_rate, which clk_change_rate() passes to clk_aic32x4_div_set_rate(), causing division by zero. Reject zero rates in both callbacks and reject a zero divisor in clk_aic32x4_div_determine_rate(). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: a51b50062091 ("ASoC: tlv320aic32x4: Model DAC/ADC dividers in CCF") Cc: stable@vger.kernel.org Signed-off-by: Alex Kazinsky Link: https://patch.msgid.link/20261023130854.93639-1-a.kazinsky@ideco.ru Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tlv320aic32x4-clk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c index 4ade06e5f5cd3..c8ba32b810af9 100644 --- a/sound/soc/codecs/tlv320aic32x4-clk.c +++ b/sound/soc/codecs/tlv320aic32x4-clk.c @@ -318,6 +318,9 @@ static int clk_aic32x4_div_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_aic32x4 *div = to_clk_aic32x4(hw); u8 divisor; + if (!rate) + return -EINVAL; + divisor = DIV_ROUND_UP(parent_rate, rate); if (divisor > AIC32X4_DIV_MAX) return -EINVAL; @@ -331,8 +334,11 @@ static int clk_aic32x4_div_determine_rate(struct clk_hw *hw, { unsigned long divisor; + if (!req->rate) + return -EINVAL; + divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate); - if (divisor > AIC32X4_DIV_MAX) + if (!divisor || divisor > AIC32X4_DIV_MAX) return -EINVAL; req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor); -- 2.53.0