aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2015-09-11 16:07:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-11 18:21:34 -0400
commite527b22c3f63c02832ac4cb8ed0ec3a9b638bbdf (patch)
tree8ed463c8a124a111ba3ba14fe2cdb768e9f2721c /fs/ocfs2/dlm
parent4f1af60bcc2fc6caa7fa3036238b5994708e9a84 (diff)
revert "ocfs2/dlm: use list_for_each_entry instead of list_for_each"
Revert commit f83c7b5e9fd6 ("ocfs2/dlm: use list_for_each_entry instead of list_for_each"). list_for_each_entry() will dereference its `pos' argument, which can be NULL in dlm_process_recovery_data(). Reported-by: Julia Lawall <julia.lawall@lip6.fr> Reported-by: Fengguang Wu <fengguang.wu@gmail.com> Cc: Joseph Qi <joseph.qi@huawei.com> Cc: Mark Fasheh <mfasheh@suse.de> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/dlm')
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index d0e436dc6437..ce12e0b1a31f 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1776,7 +1776,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
1776 struct dlm_migratable_lockres *mres) 1776 struct dlm_migratable_lockres *mres)
1777{ 1777{
1778 struct dlm_migratable_lock *ml; 1778 struct dlm_migratable_lock *ml;
1779 struct list_head *queue; 1779 struct list_head *queue, *iter;
1780 struct list_head *tmpq = NULL; 1780 struct list_head *tmpq = NULL;
1781 struct dlm_lock *newlock = NULL; 1781 struct dlm_lock *newlock = NULL;
1782 struct dlm_lockstatus *lksb = NULL; 1782 struct dlm_lockstatus *lksb = NULL;
@@ -1821,7 +1821,9 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
1821 spin_lock(&res->spinlock); 1821 spin_lock(&res->spinlock);
1822 for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) { 1822 for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) {
1823 tmpq = dlm_list_idx_to_ptr(res, j); 1823 tmpq = dlm_list_idx_to_ptr(res, j);
1824 list_for_each_entry(lock, tmpq, list) { 1824 list_for_each(iter, tmpq) {
1825 lock = list_entry(iter,
1826 struct dlm_lock, list);
1825 if (lock->ml.cookie == ml->cookie) 1827 if (lock->ml.cookie == ml->cookie)
1826 break; 1828 break;
1827 lock = NULL; 1829 lock = NULL;