All of lore.kernel.org
 help / color / mirror / Atom feed
* md/linear: If md_integrity_register() failed,linear_run() must  free the mem.
@ 2012-03-23  2:29 majianpeng
  2012-03-27  2:17 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2012-03-23  2:29 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

From df3b2e15fb325def8f5eaa076b328084dd86c421 Mon Sep 17 00:00:00 2001
From: majianpeng <majianpeng@gmail.com>
Date: Fri, 23 Mar 2012 10:09:18 +0800
Subject: [PATCH] md/linear: If md_integrity_register() failed,linear_run()
 must  free the mem.


Signed-off-by: majianpeng <majianpeng@gmail.com>
---
 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 b0fcc7d..fa211d8 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -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)
-- 
1.7.5.4

 				
--------------
majianpeng
2012-03-23


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-27  2:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23  2:29 md/linear: If md_integrity_register() failed,linear_run() must free the mem majianpeng
2012-03-27  2:17 ` NeilBrown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.