Skip to contentSkip to conversation

kvm: user: Call pthread_join only to created threads.

PATCH Applied Ryota OZAKI 2 participants 2 messages Oct 4, 2008 – Oct 5, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: user: Call pthread_join only to created threads.

Hi,

This patch fixes a bug in kvmtrace.

Thanks,
ozaki-r

Quoted 1 line

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.

---
 user/kvmtrace.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
user/kvmtrace.c +2 -1
index 876ac27..de3c189 100644
@@ -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);
 	}
 }
Signature · 1 line
1.5.4.1
Applied
#1 lore raw
Quoted 12 lines · 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 <[email protected]>
Date: Sat, 4 Oct 2008 15:30:48 +0900
Subject: [PATCH] kvm: user: Call pthread_join only to created threads.

Quoted 8 lines

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.

Signature · 1 line
error compiling committee.c: too many arguments to function