diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2014-01-10 19:36:41 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-10 16:54:35 -0800 |
commit | c63fe8f6ca3669f1d120ff70523e2911b9966574 (patch) | |
tree | d4f9e03eb7d36baf2753f00d42539ad9f36ff90b /drivers/usb | |
parent | 3569843a2b10a7f2163595fa2d499291147f7e94 (diff) | |
download | blackbird-op-linux-c63fe8f6ca3669f1d120ff70523e2911b9966574.tar.gz blackbird-op-linux-c63fe8f6ca3669f1d120ff70523e2911b9966574.zip |
usb: core: add sanity checks when using bInterfaceClass with new_id
Check if that field is actually used and if so, bail out if it exeeds a
u8. Make it also future-proof by not requiring "exactly three"
parameters in new_id, but simply "more than two".
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/driver.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 8d989b1d3dc5..574f5a04c92d 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -60,7 +60,10 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids, dynid->id.idVendor = idVendor; dynid->id.idProduct = idProduct; dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE; - if (fields == 3) { + if (fields > 2 && bInterfaceClass) { + if (bInterfaceClass > 255) + return -EINVAL; + dynid->id.bInterfaceClass = (u8)bInterfaceClass; dynid->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS; } |