From: Devendra Naga Date: Sun, 26 May 2013 03:04:16 +0000 (-0400) Subject: staging: btmtk_usb: check for a valid io_buf pointer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cff2ae2185394eba19d100596848c7e8e598c652;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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);