> 在 2019年1月8日,01:55,Markus Armbruster <arm...@redhat.com> 写道:
> 
> Fei Li <f...@suse.com> writes:
> 
>> To avoid the segmentation fault in qemu_thread_join(), just directly
>> return when the QemuThread *thread failed to be created in either
>> qemu-thread-posix.c or qemu-thread-win32.c.
>> 
>> Cc: Stefan Weil <s...@weilnetz.de>
>> Signed-off-by: Fei Li <f...@suse.com>
>> Reviewed-by: Fam Zheng <f...@redhat.com>
>> ---
>> util/qemu-thread-posix.c | 3 +++
>> util/qemu-thread-win32.c | 2 +-
>> 2 files changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
>> index 39834b0551..3548935dac 100644
>> --- a/util/qemu-thread-posix.c
>> +++ b/util/qemu-thread-posix.c
>> @@ -571,6 +571,9 @@ void *qemu_thread_join(QemuThread *thread)
>>     int err;
>>     void *ret;
>> 
>> +    if (!thread->thread) {
>> +        return NULL;
>> +    }
> 
> How can this happen?
I think I have answered this earlier, please check the following link to see 
whether it helps:
http://lists.nongnu.org/archive/html/qemu-devel/2018-11/msg06554.html

Have a nice day, thanks
Fei
> 
>>     err = pthread_join(thread->thread, &ret);
>>     if (err) {
>>         error_exit(err, __func__);
>> diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c
>> index 57b1143e97..ca4d5329e3 100644
>> --- a/util/qemu-thread-win32.c
>> +++ b/util/qemu-thread-win32.c
>> @@ -367,7 +367,7 @@ void *qemu_thread_join(QemuThread *thread)
>>     HANDLE handle;
>> 
>>     data = thread->data;
>> -    if (data->mode == QEMU_THREAD_DETACHED) {
>> +    if (data == NULL || data->mode == QEMU_THREAD_DETACHED) {
>>         return NULL;
>>     }

Reply via email to