CVE-2023-53867: ceph: fix potential use-after-free bug when trimming caps
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ceph: fix potential use-after-free bug when trimming caps
When trimming the caps and just after the 'session->s_cap_lock' is released in ceph_iterate_session_caps() the cap maybe removed by another thread, and when using the stale cap memory in the callbacks it will trigger use-after-free crash.
We need to check the existence of the cap just after the 'ci->i_ceph_lock' being acquired. And do nothing if it's already removed.
The Linux kernel CVE team has assigned CVE-2023-53867 to this issue.
Affected and fixed versions
===========================
Fixed in 6.1.28 with commit 2b2515b8095cf2149bef44383a99d5b5677f1831 Fixed in 6.2.15 with commit 448875a73e16ba7d81dec9274ce9d33a12d092fb Fixed in 6.3.2 with commit ae6e935618d99cdba11eab4714092e7e5f13cf7e Fixed in 6.4 with commit aaf67de78807c59c35bafb5003d4fb457c764800
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-53867
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:
fs/ceph/caps.c
fs/ceph/debugfs.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/super.h
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/2b2515b8095cf2149bef44383a99d5b5677f1831 https://git.kernel.org/stable/c/448875a73e16ba7d81dec9274ce9d33a12d092fb https://git.kernel.org/stable/c/ae6e935618d99cdba11eab4714092e7e5f13cf7e https://git.kernel.org/stable/c/aaf67de78807c59c35bafb5003d4fb457c764800