[PATCH] staging: rtl8723bs: Fix NULL pointer dereference in c2h_wk_callback
From: Roman Demidov
Date: Fri Jul 31 2026 - 03:02:45 EST
If the kmalloc function fails to allocate memory, the c2h_evt variable
will be NULL. Its subsequent use in the rtw_hal_c2h_valid() function
will result in a NULL pointer dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Roman Demidov <roman.demidov@xxxxxxxxxxx>
---
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b932670f5d63..3c1149828718 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1716,6 +1716,8 @@ static void c2h_wk_callback(struct work_struct *work)
kfree(c2h_evt);
continue;
}
+ } else {
+ continue;
}
}
--
2.53.0