Skip to content

Commit e527b22

Browse files
akpm00torvalds
authored andcommitted
revert "ocfs2/dlm: use list_for_each_entry instead of list_for_each"
Revert commit f83c7b5 ("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>
1 parent 4f1af60 commit e527b22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ocfs2/dlm/dlmrecovery.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
17761776
struct dlm_migratable_lockres *mres)
17771777
{
17781778
struct dlm_migratable_lock *ml;
1779-
struct list_head *queue;
1779+
struct list_head *queue, *iter;
17801780
struct list_head *tmpq = NULL;
17811781
struct dlm_lock *newlock = NULL;
17821782
struct dlm_lockstatus *lksb = NULL;
@@ -1821,7 +1821,9 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
18211821
spin_lock(&res->spinlock);
18221822
for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) {
18231823
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);
18251827
if (lock->ml.cookie == ml->cookie)
18261828
break;
18271829
lock = NULL;

0 commit comments

Comments
 (0)