dataipa: Mutex lock the ipa_lnx_stats_ioctl

Mutex locking the ipa_lnx_stats ioctl.

Change-Id: Id1fe67cb5ad972dc501a0c1b5adb33b47d8dbaaa
Signed-off-by: Michael Adisumarta <quic_madisuma@quicinc.com>
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c
index 43f48a9..2cd1e7c 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c
@@ -52,6 +52,7 @@
 static dev_t device;
 
 struct ipa_lnx_stats_spearhead_ctx ipa_lnx_agent_ctx;
+static DEFINE_MUTEX(ipa_lnx_ctx_mutex);
 
 struct wlan_intf_mode_cnt {
 	u8 ap_cnt;
@@ -1765,6 +1766,7 @@
 		return -EPERM;
 	}
 
+	mutex_lock(&ipa_lnx_ctx_mutex);
 	switch (cmd) {
 	case IPA_LNX_IOC_GET_ALLOC_INFO:
 		retval = ipa_stats_get_alloc_info(arg);
@@ -1810,6 +1812,7 @@
 				const void __user *)arg, sizeof(struct ipa_lnx_consolidated_stats));
 		if (IS_ERR(consolidated_stats)) {
 			IPA_STATS_ERR("copy from user failed");
+			mutex_unlock(&ipa_lnx_ctx_mutex);
 			return -ENOMEM;
 		}
 
@@ -1868,6 +1871,7 @@
 	default:
 		retval = -ENOTTY;
 	}
+	mutex_unlock(&ipa_lnx_ctx_mutex);
 	return retval;
 }