* [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key()
@ 2026-07-30 23:13 Ivy Lopez
2026-07-31 12:08 ` Dan Carpenter
2026-08-04 20:05 ` [PATCH v2] " Ivy Lopez
0 siblings, 2 replies; 3+ messages in thread
From: Ivy Lopez @ 2026-07-30 23:13 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Ivy Lopez
psetkeyparm holds WEP/TKIP/AES key material copied in via memcpy
from psecuritypriv before being freed. Use kfree_sensitive() instead
of kfree() so the key bytes are zeroed before the memory is released,
consistent with how psetstakey_para is already handled elsewhere in
this driver.
Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 1196ec011455..fb45f7295386 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1926,14 +1926,14 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
break;
default:
res = _FAIL;
- kfree(psetkeyparm);
+ kfree_sensitive(psetkeyparm);
goto exit;
}
if (enqueue) {
pcmd = kzalloc_obj(*pcmd);
if (!pcmd) {
- kfree(psetkeyparm);
+ kfree_sensitive(psetkeyparm);
res = _FAIL; /* try again */
goto exit;
}
@@ -1949,7 +1949,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
res = rtw_enqueue_cmd(pcmdpriv, pcmd);
} else {
setkey_hdl(adapter, (u8 *)psetkeyparm);
- kfree(psetkeyparm);
+ kfree_sensitive(psetkeyparm);
}
exit:
return res;
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key()
2026-07-30 23:13 [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key() Ivy Lopez
@ 2026-07-31 12:08 ` Dan Carpenter
2026-08-04 20:05 ` [PATCH v2] " Ivy Lopez
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-07-31 12:08 UTC (permalink / raw)
To: Ivy Lopez; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
On Thu, Jul 30, 2026 at 05:13:15PM -0600, Ivy Lopez wrote:
> psetkeyparm holds WEP/TKIP/AES key material copied in via memcpy
> from psecuritypriv before being freed. Use kfree_sensitive() instead
> of kfree() so the key bytes are zeroed before the memory is released,
> consistent with how psetstakey_para is already handled elsewhere in
> this driver.
>
> Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
> ---
This should have a Fixes tag.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key()
2026-07-30 23:13 [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key() Ivy Lopez
2026-07-31 12:08 ` Dan Carpenter
@ 2026-08-04 20:05 ` Ivy Lopez
1 sibling, 0 replies; 3+ messages in thread
From: Ivy Lopez @ 2026-08-04 20:05 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, error27, Ivy Lopez
psetkeyparm holds WEP/TKIP/AES key material copied in via memcpy
from psecuritypriv before being freed. Use kfree_sensitive() instead
of kfree() so the key bytes are zeroed before the memory is released,
consistent with how psetstakey_para is already handled elsewhere in
this driver.
Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 1196ec011455..fb45f7295386 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1926,14 +1926,14 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
break;
default:
res = _FAIL;
- kfree(psetkeyparm);
+ kfree_sensitive(psetkeyparm);
goto exit;
}
if (enqueue) {
pcmd = kzalloc_obj(*pcmd);
if (!pcmd) {
- kfree(psetkeyparm);
+ kfree_sensitive(psetkeyparm);
res = _FAIL; /* try again */
goto exit;
}
@@ -1949,7 +1949,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
res = rtw_enqueue_cmd(pcmdpriv, pcmd);
} else {
setkey_hdl(adapter, (u8 *)psetkeyparm);
- kfree(psetkeyparm);
+ kfree_sensitive(psetkeyparm);
}
exit:
return res;
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-04 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 23:13 [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key() Ivy Lopez
2026-07-31 12:08 ` Dan Carpenter
2026-08-04 20:05 ` [PATCH v2] " Ivy Lopez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox