Skip to content

Commit a1d8d9a

Browse files
committed
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>
1 parent 5dc23bd commit a1d8d9a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/ext4/page-io.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ static int io_submit_init_bio(struct ext4_io_submit *io,
372372
struct bio *bio;
373373

374374
bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES));
375+
if (!bio)
376+
return -ENOMEM;
375377
bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
376378
bio->bi_bdev = bh->b_bdev;
377379
bio->bi_end_io = ext4_end_bio;

0 commit comments

Comments
 (0)