From nobody Wed Apr 24 16:59:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520784162083745.8154135845349; Sun, 11 Mar 2018 09:02:42 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 7B406883AB; Sun, 11 Mar 2018 16:02:40 +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 080EF5D6B4; Sun, 11 Mar 2018 16:02:38 +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 0AED14CA99; Sun, 11 Mar 2018 16:02:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2BG2aHF003848 for ; Sun, 11 Mar 2018 12:02:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 75E3260BEB; Sun, 11 Mar 2018 16:02:36 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E25160F90 for ; Sun, 11 Mar 2018 16:02:34 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 477694E8B8 for ; Sun, 11 Mar 2018 16:02:33 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id t204-v6so19620566lff.9 for ; Sun, 11 Mar 2018 09:02:33 -0700 (PDT) Received: from kloomba.my.domain ([31.29.232.197]) by smtp.gmail.com with ESMTPSA id l27-v6sm1290008lfk.75.2018.03.11.09.02.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Mar 2018 09:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=nPagYggrkgiJLiyR6Di30DxkedvPs1hZT59MCXUHam0=; b=lmQ4IJifTN4g0ppkhEX6s1h8EsnUfvEJpDl/V1nzNritFF6xmhV6Y19yLbft0EYZoV QWdzrIJdqRKBcnTvRxTGgRX7Itz2IRImIUBhFOiMVSr+cpqNsz3qL8F7XikpUYpBJEP0 bfXoJHuo6RaQhBEUA3FxgvVbzAKar4BfDr+RDI/MBAo3QhagGS7vmeJbGmweRvPJLdfs EKZq1E3/LPbCjZaKfCKJi2jZNp9EQXGq1VcfmWZ0hSaY9wDW1AKBK2hgI77AyFRBmBlO qyox5iIkANdWgGYk6ZciQAJ1E8JXhRgM8gYs+fDJTi86gFD2DOZtlQCi48WeBSRRTUXt 0fag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nPagYggrkgiJLiyR6Di30DxkedvPs1hZT59MCXUHam0=; b=Gk/CznFDQ9C9fqB9HyqA/A3pQk3IzE9LkRA7LbBnlfWKZOETV4CVIWJ8tMbVDk+qyW S36bjRpIavrH9Xbdv87GTK4/c3olDp8VpoVFqFx7pPaM5Vj4iw+EnjxPoIBf9RLJ/PYb 6CFlzpifnIL/0KbxQszmfP1kpyxGuhG2ZrGK0D1MqMwGacyDagWn6Fg2sFxy0mhseKuV y16+qy/xz1qKt7a2omLetkDsQ2/EuSPTJVgsZWuQSXi4PHN8O/vEsjX1Gy2bo/qoKFbl EmKd0gK6ikUlgcAIFuw+uWYpUDhqY6p+Zs9pyNaH0esA562xsn/kJ3q1ETMQsDDeucKe WW/A== X-Gm-Message-State: AElRT7Eh/10gXbkAW6p9ePiXuWRBF+E5vnuTdt4zraVI9NFKGha9BIV3 dQP7j+j4nA7x5tvtp5RnKkOVKw== X-Google-Smtp-Source: AG47ELuxN8mzWivUoXBnqRUU/2o41SuMiimmuNkD3Z4YH7jid5ARdCELrGNadLOmDYGJcWow+45hHA== X-Received: by 2002:a19:5159:: with SMTP id f86-v6mr3022998lfb.50.1520784150021; Sun, 11 Mar 2018 09:02:30 -0700 (PDT) From: Roman Bogorodskiy To: libvir-list@redhat.com Date: Sun, 11 Mar 2018 20:02:22 +0400 Message-Id: <20180311160222.55956-1-bogorodskiy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 11 Mar 2018 16:02:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 11 Mar 2018 16:02:33 +0000 (UTC) for IP:'209.85.215.53' DOMAIN:'mail-lf0-f53.google.com' HELO:'mail-lf0-f53.google.com' FROM:'bogorodskiy@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.53 mail-lf0-f53.google.com 209.85.215.53 mail-lf0-f53.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Roman Bogorodskiy Subject: [libvirt] [PATCH] bhyve: fix crash on missing interface model 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 11 Mar 2018 16:02:41 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The bhyve driver crashes in bhyveBuildNetArgStr() when network interface model is not defined. As it has to be provided explicitly, add a check to report an error if it's missing. --- src/bhyve/bhyve_command.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index ec5d24012..9413ae5c1 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -56,6 +56,12 @@ bhyveBuildNetArgStr(virConnectPtr conn, int ret =3D -1; virDomainNetType actualType =3D virDomainNetGetActualType(net); =20 + if (net->model =3D=3D NULL) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("NIC model must be specified")); + return -1; + } + if (STREQ(net->model, "virtio")) { if (VIR_STRDUP(nic_model, "virtio-net") < 0) return -1; --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list