diff options
author | Johan Hovold <johan@kernel.org> | 2017-03-13 13:47:52 +0100 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-05-17 15:07:01 -0400 |
commit | 50c372bd694dafc0f51db83617f21c2bd6f6970c (patch) | |
tree | 4e58bac133407762b0e4ac76efd1bcefbe5d405b /drivers/uwb | |
parent | 7896de4f8b00c2c5079bf9315a058b3978cba392 (diff) |
uwb: hwa-rc: fix NULL-deref at probe
[ Upstream commit daf229b15907fbfdb6ee183aac8ca428cb57e361 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'drivers/uwb')
-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 0257f35cfb9d..e75bbe5a10cd 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c @@ -825,6 +825,9 @@ static int hwarc_probe(struct usb_interface *iface, struct hwarc *hwarc; struct device *dev = &iface->dev; + if (iface->cur_altsetting->desc.bNumEndpoints < 1) + return -ENODEV; + result = -ENOMEM; uwb_rc = uwb_rc_alloc(); if (uwb_rc == NULL) { |