OSDN Git Service

msm: ipa3: Protect access to ipa3_qmi_ctx variable by lock
authorGhanim Fodi <gfodi@codeaurora.org>
Sun, 9 Jul 2017 09:09:11 +0000 (12:09 +0300)
committerGhanim Fodi <gfodi@codeaurora.org>
Sun, 9 Jul 2017 09:09:11 +0000 (12:09 +0300)
ipa3_qmi_ctx is a global variable that may be accessed by
different worker threads. Protect the access to it
using mutex lock so that the access will be always atomic.

Change-Id: Iaf0c95d66817833c8e8123b12e94a7a01ab8df2c
CRs-fixed: 2056414
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>
drivers/platform/msm/ipa/ipa_v3/ipa_qmi_service.c

index 0269bfb..690a9db 100644 (file)
@@ -1177,10 +1177,13 @@ void ipa3_qmi_service_exit(void)
        }
 
        /* clean the QMI msg cache */
+       mutex_lock(&ipa3_qmi_lock);
        if (ipa3_qmi_ctx != NULL) {
                vfree(ipa3_qmi_ctx);
                ipa3_qmi_ctx = NULL;
        }
+       mutex_unlock(&ipa3_qmi_lock);
+
        ipa3_svc_handle = 0;
        ipa3_qmi_modem_init_fin = false;
        ipa3_qmi_indication_fin = false;