From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, Johan Hovold <johan@kernel.org>
Subject: [PATCH 3/4] staging: gigaset: add endpoint-type sanity check
Date: Fri, 29 Nov 2019 11:17:52 +0100 [thread overview]
Message-ID: <20191129101753.9721-4-johan@kernel.org> (raw)
In-Reply-To: <20191129101753.9721-1-johan@kernel.org>
Add endpoint type-sanity checks to prevent a warning in USB core on URB
submission.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/staging/isdn/gigaset/usb-gigaset.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/staging/isdn/gigaset/usb-gigaset.c b/drivers/staging/isdn/gigaset/usb-gigaset.c
index a84722d83bc6..6c07c8379711 100644
--- a/drivers/staging/isdn/gigaset/usb-gigaset.c
+++ b/drivers/staging/isdn/gigaset/usb-gigaset.c
@@ -705,6 +705,12 @@ static int gigaset_probe(struct usb_interface *interface,
endpoint = &hostif->endpoint[0].desc;
+ if (!usb_endpoint_dir_out(endpoint) || !usb_endpoint_xfer_bulk(endpoint)) {
+ dev_err(&interface->dev, "missing bulk-out endpoint\n");
+ retval = -ENODEV;
+ goto error;
+ }
+
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
ucs->bulk_out_size = buffer_size;
ucs->bulk_out_epnum = usb_endpoint_num(endpoint);
@@ -724,6 +730,12 @@ static int gigaset_probe(struct usb_interface *interface,
endpoint = &hostif->endpoint[1].desc;
+ if (!usb_endpoint_dir_in(endpoint) || !usb_endpoint_xfer_int(endpoint)) {
+ dev_err(&interface->dev, "missing int-in endpoint\n");
+ retval = -ENODEV;
+ goto error;
+ }
+
ucs->busy = 0;
ucs->read_urb = usb_alloc_urb(0, GFP_KERNEL);
--
2.24.0
next prev parent reply other threads:[~2019-11-29 10:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-29 10:17 [PATCH 0/4] staging: gigaset: fix crashes on probe Johan Hovold
2019-11-29 10:17 ` [PATCH 1/4] staging: gigaset: fix general protection fault " Johan Hovold
[not found] ` <20191201001505.964E72075A@mail.kernel.org>
2019-12-01 12:30 ` Tilman Schmidt
2019-12-01 12:41 ` Greg Kroah-Hartman
2019-12-01 13:04 ` Johan Hovold
2019-11-29 10:17 ` [PATCH 2/4] staging: gigaset: fix illegal free on probe errors Johan Hovold
2019-11-29 10:17 ` Johan Hovold [this message]
2019-11-29 10:17 ` [PATCH 4/4] staging: gigaset: rename endpoint-descriptor identifier Johan Hovold
2019-11-29 13:32 ` [PATCH 0/4] staging: gigaset: fix crashes on probe Greg Kroah-Hartman
2019-11-29 13:51 ` Johan Hovold
2019-11-29 14:23 ` Greg Kroah-Hartman
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=20191129101753.9721-4-johan@kernel.org \
--to=johan@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.