mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
net_util: queue_pair: Avoid panic and handle error properly
This panic was triggered with fuzzing on the virtio-net device. This commits handles the error explicitly to avoid the panic, which also makes the fuzzer happy (as panic is treated as bugs). Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
7c3110e6d5
commit
4d9a2b17a7
@ -186,7 +186,7 @@ impl RxVirtio {
|
||||
.translate_gva(access_platform, desc.len() as usize),
|
||||
10,
|
||||
)
|
||||
.unwrap();
|
||||
.ok_or(NetQueuePairError::DescriptorInvalidHeader)?;
|
||||
let mut next_desc = Some(desc);
|
||||
|
||||
let mut iovecs = Vec::new();
|
||||
@ -314,6 +314,8 @@ pub enum NetQueuePairError {
|
||||
QueueEnableNotification(virtio_queue::Error),
|
||||
#[error("Failed to add used index to the queue: {0}")]
|
||||
QueueAddUsed(virtio_queue::Error),
|
||||
#[error("Descriptor with invalid virtio-net header")]
|
||||
DescriptorInvalidHeader,
|
||||
}
|
||||
|
||||
pub struct NetQueuePair {
|
||||
|
Loading…
x
Reference in New Issue
Block a user