diff options
author | Johan Hovold <johan@kernel.org> | 2017-03-13 08:47:52 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-14 05:07:30 -0400 |
commit | daf229b15907fbfdb6ee183aac8ca428cb57e361 (patch) | |
tree | 57aee7e47013cab76964b20c584bf0b8bda38ff9 | |
parent | 03ace948a4eb89d1cf51c06afdfc41ebca5fdb27 (diff) |
uwb: hwa-rc: fix NULL-deref at probe
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.
Note that the dereference happens in the start callback which is called
during probe.
Fixes: de520b8bd552 ("uwb: add HWA radio controller driver")
Cc: stable <stable@vger.kernel.org> # 2.6.28
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/uwb/hwa-rc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 0aa6c3c29d17..35a1e777b449 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c | |||
@@ -823,6 +823,9 @@ static int hwarc_probe(struct usb_interface *iface, | |||
823 | struct hwarc *hwarc; | 823 | struct hwarc *hwarc; |
824 | struct device *dev = &iface->dev; | 824 | struct device *dev = &iface->dev; |
825 | 825 | ||
826 | if (iface->cur_altsetting->desc.bNumEndpoints < 1) | ||
827 | return -ENODEV; | ||
828 | |||
826 | result = -ENOMEM; | 829 | result = -ENOMEM; |
827 | uwb_rc = uwb_rc_alloc(); | 830 | uwb_rc = uwb_rc_alloc(); |
828 | if (uwb_rc == NULL) { | 831 | if (uwb_rc == NULL) { |