]> git.proxmox.com Git - mirror_qemu.git/commitdiff
usb: fix storage regression
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 13 Jul 2020 06:27:12 +0000 (08:27 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 16 Jul 2020 08:20:27 +0000 (10:20 +0200)
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")
Reported-by: Sai Pavan Boddu <saipava@xilinx.com>
Tested-by: Paul Zimmerman <pauldzim@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200713062712.1476-1-kraxel@redhat.com

hw/usb/dev-storage.c

index 2ed6a8df2413fe074771459a89d6ab5ec5892ce0..405a4ccfe700dcdc7edc1e1dda68e84c6dc9569a 100644 (file)
@@ -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;