CVE-2026-97995: virtio_console: do not free control-out buffers on remove
In the Linux kernel, the following vulnerability has been resolved:
virtioconsole: do not free control-out buffers on remove
sendcontrolmsg() publishes &portdev->cpkt as the control-out virtqueue cookie. removevqs() walks every virtqueue and passes leftover cookies to freebuf(), which treats them as struct portbuffer and reads sgpages.
If a control message is still on covq when the device is unbound, freebuf() reads past the portsdevice object.
KASAN reported slab-out-of-bounds in freebuf():
freebuf removevqs virtconsremove unbindstore
The object was the portsdevice allocated in virtconsprobe().
Drain covq without freeing. The packet lives in portdev and is released with it.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
When unbinding or removing a virtio_console device, drain c_ovq without freeing the control-out buffers.
Event History
Frequently Asked Questions
When can this issue be triggered?
It can be triggered when a virtio-console device is unbound while a control message remains pending on the control-out virtqueue (c_ovq). During virtqueue removal, the leftover control-message cookie is incorrectly handled as a port buffer.
What evidence indicates that a system may have encountered this bug?
KASAN can report a slab-out-of-bounds read in free_buf(), with a call path involving remove_vqs(), virtcons_remove(), and unbind_store. The out-of-bounds access involves a ports_device object allocated by virtcons_probe().
What is the relevant mitigation if the corrected kernel is not yet available?
Avoid unbinding virtio-console devices while control messages may still be pending on c_ovq. The resolved behavior drains c_ovq without passing its control-out packet to free_buf().