CVE-2024-26856: net: sparx5: Fix use after free inside sparx5_del_mact_entry
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: sparx5: Fix use after free inside sparx5_del_mact_entry
Based on the static analyzis of the code it looks like when an entry from the MAC table was removed, the entry was still used after being freed. More precise the vid of the mac_entry was used after calling devm_kfree on the mac_entry.
The fix consists in first using the vid of the mac_entry to delete the entry from the HW and after that to free it.
The Linux kernel CVE team has assigned CVE-2024-26856 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.14 with commit b37a1bae742f and fixed in 5.15.152 with commit e46274df1100 Issue introduced in 5.14 with commit b37a1bae742f and fixed in 6.1.82 with commit 0de693d68b0a Issue introduced in 5.14 with commit b37a1bae742f and fixed in 6.6.22 with commit e83bebb718fd Issue introduced in 5.14 with commit b37a1bae742f and fixed in 6.7.10 with commit 71809805b950 Issue introduced in 5.14 with commit b37a1bae742f and fixed in 6.8 with commit 89d72d4125e9
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-26856
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/net/ethernet/microchip/sparx5/sparx5_mactable.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/e46274df1100fb0c06704195bfff5bfbd418bf64 https://git.kernel.org/stable/c/0de693d68b0a18d5e256556c7c62d92cca35ad52 https://git.kernel.org/stable/c/e83bebb718fd1f42549358730e1206164e0861d6 https://git.kernel.org/stable/c/71809805b95052ff551922f11660008fb3666025 https://git.kernel.org/stable/c/89d72d4125e94aa3c2140fedd97ce07ba9e37674