Skip to content

Commit

Permalink
md/linear: If md_integrity_register() fails, linear_run() must free t…
Browse files Browse the repository at this point in the history
…he mem.

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 dd775ae commit 98d5561
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/md/linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks)
static int linear_run (struct mddev *mddev)
{
struct linear_conf *conf;
int ret;

if (md_check_no_bitmap(mddev))
return -EINVAL;
Expand All @@ -211,7 +212,13 @@ static int linear_run (struct mddev *mddev)
blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
mddev->queue->backing_dev_info.congested_fn = linear_congested;
mddev->queue->backing_dev_info.congested_data = mddev;
return md_integrity_register(mddev);

ret = md_integrity_register(mddev);
if (ret) {
kfree(conf);
mddev->private = NULL;
}
return ret;
}

static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
Expand Down

0 comments on commit 98d5561

Please sign in to comment.