[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200904141636.32791.knikanth@suse.de>
Date: Tue, 14 Apr 2009 16:36:32 +0530
From: Nikanth Karthikesan <knikanth@...e.de>
To: Neil Brown <neilb@...e.de>
Cc: Jens Axboe <jens.axboe@...cle.com>, linux-kernel@...r.kernel.org,
linux-raid@...r.kernel.org
Subject: [PATCH 1/6] Handle possible bio_alloc failure in md
Handle possible bio_alloc failure in md.
Signed-off-by: Nikanth Karthikesan <knikanth@...e.de>
---
Index: linux-2.6/drivers/md/md.c
===================================================================
--- linux-2.6.orig/drivers/md/md.c
+++ linux-2.6/drivers/md/md.c
@@ -532,6 +532,9 @@ void md_super_write(mddev_t *mddev, mdk_
struct bio *bio = bio_alloc(GFP_NOIO, 1);
int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG);
+ if (unlikely(!bio))
+ md_error(rdev->mddev, rdev);
+
bio->bi_bdev = rdev->bdev;
bio->bi_sector = sector;
bio_add_page(bio, page, size, 0);
@@ -587,6 +590,9 @@ int sync_page_io(struct block_device *bd
struct completion event;
int ret;
+ if (unlikely(!bio))
+ return 0;
+
rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
bio->bi_bdev = bdev;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists