diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2012-12-22 04:09:43 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-28 03:26:13 +0100 |
commit | 06025f4df88e9e41f4ebcf6b4c3df30661332bc9 (patch) | |
tree | 9d5fab4bb021444db75538a70095675af227dded /fs | |
parent | f2fs: fix equation of has_not_enough_free_secs() (diff) | |
download | linux-06025f4df88e9e41f4ebcf6b4c3df30661332bc9.tar.xz linux-06025f4df88e9e41f4ebcf6b4c3df30661332bc9.zip |
f2fs: handle error from f2fs_iget_nowait
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/recovery.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index b07e9b6ef376..207e2c865c7e 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -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); } |