mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: iommu: Return NOENT for UNMAP on unknown domain
The virtio spec mandates VIRTIO_IOMMU_S_NOENT, not S_INVAL, when the target domain does not exist. Signed-off-by: Rob Bradford <rbradford@meta.com> Assisted-by: Claude:claude-opus-4-7
This commit is contained in:
@@ -621,7 +621,7 @@ impl Request {
|
||||
return Err(Error::InvalidUnmapRequestBypassDomain);
|
||||
}
|
||||
} else {
|
||||
status = VIRTIO_IOMMU_S_INVAL;
|
||||
status = VIRTIO_IOMMU_S_NOENT;
|
||||
return Err(Error::InvalidUnmapRequestMissingDomain);
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ impl Request {
|
||||
{
|
||||
let domains = mapping.domains.read().unwrap();
|
||||
let Some(domain) = domains.get(&domain_id) else {
|
||||
status = VIRTIO_IOMMU_S_INVAL;
|
||||
status = VIRTIO_IOMMU_S_NOENT;
|
||||
return Err(Error::InvalidUnmapRequestMissingDomain);
|
||||
};
|
||||
for (&start, m) in domain.mappings.iter() {
|
||||
@@ -678,7 +678,7 @@ impl Request {
|
||||
|
||||
let mut domains = mapping.domains.write().unwrap();
|
||||
let Some(domain) = domains.get_mut(&domain_id) else {
|
||||
status = VIRTIO_IOMMU_S_INVAL;
|
||||
status = VIRTIO_IOMMU_S_NOENT;
|
||||
return Err(Error::InvalidUnmapRequestMissingDomain);
|
||||
};
|
||||
domain
|
||||
|
||||
Reference in New Issue
Block a user