CVE-2022-48822: usb: f_fs: Fix use-after-free for epfile
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.
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel use-after-free in USB FunctionFS. A race between disabling USB function endpoints and a userspace file release can leave the kernel using freed endpoint file memory. The source does not provide CVSS, confirmed impact, or active exploitation evidence.
Executive priority
Treat this as a targeted kernel maintenance issue, not a confirmed emergency. Prioritize patching for embedded, mobile, or appliance fleets that expose USB gadget FunctionFS to userspace. For standard servers without this functionality, validate exposure before escalating.
Technical view
The flaw is in usb f_fs endpoint file handling. During composition switching, ffs_func_eps_disable can keep a stale local epfile pointer while ffs_epfile_release and ffs_data_closed destroy ffs->epfiles. The fix protects endpoint-related structures and updates/destroys epfiles under spinlock.
Likely exposure
Exposure is most likely on Linux systems using USB gadget FunctionFS, such as embedded, mobile, appliance, or device-mode USB products. The source does not show broad remote server exposure or identify specific distributions beyond Linux kernel versions and stable commits.
Exploitation context
CISA KEV status is false in the source bundle, and no cited source reports active exploitation. The bundle describes a race condition, not an exploit path. Practical risk depends on local access to the relevant USB FunctionFS userspace path and kernel configuration.
Researcher notes
The public bundle lacks CVSS, CWE, exploitability analysis, and distribution-specific affected package data. The strongest evidence is the upstream kernel fix narrative and stable commit references. Avoid assuming privilege escalation or remote exploitation without additional vendor analysis.
Mitigation direction
Update to a kernel containing the referenced stable fixes.
Use distribution kernel advisories when running vendor-maintained kernels.
Prioritize devices using USB gadget FunctionFS or composition switching.
Restrict unnecessary FunctionFS or USB gadget functionality where operationally possible.
Check vendor guidance if immediate patching is not available.
Validation and detection
Inventory Linux kernel versions against the affected versions in the CVE record.
Confirm whether USB gadget FunctionFS is enabled and used.
Verify the running kernel includes the relevant stable fix commit.
Regression test USB gadget and composition-switching workflows after patching.
Review kernel crash reports for FunctionFS or USB gadget instability.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2022-48822 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.