[PATCH] USB MSD: Set s->req to NULL after handling a packet

Hannes Bredberg posted 1 patch 5 months, 1 week ago
Failed in applying to current master (apply log)
hw/usb/dev-storage.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] USB MSD: Set s->req to NULL after handling a packet
Posted by Hannes Bredberg 5 months, 1 week ago
This fixes compatibility for OSes which enqueue multiple data transfers
on the same endpoint without waiting for the previous one to be ACKed by
the mass storage device.

Signed-off-by: Hannes Bredberg <hannesbredberg@gmail.com>
---
 hw/usb/dev-storage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index b13fe345c4..43d57afd00 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -182,13 +182,14 @@ static void usb_msd_packet_complete(MSDState *s,
int status)
     USBPacket *p = s->packet;

     /*
-     * Set s->packet to NULL before calling usb_packet_complete
+     * Set s->packet and s->req to NULL before calling usb_packet_complete
      * because another request may be issued before
      * usb_packet_complete returns.
      */
     trace_usb_msd_packet_complete();
     p->status = status;
     s->packet = NULL;
+    s->req = NULL;
     usb_packet_complete(&s->dev, p);
 }

--
2.47.0
Re: [PATCH] USB MSD: Set s->req to NULL after handling a packet
Posted by Peter Maydell 5 months, 1 week ago
On Thu, 10 Jul 2025 at 18:54, Hannes Bredberg <hannesbredberg@gmail.com> wrote:
>
> This fixes compatibility for OSes which enqueue multiple data transfers
> on the same endpoint without waiting for the previous one to be ACKed by
> the mass storage device.

Which OSes are these? If there's a specific one that users
might be having problems with and we're fixing a bug for
them, that's worth noting.

thanks
-- PMM