virtio_console: do not free control-out buffers on remove
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b · < a80c33488e0bbe642ed803b13a4ac8078a70b507| No fix yet |
| Linux Linux |
|
|
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.
From the CVE record · Linux
The Linux kernel’s virtio_console driver can read past a ports_device object when a device is unbound while a control message remains queued. This occurs during buffer cleanup; the input does not establish whether an unprivileged user can trigger it.
Engineers running Linux kernels with virtio_console should check whether their kernel includes the fix; affected versions are not specified.