qcacld-3.0: Fix deadlock in hdd_adapter_lock usage
hdd_adapter_lock is acquired from MC thread and hif_napi soft IRQ
context so it should be acquired using spin_lock_bh such that when
MC thread is holding the lock soft IRQ can't pre-empt it and lead
to deadlock
Change-Id: Iee4a4905bf7cc09cba9bd26f416d505eb47a5c96
CRs-Fixed: 981886
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 79b5273..2c954e3 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -3272,10 +3272,10 @@
hdd_adapter_list_node_t **padapterNode)
{
QDF_STATUS status;
- qdf_spin_lock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock);
status = qdf_list_peek_front(&hdd_ctx->hddAdapters,
(qdf_list_node_t **) padapterNode);
- qdf_spin_unlock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock);
return status;
}
@@ -3284,12 +3284,12 @@
hdd_adapter_list_node_t **pNextAdapterNode)
{
QDF_STATUS status;
- qdf_spin_lock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock);
status = qdf_list_peek_next(&hdd_ctx->hddAdapters,
(qdf_list_node_t *) adapterNode,
(qdf_list_node_t **) pNextAdapterNode);
- qdf_spin_unlock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock);
return status;
}
@@ -3297,10 +3297,10 @@
hdd_adapter_list_node_t *adapterNode)
{
QDF_STATUS status;
- qdf_spin_lock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock);
status = qdf_list_remove_node(&hdd_ctx->hddAdapters,
&adapterNode->node);
- qdf_spin_unlock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock);
return status;
}
@@ -3308,10 +3308,10 @@
hdd_adapter_list_node_t **padapterNode)
{
QDF_STATUS status;
- qdf_spin_lock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock);
status = qdf_list_remove_front(&hdd_ctx->hddAdapters,
(qdf_list_node_t **) padapterNode);
- qdf_spin_unlock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock);
return status;
}
@@ -3319,10 +3319,10 @@
hdd_adapter_list_node_t *adapterNode)
{
QDF_STATUS status;
- qdf_spin_lock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock);
status = qdf_list_insert_back(&hdd_ctx->hddAdapters,
(qdf_list_node_t *) adapterNode);
- qdf_spin_unlock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock);
return status;
}
@@ -3330,10 +3330,10 @@
hdd_adapter_list_node_t *adapterNode)
{
QDF_STATUS status;
- qdf_spin_lock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock);
status = qdf_list_insert_front(&hdd_ctx->hddAdapters,
(qdf_list_node_t *) adapterNode);
- qdf_spin_unlock(&hdd_ctx->hdd_adapter_lock);
+ qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock);
return status;
}