summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-06-06 16:18:22 +0200
committerTheodore Ts'o <tytso@mit.edu>2013-06-06 16:18:22 +0200
commita1d8d9a757cd46e044a3f6061c315eda14bf697e (patch)
tree1f8cda247a0f1e0f6eb8346da151e64b5d46e0ed /fs
parentext4: remove ext4_ioend_wait() (diff)
downloadlinux-a1d8d9a757cd46e044a3f6061c315eda14bf697e.tar.xz
linux-a1d8d9a757cd46e044a3f6061c315eda14bf697e.zip
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" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/page-io.c2
1 files changed, 2 insertions, 0 deletions
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;