From: Ivy Lopez <skunkolee@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Ivy Lopez <skunkolee@gmail.com>
Subject: [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key()
Date: Thu, 30 Jul 2026 17:17:14 -0600 [thread overview]
Message-ID: <20260730231714.81977-2-skunkolee@gmail.com> (raw)
In-Reply-To: <20260730231714.81977-1-skunkolee@gmail.com>
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
next prev parent reply other threads:[~2026-07-30 23:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 23:17 [PATCH] staging: rtl8723bs: use guard(mutex) in ips_enter() Ivy Lopez
2026-07-30 23:17 ` Ivy Lopez [this message]
2026-07-30 23:20 ` [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key() Ivy Lopez
2026-07-31 5:19 ` [PATCH] staging: rtl8723bs: use guard(mutex) in ips_enter() Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2026-07-30 23:13 [PATCH] staging: rtl8723bs: use kfree_sensitive() for key material in rtw_set_key() Ivy Lopez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260730231714.81977-2-skunkolee@gmail.com \
--to=skunkolee@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox