aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorKarsten Keil <kkeil@linux-pingi.de>2012-07-12 18:59:46 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-18 12:40:54 -0400
commit2ae4605d738ede6d94a481a30972fadfdaf73549 (patch)
tree7b92b5c173d75ffa83be5e8e9a6ad391bcd23737 /drivers/isdn
parent5b999fd04af95e2cb624aaf6a7637561572b2d96 (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')
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c18
-rw-r--r--drivers/isdn/hisax/hfc_usb.c18
2 files changed, 26 insertions, 10 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index c65c3440cd7..114f3bcba1b 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;
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index 84f9c810307..849a8075268 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -1483,13 +1483,21 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1483 usb_rcvctrlpipe(context->dev, 0); 1483 usb_rcvctrlpipe(context->dev, 0);
1484 context->ctrl_out_pipe = 1484 context->ctrl_out_pipe =
1485 usb_sndctrlpipe(context->dev, 0); 1485 usb_sndctrlpipe(context->dev, 0);
1486
1487 driver_info = (hfcsusb_vdata *)
1488 hfcusb_idtab[vend_idx].driver_info;
1489
1486 context->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); 1490 context->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
1487 1491
1488 driver_info = 1492 if (!context->ctrl_urb) {
1489 (hfcsusb_vdata *) hfcusb_idtab[vend_idx]. 1493 pr_warn("%s: No memory for control urb\n",
1490 driver_info; 1494 driver_info->vend_name);
1491 printk(KERN_INFO "HFC-S USB: detected \"%s\"\n", 1495 kfree(context);
1492 driver_info->vend_name); 1496 return -ENOMEM;
1497 }
1498
1499 pr_info("HFC-S USB: detected \"%s\"\n",
1500 driver_info->vend_name);
1493 1501
1494 DBG(HFCUSB_DBG_INIT, 1502 DBG(HFCUSB_DBG_INIT,
1495 "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d), E-Channel(%d)", 1503 "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d), E-Channel(%d)",