Skip to content

Commit

Permalink
ocfs2: fix null pointer dereference when access dlm_state before laun…
Browse files Browse the repository at this point in the history
…ching dlm thread

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.

Signed-off-by: Zongxun Wang <[email protected]>
Signed-off-by: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Zongxun Wang authored and torvalds committed Apr 3, 2014
1 parent 0c3d1d6 commit 181a9a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/ocfs2/dlm/dlmdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 181a9a0

Please sign in to comment.