staging: rtl8723bs: use kfree_sensitive() for key material

The set_stakey_parm struct contains a 16-byte encryption key.
Use kfree_sensitive() instead of kfree() to ensure the key
material is zeroed before the memory is freed, preventing
potential information leaks.

Fixes: 554c0a3abf ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
Link: https://patch.msgid.link/20260717220135.17836-1-skunkolee@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ivy Lopez
2026-07-17 16:01:35 -06:00
committed by Greg Kroah-Hartman
parent 743161a7c0
commit d205dfa8cb

View File

@@ -896,7 +896,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
if (enqueue) {
ph2c = kzalloc_obj(*ph2c);
if (!ph2c) {
kfree(psetstakey_para);
kfree_sensitive(psetstakey_para);
res = _FAIL;
goto exit;
}
@@ -904,7 +904,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
psetstakey_rsp = kzalloc_obj(*psetstakey_rsp);
if (!psetstakey_rsp) {
kfree(ph2c);
kfree(psetstakey_para);
kfree_sensitive(psetstakey_para);
res = _FAIL;
goto exit;
}
@@ -915,7 +915,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
} else {
set_stakey_hdl(padapter, (u8 *)psetstakey_para);
kfree(psetstakey_para);
kfree_sensitive(psetstakey_para);
}
exit:
return res;
@@ -955,7 +955,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu
psetstakey_rsp = kzalloc_obj(*psetstakey_rsp);
if (!psetstakey_rsp) {
kfree(ph2c);
kfree(psetstakey_para);
kfree_sensitive(psetstakey_para);
res = _FAIL;
goto exit;
}