staging: rtl8192u: Add null check in rtl8192_usb_initendpoints
Subsystems (2)
cover staging: rtl8192u: Add null check in rtl8192_usb_initendpoints
SVACE reports return value of a function 'usb_alloc_urb' is dereferenced
without checking for null in 5.10 stable releases.
The problem has been fixed by the following
patch which can be cleanly applied to the 5.10 branch.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
PATCH 1/1 staging: rtl8192u: Add null check in rtl8192_usb_initendpoints
From: Dinghao Liu <[email protected]>
commit 4d5f81506835f7c1e5c71787bed84984faf05884 upstream.
There is an allocation for priv->rx_urb[16] has no null check, which may lead to a null pointer dereference.
--- drivers/staging/rtl8192u/r8192U_core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/rtl8192u/r8192U_core.c +2 -0
@@ -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 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerQuoted 20 lines · Danila Chernetsov
From: Dinghao Liu <[email protected]>
commit
4d5f81506835f7c1e5c71787bed84984faf05884upstream.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]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Danila Chernetsov <[email protected]>--- drivers/staging/rtl8192u/r8192U_core.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/rtl8192u/r8192U_core.c +0
-0
drivers/staging/rtl8192u/r8192U_core.c static short rtl8192_usb_initendpoints(struct net_device *dev) · line 1612
Quoted 5 lines
drivers/staging/rtl8192u/r8192U_core.c +2
-0@@ -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 ;
This was not marked for stable as it's impossible to hit in real-life. So absent that, it's not needed in any stable kernel tree, unless you can prove otherwise?
thanks,
greg k-h