CVE-2024-35847: irqchip/gic-v3-its: Prevent double free on error
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
irqchip/gic-v3-its: Prevent double free on error
The error handling path in its_vpe_irq_domain_alloc() causes a double free when its_vpe_init() fails after successfully allocating at least one interrupt. This happens because its_vpe_irq_domain_free() frees the interrupts along with the area bitmap and the vprop_page and its_vpe_irq_domain_alloc() subsequently frees the area bitmap and the vprop_page again.
Fix this by unconditionally invoking its_vpe_irq_domain_free() which handles all cases correctly and by removing the bitmap/vprop_page freeing from its_vpe_irq_domain_alloc().
[ tglx: Massaged change log ]
The Linux kernel CVE team has assigned CVE-2024-35847 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 4.19.313 with commit f5417ff561b8 Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 5.4.275 with commit b72d2b1448b6 Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 5.10.216 with commit aa44d2157475 Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 5.15.158 with commit 5dbdbe113391 Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 6.1.90 with commit dd681710ab77 Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 6.6.30 with commit 03170e657f62 Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 6.8.9 with commit 5b012f77abde Issue introduced in 4.14 with commit 7d75bbb4bc1a and fixed in 6.9 with commit c26591afd33a
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-35847
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/irqchip/irq-gic-v3-its.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/f5417ff561b8ac9a7e53c747b8627a7ab58378ae https://git.kernel.org/stable/c/b72d2b1448b682844f995e660b77f2a1fabc1662 https://git.kernel.org/stable/c/aa44d21574751a7d6bca892eb8e0e9ac68372e52 https://git.kernel.org/stable/c/5dbdbe1133911ca7d8466bb86885adec32ad9438 https://git.kernel.org/stable/c/dd681710ab77c8beafe2e263064cb1bd0e2d6ca9 https://git.kernel.org/stable/c/03170e657f62c26834172742492a8cb8077ef792 https://git.kernel.org/stable/c/5b012f77abde89bf0be8a0547636184fea618137 https://git.kernel.org/stable/c/c26591afd33adce296c022e3480dea4282b7ef91