qcacmn: Add peer APIs to get and release peer ref

The existing peer API cdp_peer_find_by_add does not maintain any peer
references. So a peer which is returned by the API may get deleted in a
different context. This may lead to access to a already deleted memory.

Fix the issue by introducing new APIs "peer_get_ref" and
"peer_release_ref" which make sure the peer is valid until it is
"released" (peer_release_ref is called).

Change-Id: Id04d13bc6a1b8a55c1ae9246077f64ffb86de3d8
CRs-Fixed: 2146742
This commit is contained in:
Mohit Khanna
2017-11-17 13:11:17 -08:00
zatwierdzone przez snandini
rodzic f7fb76bd5e
commit adfe908a35
4 zmienionych plików z 103 dodań i 0 usunięć

Wyświetl plik

@@ -187,6 +187,26 @@ enum ol_tx_spec {
OL_TX_SPEC_NO_FREE = 0x20, /* give to cb rather than free */
};
/**
* @enum peer_debug_id_type: debug ids to track peer get_ref and release_ref
* @brief Unique peer debug IDs to track the callers. Each new usage can add to
* this enum list to create a new "PEER_DEBUG_ID_".
* @PEER_DEBUG_ID_OL_INTERNAL: debug id for OL internal usage
* @PEER_DEBUG_ID_WMA_PKT_DROP: debug id for wma_is_pkt_drop_candidate API
* @PEER_DEBUG_ID_WMA_ADDBA_REQ: debug id for ADDBA request
* @PEER_DEBUG_ID_WMA_DELBA_REQ: debug id for DELBA request
* @PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP: debug id for send ADDBA response
* @PEER_DEBUG_ID_MAX: debug id MAX
*/
enum peer_debug_id_type {
PEER_DEBUG_ID_OL_INTERNAL = 0,
PEER_DEBUG_ID_WMA_PKT_DROP = 1,
PEER_DEBUG_ID_WMA_ADDBA_REQ = 2,
PEER_DEBUG_ID_WMA_DELBA_REQ = 3,
PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP = 4,
PEER_DEBUG_ID_MAX
};
/**
* struct ol_txrx_desc_type - txrx descriptor type
* @sta_id: sta id