提交 228ac635 编写于 作者: T Tristan Ye 提交者: Joel Becker

Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c

This patch tries to handle the case in which list 'dlm->tracking_list' is
empty, to avoid accessing an invalid pointer. It fixes the following oops:

http://oss.oracle.com/bugzilla/show_bug.cgi?id=1287Signed-off-by: NTristan Ye <tristan.ye@oracle.com>
Signed-off-by: NJoel Becker <joel.becker@oracle.com>
上级 0f4da216
...@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) ...@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
spin_lock(&dlm->track_lock); spin_lock(&dlm->track_lock);
if (oldres) if (oldres)
track_list = &oldres->tracking; track_list = &oldres->tracking;
else else {
track_list = &dlm->tracking_list; track_list = &dlm->tracking_list;
if (list_empty(track_list)) {
dl = NULL;
spin_unlock(&dlm->track_lock);
goto bail;
}
}
list_for_each_entry(res, track_list, tracking) { list_for_each_entry(res, track_list, tracking) {
if (&res->tracking == &dlm->tracking_list) if (&res->tracking == &dlm->tracking_list)
...@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) ...@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
} else } else
dl = NULL; dl = NULL;
bail:
/* passed to seq_show */ /* passed to seq_show */
return dl; return dl;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册