Browse Source

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>
Jaegeuk Kim 9 years ago
parent
commit
1d353eb7e4
1 changed files with 3 additions and 1 deletions
  1. 3 1
      fs/f2fs/data.c

+ 3 - 1
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)