Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
PATCH 1/1 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=1287
--- fs/ocfs2/dlm/dlmdebug.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
fs/ocfs2/dlm/dlmdebug.c +8 -1
@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)spin_lock (&dlm->track_lock);if (oldres) track_list = &oldres->tracking; -else +else { 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) {if (&res->tracking == &dlm->tracking_list)
@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) }else dl =NULL ; +bail:/* passed to seq_show */ return dl; }
Signature · 1 line
1.5.5
PATCH 1/1 Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
I am assuming you have tested it. ;)
Quoted 39 lines · Tristan Ye
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=1287
Signed-off-by Tristan Ye<[email protected]>--- fs/ocfs2/dlm/dlmdebug.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)fs/ocfs2/dlm/dlmdebug.c +8
-1@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)spin_lock (&dlm->track_lock);if (oldres) track_list =&oldres->tracking; -else +else { 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) {if (&res->tracking ==&dlm->tracking_list)@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) }else dl =NULL ; +bail:/* passed to seq_show */ return dl; }
PATCH 1/1 Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
Quoted 3 lines · Sunil Mushran
Signed-off-by Sunil Mushran<[email protected]>I am assuming you have tested it. ;)
Sure, both in local mode by creating a user dlm domain, and in a cluster.
Quoted 47 lines · Tristan Ye
Quoted 43 lines
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=1287
Signed-off-by Tristan Ye<[email protected]>--- fs/ocfs2/dlm/dlmdebug.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)fs/ocfs2/dlm/dlmdebug.c +7
-1@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)spin_lock (&dlm->track_lock);if (oldres) track_list =&oldres->tracking; -else +else { 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) {if (&res->tracking ==&dlm->tracking_list)fs/ocfs2/dlm/dlmdebug.c +1
-0@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) }else dl =NULL ; +bail:/* passed to seq_show */ return dl;}
PATCH 1/1 Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
In reply to Tristan YeQuoted 6 lines · Tristan Ye
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=1287
Signed-off-by Tristan Ye <[email protected]>
This patch is now in the fixes branch of ocfs2.git.
Joel
Signature · 9 lines
"The first requisite of a good citizen in this republic of ours is that he shall be able and willing to pull his weight." - Theodore Roosevelt Joel Becker Consulting Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127