mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: rng: Skip device-readable descriptors
A device-readable descriptor anywhere in the chain caused the handler to reset the byte count to zero and abandon the rest of the chain. This discards valid device-writable descriptors that follow and misreports bytes already written to earlier descriptors. Skip device-readable and zero-length descriptors individually so the remaining device-writable buffers still get filled with entropy. Signed-off-by: Rob Bradford <rbradford@meta.com> Assisted-by: Claude:claude-opus-4-6
This commit is contained in:
@@ -64,14 +64,12 @@ impl RngEpollHandler {
|
||||
// report a used length of 0 to indicate failure.
|
||||
let mut total_len: usize = 0;
|
||||
while let Some(desc) = desc_chain.next() {
|
||||
if !desc.is_write_only() || desc.len() == 0 {
|
||||
warn!(
|
||||
"Skipping descriptor with write_only={} len={}",
|
||||
desc.is_write_only(),
|
||||
desc.len()
|
||||
);
|
||||
total_len = 0;
|
||||
break;
|
||||
if !desc.is_write_only() {
|
||||
warn!("Skipping device-readable descriptor");
|
||||
continue;
|
||||
}
|
||||
if desc.len() == 0 {
|
||||
continue;
|
||||
}
|
||||
let addr = match desc
|
||||
.addr()
|
||||
|
||||
Reference in New Issue
Block a user