diff options
author | majianpeng <majianpeng@gmail.com> | 2012-04-01 19:48:37 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-04-01 19:48:37 -0400 |
commit | 98d5561bfbc3c7a53d6abc1812a2bd5344d36fa3 (patch) | |
tree | 6397046f8dc7a82986ebd7e442491dc118d1a850 /drivers/md | |
parent | dd775ae2549217d3ae09363e3edb305d0fa19928 (diff) |
md/linear: If md_integrity_register() fails, linear_run() must free the mem.
Signed-off-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/linear.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index b0fcc7d02adb..fa211d80fc0a 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -198,6 +198,7 @@ out: | |||
198 | static int linear_run (struct mddev *mddev) | 198 | static int linear_run (struct mddev *mddev) |
199 | { | 199 | { |
200 | struct linear_conf *conf; | 200 | struct linear_conf *conf; |
201 | int ret; | ||
201 | 202 | ||
202 | if (md_check_no_bitmap(mddev)) | 203 | if (md_check_no_bitmap(mddev)) |
203 | return -EINVAL; | 204 | return -EINVAL; |
@@ -211,7 +212,13 @@ static int linear_run (struct mddev *mddev) | |||
211 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); | 212 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); |
212 | mddev->queue->backing_dev_info.congested_fn = linear_congested; | 213 | mddev->queue->backing_dev_info.congested_fn = linear_congested; |
213 | mddev->queue->backing_dev_info.congested_data = mddev; | 214 | mddev->queue->backing_dev_info.congested_data = mddev; |
214 | return md_integrity_register(mddev); | 215 | |
216 | ret = md_integrity_register(mddev); | ||
217 | if (ret) { | ||
218 | kfree(conf); | ||
219 | mddev->private = NULL; | ||
220 | } | ||
221 | return ret; | ||
215 | } | 222 | } |
216 | 223 | ||
217 | static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | 224 | static int linear_add(struct mddev *mddev, struct md_rdev *rdev) |