diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2017-09-22 21:35:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-03 18:34:57 +0200 |
commit | 5fef87cbbf422e0f6792ac9c8536fd6aa795f1f4 (patch) | |
tree | b926c8c6b5ddf62cdf6ac0fa2df4d52b239c91bf /drivers/staging | |
parent | 1ce72e8ac57a999c2864249567fc313a0def60c9 (diff) |
staging: rtl8192u: Check some memory allocation failure
If one of these memory allocations fail, a NULL pointer dereference will
occur later on.
Return -ENOMEM instead.
There is no need to free the resources already allocated, this is done
by the caller (i.e. 'rtl8192_usb_probe()') which calls
'rtl8192_usb_deleteendpoints()'.
The calling graph is:
rtl8192_usb_probe
--> rtl8192_init
--> rtl8192_usb_initendpoints
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/rtl8192u/r8192U_core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 46b3f19e0878..48b7fd071900 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1687,9 +1687,13 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) #ifndef JACKSON_NEW_RX for (i = 0; i < (MAX_RX_URB + 1); i++) { priv->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); + if (!priv->rx_urb[i]) + return -ENOMEM; priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); + if (!priv->rx_urb[i]->transfer_buffer) + return -ENOMEM; priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; } |