From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
linux-usb@vger.kernel.org
Cc: John Youn <John.Youn@synopsys.com>,
Robert Baldyga <r.baldyga@samsung.com>,
Felipe Balbi <balbi@ti.com>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: [PATCH v3] usb: dwc2: Fix in ISOC request length checking
Date: Wed, 15 Jan 2020 09:55:40 +0400 [thread overview]
Message-ID: <8c5bd0c646737fe97770d33355b8e197ea28f303.1579067350.git.hminas@synopsys.com> (raw)
Moved ISOC request length checking from dwc2_hsotg_start_req() function to
dwc2_hsotg_ep_queue().
Fixes: 4fca54aa58293 ("usb: gadget: s3c-hsotg: add multi count support")
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
Changes for v3:
- Fix commit message format
Changes for v2:
- Fix typo in commit message
- Fix tags formatting
drivers/usb/dwc2/gadget.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 88f7d6d4ff2d..7b40cf5bdc2f 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1083,11 +1083,6 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg,
else
packets = 1; /* send one packet if length is zero. */
- if (hs_ep->isochronous && length > (hs_ep->mc * hs_ep->ep.maxpacket)) {
- dev_err(hsotg->dev, "req length > maxpacket*mc\n");
- return;
- }
-
if (dir_in && index != 0)
if (hs_ep->isochronous)
epsize = DXEPTSIZ_MC(packets);
@@ -1391,6 +1386,13 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
req->actual = 0;
req->status = -EINPROGRESS;
+ /* Don't queue ISOC request if length greater than mps*mc */
+ if (hs_ep->isochronous &&
+ req->length > (hs_ep->mc * hs_ep->ep.maxpacket)) {
+ dev_err(hs->dev, "req length > maxpacket*mc\n");
+ return -EINVAL;
+ }
+
/* In DDMA mode for ISOC's don't queue request if length greater
* than descriptor limits.
*/
--
2.11.0
next reply other threads:[~2020-01-15 5:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 5:55 Minas Harutyunyan [this message]
2020-01-21 10:24 [PATCH v3] usb: dwc2: Fix in ISOC request length checking Minas Harutyunyan
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=8c5bd0c646737fe97770d33355b8e197ea28f303.1579067350.git.hminas@synopsys.com \
--to=minas.harutyunyan@synopsys.com \
--cc=John.Youn@synopsys.com \
--cc=balbi@kernel.org \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-usb@vger.kernel.org \
--cc=r.baldyga@samsung.com \
/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).