USB: usbfs: Filter flags passed in from user space
Subsystems (2)
PATCH 1/1 USB: usbfs: Filter flags passed in from user space
USBDEVFS_URB_ISO_ASAP must be accepted only for ISO endpoints. Improve sanity checking.
--- drivers/usb/core/devio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/core/devio.c +10 -6
@@ -1442,14 +1442,18 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurbint number_of_packets =0 ;unsigned int stream_id =0 ;void *buf; - -if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP | -USBDEVFS_URB_SHORT_NOT_OK | +unsigned long mask =USBDEVFS_URB_SHORT_NOT_OK |USBDEVFS_URB_BULK_CONTINUATION |USBDEVFS_URB_NO_FSBR | -USBDEVFS_URB_ZERO_PACKET | -USBDEVFS_URB_NO_INTERRUPT )) -return -EINVAL ; +USBDEVFS_URB_ZERO_PACKET | +USBDEVFS_URB_NO_INTERRUPT ; +/* USBDEVFS_URB_ISO_ASAP is a special case */ +if (uurb->type ==USBDEVFS_URB_TYPE_ISO ) + mask |=USBDEVFS_URB_ISO_ASAP ; + +if (uurb->flags & ~mask) +return -EINVAL ; +if ((unsigned int )uurb->buffer_length >=USBFS_XFER_MAX )return -EINVAL ;if (uurb->buffer_length >0 && !uurb->buffer)
Signature · 1 line
2.13.6
Greg KH
maintainerQuoted 7 lines · Oliver Neukum
USBDEVFS_URB_ISO_ASAPmust be accepted only for ISO endpoints. Improve sanity checking.Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/core/devio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
Didn't we do something like this already?
Or was it something else? Was this triggered by some testing?
thanks,
greg k-h
Am Donnerstag, den 23.11.2017, 15:57 +0100 schrieb Greg KH:
Quoted 11 lines · Oliver Neukum
Quoted 8 lines
USBDEVFS_URB_ISO_ASAPmust be accepted only for ISO endpoints. Improve sanity checking.Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/core/devio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)Didn't we do something like this already?
I sent a patch. Alan found it insufficient.
Quoted 1 line
Or was it something else? Was this triggered by some testing?
Alexey's syzkaller tests showed that you can trigger it.
Regards
Oliver
Greg KH
maintainerQuoted 6 lines · Oliver Neukum
Am Donnerstag, den 23.11.2017, 15:57 +0100 schrieb Greg KH:
Quoted 5 lines · Oliver Neukum
Quoted 4 lines
USBDEVFS_URB_ISO_ASAPmust be accepted only for ISO endpoints. Improve sanity checking.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/core/devio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)Didn't we do something like this already?
I sent a patch. Alan found it insufficient.
Ah, ok.
Quoted 3 lines
Quoted 1 line
Or was it something else? Was this triggered by some testing?
Alexey's syzkaller tests showed that you can trigger it.
Then a nice "Reported-by:" would be good to add, as would a stable tree inclusion, right?
thanks,
greg k-h