Hi,

This patch fixes a bug in kvmtrace.

Thanks,
  ozaki-r

>From 4ccee3a01c2e8c377dc6a760b5d7802e58afda72 Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <[EMAIL PROTECTED]>
Date: Sat, 4 Oct 2008 15:30:48 +0900
Subject: [PATCH] kvm: user: Call pthread_join only to created threads.

If thread_main fails with a somewhat reason (e.g. open fails)
before all threads are created, pthread_join is called to a
uncreated thread and a segmentation fault occurs.

This patch checks whether a thread is created before calling
pthread_join to the thread.

Signed-off-by: Ryota Ozaki <[EMAIL PROTECTED]>
---
 user/kvmtrace.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/user/kvmtrace.c b/user/kvmtrace.c
index 876ac27..de3c189 100644
--- a/user/kvmtrace.c
+++ b/user/kvmtrace.c
@@ -454,7 +454,8 @@ static void stop_threads()
        int i;

        for_each_tip(tip, i) {
-               (void) pthread_join(tip->thread, (void *) &ret);
+               if (tip->thread)
+                       (void) pthread_join(tip->thread, (void *) &ret);
                close_thread(tip);
        }
 }
-- 
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to