Re: [PATCH] virtio: console: check the control packet size before parsing it

From
sashiko-bot@kernel.org
Date
2026-11-03 08:57:32
Reply to
Guanglei Zhu, 2026-11-03
The control queue handler hands whatever the host wrote to the
control queue straight to the parser:

	buf->len = min_t(size_t, len, buf->size);
	buf->offset = 0;

	handle_control_message(vq->vdev, portdev, buf);

handle_control_message() casts the start of the buffer to struct
virtio_console_control and reads the id, event and value fields
without ever looking at buf->len. A control packet shorter than the
structure makes the driver parse whatever bytes were left in the
reused buffer as a control header, and the uninitialized event then
drives the port state machine.

Drop control packets that are too short to hold the header.

Fixes: 17634ba25544 ("virtio: console: Add a new MULTIPORT feature, support for generic ports")
Cc: <redacted>
Signed-off-by: Guanglei Zhu <redacted>
Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103084156.426810-1-zhugl3@xiaopeng.com?part=1
Thread (6 messages) 6 messages, 3 authors, last reply 15d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help