Skip to contentSkip to conversation

CVE-2026-97995: virtio_console: do not free control-out buffers on remove

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Sep 25

lore
Share & tools
lore
#0 lore raw

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

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

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

virtio_console: do not free control-out buffers on remove

__send_control_msg() publishes &portdev->cpkt as the control-out virtqueue cookie. remove_vqs() walks every virtqueue and passes leftover cookies to free_buf(), which treats them as struct port_buffer and reads sgpages.

If a control message is still on c_ovq when the device is unbound, free_buf() reads past the ports_device object.

KASAN reported slab-out-of-bounds in free_buf():

free_buf
remove_vqs
virtcons_remove
unbind_store

The object was the ports_device allocated in virtcons_probe().

Drain c_ovq without freeing. The packet lives in portdev and is released with it.

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

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

	Issue introduced in 4.17 with commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b and fixed in 6.12.111 with commit 177ee901aa2bab02e7f1f8edbb814fd5e386ed62
	Issue introduced in 4.17 with commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b and fixed in 6.18.53 with commit a80c33488e0bbe642ed803b13a4ac8078a70b507
	Issue introduced in 4.17 with commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b and fixed in 7.2.7 with commit f620c40ea6862feed84deb105568b21ec53a7830
	Issue introduced in 4.17 with commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b and fixed in 7.3-rc3 with commit 894f98e73983f37354214a89a3a7fd35bf9e3072
	Issue introduced in 3.16.60 with commit f92b16b815efe8207090a9b5a767618fd89542ca
	Issue introduced in 3.18.108 with commit d2bbfac82b7942afc5d8e564d7087835280df495
	Issue introduced in 4.1.52 with commit a88e13d9a092fbb772d380944b44eb549ef131fe
	Issue introduced in 4.4.131 with commit dd807a784fd36f4136516d5858efb6473dda422c
	Issue introduced in 4.9.98 with commit 47cb14192bcbba3f15b1c3561e05e084e56fdef6
	Issue introduced in 4.14.39 with commit 6b1c41a0f7183702abb7a104c6c7e196ad69a6b3
	Issue introduced in 4.16.7 with commit 9037306163a6ba5587e4b5ca511ac7be4fb7295b

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-97995

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/char/virtio_console.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/177ee901aa2bab02e7f1f8edbb814fd5e386ed62
	https://git.kernel.org/stable/c/a80c33488e0bbe642ed803b13a4ac8078a70b507
	https://git.kernel.org/stable/c/f620c40ea6862feed84deb105568b21ec53a7830
	https://git.kernel.org/stable/c/894f98e73983f37354214a89a3a7fd35bf9e3072