Skip to contentSkip to conversation

vfs: Fix NULL pointer dereference in fsync_buffers_list()

PATCH New Jan Kara 1 participant 1 message Mar 4, 2008 VFS

lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 vfs: Fix NULL pointer dereference in fsync_buffers_list()

Fix NULL pointer dereference in fsync_buffers_list() introduced by recent fix of races in private_list handling. Since bh->b_assoc_map has been cleared in __remove_assoc_queue() we should really use original value stored in the 'mapping' variable.

---

Hmm, somehow testing of private_list handling patch on ext2 never hit the code path with the bug :(. UDF did... Please push to Linus. Thanks.

fs/buffer.c +1 -1
index 897cd74..ddfdd2c 100644
@@ -835,7 +835,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
 		smp_mb();
 		if (buffer_dirty(bh)) {
 			list_add(&bh->b_assoc_buffers,
-				 &bh->b_assoc_map->private_list);
+				 &mapping->private_list);
 			bh->b_assoc_map = mapping;
 		}
 		spin_unlock(lock);