Commit e3892296 authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds

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.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10ed273f
...@@ -835,7 +835,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list) ...@@ -835,7 +835,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
smp_mb(); smp_mb();
if (buffer_dirty(bh)) { if (buffer_dirty(bh)) {
list_add(&bh->b_assoc_buffers, list_add(&bh->b_assoc_buffers,
&bh->b_assoc_map->private_list); &mapping->private_list);
bh->b_assoc_map = mapping; bh->b_assoc_map = mapping;
} }
spin_unlock(lock); spin_unlock(lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment