diff options
author | Tristan Ye <tristan.ye@oracle.com> | 2010-09-10 10:16:33 +0800 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-09-10 09:19:30 -0700 |
commit | 228ac6357718df2d5c8d70210fa51b2225aab5ee (patch) | |
tree | 4aaf7f05d03a5757b6c128d433c220b55d89fd88 /fs | |
parent | 0f4da216b8c3c35c90ecd18e1899c6f125957c2b (diff) | |
download | linux-228ac6357718df2d5c8d70210fa51b2225aab5ee.tar.gz linux-228ac6357718df2d5c8d70210fa51b2225aab5ee.tar.bz2 linux-228ac6357718df2d5c8d70210fa51b2225aab5ee.zip |
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
Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/dlm/dlmdebug.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 5efdd37dfe48..901ca52bf86b 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c @@ -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; } |