summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepak Dhamdhere <ddhamdhe@codeaurora.org>2017-01-24 01:05:43 -0800
committerqcabuildsw <qcabuildsw@localhost>2017-01-26 09:56:58 -0800
commitf8e1cac04012e73cf4ec16dc1782058ea153b21c (patch)
treec25e0bc93a6f325b5a39429ed2c460f19e725828
parent06f4e410fa5d76f8037a3e79f5ab51765821a3d4 (diff)
qcacld-3.0: Fix memory references in wma_remove_peer()
Check for NULL values of peer and peer_map_addr before dereferencing. Move the debug print statement before peer is detached and peer object is freed. CRs-Fixed: 1115011 Change-Id: I00d547847eed8e24a01178390b9a62be0b9b75d7
-rw-r--r--core/wma/src/wma_dev_if.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index 605f2660f59f..9047e23f19e9 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -1141,6 +1141,14 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
struct peer_flush_params param = {0};
uint8_t *peer_mac_addr;
+ peer_mac_addr = ol_txrx_peer_get_peer_mac_addr(peer);
+ if (peer_mac_addr == NULL) {
+ WMA_LOGE("%s: peer mac addr is NULL, Can't remove peer, vdevid %d peer_count %d",
+ __func__, vdev_id,
+ wma->interfaces[vdev_id].peer_count);
+ return;
+ }
+
if (!wma->interfaces[vdev_id].peer_count) {
WMA_LOGE("%s: Can't remove peer with peer_addr %pM vdevid %d peer_count %d",
__func__, bssid, vdev_id,
@@ -1148,14 +1156,6 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
return;
}
- peer_mac_addr = ol_txrx_peer_get_peer_mac_addr(peer);
- if (peer_mac_addr == NULL) {
- WMA_LOGE("%s: peer mac addr is NULL, Can't remove peer with peer_addr %pM vdevid %d peer_count %d",
- __func__, bssid, vdev_id,
- wma->interfaces[vdev_id].peer_count);
- return;
- }
-
if (roam_synch_in_progress)
goto peer_detach;
/* Flush all TIDs except MGMT TID for this peer in Target */
@@ -1175,6 +1175,10 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
vdev_id);
peer_detach:
+ WMA_LOGE("%s: Remove peer %p with peer_addr %pM vdevid %d peer_count %d",
+ __func__, peer, bssid, vdev_id,
+ wma->interfaces[vdev_id].peer_count);
+
if (peer) {
if (roam_synch_in_progress)
ol_txrx_peer_detach_force_delete(peer);
@@ -1183,9 +1187,6 @@ peer_detach:
}
wma->interfaces[vdev_id].peer_count--;
- WMA_LOGE("%s: Removed peer %p with peer_addr %pM vdevid %d peer_count %d",
- __func__, peer, bssid, vdev_id,
- wma->interfaces[vdev_id].peer_count);
#undef PEER_ALL_TID_BITMASK
}