From nobody Sat May 4 05:39:57 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1622119962; cv=none; d=zohomail.com; s=zohoarc; b=gUhXAFvRFyu3dN7Is8vISDg2HAO0s+XTUTAESlh8FwXD2Z6r7TWupzGoPlnD6f6esycGYh6X09NSuW401emU29viENbqUdRBat2IbbWP+EIIAC1MU0meBll5FyPFOHxHjk5SKax6Qh+oOOBW+mBs6w0sIbp/Td9wEUenop5JcRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622119962; 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=26+DbnImWlJEpMl43BoDXMbioaum5F80QCTN4YfyJJk=; b=WZD6hwQ6l8Gpzec/KuvcUKhID6WsPhHqYQlqGcZjRoU1xPuD6UY9RBe/4jOLkKxA4dP3qGlBrqxK6R9NGe2KV8lDJIsyfFrFgA5dvlOI7MkXxGuPtMIrVyS0YuK/cjO0W2B1RGNy3QnY6RtSHYHy4y++yR7+tExD8J1U9rxW+5A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622119962026439.73511871761707; Thu, 27 May 2021 05:52:42 -0700 (PDT) Received: from localhost ([::1]:38804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmFV7-0006y0-4W for importer2@patchew.org; Thu, 27 May 2021 08:52:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmFAx-000416-2d for qemu-devel@nongnu.org; Thu, 27 May 2021 08:31:48 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmFAs-0004SO-Lp for qemu-devel@nongnu.org; Thu, 27 May 2021 08:31:46 -0400 Received: from dggeml701-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FrRtq2yYqz67gr; Thu, 27 May 2021 20:28:35 +0800 (CST) Received: from dggema765-chm.china.huawei.com (10.1.198.207) by dggeml701-chm.china.huawei.com (10.3.17.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 27 May 2021 20:31:28 +0800 Received: from DESKTOP-6NKE0BC.china.huawei.com (10.174.185.210) by dggema765-chm.china.huawei.com (10.1.198.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 27 May 2021 20:31:27 +0800 From: Kunkun Jiang To: Alex Williamson , Kirti Wankhede , "open list:All patches CC here" Subject: [PATCH] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize Date: Thu, 27 May 2021 20:31:01 +0800 Message-ID: <20210527123101.289-1-jiangkunkun@huawei.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.185.210] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggema765-chm.china.huawei.com (10.1.198.207) X-CFilter-Loop: Reflected 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.188; envelope-from=jiangkunkun@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zenghui Yu , wanghaibin.wang@huawei.com, Kunkun Jiang , Keqian Zhu , ganqixin@huawei.com Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" In the vfio_migration_init(), the SaveVMHandler is registered for VFIO device. But it lacks the operation of 'unregister'. It will lead to 'Segmentation fault (core dumped)' in qemu_savevm_state_setup(), if performing live migration after a VFIO device is hot deleted. Fixes: 7c2f5f75f94 (vfio: Register SaveVMHandlers for VFIO device) Reported-by: Qixin Gan Signed-off-by: Kunkun Jiang --- hw/vfio/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 201642d75e..ef397ebe6c 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -892,6 +892,7 @@ void vfio_migration_finalize(VFIODevice *vbasedev) =20 remove_migration_state_change_notifier(&migration->migration_state= ); qemu_del_vm_change_state_handler(migration->vm_state); + unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev); vfio_migration_exit(vbasedev); } =20 --=20 2.23.0