CVE-2024-40994: ptp: fix integer overflow in max_vclocks_store
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ptp: fix integer overflow in max_vclocks_store
On 32bit systems, the "4 * max" multiply can overflow. Use kcalloc() to do the allocation to prevent this.
The Linux kernel CVE team has assigned CVE-2024-40994 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.14 with commit 44c494c8e30e and fixed in 5.15.162 with commit 4b03da87d0b7 Issue introduced in 5.14 with commit 44c494c8e30e and fixed in 6.1.96 with commit d50d62d5e6ee Issue introduced in 5.14 with commit 44c494c8e30e and fixed in 6.6.36 with commit 666e934d749e Issue introduced in 5.14 with commit 44c494c8e30e and fixed in 6.9.7 with commit e1fccfb4638e Issue introduced in 5.14 with commit 44c494c8e30e and fixed in 6.10-rc5 with commit 81d23d2a2401
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-40994
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/ptp/ptp_sysfs.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/4b03da87d0b7074c93d9662c6e1a8939f9b8b86e https://git.kernel.org/stable/c/d50d62d5e6ee6aa03c00bddb91745d0b632d3b0f https://git.kernel.org/stable/c/666e934d749e50a37f3796caaf843a605f115b6f https://git.kernel.org/stable/c/e1fccfb4638ee6188377867f6015d0ce35764a8e https://git.kernel.org/stable/c/81d23d2a24012e448f651e007fac2cfd20a45ce0