Skip to contentSkip to conversation

usb: fix storage regression

PATCH New Gerd Hoffmann 1 participant 1 message Jul 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: fix storage regression

Fix the contition to figure whenever we need to wait for more data or not. Simply check the mode, if we are not in DATAIN state any more we are done already and don't need to go ASYNC.

Fixes 7ad3d51ebb8a ("usb: add short-packet handling to usb-storage driver")
---
 hw/usb/dev-storage.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/usb/dev-storage.c +1 -2
index 2ed6a8df2413..405a4ccfe700 100644
@@ -546,8 +546,7 @@ static void usb_msd_handle_data(USBDevice *dev, USBPacket *p)
                     }
                 }
             }
-            if (p->actual_length < p->iov.size && (p->short_not_ok ||
-                    s->scsi_len >= p->ep->max_packet_size)) {
+            if (p->actual_length < p->iov.size && s->mode == USB_MSDM_DATAIN) {
                 DPRINTF("Deferring packet %p [wait data-in]\n", p);
                 s->packet = p;
                 p->status = USB_RET_ASYNC;
Signature · 1 line
2.18.4