Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b10627f3 authored by Mohammed Javid's avatar Mohammed Javid Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 8069e329
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);

	}