iscsi: pthread_mutex_lock is called before pthread_mutex_init
iSCSI's global mutex is used in spdk_iscsi_portal_grp_create() before it is initialized by pthread_mutex_init(). A mutex filled with zero bytes has been accepted by now but this should be fixed. Change-Id: I2e197bec8da2f781c8c4f6e2a2caf9924b0a4369 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/402497 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
fd5ee08ec1
commit
76d023fd56
@ -794,6 +794,12 @@ spdk_iscsi_app_read_parameters(void)
|
||||
*/
|
||||
g_spdk_iscsi.MaxConnections = g_spdk_iscsi.MaxSessions;
|
||||
|
||||
rc = pthread_mutex_init(&g_spdk_iscsi.mutex, NULL);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("mutex_init() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
spdk_iscsi_log_globals();
|
||||
|
||||
/* portal groups */
|
||||
@ -810,12 +816,6 @@ spdk_iscsi_app_read_parameters(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = pthread_mutex_init(&g_spdk_iscsi.mutex, NULL);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("mutex_init() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user