staging: rtl8188eu: core: fix null dereference on exit path in rtw_mlme.c

Author: Jiayi Ye <yejiayily@gmail.com>

If adapter is null, null dereference may occur. This patch fixes it.
The following Coccinelle semantic patch was used to find the case.

@@
expression E, E1;
identifier f;
statement S1,S2,S3;
@@

* if (E == NULL)
{
 ... when != if (E == NULL) S1 else S2
     when != E = E1
* E->f
 ... when any
 return ...;
}
else S3

Signed-off-by: Jiayi Ye 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 149c271..bbebe67 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1437,7 +1437,7 @@ void rtw_dynamic_check_timer_handlder(void *function_context)
 	struct registry_priv *pregistrypriv = &adapter->registrypriv;
 
 	if (!adapter)
-		goto exit;
+		return;
 	if (!adapter->hw_init_completed)
 		goto exit;
 	if ((adapter->bDriverStopped) || (adapter->bSurpriseRemoved))
BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.