diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2012-04-12 16:03:56 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-04-12 16:03:56 -0400 |
commit | e627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0 (patch) | |
tree | a6f8060dd57184e79b5c46404c941f999137030d /fs/btrfs/extent_io.c | |
parent | c6664b42c4e567792abdb17c958fb01c5bcfcb3a (diff) |
Btrfs: check return value of bio_alloc() properly
bio_alloc() has the possibility of returning NULL.
So, it is necessary to check the return value.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 59ec105444fe..4789770f8eaf 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2180,6 +2180,10 @@ static int bio_readpage_error(struct bio *failed_bio, struct page *page, | |||
2180 | } | 2180 | } |
2181 | 2181 | ||
2182 | bio = bio_alloc(GFP_NOFS, 1); | 2182 | bio = bio_alloc(GFP_NOFS, 1); |
2183 | if (!bio) { | ||
2184 | free_io_failure(inode, failrec, 0); | ||
2185 | return -EIO; | ||
2186 | } | ||
2183 | bio->bi_private = state; | 2187 | bio->bi_private = state; |
2184 | bio->bi_end_io = failed_bio->bi_end_io; | 2188 | bio->bi_end_io = failed_bio->bi_end_io; |
2185 | bio->bi_sector = failrec->logical >> 9; | 2189 | bio->bi_sector = failrec->logical >> 9; |