CVE-2022-48822
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
16/07/2024
Last modified:
07/08/2024
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
usb: f_fs: Fix use-after-free for epfile<br />
<br />
Consider a case where ffs_func_eps_disable is called from<br />
ffs_func_disable as part of composition switch and at the<br />
same time ffs_epfile_release get called from userspace.<br />
ffs_epfile_release will free up the read buffer and call<br />
ffs_data_closed which in turn destroys ffs->epfiles and<br />
mark it as NULL. While this was happening the driver has<br />
already initialized the local epfile in ffs_func_eps_disable<br />
which is now freed and waiting to acquire the spinlock. Once<br />
spinlock is acquired the driver proceeds with the stale value<br />
of epfile and tries to free the already freed read buffer<br />
causing use-after-free.<br />
<br />
Following is the illustration of the race:<br />
<br />
CPU1 CPU2<br />
<br />
ffs_func_eps_disable<br />
epfiles (local copy)<br />
ffs_epfile_release<br />
ffs_data_closed<br />
if (last file closed)<br />
ffs_data_reset<br />
ffs_data_clear<br />
ffs_epfiles_destroy<br />
spin_lock<br />
dereference epfiles<br />
<br />
Fix this races by taking epfiles local copy & assigning it under<br />
spinlock and if epfiles(local) is null then update it in ffs->epfiles<br />
then finally destroy it.<br />
Extending the scope further from the race, protecting the ep related<br />
structures, and concurrent accesses.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.9 (including) | 4.14.267 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.15 (including) | 4.19.230 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.180 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.101 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.24 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.16.10 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/0042178a69eb77a979e36a50dcce9794a3140ef8
- https://git.kernel.org/stable/c/32048f4be071f9a6966744243f1786f45bb22dc2
- https://git.kernel.org/stable/c/3e078b18753669615301d946297bafd69294ad2c
- https://git.kernel.org/stable/c/72a8aee863af099d4434314c4536d6c9a61dcf3c
- https://git.kernel.org/stable/c/c9fc422c9a43e3d58d246334a71f3390401781dc
- https://git.kernel.org/stable/c/cfe5f6fd335d882bcc829a1c8a7d462a455c626e
- https://git.kernel.org/stable/c/ebe2b1add1055b903e2acd86b290a85297edc0b3



