aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-msd.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-05-04 16:49:56 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-05-04 16:55:15 +0200
commitef0bdf77d7070494692cbccd80c4c8f08c85c240 (patch)
treed2d05d81e156614e9dcb2466ffbc6ab276cd5e08 /hw/usb-msd.c
parent13a9a0d3e253e272744b523e39642c9b6d564f4d (diff)
usb: mass storage fix
Initialize scsi_len with zero when starting a new request, so any stuff leftover from the previous request is cleared out. This may happen in case the data returned by the scsi command doesn't fit into the buffer provided by the guest. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-msd.c')
-rw-r--r--hw/usb-msd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 93f4b78f3c..bd1c3a415f 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -364,6 +364,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
DPRINTF("Command tag 0x%x flags %08x len %d data %d\n",
s->tag, cbw.flags, cbw.cmd_len, s->data_len);
s->residue = 0;
+ s->scsi_len = 0;
s->scsi_dev->info->send_command(s->scsi_dev, s->tag, cbw.cmd, 0);
/* ??? Should check that USB and SCSI data transfer
directions match. */