[tip:tools/kvm] kvm tools: initialize the threadpool job iterator before using

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  3ba787ae82f6e35f5daec781c16366746c750b44
Gitweb:     http://git.kernel.org/tip/3ba787ae82f6e35f5daec781c16366746c750b44
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Mon, 17 Sep 2012 10:03:33 +0200
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Tue, 18 Sep 2012 10:17:47 +0300

kvm tools: initialize the threadpool job iterator before using

This would fix a bug where the exit function of the threadpool would hang
if no jobs were processed yet and a request to exit was received.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/util/threadpool.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/kvm/util/threadpool.c b/tools/kvm/util/threadpool.c
index 6c7566d..9b91995 100644
--- a/tools/kvm/util/threadpool.c
+++ b/tools/kvm/util/threadpool.c
@@ -78,7 +78,7 @@ static void *thread_pool__threadfunc(void *param)
 	pthread_cleanup_push(thread_pool__threadfunc_cleanup, NULL);
 
 	while (running) {
-		struct thread_pool__job *curjob;
+		struct thread_pool__job *curjob = NULL;
 
 		mutex_lock(&job_mutex);
 		while (running && (curjob = thread_pool__job_pop_locked()) == NULL)
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux