CVE-2022-48822

Source
https://cve.org/CVERecord?id=CVE-2022-48822
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-48822.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2022-48822
Downstream
Related
Published
2024-07-16T11:44:08.638Z
Modified
2026-03-14T11:56:21.021772Z
Summary
usb: f_fs: Fix use-after-free for epfile
Details

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

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

Consider a case where ffsfuncepsdisable is called from ffsfuncdisable as part of composition switch and at the same time ffsepfilerelease get called from userspace. ffsepfilerelease will free up the read buffer and call ffsdataclosed which in turn destroys ffs->epfiles and mark it as NULL. While this was happening the driver has already initialized the local epfile in ffsfuncepsdisable 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

ffsfuncepsdisable epfiles (local copy) ffsepfilerelease ffsdataclosed if (last file closed) ffsdatareset ffsdataclear ffsepfilesdestroy spinlock 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.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/48xxx/CVE-2022-48822.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
a9e6f83c2df199187a5248f824f31b6787ae23ae
Fixed
32048f4be071f9a6966744243f1786f45bb22dc2
Fixed
cfe5f6fd335d882bcc829a1c8a7d462a455c626e
Fixed
c9fc422c9a43e3d58d246334a71f3390401781dc
Fixed
0042178a69eb77a979e36a50dcce9794a3140ef8
Fixed
72a8aee863af099d4434314c4536d6c9a61dcf3c
Fixed
3e078b18753669615301d946297bafd69294ad2c
Fixed
ebe2b1add1055b903e2acd86b290a85297edc0b3
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
5cd8f6788ff34999dbd4cbec81a6adfc215e1e60

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-48822.json"