mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: console: Skip device-readable descriptors in input queue
The input queue handler wrote data to every descriptor without checking the write-only flag. The device must not write to device-readable buffers. Skip them with a warning. Signed-off-by: Rob Bradford <rbradford@meta.com> Assisted-by: Claude:claude-opus-4-6
This commit is contained in:
@@ -12,7 +12,7 @@ use std::{cmp, io, result};
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
use libc::{EFD_NONBLOCK, TIOCGWINSZ};
|
||||
use log::{error, info};
|
||||
use log::{error, info, warn};
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serial_buffer::SerialBuffer;
|
||||
@@ -213,6 +213,10 @@ impl ConsoleEpollHandler {
|
||||
if in_buffer.is_empty() {
|
||||
break;
|
||||
}
|
||||
if !desc.is_write_only() {
|
||||
warn!("Skipping device-readable descriptor on receiveq");
|
||||
continue;
|
||||
}
|
||||
let len = cmp::min(desc.len(), in_buffer.len() as u32);
|
||||
let source_slice = in_buffer.drain(..len as usize).collect::<Vec<u8>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user