Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: handle key setup failures
@ 2026-08-03  0:49 Lucas Jeffrey
  0 siblings, 0 replies; only message in thread
From: Lucas Jeffrey @ 2026-08-03  0:49 UTC (permalink / raw)
  To: gregkh; +Cc: johannes.berg, linux-staging, linux-kernel, Lucas Jeffrey

The return values from key setup helpers were ignored in
rtw_cfg80211_ap_set_encryption().

Propagate failures from rtw_ap_set_wep_key(),
rtw_ap_set_group_key(), and rtw_ap_set_pairwise_key() back to
cfg80211 instead of continuing after an unsuccessful key setup.

This avoids silently reporting success when the key setup command
could not be queued or helper functions fail to allocate memory.

Signed-off-by: Lucas Jeffrey <luquijeffrey@gmail.com>
---
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 967cd1b34aed..8e5aa036d5eb 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -563,7 +563,9 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
 
 		psecuritypriv->dot11DefKeylen[wep_key_idx] = wep_key_len;
 
-		rtw_ap_set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx, 1);
+		if (rtw_ap_set_wep_key(padapter, param->u.crypt.key, wep_key_len, wep_key_idx, 1) == _FAIL)
+			ret = -EIO;
+
 
 		goto exit;
 	}
@@ -604,7 +606,10 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
 
 			psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
 
-			rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
+			if (rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx) == _FAIL) {
+				ret = -EIO;
+				goto exit;
+			}
 
 			pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
 			if (pbcmc_sta) {
@@ -640,7 +645,10 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
 					psta->dot118021XPrivacy = _NO_PRIVACY_;
 				}
 
-				rtw_ap_set_pairwise_key(padapter, psta);
+				if (rtw_ap_set_pairwise_key(padapter, psta) == _FAIL) {
+					ret = -EIO;
+					goto exit;
+				}
 
 				psta->ieee8021x_blocked = false;
 
@@ -678,7 +686,10 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
 
 				psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
 
-				rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
+				if (rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx) == _FAIL) {
+					ret = -EIO;
+					goto exit;
+				}
 
 				pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
 				if (pbcmc_sta) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-03  0:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  0:49 [PATCH] staging: rtl8723bs: handle key setup failures Lucas Jeffrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox