From patchwork Mon Oct 7 21:49:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 175437 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4849554ill; Mon, 7 Oct 2019 14:54:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyfYFHTgANTPJ3rH01bazNv6VswK1Qe7yU0jfYiIVehFTNbwFdXbmbvY7FOdUeCSZgLoDw X-Received: by 2002:aca:cc96:: with SMTP id c144mr1243767oig.72.1570485241745; Mon, 07 Oct 2019 14:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570485241; cv=none; d=google.com; s=arc-20160816; b=hPs7PiJ+cfdLcVdCE0ZPCEvpJJRCh4LS7iHB705is7575BgTcP+walgy23yX+p+3hA /wx6HdCO12TlZRCgYRZJOf58waLjgC36ONE+bl8Mlx+bmiEV5YmYBH5N+1T7FO+b+7vb H9vRWlBXIe1MCxro63fP0lbq7Mec2Lb/jw1x/xXmEpVmMudkoqHwzpNVfojN3UZBK4y1 f8HnuVasKjILgK1AJUBPLW0r2GPQhGVOfTDwVQExMVwqpyCoLL0cYPmiMRpNLBaSQUTe l2HFNSeVI8+mDyQ63Osvy1FBGJITGsTAeZorwP1I/nKdTysVDKkiHb0eocKdgcr+JFX1 xfGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=yrAsWrbf1XxuKHcdnldGVb/y5JxxZiUoTFBeKbAzqcA=; b=dvj33dAWSt0ktXuDgVxWFu8wkXZDzAE5tDDex/0YtNDDv27xc2Fn6RU5jR01/scq5Z xUj2s+XBziJFHMyp0MJd2oILD1N1Ww2JdF4IVfiV29tWCTFkD3ti/WbRjh8TZdQoRd4f bWolqnruxTrhhv/3Y3O/4VtAXTEMVssFoclyIVgbsay6XVt1wbuGb/Kik6rLuCQ2vc0x 4wryKh6oP7uvhZEhJnY3XZpTHAqw47ngUlAmsMFTpKt4LeBbyMnLHmBEkfwmbKvvJju6 UrVkQXK5OhIv7t8vXqGKxilPSJa4g8MC1MLsBzGBZ4O7vNXax7AZbjtHduYg9CmwAse2 KGLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id a61si8441526otc.193.2019.10.07.14.54.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 14:54:01 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 31D24811DE; Mon, 7 Oct 2019 21:54:00 +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 07A265B681; Mon, 7 Oct 2019 21:54:00 +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 C2EEB1803518; Mon, 7 Oct 2019 21:53:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x97LouIR015169 for ; Mon, 7 Oct 2019 17:50:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1CE3A5C231; Mon, 7 Oct 2019 21:50:56 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from worklaptop.redhat.com (ovpn-123-156.rdu2.redhat.com [10.10.123.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2A2D5C1D4; Mon, 7 Oct 2019 21:50:55 +0000 (UTC) From: Cole Robinson To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 17:49:40 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 26/30] security: selinux: Drop !parent handling in SetImageLabelInternal 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 07 Oct 2019 21:54:00 +0000 (UTC) The only caller always passes in a non-null parent Signed-off-by: Cole Robinson --- src/security/security_selinux.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Daniel Henrique Barboza diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 9d28bc5773..e384542c49 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1849,9 +1849,8 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr, disk_seclabel = virStorageSourceGetSecurityLabelDef(src, SECURITY_SELINUX_NAME); - if (parent) - parent_seclabel = virStorageSourceGetSecurityLabelDef(parent, - SECURITY_SELINUX_NAME); + parent_seclabel = virStorageSourceGetSecurityLabelDef(parent, + SECURITY_SELINUX_NAME); if (disk_seclabel && (!disk_seclabel->relabel || disk_seclabel->label)) { if (!disk_seclabel->relabel) @@ -1863,7 +1862,7 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr, return 0; use_label = parent_seclabel->label; - } else if (!parent || parent == src) { + } else if (parent == src) { if (src->shared) { use_label = data->file_context; } else if (src->readonly) {