Skip to content

Commit

Permalink
f2fs: handle error from f2fs_iget_nowait
Browse files Browse the repository at this point in the history
In case f2fs_iget_nowait returns error, it results in truncate_hole being
called with 'error' value as inode pointer. There is no check in truncate_hole
for valid inode, so it could result in crash due "invalid access to memory".
Avoid this by handling error condition properly.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
  • Loading branch information
Namjae Jeon authored and Jaegeuk Kim committed Dec 28, 2012
1 parent 029cd28 commit 06025f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/f2fs/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,

/* Deallocate previous index in the node page */
inode = f2fs_iget_nowait(sbi->sb, ino);
if (IS_ERR(inode))
return;

truncate_hole(inode, bidx, bidx + 1);
iput(inode);
}
Expand Down

0 comments on commit 06025f4

Please sign in to comment.