diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 999144621acb..ebd134d09a64 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1325,17 +1325,22 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, HDD_SAP_WAKE_LOCK_DURATION, WIFI_POWER_EVENT_WAKELOCK_SAP); { - struct station_info staInfo; + struct station_info *sta_info; uint16_t iesLen = pSapEvent->sapevt. sapStationAssocReassocCompleteEvent.iesLen; - memset(&staInfo, 0, sizeof(staInfo)); + sta_info = qdf_mem_malloc(sizeof(*sta_info)); + if (!sta_info) { + hdd_err("Failed to allocate station info"); + return QDF_STATUS_E_FAILURE; + } + memset(sta_info, 0, sizeof(*sta_info)); if (iesLen <= MAX_ASSOC_IND_IE_LEN) { - staInfo.assoc_req_ies = + sta_info->assoc_req_ies = (const u8 *)&pSapEvent->sapevt. sapStationAssocReassocCompleteEvent.ies[0]; - staInfo.assoc_req_ies_len = iesLen; + sta_info->assoc_req_ies_len = iesLen; #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && !defined(WITH_BACKPORTS) /* * After Kernel 4.0, it's no longer need to set @@ -1343,18 +1348,18 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, * changed to use assoc_req_ies_len length to * check the existance of request IE. */ - staInfo.filled |= STATION_INFO_ASSOC_REQ_IES; + sta_info->filled |= STATION_INFO_ASSOC_REQ_IES; #endif cfg80211_new_sta(dev, (const u8 *)&pSapEvent->sapevt. sapStationAssocReassocCompleteEvent. - staMac.bytes[0], &staInfo, + staMac.bytes[0], sta_info, GFP_KERNEL); } else { hdd_err("Assoc Ie length is too long"); } + qdf_mem_free(sta_info); } - pScanInfo = &pHostapdAdapter->scan_info; /* Lets do abort scan to ensure smooth authentication for client */ if ((pScanInfo != NULL) && pScanInfo->mScanPending) { @@ -1746,6 +1751,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, } wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic); + return QDF_STATUS_SUCCESS; stopbss: