All of lore.kernel.org
 help / color / mirror / Atom feed
From: tang.junhui@zte.com.cn
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: zhang.kai16@zte.com.cn, "tang.junhui" <tang.junhui@zte.com.cn>,
	dm-devel@redhat.com
Subject: [PATCH 2/3] access vecs memory outside of locking range in check_path()
Date: Tue, 18 Oct 2016 10:51:08 +0800	[thread overview]
Message-ID: <1476759069-9832-2-git-send-email-tang.junhui@zte.com.cn> (raw)
In-Reply-To: <1476759069-9832-1-git-send-email-tang.junhui@zte.com.cn>

From: "tang.junhui" <tang.junhui@zte.com.cn>

there are vecs->mpvec memory accesses outside of locking range in
check_path(), the judgments is not necessary since the they has
existed in vector_foreach_slot(), so delete them.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
---
 multipathd/main.c | 45 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index b6eb696..e369a79 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1804,30 +1804,29 @@ checkerloop (void *ap)
 			condlog(4, "timeout waiting for DAEMON_IDLE");
 			continue;
 		}
-		if (vecs->pathvec) {
-			pthread_cleanup_push(cleanup_lock, &vecs->lock);
-			lock(&vecs->lock);
-			pthread_testcancel();
-			vector_foreach_slot (vecs->pathvec, pp, i) {
-				rc = check_path(vecs, pp, ticks);
-				if (rc < 0) {
-					vector_del_slot(vecs->pathvec, i);
-					free_path(pp);
-					i--;
-				} else
-					num_paths += rc;
-			}
-			lock_cleanup_pop(vecs->lock);
-		}
-		if (vecs->mpvec) {
-			pthread_cleanup_push(cleanup_lock, &vecs->lock);
-			lock(&vecs->lock);
-			pthread_testcancel();
-			defered_failback_tick(vecs->mpvec);
-			retry_count_tick(vecs->mpvec);
-			missing_uev_wait_tick(vecs);
-			lock_cleanup_pop(vecs->lock);
+
+		pthread_cleanup_push(cleanup_lock, &vecs->lock);
+		lock(&vecs->lock);
+		pthread_testcancel();
+		vector_foreach_slot (vecs->pathvec, pp, i) {
+			rc = check_path(vecs, pp, ticks);
+			if (rc < 0) {
+				vector_del_slot(vecs->pathvec, i);
+				free_path(pp);
+				i--;
+			} else
+				num_paths += rc;
 		}
+		lock_cleanup_pop(vecs->lock);
+
+		pthread_cleanup_push(cleanup_lock, &vecs->lock);
+		lock(&vecs->lock);
+		pthread_testcancel();
+		defered_failback_tick(vecs->mpvec);
+		retry_count_tick(vecs->mpvec);
+		missing_uev_wait_tick(vecs);
+		lock_cleanup_pop(vecs->lock);
+
 		if (count)
 			count--;
 		else {
-- 
2.8.1.windows.1

  reply	other threads:[~2016-10-18  2:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  2:51 [PATCH 1/3] segment faulty occured in dm_get_status() tang.junhui
2016-10-18  2:51 ` tang.junhui [this message]
2016-10-18 16:22   ` [PATCH 2/3] access vecs memory outside of locking range in check_path() Benjamin Marzinski
2016-10-19  6:00     ` Christophe Varoqui
2016-10-18  2:51 ` [PATCH 3/3] Treat PATH_TIMEOUT as PATH_DOWN tang.junhui
2016-10-18 16:38   ` Benjamin Marzinski
2016-10-18 16:21 ` [PATCH 1/3] segment faulty occured in dm_get_status() Benjamin Marzinski
2016-10-19  6:00   ` Christophe Varoqui

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=1476759069-9832-2-git-send-email-tang.junhui@zte.com.cn \
    --to=tang.junhui@zte.com.cn \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --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.