Skip to contentSkip to conversation

staging:r8188eu: load lib80211 crypto ops from interruptible context

PATCH New Ivan Safonov 1 participant 1 message Aug 11, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging:r8188eu: load lib80211 crypto ops from interruptible context

Preloading lib80211_crypt_* modules from an ioctl handlers prevents the module loading from a tasklet.

---
 drivers/staging/rtl8188eu/core/rtw_ap.c          |  4 +-
 drivers/staging/rtl8188eu/core/rtw_cmd.c         |  8 +-
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c   |  6 +-
 drivers/staging/rtl8188eu/core/rtw_mlme.c        | 14 ++--
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c    |  4 +-
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c     |  2 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c        |  2 +-
 drivers/staging/rtl8188eu/core/rtw_security.c    |  1 -
 drivers/staging/rtl8188eu/core/rtw_xmit.c        |  4 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_dm.c      |  2 +-
 drivers/staging/rtl8188eu/hal/usb_halinit.c      |  2 +-
 drivers/staging/rtl8188eu/include/rtw_security.h | 54 ++++++++++---
 drivers/staging/rtl8188eu/include/sta_info.h     |  2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c   | 98 ++++++++++++------------
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c    |  4 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c      |  4 +-
 16 files changed, 122 insertions(+), 89 deletions(-)
drivers/staging/rtl8188eu/core/rtw_ap.c +2 -2
index 676d549ef786..3a78bf115e9f 100644
@@ -642,8 +642,8 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf)
 		/* WEP Key will be set before this function, do not
 		 * clear CAM.
 		 */
-		if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) &&
-		    (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_))
+		if ((psecuritypriv->dot11PrivacyAlgrthm.id != _WEP40_) &&
+		    (psecuritypriv->dot11PrivacyAlgrthm.id != _WEP104_))
 			flush_all_cam_entry(padapter);	/* clear CAM */
 	}
 
drivers/staging/rtl8188eu/core/rtw_cmd.c +4 -4
index 59039211dad2..499cfbebe6b9 100644
@@ -448,9 +448,9 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct wlan_network *pnetwork)
 		 * the connection to avoid some IOT issue.
 		 * Especially for Realtek 8192u SoftAP.
 		 */
-		if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) &&
-		    (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) &&
-		    (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {
+		if ((padapter->securitypriv.dot11PrivacyAlgrthm.id != _WEP40_) &&
+		    (padapter->securitypriv.dot11PrivacyAlgrthm.id != _WEP104_) &&
+		    (padapter->securitypriv.dot11PrivacyAlgrthm.id != _TKIP_)) {
 			/* rtw_restructure_ht_ie */
 			rtw_restructure_ht_ie(padapter, &pnetwork->network.ies[0], &psecnetwork->ies[0],
 									pnetwork->network.ie_length, &psecnetwork->ie_length);
@@ -570,7 +570,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key)
 	ether_addr_copy(psetstakey_para->addr, sta->hwaddr);
 
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
-		psetstakey_para->algorithm = (unsigned char)psecuritypriv->dot11PrivacyAlgrthm;
+		psetstakey_para->algorithm = (unsigned char)psecuritypriv->dot11PrivacyAlgrthm.id;
 	else
 		GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false);
 
drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +3 -3
index c040f185074b..e57a15940ea7 100644
@@ -481,15 +481,15 @@ u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep *wep)
 
 	switch (wep->KeyLength) {
 	case 5:
-		psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
+		psecuritypriv->dot11PrivacyAlgrthm = create_crypto_algorithm(_WEP40_);
 		RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("MgntActrtw_set_802_11_add_wep:wep->KeyLength = 5\n"));
 		break;
 	case 13:
-		psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
+		psecuritypriv->dot11PrivacyAlgrthm = create_crypto_algorithm(_WEP104_);
 		RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("MgntActrtw_set_802_11_add_wep:wep->KeyLength = 13\n"));
 		break;
 	default:
-		psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
+		psecuritypriv->dot11PrivacyAlgrthm = create_crypto_algorithm(_NO_PRIVACY_);
 		RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("MgntActrtw_set_802_11_add_wep:wep->KeyLength!= 5 or 13\n"));
 		break;
 	}
drivers/staging/rtl8188eu/core/rtw_mlme.c +7 -7
index eca06f05c0c4..2323962220e4 100644
@@ -286,10 +286,10 @@ int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork)
 	int ret = true;
 	struct security_priv *psecuritypriv = &adapter->securitypriv;
 
-	if ((psecuritypriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) &&
+	if ((psecuritypriv->dot11PrivacyAlgrthm.id != _NO_PRIVACY_) &&
 	    (pnetwork->network.Privacy == 0))
 		ret = false;
-	else if ((psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_) &&
+	else if ((psecuritypriv->dot11PrivacyAlgrthm.id == _NO_PRIVACY_) &&
 		 (pnetwork->network.Privacy == 1))
 		ret = false;
 	else
@@ -1591,12 +1591,12 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in
 	}
 
 	if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) {
-		psetkeyparm->algorithm = (unsigned char)psecuritypriv->dot118021XGrpPrivacy;
+		psetkeyparm->algorithm = (unsigned char)psecuritypriv->dot118021XGrpPrivacy.id;
 		RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
 			 ("\n rtw_set_key: psetkeyparm->algorithm=(unsigned char)psecuritypriv->dot118021XGrpPrivacy=%d\n",
 			 psetkeyparm->algorithm));
 	} else {
-		psetkeyparm->algorithm = (u8)psecuritypriv->dot11PrivacyAlgrthm;
+		psetkeyparm->algorithm = (u8)psecuritypriv->dot11PrivacyAlgrthm.id;
 		RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
 			 ("\n rtw_set_key: psetkeyparm->algorithm=(u8)psecuritypriv->dot11PrivacyAlgrthm=%d\n",
 			 psetkeyparm->algorithm));
@@ -1632,7 +1632,7 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in
 	default:
 		RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
 			 ("\n rtw_set_key:psecuritypriv->dot11PrivacyAlgrthm=%x (must be 1 or 2 or 4 or 5)\n",
-			 psecuritypriv->dot11PrivacyAlgrthm));
+			 psecuritypriv->dot11PrivacyAlgrthm.id));
 		res = _FAIL;
 		goto err_free_parm;
 	}
@@ -1804,7 +1804,7 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter)
 	struct	security_priv *psecuritypriv = &adapter->securitypriv;
 	struct	wlan_network	*cur_network = &adapter->mlmepriv.cur_network;
 
-	pdev_network->Privacy = psecuritypriv->dot11PrivacyAlgrthm > 0 ? 1 : 0; /*  adhoc no 802.1x */
+	pdev_network->Privacy = psecuritypriv->dot11PrivacyAlgrthm.id > 0 ? 1 : 0; /*  adhoc no 802.1x */
 
 	pdev_network->Rssi = 0;
 
@@ -1935,7 +1935,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
 		rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor);
 		ht_cap.ampdu_params_info = max_rx_ampdu_factor & 0x03;
 
-		if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
+		if (padapter->securitypriv.dot11PrivacyAlgrthm.id == _AES_)
 			ht_cap.ampdu_params_info |= IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2);
 		else
 			ht_cap.ampdu_params_info |= IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00;
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +2 -2
index 1115050077e4..96d3fd9fde99 100644
@@ -2686,8 +2686,8 @@ static unsigned int OnAuth(struct adapter *padapter,
 
 	DBG_88E("auth alg=%x, seq=%X\n", algorithm, seq);
 
-	if (auth_mode == 2 && psecuritypriv->dot11PrivacyAlgrthm != _WEP40_ &&
-	    psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)
+	if (auth_mode == 2 && psecuritypriv->dot11PrivacyAlgrthm.id != _WEP40_ &&
+	    psecuritypriv->dot11PrivacyAlgrthm.id != _WEP104_)
 		auth_mode = 0;
 
 	if ((algorithm > 0 && auth_mode == 0) ||	/*  rx a shared-key auth but shared not enabled */
drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +1 -1
index 5ab6fc22a156..31a760a6403d 100644
@@ -173,7 +173,7 @@ int ips_leave(struct adapter *padapter)
 
 		DBG_88E_LEVEL(_drv_info_, "nolinked power save leave\n");
 
-		if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm)) {
+		if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm.id) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm.id)) {
 			DBG_88E("==>%s, channel(%d), processing(%x)\n", __func__, padapter->mlmeextpriv.cur_channel, pwrpriv->bips_processing);
 			set_channel_bwmode(padapter, padapter->mlmeextpriv.cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20);
 			for (keyid = 0; keyid < 4; keyid++) {
drivers/staging/rtl8188eu/core/rtw_recv.c +1 -1
index 17b4b9257b49..8b4173536469 100644
@@ -1973,7 +1973,7 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
 		if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
 		    !IS_MCAST(prxattrib->ra) && prxattrib->encrypt > 0 &&
 		    prxattrib->bdecrypted == 0 &&
-		    !is_wep_enc(psecuritypriv->dot11PrivacyAlgrthm) &&
+		    !is_wep_enc(psecuritypriv->dot11PrivacyAlgrthm.id) &&
 		    !psecuritypriv->busetkipkey) {
 			rtw_enqueue_recvframe(rframe, &padapter->recvpriv.uc_swdec_pending_queue);
 			DBG_88E("%s: no key, enqueue uc_swdec_pending_queue\n", __func__);
drivers/staging/rtl8188eu/core/rtw_security.c +0 -1
index 2a48b09ea9ae..6a6e3f21ae5e 100644
@@ -10,7 +10,6 @@
 #include <drv_types.h>
 #include <wifi.h>
 #include <osdep_intf.h>
-#include <net/lib80211.h>
 
 /* WEP related ===== */
 
drivers/staging/rtl8188eu/core/rtw_xmit.c +2 -2
index 2130d78e0d9f..42313e185187 100644
@@ -273,7 +273,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame *
 		while (true) {
 			/* IOT action */
 			if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) && pattrib->ampdu_en &&
-			    (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
+			    (padapter->securitypriv.dot11PrivacyAlgrthm.id == _AES_)) {
 				pattrib->vcs_mode = CTS_TO_SELF;
 				break;
 			}
@@ -605,7 +605,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr
 
 	hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ);
 
-	if (pattrib->encrypt == _TKIP_) {/* if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_PRIVACY_) */
+	if (pattrib->encrypt == _TKIP_) {/* if (psecuritypriv->dot11PrivacyAlgrthm.id == _TKIP_PRIVACY_) */
 		/* encode mic code */
 		if (stainfo) {
 			u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +1 -1
index 545d6a6102f1..80555e70d302 100644
@@ -97,7 +97,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter)
 	dm_odm->pNumRxBytesUnicast = &Adapter->recvpriv.rx_bytes;
 	dm_odm->pWirelessMode = &pmlmeext->cur_wireless_mode;
 	dm_odm->pSecChOffset = &hal_data->nCur40MhzPrimeSC;
-	dm_odm->pSecurity = (u8 *)&Adapter->securitypriv.dot11PrivacyAlgrthm;
+	dm_odm->pSecurity = (u8 *)&Adapter->securitypriv.dot11PrivacyAlgrthm.id;
 	dm_odm->pBandWidth = (u8 *)&hal_data->CurrentChannelBW;
 	dm_odm->pChannel = &hal_data->CurrentChannel;
 	dm_odm->pbNet_closed = (bool *)&Adapter->net_closed;
drivers/staging/rtl8188eu/hal/usb_halinit.c +1 -1
index 12864b648fa8..283f8a706b90 100644
@@ -1560,7 +1560,7 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val)
 
 			MinSpacingToSet = *((u8 *)val);
 			if (MinSpacingToSet <= 7) {
-				switch (Adapter->securitypriv.dot11PrivacyAlgrthm) {
+				switch (Adapter->securitypriv.dot11PrivacyAlgrthm.id) {
 				case _NO_PRIVACY_:
 				case _AES_:
 					SecMinSpace = 0;
drivers/staging/rtl8188eu/include/rtw_security.h +44 -10

90 lines not on this page · raw message

drivers/staging/rtl8188eu/include/sta_info.h +1 -1
index dc685a14aeb8..08b6ae57b8dd 100644
@@ -84,7 +84,7 @@ struct sta_info {
 	u8	hwaddr[ETH_ALEN];
 
 	uint	ieee8021x_blocked;	/* 0: allowed, 1:blocked */
-	uint	dot118021XPrivacy; /* aes, tkip... */
+	struct crypto_algorithm dot118021XPrivacy; /* aes, tkip... */
 	union Keytype	dot11tkiptxmickey;
 	union Keytype	dot11tkiprxmickey;
 	union Keytype	dot118021x_UncstKey;
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +49 -49

266 lines not on this page · raw message

drivers/staging/rtl8188eu/os_dep/mlme_linux.c +2 -2
index 238c1d9cdc7b..9c365b3469a1 100644
@@ -65,9 +65,9 @@ void rtw_reset_securitypriv(struct adapter *adapter)
 		struct security_priv *psec_priv = &adapter->securitypriv;
 
 		psec_priv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
-		psec_priv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
+		psec_priv->dot11PrivacyAlgrthm = create_crypto_algorithm(_NO_PRIVACY_);
 		psec_priv->dot11PrivacyKeyIndex = 0;
-		psec_priv->dot118021XGrpPrivacy = _NO_PRIVACY_;
+		psec_priv->dot118021XGrpPrivacy = create_crypto_algorithm(_NO_PRIVACY_);
 		psec_priv->dot118021XGrpKeyid = 1;
 		psec_priv->ndisauthtype = Ndis802_11AuthModeOpen;
 		psec_priv->ndisencryptstatus = Ndis802_11WEPDisabled;
drivers/staging/rtl8188eu/os_dep/os_intfs.c +2 -2
index 62294bdc465e..be50b91f9a06 100644
@@ -380,9 +380,9 @@ static u8 rtw_init_default_value(struct adapter *padapter)
 	/* security_priv */
 	psecuritypriv->binstallGrpkey = _FAIL;
 	psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
-	psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
+	psecuritypriv->dot11PrivacyAlgrthm = create_crypto_algorithm(_NO_PRIVACY_);
 	psecuritypriv->dot11PrivacyKeyIndex = 0;
-	psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
+	psecuritypriv->dot118021XGrpPrivacy = create_crypto_algorithm(_NO_PRIVACY_);
 	psecuritypriv->dot118021XGrpKeyid = 1;
 	psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
 	psecuritypriv->ndisencryptstatus = Ndis802_11WEPDisabled;
Signature · 1 line
2.16.4