mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
net_util: fix ctrl_queue used_len to only count written bytes
The control queue handler passed the total length of all descriptors (header + data + status) as used_len to add_used. Per virtio spec section 2.6.8, used_len must only count bytes written to device-writable descriptors. The device only writes the 1-byte status/ack field. Windows NetKVM >= 0.1.285 strictly checks this value and calls NdisMRemoveMiniport when len != sizeof(virtio_net_ctrl_ack), removing the network adapter immediately after activation. Signed-off-by: CMGS <ilskdw@gmail.com>
This commit is contained in:
@@ -171,7 +171,9 @@ impl CtrlQueue {
|
||||
.translate_gva(access_platform, status_desc.len() as usize),
|
||||
)
|
||||
.map_err(Error::GuestMemory)?;
|
||||
let len = ctrl_desc.len() + data_desc.len() + status_desc.len();
|
||||
// Per virtio spec 2.6.8, used_len is the number of bytes written
|
||||
// to device-writable descriptors. Only the status byte is written.
|
||||
let len = status_desc.len();
|
||||
|
||||
queue
|
||||
.add_used(desc_chain.memory(), desc_chain.head_index(), len)
|
||||
|
||||
Reference in New Issue
Block a user