From nobody Mon Feb 9 05:00:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1618244629; cv=none; d=zohomail.com; s=zohoarc; b=HYuMTgR12Kgf7Hhng8gqlCiZEuU+Z9y38cooBHswxBwV3KATDmBIzjeJQC0F1pEjpUyVvVpOR7PxNi9IVIphM3dBU61uhh3U1DW2rbNKy7m+azsqVBE3u5DA7Ptpp3yDkgYUz5YolkPwyAuq5N8WLjGO0s5cRW8ChKLreYefZmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618244629; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XnVZVJdAqa2izTDOLDCEtHHb3g8xeUePXwb3CMGzf8I=; b=C4jfxbkaVlb3lF7XouHyJRS3G/g96Nzio6nOOoQjlEFjzGmqqhLq9Ah0U32OMz4hTX/M2fHVEqCNyOxWz/P1sWyFBiPVPFVBoosFiL0cZP64ALOFZcUgbRftuNGh7iey0qAHI5DWT/ECnrWfAaVp0fw6dgEb9wKhkmeJS0LOPfs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1618244629489402.9349186557398; Mon, 12 Apr 2021 09:23: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-376-MZYg3SKEO422IxgmQBK14A-1; Mon, 12 Apr 2021 12:23:45 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6797195D561; Mon, 12 Apr 2021 16:23:40 +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 942CE100238C; Mon, 12 Apr 2021 16:23:40 +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 291A81806D0E; Mon, 12 Apr 2021 16:23:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13CGMUGi004545 for ; Mon, 12 Apr 2021 12:22:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id A38FD2BFED; Mon, 12 Apr 2021 16:22:30 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26DC66062F for ; Mon, 12 Apr 2021 16:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618244628; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XnVZVJdAqa2izTDOLDCEtHHb3g8xeUePXwb3CMGzf8I=; b=YRAul9Ab4ZiapMlWSwlIzd8z0Tct/wv+InquRvXDEfcqIfBhZf3cExl9Tz/CfC4eCLaxKC IoPn8Z0EVJR/eUkUACdTUbnYvjlBSAJ4ohAwEUghtjXJJWydC05NRhysQ4YTDZoLMGDRJU bLfW6l2tueEqE4UGP2Uejq8NlcPqlHQ= X-MC-Unique: MZYg3SKEO422IxgmQBK14A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/5] nodedev: Unlock @priv if initialization of mdevctlMonitors fails Date: Mon, 12 Apr 2021 18:22:20 +0200 Message-Id: <229815098534c90f57a246bec42bab2a83469674.1618243050.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.22 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) Content-Type: text/plain; charset="utf-8" If initialization of priv->mdevctlMonitors fails, then the control jumps over to cleanup label where nodeStateCleanup() is called which tries to lock @priv. But since @priv was already locked before taking the jump a deadlock occurs. The solution is to jump onto @unlock label, just like the code around is doing. Signed-off-by: Michal Privoznik --- src/node_device/node_device_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 7d4e8f5c0b..04e1094e21 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -2274,7 +2274,7 @@ nodeStateInitialize(bool privileged, if (!(priv->mdevctlMonitors =3D monitorFileRecursively(priv, mdevctlConfigDir)= )) { virMutexUnlock(&priv->mdevctlLock); - goto cleanup; + goto unlock; } virMutexUnlock(&priv->mdevctlLock); =20 --=20 2.26.3