From cff2ae2185394eba19d100596848c7e8e598c652 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Sat, 25 May 2013 23:04:16 -0400 Subject: [PATCH] staging: btmtk_usb: check for a valid io_buf pointer assigned to retval of kmalloc but not checked whether the allocation failed or not, fail the registering if allocation fail Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman --- drivers/staging/btmtk_usb/btmtk_usb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c index 85bafacbb2fd..ab57a4b97e69 100644 --- a/drivers/staging/btmtk_usb/btmtk_usb.c +++ b/drivers/staging/btmtk_usb/btmtk_usb.c @@ -1597,6 +1597,11 @@ static int btmtk_usb_probe(struct usb_interface *intf, } data->io_buf = kmalloc(256, GFP_ATOMIC); + if (!data->io_buf) { + hci_free_dev(hdev); + kfree(data); + return -ENOMEM; + } btmtk_usb_switch_iobase(data, WLAN); -- 2.20.1