All of lore.kernel.org
 help / color / mirror / Atom feed
* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-06 10:01 Oliver Neukum
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2018-09-06 10:01 UTC (permalink / raw)
  To: Greg KH; +Cc: johan, stern, linux-usb

On Mi, 2018-09-05 at 15:07 +0200, Greg KH wrote:
> On Wed, Sep 05, 2018 at 03:02:48PM +0200, Oliver Neukum wrote:
> > On Mi, 2018-09-05 at 14:19 +0200, Greg KH wrote:
> > > On Wed, Sep 05, 2018 at 12:07:03PM +0200, Oliver Neukum wrote:

> > > > +	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.
> > 
> > That means a change in the API in a way that makes orking systems fail.
> 
> Ah, good point.

Well, but do we want to do this in the next major release even if we
cannot do it in a stable release?

>   I guess they were hitting the same dev_WARN() messages
> today anyway, right?

Yes. And for a kernel problem you really want the stack traces.
Still, that does not tell us that we want to print a message if
user space messes up. So dev_warn() or nothing?

> > Do you want an extra version for stable?
> 
> No, but why was this patch not marked for stable?

I was under the impression that it was. This is a separate
patch because you could argue that it is unnecessary or that stable
and the next release should diverge on whether to take it.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-20 10:47 Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-20 10:47 UTC (permalink / raw)
  To: Alan Stern; +Cc: Oliver Neukum, johan, linux-usb

On Thu, Sep 06, 2018 at 11:34:04AM -0400, Alan Stern wrote:
> On Thu, 6 Sep 2018, Oliver Neukum wrote:
> 
> > On Mi, 2018-09-05 at 15:07 +0200, Greg KH wrote:
> > > On Wed, Sep 05, 2018 at 03:02:48PM +0200, Oliver Neukum wrote:
> > > > On Mi, 2018-09-05 at 14:19 +0200, Greg KH wrote:
> > > > > On Wed, Sep 05, 2018 at 12:07:03PM +0200, Oliver Neukum wrote:
> > 
> > > > > > +	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.
> > > > 
> > > > That means a change in the API in a way that makes orking systems fail.
> > > 
> > > Ah, good point.
> > 
> > Well, but do we want to do this in the next major release even if we
> > cannot do it in a stable release?
> > 
> > >   I guess they were hitting the same dev_WARN() messages
> > > today anyway, right?
> > 
> > Yes. And for a kernel problem you really want the stack traces.
> > Still, that does not tell us that we want to print a message if
> > user space messes up. So dev_warn() or nothing?
> 
> An alternative is for usbfs to silently fix the flags when they are
> wrong.  Would that be any better?

Probably not.  I'll take the original patches now and see if there is
any complaints by users.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-06 15:34 Alan Stern
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Stern @ 2018-09-06 15:34 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Greg KH, johan, linux-usb

On Thu, 6 Sep 2018, Oliver Neukum wrote:

> On Mi, 2018-09-05 at 15:07 +0200, Greg KH wrote:
> > On Wed, Sep 05, 2018 at 03:02:48PM +0200, Oliver Neukum wrote:
> > > On Mi, 2018-09-05 at 14:19 +0200, Greg KH wrote:
> > > > On Wed, Sep 05, 2018 at 12:07:03PM +0200, Oliver Neukum wrote:
> 
> > > > > +	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.
> > > 
> > > That means a change in the API in a way that makes orking systems fail.
> > 
> > Ah, good point.
> 
> Well, but do we want to do this in the next major release even if we
> cannot do it in a stable release?
> 
> >   I guess they were hitting the same dev_WARN() messages
> > today anyway, right?
> 
> Yes. And for a kernel problem you really want the stack traces.
> Still, that does not tell us that we want to print a message if
> user space messes up. So dev_warn() or nothing?

An alternative is for usbfs to silently fix the flags when they are
wrong.  Would that be any better?

Alan Stern

> > > Do you want an extra version for stable?
> > 
> > No, but why was this patch not marked for stable?
> 
> I was under the impression that it was. This is a separate
> patch because you could argue that it is unnecessary or that stable
> and the next release should diverge on whether to take it.
> 
> 	Regards
> 		Oliver

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-05 13:07 Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-05 13:07 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: johan, stern, linux-usb

On Wed, Sep 05, 2018 at 03:02:48PM +0200, Oliver Neukum wrote:
> On Mi, 2018-09-05 at 14:19 +0200, Greg KH wrote:
> > 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.
> 
> That means a change in the API in a way that makes orking systems fail.

Ah, good point.  I guess they were hitting the same dev_WARN() messages
today anyway, right?

> Do you want an extra version for stable?

No, but why was this patch not marked for stable?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-05 13:02 Oliver Neukum
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2018-09-05 13:02 UTC (permalink / raw)
  To: Greg KH; +Cc: johan, stern, linux-usb

On Mi, 2018-09-05 at 14:19 +0200, Greg KH wrote:
> 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.

That means a change in the API in a way that makes orking systems fail.
Do you want an extra version for stable?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-05 12:19 Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-05 12:19 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-usb, johan, stern

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [2/2] USB: usbdevfs: restore warning for nonsensical flags
@ 2018-09-05 10:07 Oliver Neukum
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2018-09-05 10:07 UTC (permalink / raw)
  To: gregkh, linux-usb, johan, stern; +Cc: Oliver Neukum

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");
+
 	as->urb->transfer_buffer_length = uurb->buffer_length;
 	as->urb->setup_packet = (unsigned char *)dr;
 	dr = NULL;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-09-20 10:47 UTC | newest]

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

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.