From 0381f56e17f1913da8a8c5ed3cfde03b4525c25d Mon Sep 17 00:00:00 2001 From: phadiman Date: Fri, 29 Jun 2018 15:40:52 +0530 Subject: [PATCH] qcacmn: Add sanity checks Add sanity checks for ast_entry structure Change-Id: I361fac6b62f4b437f8d8d126fbb922d42b9b1b00 --- dp/wifi3.0/dp_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index ec38e67a4c..fa09fdb3a8 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -326,17 +326,19 @@ static int dp_peer_update_ast_wifi3(struct cdp_soc_t *soc_hdl, uint8_t *wds_macaddr, uint32_t flags) { - int status; + int status = -1; struct dp_soc *soc = (struct dp_soc *)soc_hdl; struct dp_ast_entry *ast_entry = NULL; qdf_spin_lock_bh(&soc->ast_lock); ast_entry = dp_peer_ast_hash_find(soc, wds_macaddr); - status = dp_peer_update_ast(soc, - (struct dp_peer *)peer_hdl, - ast_entry, - flags); + if (ast_entry) { + status = dp_peer_update_ast(soc, + (struct dp_peer *)peer_hdl, + ast_entry, flags); + } + qdf_spin_unlock_bh(&soc->ast_lock); return status; @@ -358,9 +360,11 @@ static void dp_wds_reset_ast_wifi3(struct cdp_soc_t *soc_hdl, qdf_spin_lock_bh(&soc->ast_lock); ast_entry = dp_peer_ast_hash_find(soc, wds_macaddr); - if (ast_entry->type != CDP_TXRX_AST_TYPE_STATIC) { - ast_entry->is_active = TRUE; + if (ast_entry) { + if (ast_entry->type != CDP_TXRX_AST_TYPE_STATIC) + ast_entry->is_active = TRUE; } + qdf_spin_unlock_bh(&soc->ast_lock); }