CVE-2024-53148: comedi: Flush partial mappings in error case
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
comedi: Flush partial mappings in error case
If some remap_pfn_range() calls succeeded before one failed, we still have buffer pages mapped into the userspace page tables when we drop the buffer reference with comedi_buf_map_put(bm). The userspace mappings are only cleaned up later in the mmap error path.
Fix it by explicitly flushing all mappings in our VMA on the error path.
See commit 79a61cc3fc04 ("mm: avoid leaving partial pfn mappings around in error case").
The Linux kernel CVE team has assigned CVE-2024-53148 to this issue.
Affected and fixed versions
===========================
Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 5.4.287 with commit 57f048c2d205b85e34282a9b0b0ae177e84c2f44 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 5.10.231 with commit b9322408d83accc8b96322bc7356593206288c56 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 5.15.174 with commit 8797b7712de704dc231f9e821d8eb3b9aeb3a032 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.1.120 with commit 16c507df509113c037cdc0ba642b9ab3389bd26c Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.6.64 with commit 9b07fb464eb69a752406e78e62ab3a60bfa7b00d Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.11.11 with commit c6963a06ce5c61d3238751ada04ee1569663a828 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.12.2 with commit 297f14fbb81895f4ccdb0ad25d196786d6461e00 Issue introduced in 2.6.29 with commit ed9eccbe8970f6eedc1b978c157caf1251a896d4 and fixed in 6.13-rc1 with commit ce8f9fb651fac95dd41f69afe54d935420b945bd
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-53148
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/comedi/comedi_fops.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/57f048c2d205b85e34282a9b0b0ae177e84c2f44 https://git.kernel.org/stable/c/b9322408d83accc8b96322bc7356593206288c56 https://git.kernel.org/stable/c/8797b7712de704dc231f9e821d8eb3b9aeb3a032 https://git.kernel.org/stable/c/16c507df509113c037cdc0ba642b9ab3389bd26c https://git.kernel.org/stable/c/9b07fb464eb69a752406e78e62ab3a60bfa7b00d https://git.kernel.org/stable/c/c6963a06ce5c61d3238751ada04ee1569663a828 https://git.kernel.org/stable/c/297f14fbb81895f4ccdb0ad25d196786d6461e00 https://git.kernel.org/stable/c/ce8f9fb651fac95dd41f69afe54d935420b945bd