diff options
| author | Alex Kazinsky <a.kazinsky@ideco.ru> | 2026-10-23 17:08:52 +0400 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-23 16:24:48 +0100 |
| commit | 8cf9607d2d855629260fc78e6b54ea7a98525708 (patch) | |
| tree | ba471bd04751415ed69f02af76b0ee62fbedde19 /scripts/basic/split-include.c | |
| parent | ad45d5369c566d1ae332fb52e8d9ffabe85465fc (diff) | |
| download | linux-8cf9607d2d855629260fc78e6b54ea7a98525708.tar.gz linux-8cf9607d2d855629260fc78e6b54ea7a98525708.zip | |
ASoC: tlv320aic32x4: Prevent division by zero in divider callbacks
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 <a.kazinsky@ideco.ru>
Link: https://patch.msgid.link/20261023130854.93639-1-a.kazinsky@ideco.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
