apr: fix race condition in apr reset

Since apr reset is scheduled in a workqueue, it is possible that before
completion of previous session apr_deregister(), new session of apr_register()
can happen in ssr scenario. Some of the variables are not reset properly
due to this race condition. Fix this issue by failing apr_register() till
apr_deregister() is completed.

Change-Id: I203e356e8330d8633d78bbfc6ae0165afa79f1f3
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
This commit is contained in:
Vidyakumar Athota 2018-08-14 10:57:27 -07:00
parent 0c56067b68
commit 0b9c8c186f

View file

@ -543,6 +543,7 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
if (svc->need_reset) {
mutex_unlock(&svc->m_lock);
pr_err("APR: Service needs reset\n");
svc = NULL;
goto done;
}
svc->id = svc_id;