USB: usbdevfs: restore warning for nonsensical flags
Greg Kroah-Hartman
maintainerPATCH 2/2 USB: usbdevfs: restore warning for nonsensical flags
Quoted 14 lines · Oliver Neukum
If we filter flags before they reach the core we need to generate our own warnings.
Signed-off-by Oliver Neukum <[email protected]>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
drivers/usb/core/devio.c static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · line 1703
Quoted 7 lines
drivers/usb/core/devio.c +4
-0@@ -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