From 620aaf234e238e1c0492147327e4c0177af395f2 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Tue, 17 Aug 2021 14:14:17 +0200 Subject: [PATCH] vfio_user: DmaUnmap expects a reply with payload The current code was expecting a reply with only the header, which wasn't reading the rest of payload that was provided. This was causing the following replies to be completely wrong as they were shifted by the previous payload that wasn't read. The simple way to fix this issue is by reading the header and the expected payload when getting a reply from a DmaUnmap request. Signed-off-by: Sebastien Boeuf --- vfio_user/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vfio_user/src/lib.rs b/vfio_user/src/lib.rs index d49721e2b..2b5ab4162 100644 --- a/vfio_user/src/lib.rs +++ b/vfio_user/src/lib.rs @@ -410,7 +410,7 @@ impl Client { .write_all(dma_unmap.as_slice()) .map_err(Error::StreamWrite)?; - let mut reply = Header::default(); + let mut reply = DmaUnmap::default(); self.stream .read_exact(reply.as_mut_slice()) .map_err(Error::StreamRead)?;