From 0b9c8c186f42eb651fa33d9718652b2ddd8dd1b9 Mon Sep 17 00:00:00 2001 From: Vidyakumar Athota Date: Tue, 14 Aug 2018 10:57:27 -0700 Subject: [PATCH] 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 --- ipc/apr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ipc/apr.c b/ipc/apr.c index cb72766a5ff5..ff393e372869 100644 --- a/ipc/apr.c +++ b/ipc/apr.c @@ -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;