From nobody Sun Oct 5 00:08:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1757410298; cv=none; d=zohomail.com; s=zohoarc; b=ZIa5rz0oO0FCOkstl/Ef83bSStCUKXgaE2n32t3qAR8I4AT+rIXC1eZ4mXoTZ8SnlfWTZRTNw+90bwOfSBcQ109ckg+++uQto41Qi1EOxSoxUNwA3+4nWI2gNV5rjPI4aLXK+uNW534ILjnE9tr8dcJU27go8aihIgVYh/EDWkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757410298; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=S8oqLHegnFBG2ksIa94N1sXqpCcNf+FdWXnjGU7MoHs=; b=Gdo515u9Fj8d//LZkcJTsiN/AZUcmzB4gI7x7kqUPwMLs62Rx8Wh0uyw/hyIqM8GwT4/Yw3hDfc9r90bvzx3p8BiaKqvbXCYCe3bWvpUtjm9h1t28TVQHuBVsZYrHMIrw6p167UjdltXwR+/xwuEVyo1jgghGUX5nXhZEwdfvBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1757410297888756.7810350522865; Tue, 9 Sep 2025 02:31:37 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6050741A58; Tue, 9 Sep 2025 05:31:36 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 77CDB41B01; Tue, 9 Sep 2025 05:28:51 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 929C941A4F; Tue, 9 Sep 2025 05:28:42 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B626841A4C for ; Tue, 9 Sep 2025 05:28:37 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-VOSdP--oPPSOZ3mZR4EBiQ-1; Tue, 09 Sep 2025 05:28:36 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4F53D1955F45 for ; Tue, 9 Sep 2025 09:28:35 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.45]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 74B471800446; Tue, 9 Sep 2025 09:28:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757410117; 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; bh=S8oqLHegnFBG2ksIa94N1sXqpCcNf+FdWXnjGU7MoHs=; b=dsWWZYwx+N1X2lgJ2G0ce9vDBd/QzLyERTkP5KCkXURjiPjiZSp7qGS9zqCBM8tdnT49Y2 EONpK+zb1Y7l4cRpBFvsMfWDljRkoLGZsYaMoA82HLHsyPSVZTayrelUsJ7rzAgTD91ajH TYepT/akLaAInWQTYo2gB3WcrFg+4/0= X-MC-Unique: VOSdP--oPPSOZ3mZR4EBiQ-1 X-Mimecast-MFC-AGG-ID: VOSdP--oPPSOZ3mZR4EBiQ_1757410115 To: devel@lists.libvirt.org Subject: [PATCH] conf: clear the acpiNodeset field after freeing Date: Tue, 9 Sep 2025 10:28:33 +0100 Message-ID: <20250909092833.3604072-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: GYnPmYSc-vceMmZiWT7QkbWohRhHsWD7wDROeqtaqts_1757410115 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: D7LHJBEKBPOQWYARB5MWMKP4GQEZBAQ7 X-Message-ID-Hash: D7LHJBEKBPOQWYARB5MWMKP4GQEZBAQ7 X-MailFrom: berrange@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9_via_Devel?= Reply-To: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1757410302295124100 From: Daniel P. Berrang=C3=A9 The virDomainDeviceInfoClear method does not free the struct, only its contents, so all pointer fields must be explicitly set to NULL after releasing to avoid disk of double-free. Reported by coverity: *** CID 895678: Memory - corruptions (USE_AFTER_FREE) /src/conf/domain_conf.c: 5926 in virDomainDeviceInfoParseXML() 5920 goto cleanup; 5921 5922 5923 ret =3D 0; 5924 cleanup: 5925 if (ret < 0) >>> CID 895678: Memory - corruptions (USE_AFTER_FREE) >>> Calling "virDomainDeviceInfoClear" frees pointer "info->acpiNodes= et" which has already been freed. 5926 virDomainDeviceInfoClear(info); 5927 return ret; 5928 } 5929 5930 static int 5931 virDomainHostdevSubsysUSBDefParseXML(xmlNodePtr node, Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/conf/device_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index d08de68717..3fa7bba649 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -138,6 +138,7 @@ virDomainDeviceInfoClear(virDomainDeviceInfo *info) VIR_FREE(info->romfile); VIR_FREE(info->loadparm); virBitmapFree(info->acpiNodeset); + info->acpiNodeset =3D NUll; info->isolationGroup =3D 0; info->isolationGroupLocked =3D false; } --=20 2.50.1