msm: ipa3: Add spinlock to avoid deleting already deleted list

There is a chance of deleting, already deleted list
in ipa_cleanup_wlan_rx_common_cache API.

Protect the wlan_comm_desc_list,
with the spinlock to avoid this deletion.

Change-Id: I10161f71b92d6d5fe06af62b65bf3d92d0d4512a
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
This commit is contained in:
Mohammed Javid 2017-07-17 12:03:41 +05:30 committed by Gerrit - the friendly Code Review server
parent 8069e32933
commit b10627f358

View file

@ -2093,6 +2093,8 @@ static void ipa3_cleanup_wlan_rx_common_cache(void)
struct ipa3_rx_pkt_wrapper *rx_pkt;
struct ipa3_rx_pkt_wrapper *tmp;
spin_lock_bh(&ipa3_ctx->wc_memb.wlan_spinlock);
list_for_each_entry_safe(rx_pkt, tmp,
&ipa3_ctx->wc_memb.wlan_comm_desc_list, link) {
list_del(&rx_pkt->link);
@ -2113,6 +2115,8 @@ static void ipa3_cleanup_wlan_rx_common_cache(void)
IPAERR("wlan comm buff total cnt: %d\n",
ipa3_ctx->wc_memb.wlan_comm_total_cnt);
spin_unlock_bh(&ipa3_ctx->wc_memb.wlan_spinlock);
}
static void ipa3_alloc_wlan_rx_common_cache(u32 size)
@ -2150,11 +2154,13 @@ static void ipa3_alloc_wlan_rx_common_cache(u32 size)
goto fail_dma_mapping;
}
spin_lock_bh(&ipa3_ctx->wc_memb.wlan_spinlock);
list_add_tail(&rx_pkt->link,
&ipa3_ctx->wc_memb.wlan_comm_desc_list);
rx_len_cached = ++ipa3_ctx->wc_memb.wlan_comm_total_cnt;
ipa3_ctx->wc_memb.wlan_comm_free_cnt++;
spin_unlock_bh(&ipa3_ctx->wc_memb.wlan_spinlock);
}