CVE-2026-99521: rapidio: mport_cdev: fix use-after-free in mport_mm_close()
In the Linux kernel, the following vulnerability has been resolved:
rapidio: mportcdev: fix use-after-free in mportmmclose()
A use-after-free vulnerability was identified in mportmmclose() in drivers/rapidio/devices/riomportcdev.c, identical to the pattern previously addressed in dmareqfree().
This is observable from userspace when an application creates an mmap mapping via the RapidIO character device and subsequently unmaps it (or terminates, triggering exitmmap()). During munmap, mportmmclose() is invoked and drops the mapping reference via krefput().
If krefput() drops the last reference, mportreleasemapping() is called, which frees the underlying riomportmapping structure. The subsequent mutexunlock() then dereferences map->md to unlock bufmutex, leading to a use-after-free:
mportmmclose() -> mutexlock(&map->md->bufmutex); ... -> krefput(&map->ref, mportreleasemapping); / map is freed / -> mutexunlock(&map->md->bufmutex); / UAF: map used /
Fix this by caching map->md before krefput() and using the cached pointer for mutex unlocking, ensuring that freed memory is not accessed.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.61 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.2 - Compensating control
In mport_mm_close(), cache map->md before calling kref_put() and use the cached pointer when unlocking buf_mutex, so the code does not dereference map after it may have been freed.