summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormajianpeng <majianpeng@gmail.com>2012-04-02 09:48:37 +1000
committerNeilBrown <neilb@suse.de>2012-04-02 09:48:37 +1000
commit0366ef847581d692e197b88825867ca9ee00e358 (patch)
tree7faec66efc6e77b24dd349a42c7dabefbc1964be
parent98d5561bfbc3c7a53d6abc1812a2bd5344d36fa3 (diff)
downloadlinux-3.10-0366ef847581d692e197b88825867ca9ee00e358.tar.gz
linux-3.10-0366ef847581d692e197b88825867ca9ee00e358.tar.bz2
linux-3.10-0366ef847581d692e197b88825867ca9ee00e358.zip
md/raid0: If md_integrity_register() fails, raid0_run() must free the mem.
Signed-off-by: majianpeng <majianpeng@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/raid0.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 6f31f5596e0..c9809453a34 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -407,6 +407,8 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks
return array_sectors;
}
+static int raid0_stop(struct mddev *mddev);
+
static int raid0_run(struct mddev *mddev)
{
struct r0conf *conf;
@@ -454,7 +456,12 @@ static int raid0_run(struct mddev *mddev)
blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec);
dump_zones(mddev);
- return md_integrity_register(mddev);
+
+ ret = md_integrity_register(mddev);
+ if (ret)
+ raid0_stop(mddev);
+
+ return ret;
}
static int raid0_stop(struct mddev *mddev)