From nobody Sun May 5 08:07:58 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 1538108033068932.9968828019662; Thu, 27 Sep 2018 21:13:53 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 3AC34307D864; Fri, 28 Sep 2018 04:13:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 082FD17143; Fri, 28 Sep 2018 04:13:48 +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 C27AD18005CE; Fri, 28 Sep 2018 04:13:44 +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 w8S4DhPF029202 for ; Fri, 28 Sep 2018 00:13:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E71060CD7; Fri, 28 Sep 2018 04:13:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34E6D610FF for ; Fri, 28 Sep 2018 04:13:40 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (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 4CAD730820C2 for ; Fri, 28 Sep 2018 04:13:39 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id n6-v6so5283069qtl.4 for ; Thu, 27 Sep 2018 21:13:39 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:4a37:5ca5:b636:d4ae:8278]) by smtp.gmail.com with ESMTPSA id l2-v6sm2170319qtp.41.2018.09.27.21.13.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 21:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=CzAlb1XUnDuqKFhliC5t7DYlVKpO8abAYeXJuwfYBFk=; b=W4Wkupa+3ZD73ouStqeGVrMITHji9yZFAfqB+t0YbUHKBXOn5Vk/rMkANPBBaKN0qS 9sN1zFKGn93YyRuaD6GuHtwllhNIFXY2zWF4B9Vlcx0WcJ8AUzNjXL16Xatp5TKMuuho 1K9iH63Z5fbnHAG9HWe7dshsmfVh1aKlVIHp6W6jJAG0IQj1HE4E7egIXJe62tD5lKna ueQ4W9LZvr0Mhh3QNS4Gua6dBtX6oEi4ZWnqC4KPUHLnlTG/7nPt6SalfWBn3AdaO+OL q55NzAX/ZvpVnjBMP3WjXPbiDje6oLreawlaHFU7hJ6CzpDuufKLFpyYPx4KaoGVKvzP F6LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=CzAlb1XUnDuqKFhliC5t7DYlVKpO8abAYeXJuwfYBFk=; b=KDDOJ1KPVCTEh9RveoLYhGMCmq2DouU4j9F1m91kKLQovDpRyM+tMFLjFMVSupqG2i syD6dgjyAR9hK2DXKdsbv5TNIr5mIwC5RTWP+L33LWCW6Ygd6YO8E5XypxihkwTvmp6J nsyh0OLJK2Oxc0Akj5TbKE93r8N/tu0NxNB1pO272jwxmCnJmr8eLudwEQcC4OhEfski WhpqNB5+L7F+sp8IL9iytWfApcsjmATosHyXEkxIMlpnJZ4enIVZTCWkC37p8Xy3R6S6 ZScQK46InhznjHr0CQqkEoAraeaeS6ifICFMqIxsXk+JJjTX4IYbLGidpbNxcDYL8FJi NWGg== X-Gm-Message-State: ABuFfogAzaCzmwPnQR69fmr+z6oKrO6Q1d9Co0/H9lPalnUpXO4vVQdY qcEP0GDmJzDBMeTn0od7/gF5C5cs X-Google-Smtp-Source: ACcGV62mola4KaNZWo0Z/cQeraN/0HVyisDbvTGdMCPDgY/8i/XjQVqU7XkWY4bAdoEID6tPJ5Ft1A== X-Received: by 2002:aed:3a68:: with SMTP id n95-v6mr11200496qte.283.1538108018209; Thu, 27 Sep 2018 21:13:38 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Fri, 28 Sep 2018 01:13:28 -0300 Message-Id: <20180928041328.18514-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 28 Sep 2018 04:13:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 28 Sep 2018 04:13:39 +0000 (UTC) for IP:'209.85.160.195' DOMAIN:'mail-qt1-f195.google.com' HELO:'mail-qt1-f195.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.108 (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.160.195 mail-qt1-f195.google.com 209.85.160.195 mail-qt1-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] uml: Fix weird logic inside umlConnectOpen() function. 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 28 Sep 2018 04:13:51 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The pointer related to uml_driver needs to be checked before its usage inside the function. Some attributes of the driver are being accessed while the pointer is NULL considering the current logic. Signed-off-by: Julio Faracco Reviewed-by: Erik Skultety --- src/uml/uml_driver.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index fcd468243e..d1c71d8521 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1193,6 +1193,13 @@ static virDrvOpenStatus umlConnectOpen(virConnectPtr= conn, { virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); =20 + /* URI was good, but driver isn't active */ + if (uml_driver =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("uml state driver is not active")); + return VIR_DRV_OPEN_ERROR; + } + /* Check path and tell them correct path if they made a mistake */ if (uml_driver->privileged) { if (STRNEQ(conn->uri->path, "/system") && @@ -1211,13 +1218,6 @@ static virDrvOpenStatus umlConnectOpen(virConnectPtr= conn, } } =20 - /* URI was good, but driver isn't active */ - if (uml_driver =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("uml state driver is not active")); - return VIR_DRV_OPEN_ERROR; - } - if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list