kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: user: Call pthread_join only to created threads.
@ 2008-10-04  7:20 Ryota OZAKI
  2008-10-05 10:00 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Ryota OZAKI @ 2008-10-04  7:20 UTC (permalink / raw)
  To: kvm; +Cc: Ryota OZAKI

Hi,

This patch fixes a bug in kvmtrace.

Thanks,
  ozaki-r

>From 4ccee3a01c2e8c377dc6a760b5d7802e58afda72 Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <ozaki.ryota@gmail.com>
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 <ozaki.ryota@gmail.com>
---
 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

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

* Re: [PATCH] kvm: user: Call pthread_join only to created threads.
  2008-10-04  7:20 [PATCH] kvm: user: Call pthread_join only to created threads Ryota OZAKI
@ 2008-10-05 10:00 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-10-05 10:00 UTC (permalink / raw)
  To: Ryota OZAKI; +Cc: kvm

Ryota OZAKI wrote:
> Hi,
>
> This patch fixes a bug in kvmtrace.
>
> Thanks,
>   ozaki-r
>
> From 4ccee3a01c2e8c377dc6a760b5d7802e58afda72 Mon Sep 17 00:00:00 2001
> From: Ryota Ozaki <ozaki.ryota@gmail.com>
> 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.
>
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


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

end of thread, other threads:[~2008-10-05 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-04  7:20 [PATCH] kvm: user: Call pthread_join only to created threads Ryota OZAKI
2008-10-05 10:00 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).