summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAgarwal Ashish <ashishka@qti.qualcomm.com>2015-07-23 14:27:08 +0530
committerAkash Patel <akashp@codeaurora.org>2015-07-23 08:26:55 -0700
commitaf75e918ff3924d0c83d51ff3b11fb2a4fb353fa (patch)
treeaf5cd6d22fc7c65069a963d6b0d5e0ab2553d333
parentda90261585225708e445299a187aae8defe843fa (diff)
qcacld-2.0: Protect hdd_roc_req_q_lock with spin lock.
While dequeuing ROC; hdd_roc_req_q is not locked. There is chance that hdd_roc_req_q might be being accessed in different context. Fix this by protecting hdd_roc_req_q with spin lock. Change-Id: I3c66920a7a46371a4709a5536112345ff8b6d659 CRs-Fixed: 866278
-rw-r--r--CORE/HDD/src/wlan_hdd_p2p.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index 5cc02654f5f3..4b2fc692e62d 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -695,10 +695,21 @@ void wlan_hdd_roc_request_dequeue(struct work_struct *work)
hdd_context_t *hdd_ctx =
container_of(work, hdd_context_t, rocReqWork);
+ if (0 != (wlan_hdd_validate_context(hdd_ctx))) {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ FL("hdd_ctx is NULL"));
+ return;
+ }
+
+
hddLog(LOG1, FL("RoC request timeout"));
- if (list_empty(&hdd_ctx->hdd_roc_req_q.anchor))
+ spin_lock(&hdd_ctx->hdd_roc_req_q.lock);
+ if (list_empty(&hdd_ctx->hdd_roc_req_q.anchor)) {
+ spin_unlock(&hdd_ctx->hdd_roc_req_q.lock);
return;
+ }
+ spin_unlock(&hdd_ctx->hdd_roc_req_q.lock);
/* If driver is busy then we can't run RoC */
if (hdd_ctx->isLoadInProgress || hdd_ctx->isUnloadInProgress ||
@@ -713,9 +724,9 @@ void wlan_hdd_roc_request_dequeue(struct work_struct *work)
return;
}
+ spin_lock(&hdd_ctx->hdd_roc_req_q.lock);
while (!list_empty(&hdd_ctx->hdd_roc_req_q.anchor)) {
/* go to process this RoC request */
- spin_lock(&hdd_ctx->hdd_roc_req_q.lock);
status = hdd_list_remove_front(&hdd_ctx->hdd_roc_req_q,
(hdd_list_node_t**) &hdd_roc_req);
spin_unlock(&hdd_ctx->hdd_roc_req_q.lock);
@@ -731,7 +742,9 @@ void wlan_hdd_roc_request_dequeue(struct work_struct *work)
}
vos_mem_free(hdd_roc_req);
}
+ spin_lock(&hdd_ctx->hdd_roc_req_q.lock);
}
+ spin_unlock(&hdd_ctx->hdd_roc_req_q.lock);
}
static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy,