Skip to contentSkip to conversation

USB: usbdevfs: restore warning for nonsensical flags

PATCH New Greg Kroah-Hartman 1 participant 1 message Sep 5, 2018 USB

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 2/2 USB: usbdevfs: restore warning for nonsensical flags

Quoted 28 lines · Oliver Neukum
Quoted 18 lines · Greg KH
Quoted 17 lines · Oliver Neukum

If we filter flags before they reach the core we need to generate our own warnings.

Fixes 0cb54a3e47cb ("USB: debugging code shouldn't alter control flow")
---
 drivers/usb/core/devio.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/core/devio.c +0 -0
index 263dd2f309fb..244417d0dfd1 100644
@@ -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;
 
Quoted 8 lines

drivers/usb/core/devio.c static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · line 1703

Quoted 4 lines
drivers/usb/core/devio.c +4 -0
+	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.

Quoted 1 line

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?

Quoted 1 line

Do you want an extra version for stable?

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

thanks,

greg k-h