CVE-2023-53353: accel/habanalabs: postpone mem_mgr IDR destruction to hpriv_release()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
accel/habanalabs: postpone mem_mgr IDR destruction to hpriv_release()
The memory manager IDR is currently destroyed when user releases the file descriptor.
However, at this point the user context might be still held, and memory buffers might be still in use.
Later on, calls to release those buffers will fail due to not finding their handles in the IDR, leading to a memory leak.
To avoid this leak, split the IDR destruction from the memory manager fini, and postpone it to hpriv_release() when there is no user context and no buffers are used.
The Linux kernel CVE team has assigned CVE-2023-53353 to this issue.
Affected and fixed versions
===========================
Fixed in 6.3.4 with commit 840de329ca99cafd0cdde9c6ac160b1330942aba Fixed in 6.4 with commit 2e8e9a895c4589f124a37fc84d123b5114406e94
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-53353
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/accel/habanalabs/common/device.c drivers/accel/habanalabs/common/habanalabs.h drivers/accel/habanalabs/common/habanalabs_drv.c drivers/accel/habanalabs/common/memory_mgr.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/840de329ca99cafd0cdde9c6ac160b1330942aba https://git.kernel.org/stable/c/2e8e9a895c4589f124a37fc84d123b5114406e94