From nobody Sat Nov 15 16:32:53 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1750674444; cv=none; d=zohomail.com; s=zohoarc; b=CQHr/LpROifB2e9CaaXg2oslhRXrmQiBSvNeH0C+uiqVdDIzBVecU+E4nkaCYcFjiu9ytIJwruPTZKt+6PFqaZ/upgTK2abfmnrVVd65XBopVPONzi2Uhq6gK3eg1tt+bg6DSPt+zzduDCAUVUb81SkgRVUJUDILvdELq7g9PUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750674444; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CiT88LYXoJQOz7loN5BISwfFIptHHOL2mzLReDXV1Cw=; b=KvnHARh+L2NKHtqNQZy4INrXOAr5Iyswc4tNLhxe3b5I0pc15cEY20rNTI/BqNTFwI1cOEvKo1cGSAIdXaKeebOxlAj/FCmYfSCH5Lq6ZDEk4CmJC+B8WWgWzDW/HzK05rask9IVdrKXA666I8mBMbyW+Mn/26i4u4LxREeHGG4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750674439796324.65046544287486; Mon, 23 Jun 2025 03:27:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uTeNs-0005xY-8M; Mon, 23 Jun 2025 06:26:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uTeNp-0005wS-3K for qemu-devel@nongnu.org; Mon, 23 Jun 2025 06:26:37 -0400 Received: from mgamail.intel.com ([192.198.163.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uTeNl-0000l4-VM for qemu-devel@nongnu.org; Mon, 23 Jun 2025 06:26:36 -0400 Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2025 03:26:31 -0700 Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2025 03:26:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750674394; x=1782210394; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TC0z9Q1FwXllaKpGPNdMbhIi47tz2jGUovh6tzE2h5w=; b=AuZGz5A1nKnTGLUsXEgE85OUcO2tNxFcirPQs+fh2Mt0nDgLZROLfSss YmE1vz/6atEqo7IMHUxDAqAJ4ggNCeypFRWJdFzIZGV4svbYOdxZYUWhL BFWAmuAT3HYk8fc2saRhhaVQ7DVGUzG0tXwbjf5G6ZMxognx2iMsGGoS6 zWZAOAxHEm/1R/KNpGgNoQhVu/Nmr9wCX8uxB3op1W4MJNvKUcBZ/KsP3 gjTK7tsgatcJob1esZAYc0Ol8WfwQwJ16SqGNSUSNJdFYPFLR2kWhlksv y30PIJsZi790JlZac98h/DgW6GBPdaYiZOo+Hukzpu8kmFiTsm+DLdmus w==; X-CSE-ConnectionGUID: Eh/H8FeOTeyWF/zfZ8RG7A== X-CSE-MsgGUID: ssAOnNHXRCWDKo/wusNEeQ== X-IronPort-AV: E=McAfee;i="6800,10657,11472"; a="63565451" X-IronPort-AV: E=Sophos;i="6.16,258,1744095600"; d="scan'208";a="63565451" X-CSE-ConnectionGUID: oZo9Bd+CTFG2X1mhhzNnLw== X-CSE-MsgGUID: QLsLFPmCRgi1Y2qnxV1G4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,258,1744095600"; d="scan'208";a="182427937" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, eric.auger@redhat.com, steven.sistare@oracle.com, chao.p.peng@intel.com, Zhenzhong Duan Subject: [PATCH 1/4] vfio/container: Fix SIGSEGV when open container file fails Date: Mon, 23 Jun 2025 18:22:32 +0800 Message-Id: <20250623102235.94877-2-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250623102235.94877-1-zhenzhong.duan@intel.com> References: <20250623102235.94877-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.9; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1750674445184116600 Content-Type: text/plain; charset="utf-8" When open /dev/vfio/vfio fails, SIGSEGV triggers because vfio_listener_unregister() doesn't support a NULL bcontainer pointer. Fixes: a1f267a7d4d9 ("vfio/container: reform vfio_container_connect cleanup= ") Signed-off-by: Zhenzhong Duan Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/container.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 3e8d645ebb..2853f6f08b 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -710,7 +710,9 @@ static bool vfio_container_connect(VFIOGroup *group, Ad= dressSpace *as, return true; =20 fail: - vfio_listener_unregister(bcontainer); + if (new_container) { + vfio_listener_unregister(bcontainer); + } =20 if (group_was_added) { vfio_container_group_del(container, group); --=20 2.34.1