Skip to contentSkip to conversation

ocfs2: fix null pointer dereference when access dlm_state before launching dlm thread

PATCH New Joseph Qi 1 participant 1 message Feb 11, 2014 OCFS2

lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

PATCH 1/1 ocfs2: fix null pointer dereference when access dlm_state before launching dlm thread

From: Zongxun Wang <[email protected]>

When mounting an ocfs2 volume, it will firstly generate a file /sys/kernel/debug/o2dlm/<uuid>/dlm_state, and then launch the dlm thread. So the following situation will cause a null pointer dereference. dlm_debug_init -> access file dlm_state which will call dlm_state_print -> dlm_launch_thread
Move dlm_debug_init after dlm_launch_thread and dlm_launch_recovery_thread can fix this issue.

---
 fs/ocfs2/dlm/dlmdomain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ocfs2/dlm/dlmdomain.c +3 -3
index 33660a4..1307a8c 100644
@@ -1877,19 +1877,19 @@ static int dlm_join_domain(struct dlm_ctxt *dlm)
 		goto bail;
 	}
 
-	status = dlm_debug_init(dlm);
+	status = dlm_launch_thread(dlm);
 	if (status < 0) {
 		mlog_errno(status);
 		goto bail;
 	}
 
-	status = dlm_launch_thread(dlm);
+	status = dlm_launch_recovery_thread(dlm);
 	if (status < 0) {
 		mlog_errno(status);
 		goto bail;
 	}
 
-	status = dlm_launch_recovery_thread(dlm);
+	status = dlm_debug_init(dlm);
 	if (status < 0) {
 		mlog_errno(status);
 		goto bail;
Signature · 1 line
1.8.4.3