diff options
author | Yunlei He <heyunlei@huawei.com> | 2017-04-26 15:56:52 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-05-03 19:00:30 -0700 |
commit | e9cdd307704b5a8f685fa3fff4403691fbf64f97 (patch) | |
tree | 8dc251a86f1a2c61a529542807a3dd1fdc024a3e /fs/f2fs | |
parent | baaabbb72b0960d6d5220b77f206116aa54771de (diff) | |
download | blackbird-op-linux-e9cdd307704b5a8f685fa3fff4403691fbf64f97.tar.gz blackbird-op-linux-e9cdd307704b5a8f685fa3fff4403691fbf64f97.zip |
f2fs: fix a mount fail for wrong next_scan_nid
-write_checkpoint
-do_checkpoint
-next_free_nid <--- something wrong with next free nid
-f2fs_fill_super
-build_node_manager
-build_free_nids
-get_current_nat_page
-__get_meta_page <--- attempt to access beyond end of device
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/node.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index b99e318bce58..98351a4a4da3 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1955,6 +1955,9 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount) int i = 0; nid_t nid = nm_i->next_scan_nid; + if (unlikely(nid >= nm_i->max_nid)) + nid = 0; + /* Enough entries */ if (nm_i->nid_cnt[FREE_NID_LIST] >= NAT_ENTRY_PER_BLOCK) return; |