diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-10 12:18:03 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-11-12 15:00:27 +0100 |
commit | c8dcb531bcd37a4a81d2cc08a89fcd19c34348f9 (patch) | |
tree | c1721b0421027780d7c6e21e32cbd47fa5f66a56 /qemu-file.h | |
parent | 3c5645fab3c4b65d0cffbe1aaafc787e4be63d0f (diff) |
scsi: do not return short responses for emulated commands
The inquiry command, for the case of VPD=1, was returning short
responses; the number of returned bytes was just the number of bytes
in the request, without padding to the specified allocation length
with zero bytes. This is usually harmless, but it is a violation
of the SCSI specification.
To fix this, always pad with zero bytes to r->cmd.xfer in
scsi_disk_emulate_command, and return at most r->buflen bytes
(the size of the buffer for command data) rather than at most
buflen bytes (the number of bytes that was filled in).
Before this patch, "strace sg_inq -p0x83 /dev/sda" would report a
non-zero resid value. After this patch, it reports resid=0.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-file.h')
0 files changed, 0 insertions, 0 deletions