Bug 2355513 (CVE-2022-49755) - CVE-2022-49755 kernel: usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait
Summary: CVE-2022-49755 kernel: usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait
Keywords:
Status: NEW
Alias: CVE-2022-49755
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security DevOps Team
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-03-27 17:05 UTC by OSIDB Bzimport
Modified: 2025-03-28 04:43 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description OSIDB Bzimport 2025-03-27 17:05:01 UTC
In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait

While performing fast composition switch, there is a possibility that the
process of ffs_ep0_write/ffs_ep0_read get into a race condition
due to ep0req being freed up from functionfs_unbind.

Consider the scenario that the ffs_ep0_write calls the ffs_ep0_queue_wait
by taking a lock &ffs->ev.waitq.lock. However, the functionfs_unbind isn't
bounded so it can go ahead and mark the ep0req to NULL, and since there
is no NULL check in ffs_ep0_queue_wait we will end up in use-after-free.

Fix this by making a serialized execution between the two functions using
a mutex_lock(ffs->mutex).

Comment 2 Avinash Hanwate 2025-03-28 04:37:41 UTC
Upstream advisory:
https://lore.kernel.org/linux-cve-announce/2025032701-CVE-2022-49755-dfb6@gregkh/T


Note You need to log in before you can comment on or make changes to this bug.