CVE-2024-50232: iio: adc: ad7124: fix division by zero in ad7124_set_channel_odr()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
iio: adc: ad7124: fix division by zero in ad7124_set_channel_odr()
In the ad7124_write_raw() function, parameter val can potentially be zero. This may lead to a division by zero when DIV_ROUND_CLOSEST() is called within ad7124_set_channel_odr(). The ad7124_write_raw() function is invoked through the sequence: iio_write_channel_raw() -> iio_write_channel_attribute() -> iio_channel_write(), with no checks in place to ensure val is non-zero.
The Linux kernel CVE team has assigned CVE-2024-50232 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.13 with commit 7b8d045e497a and fixed in 5.15.171 with commit 4f588fffc307 Issue introduced in 5.13 with commit 7b8d045e497a and fixed in 6.1.116 with commit f51343f346e6 Issue introduced in 5.13 with commit 7b8d045e497a and fixed in 6.6.60 with commit 3dc0eda2cd5c Issue introduced in 5.13 with commit 7b8d045e497a and fixed in 6.11.7 with commit 0ac0beb4235a Issue introduced in 5.13 with commit 7b8d045e497a and fixed in 6.12-rc6 with commit efa353ae1b05
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-50232
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/iio/adc/ad7124.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/4f588fffc307a4bc2761aee6ff275bb4b433e451 https://git.kernel.org/stable/c/f51343f346e6abde094548a7fb34472b0d4cae91 https://git.kernel.org/stable/c/3dc0eda2cd5c653b162852ae5f0631bfe4ca5e95 https://git.kernel.org/stable/c/0ac0beb4235a9a474f681280a3bd4e2a5bb66569 https://git.kernel.org/stable/c/efa353ae1b0541981bc96dbf2e586387d0392baa