From: Zheyu Ma <zheyuma97@gmail.com>
To: eli.billauer@gmail.com, arnd@arndb.de, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, Zheyu Ma <zheyuma97@gmail.com>
Subject: [PATCH] char: xillybus: Check endpoint type properly
Date: Sat, 14 May 2022 15:14:35 +0800 [thread overview]
Message-ID: <20220514071436.2517776-1-zheyuma97@gmail.com> (raw)
The driver submits bulk urb without checking the endpoint type is
actually bulk.
[ 3.108411] ------------[ cut here ]------------
[ 3.108690] usb 1-1: BOGUS urb xfer, pipe 3 != type 1
[ 3.108983] WARNING: CPU: 0 PID: 211 at drivers/usb/core/urb.c:503 usb_submit_urb+0xcd9/0x18b0
[ 3.110976] RIP: 0010:usb_submit_urb+0xcd9/0x18b0
[ 3.115318] Call Trace:
[ 3.115452] <TASK>
[ 3.115570] try_queue_bulk_in+0x43c/0x6e0 [xillyusb]
[ 3.115838] xillyusb_probe+0x488/0x1230 [xillyusb]
Add a check to fix it.
Fixes: a53d1202aef1 ("char: xillybus: Add driver for XillyUSB (Xillybus variant for USB)")
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
drivers/char/xillybus/xillyusb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
index 39bcbfd908b4..2ec2e087b2e7 100644
--- a/drivers/char/xillybus/xillyusb.c
+++ b/drivers/char/xillybus/xillyusb.c
@@ -730,6 +730,11 @@ static void try_queue_bulk_in(struct xillyusb_endpoint *ep)
usb_anchor_urb(urb, &ep->anchor);
+ if (usb_urb_ep_type_check(urb)) {
+ report_io_error(xdev, -EINVAL);
+ goto unanchor;
+ }
+
rc = usb_submit_urb(urb, GFP_KERNEL);
if (rc) {
@@ -834,6 +839,11 @@ static void try_queue_bulk_out(struct xillyusb_endpoint *ep)
usb_anchor_urb(urb, &ep->anchor);
+ if (usb_urb_ep_type_check(urb)) {
+ report_io_error(xdev, -EINVAL);
+ goto unanchor;
+ }
+
rc = usb_submit_urb(urb, GFP_KERNEL);
if (rc) {
--
2.25.1
next reply other threads:[~2022-05-14 7:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-14 7:14 Zheyu Ma [this message]
2022-05-14 7:18 ` Greg KH
2022-05-14 11:48 ` [PATCH v2] char: xillybus: Check endpoint type before allocing Zheyu Ma
2022-05-14 12:52 ` Eli Billauer
2022-05-14 13:24 ` Greg KH
2022-05-14 13:32 ` Greg KH
2022-05-20 3:32 ` Zheyu Ma
2022-05-20 5:41 ` Greg KH
2022-05-22 5:06 ` Zheyu Ma
2022-05-23 16:06 ` Greg KH
2022-05-23 17:05 ` Eli Billauer
2022-05-23 17:15 ` Greg KH
2022-05-24 12:23 ` Eli Billauer
2022-05-26 12:02 ` Zheyu Ma
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=20220514071436.2517776-1-zheyuma97@gmail.com \
--to=zheyuma97@gmail.com \
--cc=arnd@arndb.de \
--cc=eli.billauer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®