block: fix status value size

As per VirtIO spec 1.2 section 5.2.6, the `status` field is a byte, not
u32. cloud-hypervisor writes an `u32` to guest memory, which
accidentally zeros out the following 3 bytes, and may corrupt guest OS
internal state.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
Changyuan Lyu
2024-07-12 22:54:12 -07:00
committed by Liu Wei
parent d89f1f4f21
commit bc6acb842f
3 changed files with 7 additions and 6 deletions

View File

@@ -148,7 +148,7 @@ impl VhostUserBlkThread {
) {
Ok(l) => {
len = l;
VIRTIO_BLK_S_OK
VIRTIO_BLK_S_OK as u8
}
Err(e) => {
len = 1;