From nobody Wed May 1 20:28:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613411998616650.2479016864405; Mon, 15 Feb 2021 09:59:58 -0800 (PST) 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-195-0knFnuUENgai5b1xbNBDlw-1; Mon, 15 Feb 2021 12:59:54 -0500 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 AEFD0512E; Mon, 15 Feb 2021 17:59:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B349B19CAB; Mon, 15 Feb 2021 17:59:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E31EE4EE4D; Mon, 15 Feb 2021 17:59:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11FHxi8c006917 for ; Mon, 15 Feb 2021 12:59:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 622625447F; Mon, 15 Feb 2021 17:59:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD1B462463 for ; Mon, 15 Feb 2021 17:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613411997; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=haidjJ+Cgd16sxrQ4LRK8oEQuYu9Y/U7+mx77YSvRrU=; b=QhOmAsEOPDbZkztHE5pBzRzcO/u4xvkZoj/kyl288x9x5S98s+pZWhN6X6MzQU062Qrkwy RV8tCkwV0+xoD/3nERuyheWmDx/y2eYYc2xAIMG7+fnM+WSynHL6K+Y5NNVfOWCTGyYq7n 2lYWAkG1BvB5rYe5j7+i3xRU/Pe8ls0= X-MC-Unique: 0knFnuUENgai5b1xbNBDlw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu_hotplug: Don't dereference NULL pointer @newb in qemuDomainChangeNet() Date: Mon, 15 Feb 2021 18:59:37 +0100 Message-Id: <2c8261870fef9afa530cc04772695a2f189fd645.1613411977.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In one of my previous commits I've made an attempt to restore the noqueue qdisc on a TAP corresponding to domain's if QoS is cleared out. The commit consisted of two almost identical hunks. In both the pointer is dereferenced. But in one of them, the pointer to new bandwidth can't be NULL while in the other it can leading to a crash. Fixes: d53b09235398c1320ed2f1b45b640823171467ed Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1919619 Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e7863328db..a66354426d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3900,10 +3900,10 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, =20 /* If the old bandwidth was cleared out, restore qdisc. */ if (virDomainNetTypeSharesHostView(newdev)) { - if (!newb->out || newb->out->average =3D=3D 0) + if (!newb || !newb->out || newb->out->average =3D=3D 0) qemuDomainInterfaceSetDefaultQDisc(driver, newdev); } else { - if (!newb->in || newb->in->average =3D=3D 0) + if (!newb || !newb->in || newb->in->average =3D=3D 0) qemuDomainInterfaceSetDefaultQDisc(driver, newdev); } needReplaceDevDef =3D true; --=20 2.26.2