f2fs: fix ERR_PTR returned by bio

This is to fix wrong error pointer handling flow reported by Dan.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim 2016-07-12 09:38:48 -07:00
parent b56ab837a0
commit 1d353eb7e4

View File

@ -1085,9 +1085,11 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
}
if (bio == NULL) {
bio = f2fs_grab_bio(inode, block_nr, nr_pages);
if (IS_ERR(bio))
if (IS_ERR(bio)) {
bio = NULL;
goto set_error_page;
}
}
if (bio_add_page(bio, page, blocksize, 0) < blocksize)
goto submit_and_realloc;