CVE-2023-52643: iio: core: fix memleak in iio_device_register_sysfs
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
iio: core: fix memleak in iio_device_register_sysfs
When iio_device_register_sysfs_group() fails, we should free iio_dev_opaque->chan_attr_group.attrs to prevent potential memleak.
The Linux kernel CVE team has assigned CVE-2023-52643 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.13 with commit 32f171724e5c and fixed in 5.15.149 with commit 1c6d19c8cbf6 Issue introduced in 5.13 with commit 32f171724e5c and fixed in 6.1.79 with commit 359f220d0e75 Issue introduced in 5.13 with commit 32f171724e5c and fixed in 6.6.18 with commit b90126c86d83 Issue introduced in 5.13 with commit 32f171724e5c and fixed in 6.7.6 with commit 3db312e06851 Issue introduced in 5.13 with commit 32f171724e5c and fixed in 6.8 with commit 95a0d596bbd0
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-2023-52643
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/industrialio-core.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/1c6d19c8cbf6abcea2c8fca2db26abca2cbf0363 https://git.kernel.org/stable/c/359f220d0e753bba840eac19ffedcdc816b532f2 https://git.kernel.org/stable/c/b90126c86d83912688501826643ea698f0df1728 https://git.kernel.org/stable/c/3db312e06851996e7fb27cb5a8ccab4c0f9cdb93 https://git.kernel.org/stable/c/95a0d596bbd0552a78e13ced43f2be1038883c81