Skip to content

Commit

Permalink
md/raid1: If md_integrity_register() failed,run() must free the mem
Browse files Browse the repository at this point in the history
Signed-off-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
majianpeng authored and NeilBrown committed Apr 1, 2012
1 parent 0366ef8 commit 5220ea1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2636,11 +2636,13 @@ static struct r1conf *setup_conf(struct mddev *mddev)
return ERR_PTR(err);
}

static int stop(struct mddev *mddev);
static int run(struct mddev *mddev)
{
struct r1conf *conf;
int i;
struct md_rdev *rdev;
int ret;

if (mddev->level != 1) {
printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n",
Expand Down Expand Up @@ -2705,7 +2707,11 @@ static int run(struct mddev *mddev)
mddev->queue->backing_dev_info.congested_data = mddev;
blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec);
}
return md_integrity_register(mddev);

ret = md_integrity_register(mddev);
if (ret)
stop(mddev);
return ret;
}

static int stop(struct mddev *mddev)
Expand Down

0 comments on commit 5220ea1

Please sign in to comment.