CVE-2026-64242: usb: gadget: net2280: Fix double free in probe error path

Greg Kroah-Hartman <[email protected]> Fri, 24 Jul 2026 17:27:49 +0200
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026072442-CVE-2026-64242-29e0@gregkh>
From: Greg Kroah-Hartman <[email protected]>

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

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

usb: gadget: net2280: Fix double free in probe error path

usb_initialize_gadget() installs gadget_release() as the release
callback for the embedded gadget device.  The struct net2280 instance is
therefore released through gadget_release() when the gadget device's last
reference is dropped.

The probe error path calls net2280_remove(), which tears down the
partially initialized device and drops the gadget reference with
usb_put_gadget().  Calling kfree(dev) afterwards can free the same object
again.

Drop the explicit kfree() and let the gadget device release callback
handle the final free.  This issue was found by a static analysis tool
I am developing.

The Linux kernel CVE team has assigned CVE-2026-64242 to this issue.


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

	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 5.10.259 with commit 71b3391dc81655ff058492f8e9d013b2c6e5747b
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 5.15.210 with commit 550fa4d071a8c8e53072900869d37ae6abf4999d
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 6.1.176 with commit c5b9fdb1e8ddf50bc6272927edb118679f170350
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 6.6.143 with commit 085652fda7f38040d1a2c42d72614f418feb843f
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 6.12.93 with commit 48f89ead20e48d447ad29fa937b43b9fa981cf28
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 6.18.35 with commit e6f8be12f0307145b9a6010f044925952b37de8b
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 7.0.12 with commit db2b72e83a0208ae2b3b270bf91662b1c6849a9b
	Issue introduced in 5.10 with commit f770fbec4165b1acfabdeadb01ad6008d2c537b5 and fixed in 7.1 with commit c8547c74988e0b5f4cbb1b895e2a57aae084f070

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-2026-64242
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/udc/net2280.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/71b3391dc81655ff058492f8e9d013b2c6e5747b
	https://git.kernel.org/stable/c/550fa4d071a8c8e53072900869d37ae6abf4999d
	https://git.kernel.org/stable/c/c5b9fdb1e8ddf50bc6272927edb118679f170350
	https://git.kernel.org/stable/c/085652fda7f38040d1a2c42d72614f418feb843f
	https://git.kernel.org/stable/c/48f89ead20e48d447ad29fa937b43b9fa981cf28
	https://git.kernel.org/stable/c/e6f8be12f0307145b9a6010f044925952b37de8b
	https://git.kernel.org/stable/c/db2b72e83a0208ae2b3b270bf91662b1c6849a9b
	https://git.kernel.org/stable/c/c8547c74988e0b5f4cbb1b895e2a57aae084f070