From 1d353eb7e43853335a3c535c204c4e86f82eaf66 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 12 Jul 2016 09:38:48 -0700 Subject: f2fs: fix ERR_PTR returned by bio This is to fix wrong error pointer handling flow reported by Dan. Reported-by: Dan Carpenter Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs/f2fs/data.c') diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 20b30162e7b4..650099597dd2 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1085,8 +1085,10 @@ submit_and_realloc: } 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) -- cgit v1.2.3