Browse Source

dsp: lsm: adjust mutex_lock to avoid deadlock

When dispatch_event in apr and q6lsm_client_free in q6lsm
are running concurrently, there may be deadlock between
session_lock in lsm and svc->m_lock in apr. Adjust session_lock
in q6lsm_client_free to avoid deadlock.

Change-Id: I26eb788d4c17af78272dd1f717717e865dfbd0ac
Signed-off-by: Meng Wang <[email protected]>
Meng Wang 5 years ago
parent
commit
818d4e9b7f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      dsp/q6lsm.c

+ 1 - 1
dsp/q6lsm.c

@@ -372,9 +372,9 @@ void q6lsm_client_free(struct lsm_client *client)
 		pr_err("%s: Invalid Session %d\n", __func__, client->session);
 		return;
 	}
-	mutex_lock(&session_lock);
 	apr_deregister(client->apr);
 	client->mmap_apr = NULL;
+	mutex_lock(&session_lock);
 	q6lsm_session_free(client);
 	q6lsm_mmap_apr_dereg();
 	mutex_destroy(&client->cmd_lock);