From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587560940; cv=none; d=zohomail.com; s=zohoarc; b=G9SAEtSGxjwekNH9hQYKxDW+aWb/3lQNB/RTPE9anjftqmBD/7ojDg9+nOp3O5QLTHwK0LAjlNOH4+87pwaLpU1My+EhopVeXnygd6PoIlnLhwbB1AuqerqLQxZjUb6vcFHn7k8rRwO2jLjqb92mFOjvRvmw5EXdbcG+nUkpeTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587560940; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fq3LoTXXybnbVOI/Fia1jToGdrSHqpKtobmIdURPVRg=; b=F2C/2oC0tarOCI5RhztaDHuzknC+EephN2bxYy76D3yPs4q+6ROGrwNXGUZWtzWc+K+mVYbiTznDXk1OeuYLyDdanyeL1M5pbyizD6Ys8/A3NL7h82k4OMu2tN48BbYiq2sp72M5ReSklIsICwkIPsQQSTCTx4oo4jVvSccWgB0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587560940088484.2359589659294; Wed, 22 Apr 2020 06:09:00 -0700 (PDT) Received: from localhost ([::1]:50252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF7a-0005Pa-Eu for importer@patchew.org; Wed, 22 Apr 2020 09:08:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46776) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF66-0003iW-Eu for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF65-0003jn-Vo for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:26 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:36151 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF65-0003g1-IE for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-vbty6HNxPcmn3FmBfwzSjg-1; Wed, 22 Apr 2020 09:07:23 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E420818CA248; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1C6A277B5; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 00F3211358BD; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fq3LoTXXybnbVOI/Fia1jToGdrSHqpKtobmIdURPVRg=; b=UrmND7L/+jBc41+KkLvAHVcbQXwoTufcqw51R8SqzueNuVhtoY0nWCnV5LtTF44zW7iMn/ oY9Ht7Qv9fMvEbXJpmcNELdVA0wdnYxCym/zMwkGuUzL3lK7kWkyifTFuIcUj8itwoc521 hJBdqr3t4MnOGcYp2C/FkWoHB0gFpuc= X-MC-Unique: vbty6HNxPcmn3FmBfwzSjg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 01/14] cryptodev: Fix cryptodev_builtin_cleanup() error API violation Date: Wed, 22 Apr 2020 15:07:06 +0200 Message-Id: <20200422130719.28225-2-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gonglei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. cryptodev_builtin_cleanup() passes @errp to cryptodev_builtin_sym_close_session() in a loop. Harmless, because cryptodev_builtin_sym_close_session() can't actually fail. Fix it anyway. Cc: Gonglei Signed-off-by: Markus Armbruster --- backends/cryptodev-builtin.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index c8ae3b9742..14316333fe 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -282,12 +282,7 @@ static int cryptodev_builtin_sym_close_session( CryptoDevBackendBuiltin *builtin =3D CRYPTODEV_BACKEND_BUILTIN(backend); =20 - if (session_id >=3D MAX_NUM_SESSIONS || - builtin->sessions[session_id] =3D=3D NULL) { - error_setg(errp, "Cannot find a valid session id: %" PRIu64 "", - session_id); - return -1; - } + assert(session_id < MAX_NUM_SESSIONS && builtin->sessions[session_id]); =20 qcrypto_cipher_free(builtin->sessions[session_id]->cipher); g_free(builtin->sessions[session_id]); @@ -356,8 +351,7 @@ static void cryptodev_builtin_cleanup( =20 for (i =3D 0; i < MAX_NUM_SESSIONS; i++) { if (builtin->sessions[i] !=3D NULL) { - cryptodev_builtin_sym_close_session( - backend, i, 0, errp); + cryptodev_builtin_sym_close_session(backend, i, 0, &error_abor= t); } } =20 --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561141; cv=none; d=zohomail.com; s=zohoarc; b=gQr5XTfA6gQr18eBjEToBkf1JMe2dJuOBl6IYtBvjvje7DnD4KJvZ4+HUDuagaqepodNfYgvDbsWQj5NZphvL25cBhRGjlPRDyfgCyWGPjvMgogXf8DzGBEJik3S0X/i5xNR4LWUInlI7F8WV6wOeUaBzN1MtjvVtloWK8g2y84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561141; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Glh3aSFU95f07Nq6p1r26pjgro1OM1831U2o6jSJdDE=; b=PjF0YPyqoR4GG7/RpfzlJFXLqsZG34ASFGWw8+CRUEFOn0wSMoAN52FzAQiAtbQFbESotnTfixWZC0uyn0kWHvOwTPVBC54IMAm1bW1TcYn4Qfx6dfvrjNrSLNTeObVFdxQ9x0AgybrDKWijO+5tm08Wn6iIy1y0oXN/3/O4frU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561141170212.515651838317; Wed, 22 Apr 2020 06:12:21 -0700 (PDT) Received: from localhost ([::1]:50316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFAp-0002op-O1 for importer@patchew.org; Wed, 22 Apr 2020 09:12:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46934) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6C-0003u6-V3 for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF6C-00040k-Av for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32628 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF6B-0003zL-PX for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-T6Z_mBxiPpylZ6JboZTCzw-1; Wed, 22 Apr 2020 09:07:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C628218CA247 for ; Wed, 22 Apr 2020 13:07:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 908B85D714; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0468C11358BE; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Glh3aSFU95f07Nq6p1r26pjgro1OM1831U2o6jSJdDE=; b=A2g7NpwKnlI4bTBrakgkdq5t3ciXG+o+myHPSnqBT9QLWyXNhHbUUFLyCYvkXNAAYjH/zu g+ybT4pmbmmQ6rGIGP+dSyPk3s01WTvCArBxES+At5g9WI6clY4hw7Frv6R2FxrpoPm59k nZi56ihYcamtStSqww1B9qA6wGqyI5I= X-MC-Unique: T6Z_mBxiPpylZ6JboZTCzw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 02/14] block/file-posix: Fix check_cache_dropped() error handling Date: Wed, 22 Apr 2020 15:07:07 +0200 Message-Id: <20200422130719.28225-3-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 09:07:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. check_cache_dropped() calls error_setg() in a loop. It fails to break the loop in one instance. If a subsequent iteration error_setg()s again, it trips error_setv()'s assertion. Fix it to break the loop. Fixes: 31be8a2a97ecba7d31a82932286489cac318e9e9 Cc: Stefan Hajnoczi Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- block/file-posix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 7e19bbff5f..094e3b0212 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2691,10 +2691,13 @@ static void check_cache_dropped(BlockDriverState *b= s, Error **errp) vec_end =3D DIV_ROUND_UP(length, page_size); for (i =3D 0; i < vec_end; i++) { if (vec[i] & 0x1) { - error_setg(errp, "page cache still in use!"); break; } } + if (i < vec_end) { + error_setg(errp, "page cache still in use!"); + break; + } } =20 if (window) { --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561311; cv=none; d=zohomail.com; s=zohoarc; b=IkMaT/lYMURhd0OtVJziJhgFTPUVru2FSm0SXC7ShSeA7+hgTymRCUYbHl83RqcpyFmYs8N/NlaxWi4gMXo2f0kFEV8sRPtNqkXvQN8E4TbB8dmCjwCSmkBNEw6Z9i+5Q+VIcX7s9IgPkaR5BgIrbAYUhqsciCMsWy8TCz7O5A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561311; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fidAYO+9hszl7oApQssrrQ9tS5TjJYShG/nQrI4K8HU=; b=igBnITyAWtzXSDnat+/JBWdW/fvi1MraTWoWy5+i19r5/Py1idcxOqa5+FSpEvMs+/4eIRhyYwOfjBJSoFQ02IyDArGINcnrabSg+xaqMDNRWN26raxb3l50NyxgkQUMYlhY26J2NAsFcjEnQMwpV5N/rULp72+AFQwM3KiCZIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561311945322.5232229133319; Wed, 22 Apr 2020 06:15:11 -0700 (PDT) Received: from localhost ([::1]:50378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFDa-0007Y2-MK for importer@patchew.org; Wed, 22 Apr 2020 09:15:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46868) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF69-0003n5-Gd for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF66-0003jx-0O for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:29 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33734 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF65-0003fv-IG for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-Fv6SnpdwPb2ugqxmOswErw-1; Wed, 22 Apr 2020 09:07:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6FBC18CA247 for ; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 945DA60C88; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0795211358BF; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fidAYO+9hszl7oApQssrrQ9tS5TjJYShG/nQrI4K8HU=; b=QuUhs/xRtgmJeM4s7dM5LsUitr5ZMqAr0oKUE4lb2WgT43mQ9Pg3OIUX6xxevnuH5sazpO S5A8WlrhfkWAQhUN2tw6uyr9nEHUKic/q+Fpt0uOHm1UyM1jRvFgPFYflJbzRcY3vc1IdQ /yw6vREOwWqn2uNXx5wNy3t/6w+Tpyk= X-MC-Unique: Fv6SnpdwPb2ugqxmOswErw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 03/14] cpus: Fix configure_icount() error API violation Date: Wed, 22 Apr 2020 15:07:08 +0200 Message-Id: <20200422130719.28225-4-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. configure_icount() is wrong that way. Harmless, because its @errp is always &error_abort or &error_fatal. Just as wrong (and just as harmless): when it fails, it can still update global state. Fix all that. Cc: Paolo Bonzini Signed-off-by: Markus Armbruster --- cpus.c | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/cpus.c b/cpus.c index ef441bdf62..1b542b37f9 100644 --- a/cpus.c +++ b/cpus.c @@ -797,40 +797,49 @@ void cpu_ticks_init(void) =20 void configure_icount(QemuOpts *opts, Error **errp) { - const char *option; + const char *option =3D qemu_opt_get(opts, "shift"); + bool sleep =3D qemu_opt_get_bool(opts, "sleep", true); + bool align =3D qemu_opt_get_bool(opts, "align", false); + long time_shift =3D -1; char *rem_str =3D NULL; =20 - option =3D qemu_opt_get(opts, "shift"); - if (!option) { - if (qemu_opt_get(opts, "align") !=3D NULL) { - error_setg(errp, "Please specify shift option when using align= "); - } + if (!option && qemu_opt_get(opts, "align")) { + error_setg(errp, "Please specify shift option when using align"); return; } =20 - icount_sleep =3D qemu_opt_get_bool(opts, "sleep", true); + if (align && !sleep) { + error_setg(errp, "align=3Don and sleep=3Doff are incompatible"); + return; + } + + if (strcmp(option, "auto") !=3D 0) { + errno =3D 0; + time_shift =3D strtol(option, &rem_str, 0); + if (errno !=3D 0 || *rem_str !=3D '\0' || !strlen(option)) { + error_setg(errp, "icount: Invalid shift value"); + return; + } + } else if (icount_align_option) { + error_setg(errp, "shift=3Dauto and align=3Don are incompatible"); + return; + } else if (!icount_sleep) { + error_setg(errp, "shift=3Dauto and sleep=3Doff are incompatible"); + return; + } + + icount_sleep =3D sleep; if (icount_sleep) { timers_state.icount_warp_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL= _RT, icount_timer_cb, NULL); } =20 - icount_align_option =3D qemu_opt_get_bool(opts, "align", false); + icount_align_option =3D align; =20 - if (icount_align_option && !icount_sleep) { - error_setg(errp, "align=3Don and sleep=3Doff are incompatible"); - } - if (strcmp(option, "auto") !=3D 0) { - errno =3D 0; - timers_state.icount_time_shift =3D strtol(option, &rem_str, 0); - if (errno !=3D 0 || *rem_str !=3D '\0' || !strlen(option)) { - error_setg(errp, "icount: Invalid shift value"); - } + if (time_shift >=3D 0) { + timers_state.icount_time_shift =3D time_shift; use_icount =3D 1; return; - } else if (icount_align_option) { - error_setg(errp, "shift=3Dauto and align=3Don are incompatible"); - } else if (!icount_sleep) { - error_setg(errp, "shift=3Dauto and sleep=3Doff are incompatible"); } =20 use_icount =3D 2; --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561675; cv=none; d=zohomail.com; s=zohoarc; b=jRtcDXWe+12fcFapyz9Er34EqFkpgphS/9znRqguX9Mh6YibBjB26fxvcpi9ttMtxrkVyPI4YoTJc4RPYj0KQ8F5rtZSzRpJw0fF9jIEGynqD802GxOzzc6ZISuxtX/mTQMosZhu1um8HNcnhm/nEV6Arv7sRmjG3+U/UG1cjB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561675; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VfYN+TU+3RtiZ4Pa1zd3jj/XHqO17tt2OP3Q91CNoWs=; b=W+GuyesXqbgh+6roSFmbXXOwZkumV2YTiQ2pMpMwuoUw/2QHXrjbWE6uBDM5sSBJSh9Steq4pqF+aG7DaeWbUW79p4qZAeEIyDuhjQyBO047uLD/gOY3MzZqlyGATnT1MKsfMxy1G3fRQ1cWrLdBrzgOwBWsycmEnK9W4jMrV8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561675684866.3919437818313; Wed, 22 Apr 2020 06:21:15 -0700 (PDT) Received: from localhost ([::1]:50468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFJS-0006BQ-Gj for importer@patchew.org; Wed, 22 Apr 2020 09:21:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47098) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6K-00043W-UZ for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF65-0003jb-RA for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:40 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:55916 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF65-0003fz-DQ for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-MBZJOojGPgqV0JcqchcQGg-1; Wed, 22 Apr 2020 09:07:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB2521084431 for ; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97AFD60C99; Wed, 22 Apr 2020 13:07:21 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0ADCF11358C0; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VfYN+TU+3RtiZ4Pa1zd3jj/XHqO17tt2OP3Q91CNoWs=; b=dOMOPRY1yVJRYlS9L3MbuGev7n9s5dTHXYfMefXXut/Juq7u3YZs8FCTcvPd1FSZTs9O9n OvI8ALHkE4hIEkVnQZH4BOOPLyUQZwpSPnp4vUULHvxjQfOqyi19bEvnONpMcDcMMQ2xk+ sCwFo5FGd5AM5LZR9ghcya+WSfrnlTg= X-MC-Unique: MBZJOojGPgqV0JcqchcQGg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 04/14] cpus: Proper range-checking for -icount shift=N Date: Wed, 22 Apr 2020 15:07:09 +0200 Message-Id: <20200422130719.28225-5-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:57:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" timers_state.icount_time_shift must be in [0,63] to avoid undefined behavior when shifting by it, e.g. in cpu_icount_to_ns(). icount_adjust() clamps it to [0,MAX_ICOUNT_SHIFT], with MAX_ICOUNT_SHIFT =3D 10. configure_icount() doesn't. Fix that. Fixes: a8bfac37085c3372366d722f131a7e18d664ee4d Cc: Paolo Bonzini Signed-off-by: Markus Armbruster --- cpus.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index 1b542b37f9..5670c96bcf 100644 --- a/cpus.c +++ b/cpus.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/config-file.h" +#include "qemu/cutils.h" #include "migration/vmstate.h" #include "monitor/monitor.h" #include "qapi/error.h" @@ -801,7 +802,6 @@ void configure_icount(QemuOpts *opts, Error **errp) bool sleep =3D qemu_opt_get_bool(opts, "sleep", true); bool align =3D qemu_opt_get_bool(opts, "align", false); long time_shift =3D -1; - char *rem_str =3D NULL; =20 if (!option && qemu_opt_get(opts, "align")) { error_setg(errp, "Please specify shift option when using align"); @@ -814,9 +814,8 @@ void configure_icount(QemuOpts *opts, Error **errp) } =20 if (strcmp(option, "auto") !=3D 0) { - errno =3D 0; - time_shift =3D strtol(option, &rem_str, 0); - if (errno !=3D 0 || *rem_str !=3D '\0' || !strlen(option)) { + if (qemu_strtol(option, NULL, 0, &time_shift) < 0 + || time_shift < 0 || time_shift > MAX_ICOUNT_SHIFT) { error_setg(errp, "icount: Invalid shift value"); return; } --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561017; cv=none; d=zohomail.com; s=zohoarc; b=QXIEhefDZMwTWXUlmhpWVi+jfjMPq/XvBtWhKwjUb9xPsNyTT4Ay2gWfr/oXGnG8bzfuuBd5BrMqFcpuC8TPp9J3CI7voOl3fqAZ5y4xDT0QYKZCww6mw6wLBUmKTtnWLrju75Sz/SyGm/Kjq++3mTsSIOEr13133+sgBvcPHZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561017; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oGgKscofsQygorrpqjNCPgIrftyN69zP62MTnCqjIBo=; b=X6sRaSJVlUWzWYGvuNFUtr5WaFbphB5kaq0bgS/TU4J+xiKV6UsXX5Z/IEQRhAr4gZHzmuziLpoVi392LAo+QdbAzVcXiHe691eX0/p7rtNuP1qDb8Um+l9H1YNXTMl0FYeICWBI3Ly1N/1DViBi+Z5ZiUbFdsniMTd+BWtaQmg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561017425995.2977557069681; Wed, 22 Apr 2020 06:10:17 -0700 (PDT) Received: from localhost ([::1]:50276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF8q-0007xy-5Y for importer@patchew.org; Wed, 22 Apr 2020 09:10:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46826) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF68-0003ku-CI for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF67-0003ny-Fz for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:28 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55854 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF67-0003kG-0R for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-wnw-nJ2PPd-N1onAB1v74A-1; Wed, 22 Apr 2020 09:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E19C1030980; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BAE710027BA; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0E09811358C1; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGgKscofsQygorrpqjNCPgIrftyN69zP62MTnCqjIBo=; b=FTqbFq7JU+nh6cDX9YmwFaSW/jAq2jx4F0kQYOjvWMl2D3at2ptVUFOLglM/wY8+d2XYhh oqCS7C4btBresV4f1wMzMzvV3Cj6qDJNjH5++pFLQ/Wub8BWo6QYVdjTcs6aJ32lzd5IFp 8NznVJ5tuUcER6AewToa3IbVEiVONoU= X-MC-Unique: wnw-nJ2PPd-N1onAB1v74A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 05/14] arm/virt: Fix virt_machine_device_plug_cb() error API violation Date: Wed, 22 Apr 2020 15:07:10 +0200 Message-Id: <20200422130719.28225-6-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 09:07:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. virt_machine_device_plug_cb() passes @errp to cryptodev_builtin_sym_close_session() in a loop. Harmless, because cryptodev_builtin_sym_close_session() can't actually fail. Fix by dropping its Error ** parameter. Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 7dc96abf72..cca5316256 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1186,7 +1186,7 @@ static void create_smmu(const VirtMachineState *vms, g_free(node); } =20 -static void create_virtio_iommu_dt_bindings(VirtMachineState *vms, Error *= *errp) +static void create_virtio_iommu_dt_bindings(VirtMachineState *vms) { const char compat[] =3D "virtio,pci-iommu"; uint16_t bdf =3D vms->virtio_iommu_bdf; @@ -2118,7 +2118,7 @@ static void virt_machine_device_plug_cb(HotplugHandle= r *hotplug_dev, =20 vms->iommu =3D VIRT_IOMMU_VIRTIO; vms->virtio_iommu_bdf =3D pci_get_bdf(pdev); - create_virtio_iommu_dt_bindings(vms, errp); + create_virtio_iommu_dt_bindings(vms); } } =20 --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587560948; cv=none; d=zohomail.com; s=zohoarc; b=EWU9ZY+fw+Fe1A5+zdnNikTvUHB6qriA+t31RMQedBDpru7dH1X0BFenmaEQbCFy2THI9jkIg60YZ67NSHsnzgApQvS2io5HGUiTgbSyuhc9Crg2Opp35P0JFUblIGG4R+KbnKFbzdjqFixm7eF1ddjmkft0RIndLYn0pR/MRa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587560948; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5Jq9e8o17VgILfi38+otFl0VpRP+BxozTAvRN+DwzvI=; b=YXyb8bGSV+wEXjAqW05+XeBXAHocBjkeKbDCLTfVel59hUnUE0ujD21Ta3z/y7FcwBE8KtbaHThXRbtD3w7obvyJCW70a4CnKQ2D6bNk8PNEbDa5hNeYSYpU0y2y4Om4oKvEAMBhF44UXfntMV17kTIaPZ1rVngQQQz93ffAIl8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587560948738951.6435578002319; Wed, 22 Apr 2020 06:09:08 -0700 (PDT) Received: from localhost ([::1]:50254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF7j-0005qK-BW for importer@patchew.org; Wed, 22 Apr 2020 09:09:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46864) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF69-0003mo-AJ for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF67-0003pb-Pu for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46284 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF67-0003ji-CD for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-_QV421ytNfujhGn5wJMpqw-1; Wed, 22 Apr 2020 09:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39F258017F5 for ; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B2D0600E5; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 11FD211358C2; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Jq9e8o17VgILfi38+otFl0VpRP+BxozTAvRN+DwzvI=; b=gNv/7Yk53/UXoqhmmyYIqfn6TcL5NjCZXTsE5cvxVP+wzbmwB6Lq70gVNCwN9u6/WlaiSc WlunkNKb4jvxMNghV2F1YCmssqyIUihhLPBYW8VbeOn8JxLjIib59V7hHJsAbMOTZLTaWD siyzdW1vrTj7X5rkSU/1aAz8u/qsEYs= X-MC-Unique: _QV421ytNfujhGn5wJMpqw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 06/14] fdc: Fix fallback=auto error handling Date: Wed, 22 Apr 2020 15:07:11 +0200 Message-Id: <20200422130719.28225-7-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 09:07:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" fdctrl_realize_common() rejects fallback=3Dauto. Used by devices "isa-fdc", "sysbus-fdc", "SUNW,fdtwo". The error handling is broken: $ qemu-system-x86_64 -nodefaults -device isa-fdc,fallback=3Dauto,driveA= =3Dfd0 -drive if=3Dnone,id=3Dfd0 ** ERROR:/work/armbru/qemu/hw/block/fdc.c:434:pick_drive_type: assertion f= ailed: (drv->drive !=3D FLOPPY_DRIVE_TYPE_AUTO) Aborted (core dumped) Cause: fdctrl_realize_common() neglects to bail out after setting the error. Fix that. Fixes: a73275dd6fc3bfda33165bebc28e0c33c20cb0a0 Cc: John Snow Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/fdc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 33bc9e2f92..9628cc171e 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2615,6 +2615,7 @@ static void fdctrl_realize_common(DeviceState *dev, F= DCtrl *fdctrl, =20 if (fdctrl->fallback =3D=3D FLOPPY_DRIVE_TYPE_AUTO) { error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'"); + return; } =20 /* Fill 'command_to_handler' lookup table */ --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561526; cv=none; d=zohomail.com; s=zohoarc; b=IyIqIMBTdCcfu9Ds4ee0wF4PTfP7uit8MoRbVXgV5N3+XyPJ5JSrlHigZTaeZsgDW/RD7TxULCfryb9bw+mrGabEzCIDQwvjV6rirgsy7wcS7gKnbkOL0gAkaV1hm17uzWZPy6gQDhHdMkWx+A8x3zLefsmifnKfPsnh8KFq0kA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561526; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ld/bBsfDpttrTV0PKzMSzSLeV9H2V1HonsYLEXv6m2Y=; b=ePtG0xKuhVbsT5tam0duhVmdLU+sqDyVxhcE1W8coMAEx63YBCqQH7lMKPoQDRFwssxVEBM1UCzxqwcO+GUSLTDMIWcc1w0BMEy4I4a9P3ti3cMk7M/Q7D97TMBCODVyeeYGLDOMwFMdrMu8kS55UoCmhAYnzC+D+Qx+64OOtqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561526792494.66182015549737; Wed, 22 Apr 2020 06:18:46 -0700 (PDT) Received: from localhost ([::1]:50430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFH3-0002su-Vr for importer@patchew.org; Wed, 22 Apr 2020 09:18:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46918) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6C-0003rq-8s for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF69-0003uS-P5 for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:30 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22906 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF69-0003sl-A8 for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-tipvEGmDP0-F5p9IolmMqg-1; Wed, 22 Apr 2020 09:07:26 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12C158017FF for ; Wed, 22 Apr 2020 13:07:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23AA8277C8; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 155CC11358C3; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ld/bBsfDpttrTV0PKzMSzSLeV9H2V1HonsYLEXv6m2Y=; b=O2fe2bMLKJu1z2RSPCb5BfSefSHEk0CowqHntbA5In4GqL6CX2VTQ+ykGUntvVzYLSg7bq 5p4mzrC/L4DXoytVz6cG6E0erQTQFq0LiPzj1/mXWfhoBz+eAYTN77SS7eeKbppv9v2pNY hgwngT2WTWW31BFjUgX49+ARuGirhzo= X-MC-Unique: tipvEGmDP0-F5p9IolmMqg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 07/14] bochs-display: Fix vgamem=SIZE error handling Date: Wed, 22 Apr 2020 15:07:12 +0200 Message-Id: <20200422130719.28225-8-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:57:52 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" bochs_display_realize() rejects out-of-range vgamem. The error handling is broken: $ qemu-system-x86_64 -S -display none -monitor stdio QEMU 4.2.93 monitor - type 'help' for more information (qemu) device_add bochs-display,vgamem=3D1 Error: bochs-display: video memory too small (qemu) device_add bochs-display,vgamem=3D1 RAMBlock "0000:00:04.0/bochs-display-vram" already registered, abort! Aborted (core dumped) Cause: bochs_display_realize() neglects to bail out after setting the error. Fix that. Fixes: 765c94290863eef1fc4a67819d452cc13b7854a1 Cc: Gerd Hoffmann Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Gerd Hoffmann --- hw/display/bochs-display.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c index 70eb619ef4..e763a0a72d 100644 --- a/hw/display/bochs-display.c +++ b/hw/display/bochs-display.c @@ -267,16 +267,18 @@ static void bochs_display_realize(PCIDevice *dev, Err= or **errp) Object *obj =3D OBJECT(dev); int ret; =20 - s->con =3D graphic_console_init(DEVICE(dev), 0, &bochs_display_gfx_ops= , s); - if (s->vgamem < 4 * MiB) { error_setg(errp, "bochs-display: video memory too small"); + return; } if (s->vgamem > 256 * MiB) { error_setg(errp, "bochs-display: video memory too big"); + return; } s->vgamem =3D pow2ceil(s->vgamem); =20 + s->con =3D graphic_console_init(DEVICE(dev), 0, &bochs_display_gfx_ops= , s); + memory_region_init_ram(&s->vram, obj, "bochs-display-vram", s->vgamem, &error_fatal); memory_region_init_io(&s->vbe, obj, &bochs_display_vbe_ops, s, --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561595; cv=none; d=zohomail.com; s=zohoarc; b=ir9Y+wqU7mzpH0yFeyPHFT7VqWHAJqMQxzyof77uMdlEImyOG9N9jTXRv+WXOPN8rByVnqu3JL5ADjY9q+6KAPfGCn3rEzUNjgWJf+LAi8DW7ZqWzxXYDs+HCLu2B0/oFpjzxtPhdLtSQWysmdFq6lsGsaiKBnGvfyXVxo4CvHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561595; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sueXh/OLDF/vK9gMNelEOqsem9lXh2AuWecravX7H6s=; b=anwMPxUVwsMtkbpxl+gnvWJ463QIQ//C0SBe6cShCUTXvDa/eH+KtToRz10vfbrPLabea+nJGKFgtcOUWN1XvQsQb1G7OQeW29kte/FWBX6xtx4ZPnYaaxU44P31YBuq697L2kD5pnyPFNAHJby9IMm5p6GUeH6xApPK5yZUk+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561595678748.1756427127905; Wed, 22 Apr 2020 06:19:55 -0700 (PDT) Received: from localhost ([::1]:50440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFIA-0004FG-Uq for importer@patchew.org; Wed, 22 Apr 2020 09:19:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46964) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6E-0003vS-0L for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF6C-00041w-Mt for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:33 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:29263 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF6C-0003xh-7R for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-67EzW1g2OnaPx_8RheMedw-1; Wed, 22 Apr 2020 09:07:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9281A18CA246 for ; Wed, 22 Apr 2020 13:07:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28C5927BD7; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 18CF711358C4; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560850; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sueXh/OLDF/vK9gMNelEOqsem9lXh2AuWecravX7H6s=; b=b6LvxNc1uPRi1Lo1EWlI+cXMF3u7uX3RSaVziGIWUcAT6QOUNDqZbVzBVIIYpvjU7zng3a 2wevYMDbqIRCsZv2bH2b6YJEciM7FahSDR7tx5RNSyMuqdpLDp8GLQaw4AgBaJ6Yu8WIlN 9bznuzIWiXXtwXuv6TWm3H01gRgRsVw= X-MC-Unique: 67EzW1g2OnaPx_8RheMedw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 08/14] virtio-net: Fix duplex=... and speed=... error handling Date: Wed, 22 Apr 2020 15:07:13 +0200 Message-Id: <20200422130719.28225-9-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" virtio_net_device_realize() rejects invalid duplex and speed values. The error handling is broken: $ ../qemu/bld-sani/x86_64-softmmu/qemu-system-x86_64 -S -display none -= monitor stdio QEMU 4.2.93 monitor - type 'help' for more information (qemu) device_add virtio-net,duplex=3Dx Error: 'duplex' must be 'half' or 'full' (qemu) c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D15654=3D=3DERROR: AddressSanitizer: heap-use-after-free on addres= s 0x62e000014590 at pc 0x560b75c8dc13 bp 0x7fffdf1a6950 sp 0x7fffdf1a6940 READ of size 8 at 0x62e000014590 thread T0 #0 0x560b75c8dc12 in object_dynamic_cast_assert /work/armbru/qemu/qom/obje= ct.c:826 #1 0x560b74c38ac0 in virtio_vmstate_change /work/armbru/qemu/hw/virtio/vir= tio.c:3210 #2 0x560b74d9765e in vm_state_notify /work/armbru/qemu/softmmu/vl.c:1271 #3 0x560b7494ba72 in vm_prepare_start /work/armbru/qemu/cpus.c:2156 #4 0x560b7494bacd in vm_start /work/armbru/qemu/cpus.c:2162 #5 0x560b75a7d890 in qmp_cont /work/armbru/qemu/monitor/qmp-cmds.c:160 #6 0x560b75a8d70a in hmp_cont /work/armbru/qemu/monitor/hmp-cmds.c:1043 #7 0x560b75a799f2 in handle_hmp_command /work/armbru/qemu/monitor/hmp.c:10= 82 [...] 0x62e000014590 is located 33168 bytes inside of 42288-byte region [0x62= e00000c400,0x62e000016930) freed by thread T1 here: #0 0x7feadd39491f in __interceptor_free (/lib64/libasan.so.5+0x10d91f) #1 0x7feadcebcd7c in g_free (/lib64/libglib-2.0.so.0+0x55d7c) #2 0x560b75c8fd40 in object_unref /work/armbru/qemu/qom/object.c:1128 #3 0x560b7498a625 in memory_region_unref /work/armbru/qemu/memory.c:1762 #4 0x560b74999fa4 in do_address_space_destroy /work/armbru/qemu/memory.c:2= 788 #5 0x560b762362fc in call_rcu_thread /work/armbru/qemu/util/rcu.c:283 #6 0x560b761c8884 in qemu_thread_start /work/armbru/qemu/util/qemu-thread-= posix.c:519 #7 0x7fead9be34bf in start_thread (/lib64/libpthread.so.0+0x84bf) previously allocated by thread T0 here: #0 0x7feadd394d18 in __interceptor_malloc (/lib64/libasan.so.5+0x10dd18) #1 0x7feadcebcc88 in g_malloc (/lib64/libglib-2.0.so.0+0x55c88) #2 0x560b75c8cf8a in object_new /work/armbru/qemu/qom/object.c:699 #3 0x560b75010ad9 in qdev_device_add /work/armbru/qemu/qdev-monitor.c:654 #4 0x560b750120c2 in qmp_device_add /work/armbru/qemu/qdev-monitor.c:805 #5 0x560b75012c1b in hmp_device_add /work/armbru/qemu/qdev-monitor.c:905 [...] =3D=3D15654=3D=3DABORTING Cause: virtio_net_device_realize() neglects to bail out after setting the error. Fix that. Fixes: 9473939ed7addcaaeb8fde5c093918fb7fa0919c Cc: "Michael S. Tsirkin" Cc: Jason Wang Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index a46e3b37a7..b52ff4ab63 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2947,6 +2947,7 @@ static void virtio_net_device_realize(DeviceState *de= v, Error **errp) n->net_conf.duplex =3D DUPLEX_FULL; } else { error_setg(errp, "'duplex' must be 'half' or 'full'"); + return; } n->host_features |=3D (1ULL << VIRTIO_NET_F_SPEED_DUPLEX); } else { @@ -2955,7 +2956,9 @@ static void virtio_net_device_realize(DeviceState *de= v, Error **errp) =20 if (n->net_conf.speed < SPEED_UNKNOWN) { error_setg(errp, "'speed' must be between 0 and INT_MAX"); - } else if (n->net_conf.speed >=3D 0) { + return; + } + if (n->net_conf.speed >=3D 0) { n->host_features |=3D (1ULL << VIRTIO_NET_F_SPEED_DUPLEX); } =20 --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587560873; cv=none; d=zohomail.com; s=zohoarc; b=DnLVfR/V1e8AJOIBUVQrrM6RPb4HecUEH5npbf/rao8rrtkIqcfOPi96HEovefdQyNu1escGDxeB7/4cp9+VhILG49yaVcPWzqzH9fEcKIHsITubiA9oFo//ueqwA7Ch2kltVrt04Tr1W3JXelNOds8cWxjXRp9HcTkBFdfu6r4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587560873; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4HJTMDpzbAUUU2nrkN9nZ+ekSAeo3tJy8O/pNLEoIcU=; b=kJe0/jMrmeRQFnuKEmxUOyMwAbdJyN0aTTGTcepSuRdizCquccPBPMQs+ETppp08cgW6sMLffpc3xNujrrmBeegXsUXIxlG54gF9t3xwJ1yODcRX/Sf9pJE5oqMMqTN+4bu54aSGOrKLFOYM8GlKD6hJ9fbEA9AEZneeYF7d76k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1587560873810779.5715496946923; Wed, 22 Apr 2020 06:07:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRF68-0001fl-La; Wed, 22 Apr 2020 13:07:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRF67-0001fg-G8 for xen-devel@lists.xenproject.org; Wed, 22 Apr 2020 13:07:27 +0000 Received: from us-smtp-delivery-1.mimecast.com (unknown [207.211.31.120]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 36d9eb3a-849a-11ea-b58d-bc764e2007e4; Wed, 22 Apr 2020 13:07:26 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-qrfxHadDMEiHhCJ7_Dd9lA-1; Wed, 22 Apr 2020 09:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7303A8EB022; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2395960C99; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1D92311358C5; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) X-Inumbo-ID: 36d9eb3a-849a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4HJTMDpzbAUUU2nrkN9nZ+ekSAeo3tJy8O/pNLEoIcU=; b=enBEuahPp8P+QpX0ayMOyg3S/o6FP7TRvbi9+t/gqZwQxlqD4zwLxe5w9cAFoeAaluPlzP db9/BZQ5UIiNS93ckDo0sCf7anPzi1rOBKKgaZ9ZFhv5qGEqZ2uSetuCg6gto7t9pNK/ys 5c8HiPqVSEEOSCOUAMNl0xjjsEO2SAc= X-MC-Unique: qrfxHadDMEiHhCJ7_Dd9lA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 09/14] xen/pt: Fix flawed conversion to realize() Date: Wed, 22 Apr 2020 15:07:14 +0200 Message-Id: <20200422130719.28225-10-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , xen-devel@lists.xenproject.org, Stefano Stabellini , Paul Durrant Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The conversion of xen_pt_initfn() to xen_pt_realize() blindly replaced XEN_PT_ERR() by error_setg(). Several error conditions that did not fail xen_pt_initfn() now fail xen_pt_realize(). Unsurprisingly, the cleanup on these errors looks highly suspicious. Revert the inappropriate replacements. Fixes: 5a11d0f7549e24a10e178a9dc8ff5e698031d9a6 Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: xen-devel@lists.xenproject.org Signed-off-by: Markus Armbruster Reviewed-by: Paul Durrant --- hw/xen/xen_pt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index b91082cb8b..81d5ad8da7 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -858,8 +858,8 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) =20 rc =3D xc_physdev_map_pirq(xen_xc, xen_domid, machine_irq, &pirq); if (rc < 0) { - error_setg_errno(errp, errno, "Mapping machine irq %u to" - " pirq %i failed", machine_irq, pirq); + XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (err: %d)= \n", + machine_irq, pirq, errno); =20 /* Disable PCI intx assertion (turn on bit10 of devctl) */ cmd |=3D PCI_COMMAND_INTX_DISABLE; @@ -880,8 +880,8 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) PCI_SLOT(d->devfn), e_intx); if (rc < 0) { - error_setg_errno(errp, errno, "Binding of interrupt %u failed", - e_intx); + XEN_PT_ERR(d, "Binding of interrupt %i failed! (err: %d)\n", + e_intx, errno); =20 /* Disable PCI intx assertion (turn on bit10 of devctl) */ cmd |=3D PCI_COMMAND_INTX_DISABLE; @@ -889,8 +889,8 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) =20 if (xen_pt_mapped_machine_irq[machine_irq] =3D=3D 0) { if (xc_physdev_unmap_pirq(xen_xc, xen_domid, machine_irq))= { - error_setg_errno(errp, errno, "Unmapping of machine" - " interrupt %u failed", machine_irq); + XEN_PT_ERR(d, "Unmapping of machine interrupt %i faile= d!" + " (err: %d)\n", machine_irq, errno); } } s->machine_irq =3D 0; --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561213; cv=none; d=zohomail.com; s=zohoarc; b=SFR/WEwmp0ShITuX3T+rGMOF0uYSADABS2P+TM7BDpE6auxSzkR3QcVSfWF3O/vTfY/Z4B++ncFG0aJZPx4G7HAijanSx20zrFWTIvYidw9IRq2af5qiWVhyO6y17WSxEvGJ8q0+K87AGbNjHnnQUClCIbOHGVaD+qANxlKuMQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561213; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0PA1TH5QcQ1BStW+tdM1XTu8QFduUmsERW533elcOEg=; b=F7m4mAvD1sXacmNna4X6cZUMgMLhJMF3vgEdR9S9zrvy2ACZ8R892nATe5hC6/cqNYwgGvzgS3Ik8WtIh02RmeLje8eFBfj5P78iGVyGMSGcnp50z8iUOnYvDntB5VVhUS978HbUrT2sG9nf8mRZcCvuEW23R4dWBdKh6ytLT6I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561213213545.9938008336522; Wed, 22 Apr 2020 06:13:33 -0700 (PDT) Received: from localhost ([::1]:50346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFC0-0004bO-Dr for importer@patchew.org; Wed, 22 Apr 2020 09:13:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46846) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF68-0003ls-SD for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF67-0003oK-Kb for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:28 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:38893 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF67-0003k6-1E for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-5_4fJ7p7PsuMMwdoS0GInw-1; Wed, 22 Apr 2020 09:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5EE4CA0CC6 for ; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2608E5C29A; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1F87911358C6; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0PA1TH5QcQ1BStW+tdM1XTu8QFduUmsERW533elcOEg=; b=R1XMWs4ZMxzHj/qZUJW/vvdpfyJhl1XfwoeBkTa8EAL5DFjkEkuTsKKJjAYbxfPgYgAlBV oNIbJv8+g6yT8WPH86x+qwPzZZqO8bMunCOX3FZLsWYSu9yM7B6gy73d2HYTCwDa7IB52a 0MCRpRbzTpfdEaECv+vkXPtKOp4W0N8= X-MC-Unique: 5_4fJ7p7PsuMMwdoS0GInw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 10/14] io: Fix qio_channel_socket_close() error handling Date: Wed, 22 Apr 2020 15:07:15 +0200 Message-Id: <20200422130719.28225-11-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. qio_channel_socket_close() passes @errp first to socket_listen_cleanup(), and then, if closesocket() fails, to error_setg_errno(). If socket_listen_cleanup() failed, this will trip the assertion in error_setv(). Fix by ignoring a second error. Fixes: 73564c407caedf992a1c688b5fea776a8b56ba2a Cc: Daniel P. Berrang=C3=A9 Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrang=C3=A9 --- io/channel-socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index b74f5b92a0..e1b4667087 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -704,6 +704,7 @@ qio_channel_socket_close(QIOChannel *ioc, { QIOChannelSocket *sioc =3D QIO_CHANNEL_SOCKET(ioc); int rc =3D 0; + Error *err =3D NULL; =20 if (sioc->fd !=3D -1) { #ifdef WIN32 @@ -715,8 +716,8 @@ qio_channel_socket_close(QIOChannel *ioc, =20 if (closesocket(sioc->fd) < 0) { sioc->fd =3D -1; - error_setg_errno(errp, errno, - "Unable to close socket"); + error_setg_errno(&err, errno, "Unable to close socket"); + error_propagate(errp, err); return -1; } sioc->fd =3D -1; --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561460; cv=none; d=zohomail.com; s=zohoarc; b=djLQALIrefWgF2cAedr/PSG33kr9b9I4+soNLxtiXvXHAq1ZR8VFFaUA8uiQhmzPF9bvIEPW/OLEtTykL0VUDWf/ziHNofsJSDof2Gr4clC8UO9CeOFCATcK0cn6e+8WXS+yoNgpIsfnsMmQ1rKqJXNZireoWYMNEcX/ykNMQ+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561460; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wYKIi3HEA0GUP+kQcT/vivYitUM0GVQKFCyq6ffCeAY=; b=R8WJ9og4+YeeNXctyuxidDX0omj8hMRgqNW0yurvtDpREazOo0fGwEs5ezQadhmERrG9IYEUOp7t6YZbF6zQSZJsWOOaa0pk86ye8F9odja/2xYu+x0D/vIK7AQmL5sDNE8nWQVLChmEpfZFeZM8LdLAfWZlZW6P4BBphbTBOhA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561460306875.2921054547886; Wed, 22 Apr 2020 06:17:40 -0700 (PDT) Received: from localhost ([::1]:50414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFFz-0001fp-3C for importer@patchew.org; Wed, 22 Apr 2020 09:17:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6A-0003ol-8M for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF68-0003sv-V9 for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:29 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25361 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF68-0003qv-F7 for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-ArvIrDTaP3aKxzBiV66TAA-1; Wed, 22 Apr 2020 09:07:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7E5F8017F6; Wed, 22 Apr 2020 13:07:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DCC75D715; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2A4E911358C7; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wYKIi3HEA0GUP+kQcT/vivYitUM0GVQKFCyq6ffCeAY=; b=DVstdFt70r+OnTAccIwCoPjL6aNOLjOl634SoN/nzzd2iohkrtuPBlkzWumn3NASaxCnYP NKlYYN+p3Cwc35La8ZZWhbRJ5EkYrIL6fZQzednwIKLtgWH8ZlfO9QGOzderYrbTjRekd3 3bHjw6oK7sSmyJdLS/+e+HaeTr8YSUk= X-MC-Unique: ArvIrDTaP3aKxzBiV66TAA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 11/14] migration/colo: Fix qmp_xen_colo_do_checkpoint() error handling Date: Wed, 22 Apr 2020 15:07:16 +0200 Message-Id: <20200422130719.28225-12-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , zhanghailiang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. qmp_xen_colo_do_checkpoint() passes @errp first to replication_do_checkpoint_all(), and then to colo_notify_filters_event(). If both fail, this will trip the assertion in error_setv(). Similar code in secondary_vm_do_failover() calls colo_notify_filters_event() only after replication_do_checkpoint_all() succeeded. Do the same here. Fixes: 0e8818f023616677416840d6ddc880db8de3c967 Cc: Zhang Chen Cc: zhanghailiang Signed-off-by: Markus Armbruster Reviewed-by: zhanghailiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Zhang Chen --- migration/colo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/colo.c b/migration/colo.c index a54ac84f41..1b3493729b 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -263,7 +263,13 @@ ReplicationStatus *qmp_query_xen_replication_status(Er= ror **errp) =20 void qmp_xen_colo_do_checkpoint(Error **errp) { - replication_do_checkpoint_all(errp); + Error *err =3D NULL; + + replication_do_checkpoint_all(&err); + if (err) { + error_propagate(errp, err); + return; + } /* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event(COLO_EVENT_CHECKPOINT, errp); } --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561133; cv=none; d=zohomail.com; s=zohoarc; b=HgmkW0FFX24I+UK+FelvX7MU4M5kpt70aV1mSvZnG87SlARBVOuILiRBxBn2HCE5Fr+PZNmQ6Rv7cu3bORnXbGyPTyMSOInboh+71JU3IxFCSrD7Mhq0VkXZkcNMg25SJNR+B0lLfJ5TjPN6koQ/UrwJ11/bVMWvL81BsVUokuA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561133; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5H2M8bjsIlcLctdaefUgx2egEhpey1ae4R76ADCSuTc=; b=IDaW2877wAbKlp1EYiuHpSUNKOwqDSxHzxUZXh/e/c+CtPhB23cS94WxI8mf6hxrBgVe9KtqLF9154u8afXYldeibP5KUve9eEMv2lBkTsNqXiEU1dtZRa8Ybs2OIJkIHsPQwEW/0oXgDujrYsXe/c9KdeH37/7v068l54TcBUI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561132916864.9102228248813; Wed, 22 Apr 2020 06:12:12 -0700 (PDT) Received: from localhost ([::1]:50312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFAf-0002a9-Sh for importer@patchew.org; Wed, 22 Apr 2020 09:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46836) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF68-0003lU-Le for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF67-0003oA-IW for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:28 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:32027 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF67-0003kE-14 for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-Kh-KxkYeM2eRoz8o7Vp1eg-1; Wed, 22 Apr 2020 09:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6BDE7107ACC9 for ; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D50B5D715 for ; Wed, 22 Apr 2020 13:07:23 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 31C8E11358C8; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5H2M8bjsIlcLctdaefUgx2egEhpey1ae4R76ADCSuTc=; b=Yz9rG6WQDHRlzUder9OOCHuEs576ulVnVfEwWdvOyUIoS00mvplgOZJkm/LEoPUd2VSJoc iFvaQSXlzTJ5xOfZTZVC3OdaJYD2WGyHSgwxzNttRsXPcOYjUx0TeY9IGV+XRH5UeSl0pi N1J/TzNRb4ashA5ICuMEoZsdzldZUtw= X-MC-Unique: Kh-KxkYeM2eRoz8o7Vp1eg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 12/14] tests/test-logging: Fix test for -dfilter 0..0xffffffffffffffff Date: Wed, 22 Apr 2020 15:07:17 +0200 Message-Id: <20200422130719.28225-13-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Fixes: 58e19e6e7914354242a67442d0006f9e31684d1a Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/test-logging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-logging.c b/tests/test-logging.c index 6387e4933f..8580b82420 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -73,10 +73,10 @@ static void test_parse_range(void) g_assert(qemu_log_in_addr_range(UINT64_MAX)); g_assert_false(qemu_log_in_addr_range(UINT64_MAX - 1)); =20 - qemu_set_dfilter_ranges("0..0xffffffffffffffff", &err); + qemu_set_dfilter_ranges("0..0xffffffffffffffff", &error_abort); g_assert(qemu_log_in_addr_range(0)); g_assert(qemu_log_in_addr_range(UINT64_MAX)); -=20 + qemu_set_dfilter_ranges("2..1", &err); error_free_or_abort(&err); =20 --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561030; cv=none; d=zohomail.com; s=zohoarc; b=gwvHtnRtJ+f5CcRLmQZvt2xjadZPe85O4EC1XvjvRDy1VyHr4uxTBl1HzgGtFevdzk2BDO649paOWURoV7kquwgr8kh3dlwWCmSwBfRZev6IDEHtBsRdfzdtbeAM23burmNotSBl4gejO4WyadrqwVMn7Qo6MjlJVUsvBdyqIGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561030; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tOpA4vKhF0E/s3TXOxfOc3XODiJpn13TNPnTc0IUeNc=; b=nUJJ7gSZMW/XP4P30XRqFQ8bXa9jqrDG3l+Q2lJLyobZz128XjjGDIg93aPXInfnQZMGOKRR9JA5Ic4bqT5QQ5MrA3cadj83gBL/od/2o2V4h9Zo2WIWt8Sa8u8cz1NX8Rq+fsNNYCfuMaA44hLvIcPC0OGNttFDd5DDHDvCgbc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561030590753.1684656145496; Wed, 22 Apr 2020 06:10:30 -0700 (PDT) Received: from localhost ([::1]:50278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF93-0008Lt-77 for importer@patchew.org; Wed, 22 Apr 2020 09:10:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46950) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6D-0003v4-EG for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF6A-0003wD-Ds for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:33 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:55158 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF69-0003u7-ST for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-287-MN0mvPpIMmSQmRAdONPk_g-1; Wed, 22 Apr 2020 09:07:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B71AD107ACCA; Wed, 22 Apr 2020 13:07:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84FE6600E8; Wed, 22 Apr 2020 13:07:24 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 385E411358CA; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tOpA4vKhF0E/s3TXOxfOc3XODiJpn13TNPnTc0IUeNc=; b=hVHF8PZ+STPdA+pGil2Qq2WJGGnE0RPXvxsaIwruNfXzVxPK1G6qm65SJwqMQpuzpWPy/n PNYthuex8HyOkx42VWeqJ1EuwQULYZ/GM9qo00TpIc2kbM41Wi3t9gIe3XqLqcWwCs16FV LFUwVeRHuXmqkVWHplayVHJs4b3yKUc= X-MC-Unique: MN0mvPpIMmSQmRAdONPk_g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 13/14] qga: Fix qmp_guest_get_memory_blocks() error handling Date: Wed, 22 Apr 2020 15:07:18 +0200 Message-Id: <20200422130719.28225-14-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 02:12:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. qmp_guest_get_memory_blocks() passes &local_err to transfer_memory_block() in a loop. If this fails in more than one iteration, it can trip error_setv()'s assertion. Fix it to break the loop. Cc: Michael Roth Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- qga/commands-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index a52af0315f..ae1348dc8f 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2518,6 +2518,9 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(Err= or **errp) mem_blk->phys_index =3D strtoul(&de->d_name[6], NULL, 10); mem_blk->has_can_offline =3D true; /* lolspeak ftw */ transfer_memory_block(mem_blk, true, NULL, &local_err); + if (local_err) { + break; + } =20 entry =3D g_malloc0(sizeof *entry); entry->value =3D mem_blk; --=20 2.21.1 From nobody Sun May 12 02:56:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587561227; cv=none; d=zohomail.com; s=zohoarc; b=eY+up+VOTfXQbuagSCxuzCnz8CTl2JiyI2EWMXg4bBdJ0MUBp4YRzjNTXAvOwlfs4bT+m6FWVqmsnuCQDl9KZPsMpzoXWJykhvYcHJnmy2J0ruheIrrAhEEX/NV899uiCsSky12jqVuMx+/eBe4AEuRRuRW7Hz9T9TdWKz3DWtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587561227; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P4KVJJRj1MDcAz5rSwyrh0wdoPM26+UDuMR2Ulp1pEs=; b=AokcUDj1aKxdRso1pbNvrR1lIuSvwCjtKseJw7gzt99L7vbmQ4fWCDTIupEn94jDLP6AFb7flcLcWgYlKc002PIx0GV31bNd0nqWKbeWv+6KOp9AD8ukmxrHESoGwA1x1cfNQFbmTlASvBZhRc+7798p4QFkhrjnbt+qv7Qt4hM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587561227915934.7573333092969; Wed, 22 Apr 2020 06:13:47 -0700 (PDT) Received: from localhost ([::1]:50348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRFCE-0005Be-5Q for importer@patchew.org; Wed, 22 Apr 2020 09:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47204) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRF6Q-00047H-Mi for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRF6A-0003x1-JB for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:46 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52203 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRF6A-0003uF-3E for qemu-devel@nongnu.org; Wed, 22 Apr 2020 09:07:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-358-eCgbFUccPFeyGtEDeGnZIA-1; Wed, 22 Apr 2020 09:07:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCE7DA0CBF; Wed, 22 Apr 2020 13:07:24 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AF3160C87; Wed, 22 Apr 2020 13:07:24 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3DFA011358CB; Wed, 22 Apr 2020 15:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587560849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P4KVJJRj1MDcAz5rSwyrh0wdoPM26+UDuMR2Ulp1pEs=; b=Cv0xr3a8gV90hJ4XnMLCyO/nJro2nLYi5/gWoS9S8bjgA9qcYyGqApqoZT6Zn+C5DEv5zj NwoIJOrB+DUNstTESOPwVx4jpdNzeMaXUjN3WoZElfKAYhc1mIuXl/f5KUnliooXeMs59z uIniAQLSU/Vso76L8cuokDL4K8U+920= X-MC-Unique: eCgbFUccPFeyGtEDeGnZIA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 14/14] qga: Fix qmp_guest_suspend_{disk, ram}() error handling Date: Wed, 22 Apr 2020 15:07:19 +0200 Message-Id: <20200422130719.28225-15-armbru@redhat.com> In-Reply-To: <20200422130719.28225-1-armbru@redhat.com> References: <20200422130719.28225-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/22 04:15:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second qmp_guest_suspend_disk() and qmp_guest_suspend_ram() pass @local_err first to check_suspend_mode(), then to acquire_privilege(), then to execute_async(). Continuing after errors here can only end in tears. For instance, we risk tripping error_setv()'s assertion. Fixes: aa59637ea1c6a4c83430933f9c44c43e6c3f1b69 Fixes: f54603b6aa765514b2519e74114a2f417759d727 Cc: Michael Roth Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qga/commands-win32.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 9717a8d52d..5ba56327dd 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -1322,9 +1322,16 @@ void qmp_guest_suspend_disk(Error **errp) =20 *mode =3D GUEST_SUSPEND_MODE_DISK; check_suspend_mode(*mode, &local_err); + if (local_err) { + goto out; + } acquire_privilege(SE_SHUTDOWN_NAME, &local_err); + if (local_err) { + goto out; + } execute_async(do_suspend, mode, &local_err); =20 +out: if (local_err) { error_propagate(errp, local_err); g_free(mode); @@ -1338,9 +1345,16 @@ void qmp_guest_suspend_ram(Error **errp) =20 *mode =3D GUEST_SUSPEND_MODE_RAM; check_suspend_mode(*mode, &local_err); + if (local_err) { + goto out; + } acquire_privilege(SE_SHUTDOWN_NAME, &local_err); + if (local_err) { + goto out; + } execute_async(do_suspend, mode, &local_err); =20 +out: if (local_err) { error_propagate(errp, local_err); g_free(mode); --=20 2.21.1