From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <greg@kroah.com>,
Roger Whittaker <Roger.Whittaker@suse.com>,
Takashi Iwai <tiwai@suse.de>, Johan Hovold <johan@kernel.org>,
USB list <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] USB: Fix: Don't skip endpoint descriptors with maxpacket=0
Date: Mon, 6 Jan 2020 18:13:29 +0200 [thread overview]
Message-ID: <20200106161329.GA13373@pendragon.ideasonboard.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.2001061040270.1514-100000@iolanthe.rowland.org>
Hi Alan,
Thank you for the patch.
On Mon, Jan 06, 2020 at 10:43:42AM -0500, Alan Stern wrote:
> It turns out that even though endpoints with a maxpacket length of 0
> aren't useful for data transfer, the descriptors do serve other
> purposes. In particular, skipping them will also skip over other
> class-specific descriptors for classes such as UVC. This unexpected
> side effect has caused some UVC cameras to stop working.
>
> In addition, the USB spec requires that when isochronous endpoint
> descriptors are present in an interface's altsetting 0 (which is true
> on some devices), the maxpacket size _must_ be set to 0. Warning
> about such things seems like a bad idea.
>
> This patch updates an earlier commit which would log a warning and
> skip these endpoint descriptors. Now we only log a warning, and we
> don't even do that for isochronous endpoints in altsetting 0.
>
> We don't need to worry about preventing endpoints with maxpacket = 0
> from ever being used for data transfers; usb_submit_urb() already
> checks for this.
>
> Reported-and-tested-by: Roger Whittaker <Roger.Whittaker@suse.com>
> Fixes: d482c7bb0541 ("USB: Skip endpoints with 0 maxpacket length")
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Link: https://marc.info/?l=linux-usb&m=157790377329882&w=2
The patch looks good to me, so
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
But shouldn't we also warn if maxp != 0 && usb_endpoint_xfer_isoc(d) &&
asnum == 0 ?
> ---
>
>
> [as1928]
>
>
> drivers/usb/core/config.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> Index: usb-devel/drivers/usb/core/config.c
> ===================================================================
> --- usb-devel.orig/drivers/usb/core/config.c
> +++ usb-devel/drivers/usb/core/config.c
> @@ -346,12 +346,16 @@ static int usb_parse_endpoint(struct dev
> endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
> }
>
> - /* Validate the wMaxPacketSize field */
> + /*
> + * Validate the wMaxPacketSize field.
> + * Some devices have isochronous endpoints in altsetting 0;
> + * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0
> + * (see the end of section 5.6.3), so don't warn about them.
> + */
> maxp = usb_endpoint_maxp(&endpoint->desc);
> - if (maxp == 0) {
> - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n",
> + if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) {
> + dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n",
> cfgno, inum, asnum, d->bEndpointAddress);
> - goto skip_to_next_endpoint_or_interface_descriptor;
> }
>
> /* Find the highest legal maxpacket size for this endpoint */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2020-01-06 16:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200101144709.GA8389@suse.com>
[not found] ` <20200101172449.GF6226@pendragon.ideasonboard.com>
[not found] ` <20200101175220.GA18140@suse.com>
2020-01-01 18:35 ` Certain cameras no longer working with uvcvideo on recent (openSUSE) kernels Laurent Pinchart
2020-01-01 18:47 ` Greg KH
2020-01-01 20:09 ` Alan Stern
2020-01-02 11:20 ` Johan Hovold
2020-01-02 13:11 ` Takashi Iwai
2020-01-02 15:06 ` Alan Stern
2020-01-02 15:32 ` Johan Hovold
2020-01-02 18:24 ` Alan Stern
2020-01-02 16:38 ` Laurent Pinchart
2020-01-02 16:57 ` Roger Whittaker
2020-01-02 17:03 ` Laurent Pinchart
2020-01-02 17:49 ` Alan Stern
2020-01-02 21:51 ` Roger Whittaker
2020-01-02 23:11 ` Laurent Pinchart
2020-01-03 15:13 ` Alan Stern
2020-01-04 18:22 ` Laurent Pinchart
2020-01-05 12:28 ` Roger Whittaker
2020-01-06 15:43 ` [PATCH] USB: Fix: Don't skip endpoint descriptors with maxpacket=0 Alan Stern
2020-01-06 16:03 ` Johan Hovold
2020-01-06 16:17 ` Alan Stern
2020-01-06 19:12 ` Greg KH
2020-01-06 16:13 ` Laurent Pinchart [this message]
2020-01-06 16:21 ` Alan Stern
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=20200106161329.GA13373@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Roger.Whittaker@suse.com \
--cc=greg@kroah.com \
--cc=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tiwai@suse.de \
/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).