diff options
author | Karsten Keil <kkeil@linux-pingi.de> | 2012-07-12 18:59:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-18 12:40:54 -0400 |
commit | 2ae4605d738ede6d94a481a30972fadfdaf73549 (patch) | |
tree | 7b92b5c173d75ffa83be5e8e9a6ad391bcd23737 /drivers/isdn/hardware | |
parent | 5b999fd04af95e2cb624aaf6a7637561572b2d96 (diff) |
ISDN: Add check for usb_alloc_urb() result
usb_alloc_urb() return value needs to be checked to avoid
later NULL pointer access.
Reported by rucsoftsec@gmail.com via bugzilla.kernel.org #44601.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfcsusb.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index c65c3440cd70..114f3bcba1b0 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c | |||
@@ -2084,13 +2084,21 @@ hfcsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2084 | /* create the control pipes needed for register access */ | 2084 | /* create the control pipes needed for register access */ |
2085 | hw->ctrl_in_pipe = usb_rcvctrlpipe(hw->dev, 0); | 2085 | hw->ctrl_in_pipe = usb_rcvctrlpipe(hw->dev, 0); |
2086 | hw->ctrl_out_pipe = usb_sndctrlpipe(hw->dev, 0); | 2086 | hw->ctrl_out_pipe = usb_sndctrlpipe(hw->dev, 0); |
2087 | |||
2088 | driver_info = (struct hfcsusb_vdata *) | ||
2089 | hfcsusb_idtab[vend_idx].driver_info; | ||
2090 | |||
2087 | hw->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); | 2091 | hw->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); |
2092 | if (!hw->ctrl_urb) { | ||
2093 | pr_warn("%s: No memory for control urb\n", | ||
2094 | driver_info->vend_name); | ||
2095 | kfree(hw); | ||
2096 | return -ENOMEM; | ||
2097 | } | ||
2088 | 2098 | ||
2089 | driver_info = | 2099 | pr_info("%s: %s: detected \"%s\" (%s, if=%d alt=%d)\n", |
2090 | (struct hfcsusb_vdata *)hfcsusb_idtab[vend_idx].driver_info; | 2100 | hw->name, __func__, driver_info->vend_name, |
2091 | printk(KERN_DEBUG "%s: %s: detected \"%s\" (%s, if=%d alt=%d)\n", | 2101 | conf_str[small_match], ifnum, alt_used); |
2092 | hw->name, __func__, driver_info->vend_name, | ||
2093 | conf_str[small_match], ifnum, alt_used); | ||
2094 | 2102 | ||
2095 | if (setup_instance(hw, dev->dev.parent)) | 2103 | if (setup_instance(hw, dev->dev.parent)) |
2096 | return -EIO; | 2104 | return -EIO; |