From: Qiang Liu <cyruscyliu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Qiang Liu <cyruscyliu@gmail.com>,
Paul Zimmerman <pauldzim@gmail.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH] hw/usb/core: fix inconsistent ep and pid (UBS_TOKEN_SETUP)
Date: Sun, 29 Jan 2023 18:54:06 +0800 [thread overview]
Message-ID: <20230129105406.2548988-1-cyruscyliu@gmail.com> (raw)
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 <pauldzim@gmail.com>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
---
hw/usb/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/core.c b/hw/usb/core.c
index 975f76250a..eb50a7bff8 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -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);
--
2.25.1
next reply other threads:[~2023-01-29 11:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 10:54 Qiang Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-01-30 11:55 [PATCH] hw/usb/core: fix inconsistent ep and pid (UBS_TOKEN_SETUP) Qiang Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230129105406.2548988-1-cyruscyliu@gmail.com \
--to=cyruscyliu@gmail.com \
--cc=kraxel@redhat.com \
--cc=pauldzim@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).