mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: iommu: Clamp bypass config field to 0 or 1
The virtio spec says the device must never present a value other than 0 or 1 for bypass. Mask off the upper bits on write so a later read does not return whatever the driver wrote. Signed-off-by: Rob Bradford <rbradford@meta.com> Assisted-by: Claude:claude-opus-4-7
This commit is contained in:
@@ -1241,7 +1241,9 @@ impl VirtioDevice for Iommu {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.config.bypass = data[0];
|
// virtio spec says ignore bits 1-7 and that the device must
|
||||||
|
// never present a value other than 0 or 1.
|
||||||
|
self.config.bypass = data[0] & 1;
|
||||||
|
|
||||||
self.update_bypass();
|
self.update_bypass();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user