linux/drivers/char
Jia Jia 894f98e739 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.

Fixes: a7a69ec0d8 ("virtio_console: free buffers after reset")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260819021230.292696-1-physicalmtea@gmail.com>
2026-09-07 18:54:02 -04:00
..
agp agp/amd-k7: Don't rely on address of pci_device_id 2026-07-28 11:18:24 -05:00
hw_random This update includes the following changes: 2026-08-19 17:25:42 -07:00
ipmi ipmi: Fix use-after-free of cmd_rcvr in _ipmi_destroy_user() 2026-08-25 18:55:02 -05:00
tpm tpm-buf: Add TPM buffer support header for standalone reuse 2026-08-25 18:13:37 +03:00
xilinx_hwicap char: xilinx_hwicap: unregister class on init errors 2026-07-17 16:22:57 +02:00
xillybus char: xillybus: Remove redundant dev_err() 2026-07-17 16:23:18 +02:00
adi.c char/adi: Use min_t(size_t,,) in adi_read() + adi_write() 2025-10-22 07:53:49 +02:00
apm-emulation.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
bsr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ds1620.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
dsp56k.c dsp56k: add missing MODULE_DESCRIPTION() macro 2024-07-03 16:40:26 +02:00
hangcheck-timer.c hangcheck-timer: fix coding style spacing 2025-11-26 15:11:15 +01:00
hpet.c hpet: Check ACPI_COMPANION() against NULL at probe time 2026-05-23 13:47:34 +02:00
Kconfig char: applicom: remove low-quality, unused driver 2026-05-23 13:47:34 +02:00
lp.c parport: Remove parport_driver.devmodel 2024-07-03 16:44:22 +02:00
Makefile char: applicom: remove low-quality, unused driver 2026-05-23 13:47:34 +02:00
mem.c mm/vma: eliminate mmap_action->error_hook, introduce error_override 2026-06-04 14:45:00 -07:00
misc_minor_kunit.c initramfs_test: use test init/exit hooks to override init fs 2026-07-31 12:56:51 +02:00
misc.c char: Use list_del_init() in misc_deregister() to reinitialize list pointer 2025-09-06 19:43:18 +02:00
nsc_gpio.c char: remove unnecessary module_init/exit functions 2026-04-02 17:05:53 +02:00
nvram.c char/nvram: Remove redundant nvram_mutex 2026-05-23 13:47:34 +02:00
nwbutton.c char: add missing NetWinder MODULE_DESCRIPTION() macros 2024-07-31 13:47:45 +02:00
nwbutton.h
nwflash.c char: add missing NetWinder MODULE_DESCRIPTION() macros 2024-07-31 13:47:45 +02:00
pc8736x_gpio.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
powernv-op-panel.c char: powernv-op-panel: remove unnecessary reset of position pointer 2026-07-17 15:53:21 +02:00
ppdev.c ppdev: prevent overflow when setting port timeout 2026-07-17 15:53:18 +02:00
ps3flash.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
random.c random: vDSO: Remove ifdeffery 2026-03-11 15:22:49 +01:00
scx200_gpio.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
sonypi.c sonypi: Stop setting acpi_device_name/class() 2026-07-09 16:44:07 +03:00
tlclk.c tlclk: if sscanf() fails, fall back to 0, not random value 2026-07-17 14:53:45 +02:00
toshiba.c
ttyprintk.c char: add missing MODULE_DESCRIPTION() macros 2024-06-04 17:40:17 +02:00
uv_mmtimer.c
virtio_console.c virtio_console: do not free control-out buffers on remove 2026-09-07 18:54:02 -04:00