qcacmn: Handle race between WDS add vs peer delete

In case where WDS ast entry is added and next hop
peer is deleted even before PEER map for ast entry
is received free the AST entry

Change-Id: Id65a5649665588e98f85fd0f363bc7d114c56828
CRs-Fixed: 3650748
This commit is contained in:
Chaithanya Garrepalli
2023-11-01 22:48:37 +05:30
committed by Ravindra Konda
parent 10e648c51e
commit 4620e06006

View File

@@ -1534,10 +1534,6 @@ static inline QDF_STATUS dp_peer_map_ast(struct dp_soc *soc,
if (soc->ast_offload_support && !wlan_cfg_get_dp_soc_dpdk_cfg(soc->ctrl_psoc))
return QDF_STATUS_SUCCESS;
if (!peer) {
return QDF_STATUS_E_INVAL;
}
dp_peer_err("%pK: peer %pK ID %d vid %d mac " QDF_MAC_ADDR_FMT,
soc, peer, hw_peer_id, vdev_id,
QDF_MAC_ADDR_REF(mac_addr));
@@ -1547,6 +1543,21 @@ static inline QDF_STATUS dp_peer_map_ast(struct dp_soc *soc,
ast_entry = dp_peer_ast_hash_find_by_vdevid(soc, mac_addr, vdev_id);
if (is_wds) {
/*
* While processing peer map of AST entry if the next hop peer is
* deleted free the AST entry as it is not attached to peer yet
*/
if (!peer) {
if (ast_entry)
dp_peer_free_ast_entry(soc, ast_entry);
qdf_spin_unlock_bh(&soc->ast_lock);
dp_peer_alert("Peer is NULL for WDS entry mac "
QDF_MAC_ADDR_FMT " ",
QDF_MAC_ADDR_REF(mac_addr));
return QDF_STATUS_E_INVAL;
}
/*
* In certain cases like Auth attack on a repeater
* can result in the number of ast_entries falling
@@ -1597,6 +1608,13 @@ static inline QDF_STATUS dp_peer_map_ast(struct dp_soc *soc,
}
}
if (!peer) {
qdf_spin_unlock_bh(&soc->ast_lock);
dp_peer_alert("Peer is NULL for mac " QDF_MAC_ADDR_FMT " ",
QDF_MAC_ADDR_REF(mac_addr));
return QDF_STATUS_E_INVAL;
}
if (ast_entry) {
ast_entry->ast_idx = hw_peer_id;
soc->ast_table[hw_peer_id] = ast_entry;