[PATCH] staging: rtl8723bs: handle key setup failures
From: Lucas Jeffrey
Date: Sun Aug 02 2026 - 20:52:13 EST
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@xxxxxxxxx>
---
.../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