From 26006974e814d7285bd4944f14681ffb2d7c4b86 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Mon, 4 Apr 2022 14:43:36 +0200 Subject: [PATCH] virtio-devices: iommu: Error out if couldn't translate address It doesn't matter if we're trying to translate a GVA or a GPA address, but in both cases we must error out if the address couldn't be translated. Signed-off-by: Sebastien Boeuf --- virtio-devices/src/iommu.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/virtio-devices/src/iommu.rs b/virtio-devices/src/iommu.rs index 25f513fde..75a3daa5d 100644 --- a/virtio-devices/src/iommu.rs +++ b/virtio-devices/src/iommu.rs @@ -702,8 +702,10 @@ impl DmaRemapping for IommuMapping { } } - debug!("Into same addr..."); - Ok(addr) + Err(io::Error::new( + io::ErrorKind::Other, + format!("failed to translate GVA addr 0x{:x}", addr), + )) } fn translate_gpa(&self, id: u32, addr: u64) -> std::result::Result { @@ -720,8 +722,10 @@ impl DmaRemapping for IommuMapping { } } - debug!("Into same addr..."); - Ok(addr) + Err(io::Error::new( + io::ErrorKind::Other, + format!("failed to translate GPA addr 0x{:x}", addr), + )) } }