From patchwork Sun Sep 24 21:22:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 114155 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1929384qgf; Sun, 24 Sep 2017 15:02:36 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCA1L+p4z5pCAraDpeZ5mBjiYv3JRC7Mld3Ofk2pAoIYTg4qemPErfThURHneA5Byqtc0hh X-Received: by 10.55.73.213 with SMTP id w204mr8130948qka.215.1506290556790; Sun, 24 Sep 2017 15:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506290556; cv=none; d=google.com; s=arc-20160816; b=x3bjXgU6wer4AraUWY1lPQoYdoxZOYjAeD3FthRY0cD0w0E1LTr7+Tz55QapKAcYZy aZ/nP6yzAF/QYsA6hGcnWdApFBjcD2x4aCeP62pa/Atm4JKC03lme2nURJCqdktvIvjT 4hdzqyASfbNdEnDJkrBte09DOKRF8rAVuIjBKRkrvV5h8u+yhZYVN4OXotbCZ7lhgyGG VflE9cWdZQpggIltjOp2H+FsN/HIwSrnOls5DKPHnFlaIfUptIcIW24oTolBFREhM63q HSNaaYV04cIxAzR9qzL0CHUiDK0MZw/XvLdL7+PbYeWDryMEGIYn9aE5HHEk1f0fHZ6t t5+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=1kIz+87dpQKQA3PbgKPXTPsxd+pWjExa+ZE/e+4TjbY=; b=ciYshhiIGjG+6+14WvnECFHTCjpD1urvU4vQNUTH7rGz0re49El/PLz2WABlWdm4Wj FWy2VuxvoQzIA7WPKiThUpjkXA5XPdbms3+H3CxmLkPUPFBwdPaUOY65MyRPFsbQrMNL ATEmBmZ1/Nx4f0s5zahrmSOlGFwALTHmvB5KSSn+Q2S9Z4AcWBPsgnGlnEAYOl4g4Wk1 bfJCusmXvnC+NTe3wE0Y3siVgLN40UYHrAuaiVa2MsFEQQNDjbkbL4f5ry5jJLZSTqFk FuTzzh5YHuFWSj/qtcDIytC9p5cbqyFhkAixoxYrRmSTRQ89+H+Wc55eRKfYLLXonZmk FDZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z193si3168493qka.37.2017.09.24.15.02.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 24 Sep 2017 15:02:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:39618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwEyw-00006T-Lp for patch@linaro.org; Sun, 24 Sep 2017 18:02:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwEyW-00005r-Up for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:02:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwEyT-0006Ue-QX for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:02:08 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:51549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwEyT-0006UJ-FS; Sun, 24 Sep 2017 18:02:05 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A83B641C97; Mon, 25 Sep 2017 01:02:00 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 4D483C41; Mon, 25 Sep 2017 00:22:57 +0300 (MSK) Received: (nullmailer pid 28276 invoked by uid 1000); Sun, 24 Sep 2017 21:22:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 25 Sep 2017 00:22:36 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 18/31] util/qemu-thread-posix.c: Replace OS ifdefs with CONFIG_HAVE_SEM_TIMEDWAIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Peter Maydell , Michael Tokarev Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In qemu-thread-posix.c we have two implementations of the various qemu_sem_* functions, one of which uses native POSIX sem_* and the other of which emulates them with pthread conditions. This is necessary because not all our host OSes support sem_timedwait(). Instead of a hard-coded list of OSes which don't implement sem_timedwait(), which gets out of date, make configure test for the presence of the function and set a new CONFIG_HAVE_SEM_TIMEDWAIT appropriately. In particular, newer NetBSDs have sem_timedwait(), so this commit will switch them over to using it. OSX still does not have an implementation. Signed-off-by: Peter Maydell Reviewed-by: Kamil Rytarowski Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- configure | 15 +++++++++++++++ include/qemu/thread-posix.h | 2 +- util/qemu-thread-posix.c | 10 +++++----- 3 files changed, 21 insertions(+), 6 deletions(-) -- 2.11.0 diff --git a/configure b/configure index 12d4e4ebfa..1f7b4f03ce 100755 --- a/configure +++ b/configure @@ -4425,6 +4425,18 @@ if compile_prog "" "" ; then fi ########################################## +# check if we have sem_timedwait + +sem_timedwait=no +cat > $TMPC << EOF +#include +int main(void) { return sem_timedwait(0, 0); } +EOF +if compile_prog "" "" ; then + sem_timedwait=yes +fi + +########################################## # check if trace backend exists $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null @@ -5678,6 +5690,9 @@ fi if test "$inotify1" = "yes" ; then echo "CONFIG_INOTIFY1=y" >> $config_host_mak fi +if test "$sem_timedwait" = "yes" ; then + echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak +fi if test "$byteswap_h" = "yes" ; then echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak fi diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index e5e3a0ff97..f4296d31c4 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -21,7 +21,7 @@ struct QemuCond { }; struct QemuSemaphore { -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_t lock; pthread_cond_t cond; unsigned int count; diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 4e95d272dc..7306475899 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -168,7 +168,7 @@ void qemu_sem_init(QemuSemaphore *sem, int init) { int rc; -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT rc = pthread_mutex_init(&sem->lock, NULL); if (rc != 0) { error_exit(rc, __func__); @@ -196,7 +196,7 @@ void qemu_sem_destroy(QemuSemaphore *sem) assert(sem->initialized); sem->initialized = false; -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT rc = pthread_cond_destroy(&sem->cond); if (rc < 0) { error_exit(rc, __func__); @@ -218,7 +218,7 @@ void qemu_sem_post(QemuSemaphore *sem) int rc; assert(sem->initialized); -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_lock(&sem->lock); if (sem->count == UINT_MAX) { rc = EINVAL; @@ -256,7 +256,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) struct timespec ts; assert(sem->initialized); -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT rc = 0; compute_abs_deadline(&ts, ms); pthread_mutex_lock(&sem->lock); @@ -304,7 +304,7 @@ void qemu_sem_wait(QemuSemaphore *sem) int rc; assert(sem->initialized); -#if defined(__APPLE__) || defined(__NetBSD__) +#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_lock(&sem->lock); while (sem->count == 0) { rc = pthread_cond_wait(&sem->cond, &sem->lock); From patchwork Sun Sep 24 21:22:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 114157 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1958664qgf; Sun, 24 Sep 2017 15:48:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCiMZi6qgMeWVcop5vDKpYtDSiHP7pVyEx95TKOrP4S1cZ089e/Gh/I95iQkd/nJrsdXSoR X-Received: by 10.200.15.74 with SMTP id l10mr8831758qtk.159.1506293304165; Sun, 24 Sep 2017 15:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506293304; cv=none; d=google.com; s=arc-20160816; b=taPlDWf9VboYtDN4XGg9LbIm5znPCOfFmQkG4QvN46F8fmYJO/OKwsfcskit/r5gBO kLpZp3TpBuN+4r4b3b+iSshs+7LzKuHJnsX8M5gfdco/w5Tikyhi1pKP51szj9UCfJ5A 82NlRu55iAhCC6S1gvuXHQ3g7ZrQ9SufSYdDzY2HRD/rMkgYbU7KZkVKXv8e6s2dWC8F 5Hp74WCC9/EsQXWoSJKM0uwlimJSNe31SZjO+U4MC+S60uCFVW0wA1lfo0p6lw7YxKWe BNqgz+i20hs21u0bQAsCqQDVBQ+IxcEPb4ibyyxzNs4JQ89Q0uXVbQ/PSgH8dvAE9+M2 +3Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=POFATsyyyU20WtCjaTmgdbk2KlXEfjYf3NMid6+4XeU=; b=F1vuu+VuQV0wT2ktz/NztOcXXu8EQJY0BD/YLXPNJ8yTURiztDTmYnPbcuMkwNb/H7 YmGJd8TLunOG9HFqEjIutf3xqknSuwUUBDdbweBZd4482kAa2giGHdb8zz0W7uIGEbbr uZxzzBl9pa4m/5P6MzZxLDIwRNIU9X+blQJ1tv63KNlst234olPjniloonBmmymW7l+7 dIbTS6uspuJLJDKZ3TcahmMnnc6w1A9jd6vzM0eilawVv6ux4X3koQEGMAoilsR3jA73 yGm/QkW4ZzW/0VwsLE9KsrOWOf2X+7ovs6KCNd/YukbOte7T6YUrxcVBqSg7JqykAtPH WwXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d77si5039904qkh.149.2017.09.24.15.48.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 24 Sep 2017 15:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:39746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFhG-0007sy-3r for patch@linaro.org; Sun, 24 Sep 2017 18:48:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFbE-0002pP-0k for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:42:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwFbA-000833-45 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:42:08 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:34625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFb9-00081d-Rw; Sun, 24 Sep 2017 18:42:04 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 721C941C98; Mon, 25 Sep 2017 01:42:00 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id E8630B70; Mon, 25 Sep 2017 00:22:54 +0300 (MSK) Received: (nullmailer pid 28280 invoked by uid 1000); Sun, 24 Sep 2017 21:22:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 25 Sep 2017 00:22:38 +0300 Message-Id: <0302ff8504fef78c03da92c3defd59d4e3e4d9c5.1506288070.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 20/31] hw/display/xenfb.c: Add trace_xenfb_key_event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liang Yan , qemu-trivial@nongnu.org, Michael Tokarev Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Liang Yan It may be better to add a trace event to monitor the last moment of a key event from QEMU to guest VM Signed-off-by: Liang Yan Signed-off-by: Michael Tokarev --- hw/display/trace-events | 1 + hw/display/xenfb.c | 1 + 2 files changed, 2 insertions(+) -- 2.11.0 diff --git a/hw/display/trace-events b/hw/display/trace-events index ed8cca0755..da498c1def 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -6,6 +6,7 @@ jazz_led_write(uint64_t addr, uint8_t new) "write addr=0x%"PRIx64": 0x%x" # hw/display/xenfb.c xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state, int abs_pointer_wanted) "%p x %d y %d z %d bs 0x%x abs %d" +xenfb_key_event(void *opaque, int scancode, int button_state) "%p scancode %d bs 0x%x" xenfb_input_connected(void *xendev, int abs_pointer_wanted) "%p abs %d" # hw/display/g364fb.c diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index df8b78f6f4..8e2547ac05 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -290,6 +290,7 @@ static void xenfb_key_event(void *opaque, int scancode) scancode |= 0x80; xenfb->extended = 0; } + trace_xenfb_key_event(opaque, scancode2linux[scancode], down); xenfb_send_key(xenfb, down, scancode2linux[scancode]); } From patchwork Sun Sep 24 21:22:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 114156 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1956203qgf; Sun, 24 Sep 2017 15:44:09 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAyonbz5CqI+KrazBKGEMQAzudav7KzKIh5+WodboxYaQcyfh4Q+WwtfUzQSyIgQTLSKGja X-Received: by 10.55.165.202 with SMTP id o193mr7992626qke.291.1506293049862; Sun, 24 Sep 2017 15:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506293049; cv=none; d=google.com; s=arc-20160816; b=04nnRbX1uLfHKZCPei4jlxunJkEp6foIxw3bJ5+EwVCbHZkkRrhiStL4w9cDyOl088 uIYrn5FonW1pe9Pc6a8rfvUcKx6rZ/JnTg3KLKHhJujp7K79D3ke/GisoJu3Cv8PLkhE 0N4qYWYghB3MB4kfMGQJlUQww5ax7qARpQ6OV5kS+KZqP7F8TZoqmJfW27db3ViiqZw3 CPNYF3HTUuQrT7x4oDpAxD3jJnk9obkcZfORpZnw7G5odPr3BYzcT72fHLNvgOy5XCg4 Czm4d6lEw3eNXQXeI2MNTLVA+Y8J4n0pnS9Y8I5GrCihnA3zkpWXqD923TYWt1LoHaaO 1erQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=SqaUjksnllAgcTwbPtkQd1FgSGYdx6CUbuyKBQeypZs=; b=xo2Bv/iZ6krvBkVSMDKVeuaGS0hfQD4YTQl7L9TbDFiriij8vGudr/2Gfn5JTu8NKd kcd05G3oALTIJYOvWvWn0ZG3y6fVjWyPs6sUNNmRUTTFBMk7HiPieSleGYpCOuxtqfwh n4Gg9oPa8POgM/b3IBiJcWk1RYPg8OeI0FktzXv9pBODZa3qwgDqLPtAScyvbYXv1G1a X+z6rzE8seHyTHBJBjg4X0m4vJWVXhCkNbx9XKXaiTAvTRPGdQ2DBFL14ySFc4XmS3hd 6MfbwRaDRJ1jgqFxyxW+evGSQidPZYn0Jo4sX1bGMbmU2QtDHNXqdfUoImMC/qGJJy2O vYVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n7si3633236qti.64.2017.09.24.15.44.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 24 Sep 2017 15:44:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:39728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFd9-00045Z-OK for patch@linaro.org; Sun, 24 Sep 2017 18:44:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFbE-0002pM-0K for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:42:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwFbA-00082j-3D for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:42:08 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:58441) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFb9-00081f-Rn; Sun, 24 Sep 2017 18:42:04 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 4136E41C78; Mon, 25 Sep 2017 01:42:00 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 4F570B7B; Mon, 25 Sep 2017 00:22:55 +0300 (MSK) Received: (nullmailer pid 28284 invoked by uid 1000); Sun, 24 Sep 2017 21:22:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 25 Sep 2017 00:22:40 +0300 Message-Id: <42c74252d68714894de4ba6d9c257dcd919e30b0.1506288070.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 22/31] chardev/baum: fix baum that releases brlapi twice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liang Yan , qemu-trivial@nongnu.org, Michael Tokarev Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Liang Yan Error process of baum_chr_open needs to set brlapi null, so it won't get released twice in char_braille_finalize, which will cause "/usr/bin/qemu-system-x86_64: double free or corruption (!prev)" Signed-off-by: Liang Yan Reviewed-by: Marc-André Lureau Signed-off-by: Michael Tokarev --- chardev/baum.c | 1 + 1 file changed, 1 insertion(+) -- 2.11.0 diff --git a/chardev/baum.c b/chardev/baum.c index 302dd9666c..67fd783a59 100644 --- a/chardev/baum.c +++ b/chardev/baum.c @@ -643,6 +643,7 @@ static void baum_chr_open(Chardev *chr, error_setg(errp, "brlapi__openConnection: %s", brlapi_strerror(brlapi_error_location())); g_free(handle); + baum->brlapi = NULL; return; } baum->deferred_init = 0;