Skip to content

Commit

Permalink
staging: rtl8192u: Add null check in rtl8192_usb_initendpoints
Browse files Browse the repository at this point in the history
There is an allocation for priv->rx_urb[16] has no null check,
which may lead to a null pointer dereference.

Signed-off-by: Dinghao Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
dinghaoliu authored and gregkh committed Dec 28, 2020
1 parent 850c35b commit ec36ae7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/rtl8192u/r8192U_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev)
void *oldaddr, *newaddr;

priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);
if (!priv->rx_urb[16])
return -ENOMEM;
priv->oldaddr = kmalloc(16, GFP_KERNEL);
if (!priv->oldaddr)
return -ENOMEM;
Expand Down

0 comments on commit ec36ae7

Please sign in to comment.