Skip to contentSkip to conversation

CVE-2025-40093: usb: gadget: f_ecm: Refactor bind path to use __free()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 30, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

usb: gadget: f_ecm: Refactor bind path to use __free()

After an bind/unbind cycle, the ecm->notify_req is left stale. If a subsequent bind fails, the unified error label attempts to free this stale request, leading to a NULL pointer dereference when accessing ep->ops->free_request.

Refactor the error handling in the bind path to use the __free() automatic cleanup mechanism.

The Linux kernel CVE team has assigned CVE-2025-40093 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 2.6.27 with commit da741b8c56d612b5dd26ffa31341911a5fea23ee and fixed in 6.1.158 with commit d3745aaef19198d0c81637a7dd50ef53c4f879b7
	Issue introduced in 2.6.27 with commit da741b8c56d612b5dd26ffa31341911a5fea23ee and fixed in 6.6.114 with commit 070f341d86cf2c098d63e484a86c7c1d2696a868
	Issue introduced in 2.6.27 with commit da741b8c56d612b5dd26ffa31341911a5fea23ee and fixed in 6.12.55 with commit 15b9faf53ba8719700596e7ef78879ce200e8c2e
	Issue introduced in 2.6.27 with commit da741b8c56d612b5dd26ffa31341911a5fea23ee and fixed in 6.17.5 with commit 4630c68bade82f087eaaab22e9a361da2f18d139
	Issue introduced in 2.6.27 with commit da741b8c56d612b5dd26ffa31341911a5fea23ee and fixed in 6.18-rc1 with commit 42988380ac67c76bb9dff8f77d7ef3eefd50b7b5

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-40093

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/usb/gadget/function/f_ecm.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/d3745aaef19198d0c81637a7dd50ef53c4f879b7
	https://git.kernel.org/stable/c/070f341d86cf2c098d63e484a86c7c1d2696a868
	https://git.kernel.org/stable/c/15b9faf53ba8719700596e7ef78879ce200e8c2e
	https://git.kernel.org/stable/c/4630c68bade82f087eaaab22e9a361da2f18d139
	https://git.kernel.org/stable/c/42988380ac67c76bb9dff8f77d7ef3eefd50b7b5