All of lore.kernel.org
 help / color / mirror / Atom feed
From: ding.yemin@zte.com.cn
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: tang.junhui@zte.com.cn, zhang.kai16@zte.com.cn,
	"ding.yemin" <ding.yemin@zte.com.cn>,
	dm-devel@redhat.com
Subject: [PATCH] RCU protection for variable conf in add_map_with_path()
Date: Tue, 25 Oct 2016 16:41:52 +0800	[thread overview]
Message-ID: <1477384912-10940-1-git-send-email-ding.yemin@zte.com.cn> (raw)

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 --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))
-- 
2.8.1.windows.1


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

                 reply	other threads:[~2016-10-25  8:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477384912-10940-1-git-send-email-ding.yemin@zte.com.cn \
    --to=ding.yemin@zte.com.cn \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --cc=tang.junhui@zte.com.cn \
    --cc=zhang.kai16@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.