diff --git a/core/rtw_security.c b/core/rtw_security.c index 9905de7..a057481 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -2000,7 +2000,7 @@ BIP_exit: #endif /* CONFIG_IEEE80211W */ /* compress 512-bits */ -static int sha256_compress(struct sha256_state *md, unsigned char *buf) +static int sha256_compress(struct rtl_sha256_state *md, unsigned char *buf) { u32 S[8], W[64], t0, t1; u32 t; @@ -2042,7 +2042,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf) } /* Initialize the hash state */ -static void sha256_init(struct sha256_state *md) +static void rtl_sha256_init(struct rtl_sha256_state *md) { md->curlen = 0; md->length = 0; @@ -2063,7 +2063,7 @@ static void sha256_init(struct sha256_state *md) @param inlen The length of the data (octets) @return CRYPT_OK if successful */ -static int sha256_process(struct sha256_state *md, unsigned char *in, +static int sha256_process(struct rtl_sha256_state *md, unsigned char *in, unsigned long inlen) { unsigned long n; @@ -2103,7 +2103,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in, @param out [out] The destination of the hash (32 bytes) @return CRYPT_OK if successful */ -static int sha256_done(struct sha256_state *md, unsigned char *out) +static int sha256_done(struct rtl_sha256_state *md, unsigned char *out) { int i; @@ -2155,10 +2155,10 @@ static int sha256_done(struct sha256_state *md, unsigned char *out) static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len, u8 *mac) { - struct sha256_state ctx; + struct rtl_sha256_state ctx; size_t i; - sha256_init(&ctx); + rtl_sha256_init(&ctx); for (i = 0; i < num_elem; i++) if (sha256_process(&ctx, addr[i], len[i])) return -1; diff --git a/include/rtw_security.h b/include/rtw_security.h index 9404a97..05808f3 100644 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -193,7 +193,7 @@ struct security_priv u8 bWepDefaultKeyIdxSet; }; -struct sha256_state { +struct rtl_sha256_state { u64 length; u32 state[8], curlen; u8 buf[64]; diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 2639928..536f1f2 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -335,19 +335,15 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl u8 *notify_ie; size_t notify_ielen; s32 notify_signal; - u8 buf[MAX_BSSINFO_LEN], *pbuf; + u8 *buf, *pbuf; size_t len,bssinf_len=0; struct rtw_ieee80211_hdr *pwlanhdr; __le16 *fctrl; u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - struct wireless_dev *wdev = padapter->rtw_wdev; struct wiphy *wiphy = wdev->wiphy; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - /* DBG_8192C("%s\n", __func__); */ - bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr); if (bssinf_len > MAX_BSSINFO_LEN) { DBG_88E("%s IE Length too long > %d byte\n",__FUNCTION__,MAX_BSSINFO_LEN); @@ -416,6 +412,9 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl } else { notify_signal = 100*translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);/* dbm */ } + buf = kzalloc(MAX_BSSINFO_LEN, GFP_KERNEL); + if (!buf) + goto exit; pbuf = buf; pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; @@ -455,7 +454,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl len, notify_signal, GFP_ATOMIC); if (unlikely(!bss)) { DBG_8192C(FUNC_ADPT_FMT" bss NULL\n", FUNC_ADPT_ARG(padapter)); - goto exit; + goto free_buf; } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) @@ -472,30 +471,13 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl #endif /* COMPAT_KERNEL_RELEASE */ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) */ -/* - { - if ( bss->information_elements == bss->proberesp_ies) - { - if ( bss->len_information_elements != bss->len_proberesp_ies) - { - DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n"); - } - - } - else if (bss->len_information_elements < bss->len_beacon_ies) - { - bss->information_elements = bss->beacon_ies; - bss->len_information_elements = bss->len_beacon_ies; - } - } -*/ - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(wiphy, bss); #else cfg80211_put_bss(bss); #endif - +free_buf: + kfree(buf); exit: return bss; @@ -4427,9 +4409,17 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, #else struct net_device *ndev, #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + struct mgmt_frame_regs *upd) +#else u16 frame_type, bool reg) +#endif { struct adapter *adapter = wiphy_to_adapter(wiphy); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + u16 frame_type = BIT(upd->global_stypes << 4); + bool reg = false; +#endif #ifdef CONFIG_DEBUG_CFG80211 DBG_88E(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter), @@ -4859,7 +4849,12 @@ static struct cfg80211_ops rtw_cfg80211_ops = { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) .mgmt_tx = cfg80211_rtw_mgmt_tx, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + .update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register, +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, +#endif + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) .action = cfg80211_rtw_mgmt_tx, #endif