From: Theodore Ts'o Date: Thu, 6 Jun 2013 14:18:22 +0000 (-0400) Subject: ext4: add check to io_submit_init_bio X-Git-Tag: next-20130617~97^2~17 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7745883f99c0e81e6bc71527d23ca363eb125a3f;p=karo-tx-linux.git ext4: add check to io_submit_init_bio The bio_alloc() function can return NULL if the memory allocation fails. So we need to check for this. Signed-off-by: "Theodore Ts'o" --- diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index ce8c15a7eabc..48786cdb5e6c 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -372,6 +372,8 @@ static int io_submit_init_bio(struct ext4_io_submit *io, struct bio *bio; bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES)); + if (!bio) + return -ENOMEM; bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9); bio->bi_bdev = bh->b_bdev; bio->bi_end_io = ext4_end_bio;