From nobody Thu May 2 03:39:59 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 ARC-Seal: i=1; a=rsa-sha256; t=1626859729; cv=none; d=zohomail.com; s=zohoarc; b=Ya6K50Awhn8GEHQhM6fopribLxnKenK+dv79IH6DCLpZnPu0ESBhBmwAfNYdO69JuvnSznaAJQQCui6DSR4EJJBzUbbRe0APK5CBN8ZPPNQ5LS1RHqrbZJ0ALCbv87RaxLVfwWYsNZls/S/Yo7/AZPxoL4c3JhOGii2srkAZEck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626859729; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=POP3V7X04o9BWlCM5ChSVYyaMSSSHxAi9Br/boyQO1k=; b=d0hgTXfA4+mHX61hOHuO3ahedxylV77XNuUPGkoQNf6VvG0lQhEI9Sdwvr/lcGdxEsIwdqmikV1AP5YPK6rsMyTR+tgp95FY+aOFl4XoQy1aY5Rrfdreb9vBG0LX0tPQpFSxAGqnBg9DRHqPKM2R1lN0qkErjMJLt5Cdy8GAVfU= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) 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 1626859729423825.4908062920555; Wed, 21 Jul 2021 02:28:49 -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-425-10WnYrOaOLqITEjmyBBK_A-1; Wed, 21 Jul 2021 05:28:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93DFC423C5; Wed, 21 Jul 2021 09:28:39 +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 46F5E19D7C; Wed, 21 Jul 2021 09:28:37 +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 D207A1809C98; Wed, 21 Jul 2021 09:28:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16L9RhCr026248 for ; Wed, 21 Jul 2021 05:27:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 613DA83874; Wed, 21 Jul 2021 09:27:43 +0000 (UTC) Received: from andariel.local (unknown [10.40.193.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id A879684A0B for ; Wed, 21 Jul 2021 09:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626859728; 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=POP3V7X04o9BWlCM5ChSVYyaMSSSHxAi9Br/boyQO1k=; b=jF3i/xlEtGNpmlSNQdt5C6BG5OCJahPM3jdqJHNsuU7TxR3VAAAY6flFH5Xg7P6pzlWpNr 3KEYssPwaM8+oH+ta6o/i/iwMh/RSYXSHlQcM2C54ItZlwbm9hiPifoMQU3irx+uNCHCWF xyNoyvMrH6lRX1U/7F67sE4yuuAsBYE= X-MC-Unique: 10WnYrOaOLqITEjmyBBK_A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] storage_driver: Unlock object on ACL fail in storagePoolLookupByTargetPath Date: Wed, 21 Jul 2021 11:27:41 +0200 Message-Id: <0966db4bae9bad1e7d4cb7bded0a855bead3cf50.1626859575.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.84 on 10.5.11.23 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) X-ZM-MESSAGEID: 1626859729771100001 Content-Type: text/plain; charset="utf-8" 'virStoragePoolObjListSearch' returns a locked and refed object, thus we must release it on ACL permission failure. Fixes: 7aa0e8c0cb8 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1984318 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- Technically a security issue since it DoS-es the objects a user doesn't have access to for users which do have access. Posting to standard devel list since the bugzilla above is public. src/storage/storage_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index c2ff4b8d06..6aa10d89f6 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1738,8 +1738,10 @@ storagePoolLookupByTargetPath(virConnectPtr conn, storagePoolLookupByTargetPathCa= llback, cleanpath))) { def =3D virStoragePoolObjGetDef(obj); - if (virStoragePoolLookupByTargetPathEnsureACL(conn, def) < 0) + if (virStoragePoolLookupByTargetPathEnsureACL(conn, def) < 0) { + virStoragePoolObjEndAPI(&obj); return NULL; + } pool =3D virGetStoragePool(conn, def->name, def->uuid, NULL, NULL); virStoragePoolObjEndAPI(&obj); --=20 2.31.1