mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
msm: synx: default user callback fix
Avoid race with enqueue and dequeue of user callback data. This is necessary since the callback added in the event queue could be dequeued and variable cleaned up before wake up function is completed. Change-Id: I70aa09d8fc88bcb6e7e4b7aebd0f854a9de075d0 Signed-off-by: Sumukh Hallymysore Ravindra <shallymy@codeaurora.org>
This commit is contained in:
parent
0f30cf7e56
commit
2b0acb8d64
1 changed files with 8 additions and 5 deletions
|
|
@ -719,14 +719,17 @@ void synx_util_default_user_callback(s32 h_synx,
|
|||
int status, void *data)
|
||||
{
|
||||
struct synx_client_cb *cb = data;
|
||||
struct synx_client *client = NULL;
|
||||
|
||||
if (cb && cb->client) {
|
||||
pr_debug("user cb queued for handle %d\n", h_synx);
|
||||
client = cb->client;
|
||||
pr_debug("[sess: %u] user cb queued for handle %d\n",
|
||||
client->id, h_synx);
|
||||
cb->kernel_cb.status = status;
|
||||
mutex_lock(&cb->client->event_q_lock);
|
||||
list_add_tail(&cb->node, &cb->client->event_q);
|
||||
mutex_unlock(&cb->client->event_q_lock);
|
||||
wake_up_all(&cb->client->event_wq);
|
||||
mutex_lock(&client->event_q_lock);
|
||||
list_add_tail(&cb->node, &client->event_q);
|
||||
mutex_unlock(&client->event_q_lock);
|
||||
wake_up_all(&client->event_wq);
|
||||
} else {
|
||||
pr_err("%s: invalid params\n", __func__);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue