# CVE-2022-48822: usb: f_fs: Fix use-after-free for epfile

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.27%, higher than 21% of CVEs (2026-12-01)
- Published: 2024-07-16T11:44:08.638Z
- Modified: 2026-08-05T08:52:31.008Z
- Weaknesses: CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

usb: f_fs: Fix use-after-free for epfile

Consider a case where ffs_func_eps_disable is called from
ffs_func_disable as part of composition switch and at the
same time ffs_epfile_release get called from userspace.
ffs_epfile_release will free up the read buffer and call
ffs_data_closed which in turn destroys ffs->epfiles and
mark it as NULL. While this was happening the driver has
already initialized the local epfile in ffs_func_eps_disable
which is now freed and waiting to acquire the spinlock. Once
spinlock is acquired the driver proceeds with the stale value
of epfile and tries to free the already freed read buffer
causing use-after-free.

Following is the illustration of the race:

      CPU1                                  CPU2

   ffs_func_eps_disable
   epfiles (local copy)
					ffs_epfile_release
					ffs_data_closed
					if (last file closed)
					ffs_data_reset
					ffs_data_clear
					ffs_epfiles_destroy
spin_lock
dereference epfiles

Fix this races by taking epfiles local copy & assigning it under
spinlock and if epfiles(local) is null then update it in ffs->epfiles
then finally destroy it.
Extending the scope further from the race, protecting the ep related
structures, and concurrent accesses.

(As written by CVE List.)

## Affected

- Linux Linux: from a9e6f83c2df199187a5248f824f31b6787ae23ae before 32048f4be071f9a6966744243f1786f45bb22dc2; from a9e6f83c2df199187a5248f824f31b6787ae23ae before cfe5f6fd335d882bcc829a1c8a7d462a455c626e; from a9e6f83c2df199187a5248f824f31b6787ae23ae before c9fc422c9a43e3d58d246334a71f3390401781dc; from a9e6f83c2df199187a5248f824f31b6787ae23ae before 0042178a69eb77a979e36a50dcce9794a3140ef8; from a9e6f83c2df199187a5248f824f31b6787ae23ae before 72a8aee863af099d4434314c4536d6c9a61dcf3c; from a9e6f83c2df199187a5248f824f31b6787ae23ae before 3e078b18753669615301d946297bafd69294ad2c; from a9e6f83c2df199187a5248f824f31b6787ae23ae before ebe2b1add1055b903e2acd86b290a85297edc0b3; 5cd8f6788ff34999dbd4cbec81a6adfc215e1e60; from 4.8.10 before 4.9; 4.9 (not affected: before 4.9; from 4.14.267 up to 4.14.*; from 4.19.230 up to 4.19.*; from 5.4.180 up to 5.4.*; from 5.10.101 up to 5.10.*; from 5.15.24 up to 5.15.*; from 5.16.10 up to 5.16.*; from 5.17 up to *)
- linux linux_kernel: from 4.9 before 4.14.267; from 4.15 before 4.19.230; from 4.20 before 5.4.180; from 5.5 before 5.10.101; from 5.11 before 5.15.24; from 5.16 before 5.16.10

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/32048f4be071f9a6966744243f1786f45bb22dc2> (patch)
- <https://git.kernel.org/stable/c/cfe5f6fd335d882bcc829a1c8a7d462a455c626e> (patch)
- <https://git.kernel.org/stable/c/c9fc422c9a43e3d58d246334a71f3390401781dc> (patch)
- <https://git.kernel.org/stable/c/0042178a69eb77a979e36a50dcce9794a3140ef8> (patch)
- <https://git.kernel.org/stable/c/72a8aee863af099d4434314c4536d6c9a61dcf3c> (patch)
- <https://git.kernel.org/stable/c/3e078b18753669615301d946297bafd69294ad2c> (patch)
- <https://git.kernel.org/stable/c/ebe2b1add1055b903e2acd86b290a85297edc0b3> (patch)

## Sources

- CVE List: [CVE-2022-48822](https://www.cve.org/CVERecord?id=CVE-2022-48822), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2022-48822](https://nvd.nist.gov/vuln/detail/CVE-2022-48822), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2022-48822 · Whole record: https://cve.day/CVE-2022-48822.json · Rebuilt by cve.day 2026-11-25T22:58:19.901Z
