Commit f7409d0f authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: fix wrong pointer access during try_to_free_nids

If we release the lock in list_for_each_entry_safe, we can lose the tmp
pointer by alloc_nid.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 80c54505
......@@ -1664,11 +1664,9 @@ int try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink)
if (i->state == NID_ALLOC)
continue;
__del_from_free_nid_list(nm_i, i);
nm_i->fcnt--;
spin_unlock(&nm_i->free_nid_list_lock);
kmem_cache_free(free_nid_slab, i);
nm_i->fcnt--;
nr_shrink--;
spin_lock(&nm_i->free_nid_list_lock);
}
spin_unlock(&nm_i->free_nid_list_lock);
mutex_unlock(&nm_i->build_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