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 <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2021-08-17 14:14:17 +02:00 committed by Bo Chen
parent 86b2c17135
commit 620aaf234e

View File

@ -410,7 +410,7 @@ impl Client {
.write_all(dma_unmap.as_slice()) .write_all(dma_unmap.as_slice())
.map_err(Error::StreamWrite)?; .map_err(Error::StreamWrite)?;
let mut reply = Header::default(); let mut reply = DmaUnmap::default();
self.stream self.stream
.read_exact(reply.as_mut_slice()) .read_exact(reply.as_mut_slice())
.map_err(Error::StreamRead)?; .map_err(Error::StreamRead)?;