diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-08-09 19:31:54 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-08-15 12:22:40 -0400 |
commit | 8a9af4fdf6d5eeb3200a088354d266a87e8260b0 (patch) | |
tree | 697e4a7c0558d108ee31cc9ad04631ad6bbc6284 /drivers | |
parent | 585df1d90cb07a02ca6c7a7d339e56e46d50dafb (diff) |
USB: Avoid NULL pointer deref in usb_hcd_alloc_bandwidth.
usb_ifnum_to_if() can return NULL if the USB device does not have a
configuration installed (usb_device->actconfig == NULL), or if we can't
find the interface number in the installed configuration. Return an
error instead of crashing.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/hcd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8669ba3fe794..73cbbd85219f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1775,6 +1775,8 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, | |||
1775 | struct usb_interface *iface = usb_ifnum_to_if(udev, | 1775 | struct usb_interface *iface = usb_ifnum_to_if(udev, |
1776 | cur_alt->desc.bInterfaceNumber); | 1776 | cur_alt->desc.bInterfaceNumber); |
1777 | 1777 | ||
1778 | if (!iface) | ||
1779 | return -EINVAL; | ||
1778 | if (iface->resetting_device) { | 1780 | if (iface->resetting_device) { |
1779 | /* | 1781 | /* |
1780 | * The USB core just reset the device, so the xHCI host | 1782 | * The USB core just reset the device, so the xHCI host |