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/scrub.c | |
parent | c6664b42c4e567792abdb17c958fb01c5bcfcb3a (diff) | |
download | linux-stable-e627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0.tar.gz linux-stable-e627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0.tar.bz2 linux-stable-e627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0.zip |
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/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index c9a2c1aef4bd..60f0e28db31e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1044,6 +1044,8 @@ static int scrub_recheck_block(struct btrfs_fs_info *fs_info, BUG_ON(!page->page); bio = bio_alloc(GFP_NOFS, 1); + if (!bio) + return -EIO; bio->bi_bdev = page->bdev; bio->bi_sector = page->physical >> 9; bio->bi_end_io = scrub_complete_bio_end_io; @@ -1172,6 +1174,8 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, DECLARE_COMPLETION_ONSTACK(complete); bio = bio_alloc(GFP_NOFS, 1); + if (!bio) + return -EIO; bio->bi_bdev = page_bad->bdev; bio->bi_sector = page_bad->physical >> 9; bio->bi_end_io = scrub_complete_bio_end_io; |