CVE-2026-64345: usb: gadget: f_printer: take kref only for successful open

Greg Kroah-Hartman <[email protected]> Sat, 25 Jul 2026 10:49:22 +0200
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026072517-CVE-2026-64345-5069@gregkh>
From: Greg Kroah-Hartman <[email protected]>

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

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

usb: gadget: f_printer: take kref only for successful open

printer_open() returns -EBUSY when the character device is already
open, but it increments dev->kref regardless of the return value. VFS
does not call ->release() for a failed open, so every rejected second
open permanently leaks one reference.

Move kref_get() into the successful-open branch.

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


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

	Issue introduced in 5.10 with commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 and fixed in 5.10.261 with commit 94ec20d97aa51547965a539f660a1fe79c6929a3
	Issue introduced in 5.10 with commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 and fixed in 6.6.145 with commit 75c0ad13e136961328253742501b4efc3988a587
	Issue introduced in 5.10 with commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 and fixed in 6.12.96 with commit bf20c94fa6aaff945f0ae3a23f3212cd299f28d9
	Issue introduced in 5.10 with commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 and fixed in 6.18.39 with commit 8a5eba992c862b0c94411eecf9b7121e8636db38
	Issue introduced in 5.10 with commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 and fixed in 7.1.4 with commit 7f1f24c367938c5537e2308bf9a965f051d14774
	Issue introduced in 5.10 with commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 and fixed in 7.2-rc3 with commit 30adce93d5c4a5a1ec29d9249e3fdfcc391d406b
	Issue introduced in 4.4.241 with commit 25c95c6bd4dc50a3c20de0fa7f450ea02b2320fc
	Issue introduced in 4.9.241 with commit 4a47581cf010dc351d8069978080fdb000c0776d
	Issue introduced in 4.14.203 with commit d9fe88b2a38dc700bf5bd3a09c7cd11bbc248367
	Issue introduced in 4.19.154 with commit cedb0187b8ba929c3f76f28e6bc25804d65f8a54
	Issue introduced in 5.4.73 with commit e9e791f5c39ab30e374a3b1a9c25ca7ff24988f3
	Issue introduced in 5.8.17 with commit 34f026263889e2827e04acdc3a0eb9ecbd191ef0
	Issue introduced in 5.9.2 with commit 5f845e5d18d151230476cf90aa46449f69ba2ef1

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-64345
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_printer.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/94ec20d97aa51547965a539f660a1fe79c6929a3
	https://git.kernel.org/stable/c/75c0ad13e136961328253742501b4efc3988a587
	https://git.kernel.org/stable/c/bf20c94fa6aaff945f0ae3a23f3212cd299f28d9
	https://git.kernel.org/stable/c/8a5eba992c862b0c94411eecf9b7121e8636db38
	https://git.kernel.org/stable/c/7f1f24c367938c5537e2308bf9a965f051d14774
	https://git.kernel.org/stable/c/30adce93d5c4a5a1ec29d9249e3fdfcc391d406b