diff mbox

RCU protection for variable conf in add_map_with_path()

Message ID 1477384912-10940-1-git-send-email-ding.yemin@zte.com.cn (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

ding.yemin@zte.com.cn Oct. 25, 2016, 8:41 a.m. UTC
From: "ding.yemin" <ding.yemin@zte.com.cn>

Take the variable "conf" under RCU protection in add_map_with_path()。

Signed-off-by: ding.yemin <ding.yemin@zte.com.cn>
---
 libmultipath/structs_vec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index a0c8869..b8ae87c 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -489,12 +489,14 @@  add_map_with_path (struct vectors * vecs,
 	conf = get_multipath_config();
 	mpp->mpe = find_mpe(conf->mptable, pp->wwid);
 	mpp->hwe = pp->hwe;
-	put_multipath_config(conf);
 
 	strcpy(mpp->wwid, pp->wwid);
 	find_existing_alias(mpp, vecs);
-	if (select_alias(conf, mpp))
+	if (select_alias(conf, mpp)) {
+		put_multipath_config(conf);
 		goto out;
+	}
+	put_multipath_config(conf);
 	mpp->size = pp->size;
 
 	if (adopt_paths(vecs->pathvec, mpp))