From nobody Sat Apr 27 00:40:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1572668985; cv=none; d=zoho.com; s=zohoarc; b=VnP6N0IxQD0RSvnnPEvthHNvBZ3hp2Q/O2c3OcZV4KEft272KkYETxUUKDQW49jrUWa9TGKwKU9r0Gt1q8oHRtgm9QN+NDataK5pkgtuHgbhReLgEEYufvMWi6SIO6Gs3kvXM+TuwPrrdjbfmBH5s22XWsjFbEmNoMMZL2/RnxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572668985; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=m0wQ/YCJHnrvOz43+laRDnhgVVscS6+RN/UGJBnbY7s=; b=mHlEjxoK9Ze2o3G/X9tnh+kgKRtAmdNc5rUsmwJUgapPBKLzThhwZk8TJnDJiBLi3hQK34rOc2FS97jfDcgjaHjt4JaZHF4TGDx7gzluEdO+AXGb2LLyuXAUWRIUKZeto5Gq7mteG7xS+Cbycf4ccGEzfq7j4gb9ZMEftRndcM0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1572668985311904.342537889936; Fri, 1 Nov 2019 21:29:45 -0700 (PDT) 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-243-4_BTqUzCOA6nhuA2mGF7Ng-1; Sat, 02 Nov 2019 00:29:42 -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 BA3568064DC; Sat, 2 Nov 2019 04:29:36 +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 21CA7600D1; Sat, 2 Nov 2019 04:29:30 +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 52C8B4BB65; Sat, 2 Nov 2019 04:29:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA24T1FP001178 for ; Sat, 2 Nov 2019 00:29:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB5ED166BE; Sat, 2 Nov 2019 04:29:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D62241A7E5 for ; Sat, 2 Nov 2019 04:28:59 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (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 69B383082D67 for ; Sat, 2 Nov 2019 04:28:58 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id o49so15786492qta.7 for ; Fri, 01 Nov 2019 21:28:58 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7ca:db9c:480e:1004:b596:f05]) by smtp.gmail.com with ESMTPSA id w131sm6091581qka.85.2019.11.01.21.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 21:28:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572668984; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=m0wQ/YCJHnrvOz43+laRDnhgVVscS6+RN/UGJBnbY7s=; b=YsVcSuwRnv7ZT0vyZ1ygvZN8yZDui1WZL0s5bLiWfMsyI0V9GFB9MF3uxCBWsZDfwmJLXi Xu9nza3FzBUJWPTwkYJV0kgRLwP8IZPylXM/OVp7gsrXxrDZX/ryilE6KjcAMzw0EpEGJZ CuiXH/eLl+gSUDcsAEnHq/mHUqAvwl4= 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:mime-version :content-transfer-encoding; bh=BQ4rfzTFJdIKsExCs27PvPldiTdwAG/yFXSLuhvQuho=; b=JFYAMGBX6tjDe8uSNqknCSF3dwLyat08FU1qhloCTJQdYyUbcqNa2B71lkuVLOZ/Cc neXsc7guNa7k8inHlX/yN0DZJkQaY9Rhvlewx72i5Ij/WorLPvU+uFeiBRzzrz4zZPX9 gkOdYFnmxwNr7GHijiYogxaWC66B9Z3ocJUFrtRBmQeLF+y43z3AaJRfpUEScoVHgfEq WFRee3icihmbz+KaYSdK/EqIBI344KnVeFwz6UUvI7gZR74uyJ8J023cGjuZwMZFlpn8 HpH33dnpr0KTQ0F/oiUUW7xELR2lEsup/olBWh4zNLAM2UKb80wlG8SUCg3HMmy5memR WZLQ== X-Gm-Message-State: APjAAAX3sWp5bHPieTzHPnc5jqc6vJA9QG71ekRClNp3znEdYZR2Xy4+ 6jKIy/qVyQCkgxJW0xIMRlEzp85df6A= X-Google-Smtp-Source: APXvYqwvKcYmV8bYuza59f81Ju8tXjF+F33sx1+jJfLFoiFl3+EIwBl2MaAV6Ly9erJGclWTKPIZQQ== X-Received: by 2002:ac8:45c2:: with SMTP id e2mr3147550qto.366.1572668937076; Fri, 01 Nov 2019 21:28:57 -0700 (PDT) From: jcfaracco@gmail.com To: libvir-list@redhat.com Date: Sat, 2 Nov 2019 01:28:51 -0300 Message-Id: <20191102042851.21674-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sat, 02 Nov 2019 04:28:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sat, 02 Nov 2019 04:28:58 +0000 (UTC) for IP:'209.85.160.194' DOMAIN:'mail-qt1-f194.google.com' HELO:'mail-qt1-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.097 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.194 mail-qt1-f194.google.com 209.85.160.194 mail-qt1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Julio Faracco Subject: [libvirt] [PATCH] util: Fix segmentation fault when seclabel fails to allocate memory 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 X-MC-Unique: 4_BTqUzCOA6nhuA2mGF7Ng-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Julio Faracco In function virSecurityDeviceLabelDefNew(), when libvirt fails to allocate seclabel structure it returns a failure. This case is setting seclabel as a NULL pointer and accessing its attribute below. This commit fixes this wrong logic. Signed-off-by: Julio Faracco --- src/util/virseclabel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virseclabel.c b/src/util/virseclabel.c index a2b5ebf6b7..2141d84210 100644 --- a/src/util/virseclabel.c +++ b/src/util/virseclabel.c @@ -77,7 +77,7 @@ virSecurityDeviceLabelDefNew(const char *model) =20 if (VIR_ALLOC(seclabel) < 0) { virSecurityDeviceLabelDefFree(seclabel); - seclabel =3D NULL; + return NULL; } =20 seclabel->model =3D g_strdup(model); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list