Skip to content

Commit e029386

Browse files
author
Jaegeuk Kim
committed
f2fs: avoid trying to get invalid block address
In f2fs_new_inode(), if we fail to get a new inode, we go iput(), followed by f2fs_evict_inode(). If the inode is not marked as bad, it'll try to call f2fs_remove_inode_page() which tries to read the inode block given node id. But, there's no block address allocated yet, which gives a chance to access a wrong block address, if the block device has some garbage data in NAT table. We need to make sure NAT table should have zero data for all the unallocated node ids, but also would be better to take this unnecessary path as well. Let's mark the faild inode as bad. Fixes: 0abd675 ("f2fs: support plain user/group quota") Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 5c1768b commit e029386

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/f2fs/namei.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static struct inode *f2fs_new_inode(struct mnt_idmap *idmap,
341341
trace_f2fs_new_inode(inode, err);
342342
dquot_drop(inode);
343343
inode->i_flags |= S_NOQUOTA;
344+
make_bad_inode(inode);
344345
if (nid_free)
345346
set_inode_flag(inode, FI_FREE_NID);
346347
clear_nlink(inode);

0 commit comments

Comments
 (0)