CVE-2022-48822

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

7.8 high EPSS 0.27%

Published 16 Jul 2024 Updated 5 Aug 2026 CNA: Linux

Check your servers for CVE-2022-48822

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-48822 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Severity (CVSS)

7.8 high CVSS 3.1 from Linux (CNA)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attack vector
local: the attacker needs local access, or a user has to open a prepared file
Attack complexity
low: an attack works without special conditions
Privileges required
low: the attacker needs an ordinary user account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.27%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 21.2% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 10 Sep 2024):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
no: each attack takes manual steps
Technical impact
partial: limited control or limited data

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before 32048f4be071f9a6966744243f1786f45bb22dc2
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before cfe5f6fd335d882bcc829a1c8a7d462a455c626e
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before c9fc422c9a43e3d58d246334a71f3390401781dc
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before 0042178a69eb77a979e36a50dcce9794a3140ef8
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before 72a8aee863af099d4434314c4536d6c9a61dcf3c
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before 3e078b18753669615301d946297bafd69294ad2c
affected from a9e6f83c2df199187a5248f824f31b6787ae23ae, before ebe2b1add1055b903e2acd86b290a85297edc0b3
affected 5cd8f6788ff34999dbd4cbec81a6adfc215e1e60
affected from 4.8.10, before 4.9
Other versions: unaffected
Linux
affected 4.9
unaffected before 4.9
unaffected from 4.14.267 up to and including 4.14.*
unaffected from 4.19.230 up to and including 4.19.*
unaffected from 5.4.180 up to and including 5.4.*
unaffected from 5.10.101 up to and including 5.10.*
unaffected from 5.15.24 up to and including 5.15.*
unaffected from 5.16.10 up to and including 5.16.*
unaffected 5.17 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2022-48822 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2022-48822

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2022-48822
trivy image --scanners vuln IMAGE | grep CVE-2022-48822

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2022-48822 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.