Skip to content
Snippets Groups Projects
Commit b85db0f2 authored by Zicheng Qu's avatar Zicheng Qu Committed by Frieder Schrempf
Browse files

staging: iio: frequency: ad9832: fix division by zero in ad9832_calc_freqreg()

commit 6bd30181 upstream.

In the ad9832_write_frequency() function, clk_get_rate() might return 0.
This can lead to a division by zero when calling ad9832_calc_freqreg().
The check if (fout > (clk_get_rate(st->mclk) / 2)) does not protect
against the case when fout is 0. The ad9832_write_frequency() function
is called from ad9832_write(), and fout is derived from a text buffer,
which can contain any value.

Link: https://lore.kernel.org/all/2024100904-CVE-2024-47663-9bdc@gregkh/


Fixes: ea707584 ("Staging: IIO: DDS: AD9832 / AD9835 driver")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarZicheng Qu <quzicheng@huawei.com>
Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20241022134354.574614-1-quzicheng@huawei.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c8d7ad99
No related branches found
No related tags found
1 merge request!180🤖 Sync Bot: Update v6.1-ktn to Latest Stable Kernel (v6.1.124)
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment