hw/usb/core: fix inconsistent ep and pid (UBS_TOKEN_SETUP)
PATCH 1/1 hw/usb/core: fix inconsistent ep and pid (UBS_TOKEN_SETUP)
Sometimes, ep is not enforced to 0 when pid is USB_TOKEN_SETUP. I trigger this through dwc2
(https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg07179.html).
A similar bug was found [here](https://gitlab.com/qemu-project/qemu/-/issues/119) and [here](https://gitlab.com/qemu-project/qemu/-/issues/303).
Fixes 25d5de7d81a5 ("usb: link packets to endpoints not devices")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/119
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/303
Cc Paul Zimmerman <[email protected]>
Signed-off-by Qiang Liu <[email protected]>
--- hw/usb/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/core.c +1 -1
@@ -738,7 +738,7 @@ struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep)struct USBEndpoint *eps;assert (dev !=NULL ); -if (ep ==0 ) { +if (ep ==0 || pid ==USB_TOKEN_SETUP ) {return &dev->ep_ctl; }assert (pid ==USB_TOKEN_IN || pid ==USB_TOKEN_OUT );
Signature · 1 line
2.25.1