Browse Source

qcacmn: initialize spinlock after memset function

In some scenarios, memset function is called after spinlock initialization,
which clears the container holding the spin lock causing the spinlock to
be uninitialized. Fix this by initializing the spinlock after the container
has been cleared with memset().
Change-Id: I87e9844e95e814d8dca25e591a6494516d929c70
CRs-Fixed: 3377971
Krunalsinh Padhar 2 years ago
parent
commit
ce5f301bce

+ 2 - 1
umac/cmn_services/sm_engine/src/wlan_sm_engine_dbg.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -50,8 +51,8 @@ void wlan_sm_save_history(struct wlan_sm *sm,
 
 void wlan_sm_history_init(struct wlan_sm *sm)
 {
-	qdf_spinlock_create(&sm->history.sm_history_lock);
 	qdf_mem_zero(&sm->history, sizeof(struct wlan_sm_history));
+	qdf_spinlock_create(&sm->history.sm_history_lock);
 }
 
 void wlan_sm_history_delete(struct wlan_sm *sm)

+ 1 - 1
umac/mlme/connection_mgr/core/src/wlan_cm_util.c

@@ -1647,8 +1647,8 @@ void cm_req_history_del(struct cnx_mgr *cm_ctx,
 
 void cm_req_history_init(struct cnx_mgr *cm_ctx)
 {
-	qdf_spinlock_create(&cm_ctx->req_history.cm_req_hist_lock);
 	qdf_mem_zero(&cm_ctx->req_history, sizeof(struct cm_req_history));
+	qdf_spinlock_create(&cm_ctx->req_history.cm_req_hist_lock);
 }
 
 void cm_req_history_deinit(struct cnx_mgr *cm_ctx)