diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-12-09 23:31:49 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-01-11 17:15:24 +0100 |
commit | fa7935c1e1f84b600fcb1983485352b8d99e01d3 (patch) | |
tree | 3bd65021279bbdbf1827a5ea3869a875418db396 /hw/usb-msd.c | |
parent | ab4797ad2ec34e63ee8751fbd3e5d0a9888eaf4a (diff) |
usb storage: handle long responses
The scsi layer may return us more data than the guests wants to have.
Handle this by just ignoring the extra bytes and calling the
{read,write}_data callback to finish the request.
Seen happening in real life with some extended inquiry command.
With this patch applied the linux kernel stops reseting the device
once at boot.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-msd.c')
-rw-r--r-- | hw/usb-msd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c index 28c12dd632..729d96ccc3 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -187,7 +187,7 @@ static void usb_msd_copy_data(MSDState *s) s->usb_buf += len; s->scsi_buf += len; s->data_len -= len; - if (s->scsi_len == 0) { + if (s->scsi_len == 0 || s->data_len == 0) { if (s->mode == USB_MSDM_DATAIN) { s->scsi_dev->info->read_data(s->scsi_dev, s->tag); } else if (s->mode == USB_MSDM_DATAOUT) { @@ -434,7 +434,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p) break; case USB_MSDM_DATAIN: - DPRINTF("Data in %d/%d\n", len, s->data_len); + DPRINTF("Data in %d/%d, scsi_len %d\n", len, s->data_len, s->scsi_len); if (len > s->data_len) len = s->data_len; s->usb_buf = data; |