md/linear: If md_integrity_register() fails, linear_run() must free the mem.
authormajianpeng <majianpeng@gmail.com>
Sun, 1 Apr 2012 23:48:37 +0000 (09:48 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 1 Apr 2012 23:48:37 +0000 (09:48 +1000)
Signed-off-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/linear.c

index b0fcc7d02adb49b37275ccf9caa2c48465e886ad..fa211d80fc0a1e4e37603b1455184cbee7da6e56 100644 (file)
@@ -198,6 +198,7 @@ out:
 static int linear_run (struct mddev *mddev)
 {
        struct linear_conf *conf;
+       int ret;
 
        if (md_check_no_bitmap(mddev))
                return -EINVAL;
@@ -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)