linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: linux-usb@vger.kernel.org, johan@kernel.org, stern@rowland.harvard.edu
Subject: [2/2] USB: usbdevfs: restore warning for nonsensical flags
Date: Wed, 5 Sep 2018 14:19:32 +0200	[thread overview]
Message-ID: <20180905121932.GA16841@kroah.com> (raw)

On Wed, Sep 05, 2018 at 12:07:03PM +0200, Oliver Neukum wrote:
> If we filter flags before they reach the core we need to generate our
> own warnings.
> 
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> Fixes: 0cb54a3e47cb ("USB: debugging code shouldn't alter control flow")
> ---
>  drivers/usb/core/devio.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 263dd2f309fb..244417d0dfd1 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -1697,6 +1697,11 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
>  		u |= URB_NO_INTERRUPT;
>  	as->urb->transfer_flags = u;
>  
> +	if (!allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
> +		dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_SHORT_NOT_OK.\n");
> +	if (!allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
> +		dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_ZERO_PACKET.\n");

We should not make it trivial for userspace to spam the kernel log if at
all possible.  Returning an error is probably the better thing to do
here, not just silently fix it up or ignore it.

thanks,

greg k-h

             reply	other threads:[~2018-09-05 12:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 12:19 Greg Kroah-Hartman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-09-20 10:47 [2/2] USB: usbdevfs: restore warning for nonsensical flags Greg Kroah-Hartman
2018-09-06 15:34 Alan Stern
2018-09-06 10:01 Oliver Neukum
2018-09-05 13:07 Greg Kroah-Hartman
2018-09-05 13:02 Oliver Neukum
2018-09-05 10:07 Oliver Neukum

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=20180905121932.GA16841@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stern@rowland.harvard.edu \
    /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).