public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Johan Hovold <johan@kernel.org>
Cc: Greg KH <greg@kroah.com>, "Geoffrey D. Bennett" <g@b4.vu>,
	USB mailing list <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] USB: core: WARN if pipe direction != setup packet direction
Date: Fri, 21 May 2021 10:41:42 -0400	[thread overview]
Message-ID: <20210521144142.GD1239965@rowland.harvard.edu> (raw)
In-Reply-To: <YKey+pWP8iKkCV1Q@hovoldconsulting.com>

On Fri, May 21, 2021 at 03:17:46PM +0200, Johan Hovold wrote:
> On Fri, May 21, 2021 at 10:03:26AM +0200, Johan Hovold wrote:
> > So first, this should probably be rate limited.
> 
> This could actually be done using WARN_ON_ONCE() as we don't have to
> worry about syzbot fuzzing descriptors here (all control endpoints are
> bidirectional).
> 
> > Second, did you try to estimate how many call sites that get this wrong?
> > I always felt a bit pedantic when pointing out that the pipe direction
> > should match the request type to driver author's during review when (in
> > almost all cases?) this hasn't really mattered. I fear we may have
> > accumulated a fairly large number of these mismatches over the years but
> > I haven't verified that.
> 
> I did a quick review of all ctrlpipe-macro uses in usb/misc and
> usb/serial and found two instances.
> 
> A simple grep pattern looking for explicit USB_DIR/ctrlpipe mismatches
> caught another five tree wide (not including the
> sound/usb/mixer_scarlett_gen2.c which Geoffrey reported), but there are
> likely more of those out there as the request type is often not that
> explicit.
> 
> I've prepared patches for the above, excluding the sound driver Geoffrey
> said he was fixing.

Many thanks for making the effort to do this.

Alan Stern

  reply	other threads:[~2021-05-21 14:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 20:20 [PATCH] USB: core: WARN if pipe direction != setup packet direction Alan Stern
2021-05-21  8:03 ` Johan Hovold
2021-05-21 12:14   ` Greg KH
2021-05-21 13:17   ` Johan Hovold
2021-05-21 14:41     ` Alan Stern [this message]
2021-05-22  2:16     ` [PATCH v2] " Alan Stern
2021-05-22  7:56       ` Johan Hovold
2021-05-24 11:39       ` Johan Hovold
2021-05-24 14:47         ` Alan Stern
2021-05-25 12:40           ` Johan Hovold
2021-05-25 15:12             ` Alan Stern
2021-05-26  7:49               ` Johan Hovold
2021-05-21 14:38   ` [PATCH] " Alan Stern
2021-05-22  7:56     ` Johan Hovold

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=20210521144142.GD1239965@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=g@b4.vu \
    --cc=greg@kroah.com \
    --cc=johan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox