From nobody Mon Jun 15 19:12:36 2026 Received: from sg-3-111.ptr.tlmpb.com (sg-3-111.ptr.tlmpb.com [101.45.255.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C65A7392C29 for ; Mon, 13 Apr 2026 06:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.45.255.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776063223; cv=none; b=DpzH/4Az6hCNY3OYCPzRsGu26uQM3EF3rjW7z4Y9ttXCDg7l+wk3EL6b5D8qLv1nY4M00JM2TMqWjACU/+rkveF0I1sCaqYxo1qzXJ07u1kNOxpO9Om2PT9sTR5aZ/lzqV/8nLbP2MOCh4qtbOkqd+MWF8UpVAPIV9Sc6Du91ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776063223; c=relaxed/simple; bh=u6YITT5i3g3xtgW9vHR1/H4ETIGCGLKHnuU1y7MmgAg=; h=From:Message-Id:Mime-Version:Cc:Subject:Date:Content-Type:To; b=ENdu965okAW0D7WsfDmCJz1YKyCtHZRYYFOHOAjnDMOU5q8SynuslbjVuFXbwmRQFvJ3wkuV9G89ExIEoSakPfDx/JSf/5h++7LDuAEQ+7Si8ADR/1pHgxSJa6NG6YIifPbcof01CWIabkUh64KRhZbrdPOrCyKPaCotzrhYx7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=TqDavQnt; arc=none smtp.client-ip=101.45.255.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="TqDavQnt" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1776063171; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=ZXothe/xKfm9FfMx4E0qgqfIEiuHvE3j/N2wGcAtYxw=; b=TqDavQntuKDSh00Ki6sB0RjiUhqGNCnjZj2QhdksM0ZkHiFhdXgp39gQcKQt2Bafo58rI1 4kpHxEebnDWsaaMGIlVAlCXXXhaqEuhMEmhZB7i6woVWR+dGACVv91BhrX78548YyiQH8h t8gM30YcPbb1kCPmgoM8Y4Vb213d65KmnCuXZxE3kAn9TZpmKVS9I2OdsGOvmz0gDWLJkb RLU4Z8MRhCi9p6l6w0Cp86ImjVdXUAb/IAA4s01OhXNIDBkE32O0vqSrB10KGgNyDhBmfK zPttJ9DwH4p9hECOUehoZx1ZZUiAYCYumfMpTe8631wng0cPUqMM/exeNI6NxA== From: "Jinhui Guo" Message-Id: <20260413065204.30330-1-guojinhui.liam@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.17.1 X-Original-From: Jinhui Guo X-Lms-Return-Path: Content-Transfer-Encoding: quoted-printable Cc: , , , "Jinhui Guo" Subject: [PATCH] vfio/virtio: Fix lock/unlock mismatch in virtiovf_read_device_context_chunk() Date: Mon, 13 Apr 2026 14:52:04 +0800 To: "Alex Williamson" , "Jason Gunthorpe" , "Yishai Hadas" , "Shameer Kolothum" , "Kevin Tian" Content-Type: text/plain; charset="utf-8" virtiovf_read_device_context_chunk() takes migf->list_lock with spin_lock() but releases it with spin_unlock_irq(). This mismatch can incorrectly enable interrupts if they were already disabled when the lock was acquired, leading to unbalanced IRQ state. Fix by using spin_lock_irq() to match spin_unlock_irq(). Fixes: 0bbc82e4ec79 ("vfio/virtio: Add support for the basic live migration= functionality") Signed-off-by: Jinhui Guo --- drivers/vfio/pci/virtio/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/pci/virtio/migrate.c b/drivers/vfio/pci/virtio/mi= grate.c index 35fa2d6ed611..9fc24788fc04 100644 --- a/drivers/vfio/pci/virtio/migrate.c +++ b/drivers/vfio/pci/virtio/migrate.c @@ -621,7 +621,7 @@ virtiovf_read_device_context_chunk(struct virtiovf_migr= ation_file *migf, =20 buf->start_pos =3D buf->migf->max_pos; migf->max_pos +=3D buf->length; - spin_lock(&migf->list_lock); + spin_lock_irq(&migf->list_lock); list_add_tail(&buf->buf_elm, &migf->buf_list); spin_unlock_irq(&migf->list_lock); return 0; --=20 2.20.1