qcacld-3.0: Delete old peer from obj manager when STA roam to new peer

When STA roam to new peer the old peer is not deleted from object
manager and this leads to crash during unload.

To fix this delete old peer from object manager once STA roams to
new peer

Change-Id: I991e0fc5fd7e1a8cb797395de601eab3ebfa015a
CRs-Fixed: 2022056
This commit is contained in:
Abhishek Singh 2017-03-20 17:56:34 +05:30 • committed by Sandeep Puligilla
commit 07c627e132
3 changed files with 36 additions and 24 deletions

View file

@ -1432,11 +1432,14 @@ static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx)
*
* Return: QDF_STATUS enumeration
*/
QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *adapter, uint8_t staid)
{
QDF_STATUS qdf_status;
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
int ret = 0;
uint8_t *peer_mac = NULL;
struct qdf_mac_addr broadcastMacAddr =
QDF_MAC_ADDR_BROADCAST_INITIALIZER;
if (eConnectionState_IbssDisconnected ==
pHddStaCtx->conn_info.connState) {
/*
@ -1447,10 +1450,27 @@ QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC),
(struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX),
staId);
staid);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_err("cdp_clear_peer() failed for staID %d. Status(%d) [0x%08X]",
staId, qdf_status, qdf_status);
hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]",
staid, qdf_status, qdf_status);
}
if (adapter->device_mode == QDF_STA_MODE) {
peer_mac = pHddStaCtx->conn_info.bssId.bytes;
} else if (adapter->device_mode == QDF_IBSS_MODE) {
if (pHddStaCtx->broadcast_staid == staid)
peer_mac = broadcastMacAddr.bytes;
else
peer_mac = pHddStaCtx->conn_info.
peerMacAddress[staid].bytes;
}
ret = hdd_remove_peer_object(adapter->hdd_vdev,
peer_mac);
if (ret) {
hdd_err("Peer obj %pM delete fails", peer_mac);
return QDF_STATUS_E_FAILURE;
}
return qdf_status;
}
@ -2389,6 +2409,7 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter,
hdd_conn_set_connection_state(pAdapter,
eConnectionState_Associated);
}
/* Save the connection info from CSR... */
hdd_conn_save_connect_info(pAdapter, pRoamInfo,
eCSR_BSS_TYPE_INFRASTRUCTURE);
@ -2405,7 +2426,6 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter,
pAdapter->wapi_info.fIsWapiSta = 0;
}
#endif /* FEATURE_WLAN_WAPI */
/* Indicate 'connect' status to user space */
hdd_send_association_event(dev, pRoamInfo);
@ -3358,7 +3378,6 @@ roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter,
eRoamCmdStatus roamStatus,
eCsrRoamResult roamResult)
{
int ret;
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
QDF_STATUS qdf_status;
@ -3470,12 +3489,6 @@ roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter,
pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL;
pHddStaCtx->ibss_sta_generation++;
ret = hdd_remove_peer_object(pAdapter->hdd_vdev,
pRoamInfo->peerMac.bytes);
if (ret)
hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails",
MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes));
cfg80211_del_sta(pAdapter->dev,
(const u8 *)&pRoamInfo->peerMac.bytes,
GFP_KERNEL);

View file

@ -1832,15 +1832,6 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
NULL,
pHostapdAdapter->device_mode);
}
ret = hdd_remove_peer_object(pHostapdAdapter->hdd_vdev,
pSapEvent->sapevt.
sapStationDisassocCompleteEvent.
staMac.bytes);
if (ret)
hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails",
MAC_ADDR_ARRAY(pSapEvent->sapevt.
sapStationDisassocCompleteEvent.
staMac.bytes));
#ifdef MSM_PLATFORM
/*stop timer in sap/p2p_go */
if (pHddApCtx->bApActive == false) {

View file

@ -46,7 +46,7 @@
#include <cds_utils.h>
#include <cdp_txrx_flow_ctrl_v2.h>
#include <cdp_txrx_handle.h>
#include <wlan_hdd_object_manager.h>
#ifdef IPA_OFFLOAD
#include <wlan_hdd_ipa.h>
#endif
@ -763,6 +763,7 @@ QDF_STATUS hdd_softap_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
{
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
hdd_context_t *pHddCtx;
int ret;
if (NULL == pAdapter) {
hdd_err("NULL adapter");
@ -787,12 +788,19 @@ QDF_STATUS hdd_softap_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
staId, qdf_status, qdf_status);
}
ret = hdd_remove_peer_object(pAdapter->hdd_vdev,
pAdapter->aStaInfo[staId].macAddrSTA.bytes);
if (ret)
hdd_err("Peer obj %pM delete fails",
pAdapter->aStaInfo[staId].macAddrSTA.bytes);
if (pAdapter->aStaInfo[staId].isUsed) {
spin_lock_bh(&pAdapter->staInfo_lock);
qdf_mem_zero(&pAdapter->aStaInfo[staId],
sizeof(hdd_station_info_t));
spin_unlock_bh(&pAdapter->staInfo_lock);
}
pHddCtx->sta_to_adapter[staId] = NULL;
return qdf_status;