From 9f481091f9d307b8344799e03233edba2051e24b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 8 Feb 2026 13:09:56 +0100 Subject: [PATCH] fix up queue-5.10/kvm-don-t-clobber-irqfd-routing-type-when-deassigning-irqfd.patch --- ...-routing-type-when-deassigning-irqfd.patch | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/queue-5.10/kvm-don-t-clobber-irqfd-routing-type-when-deassigning-irqfd.patch b/queue-5.10/kvm-don-t-clobber-irqfd-routing-type-when-deassigning-irqfd.patch index a5126964e9..8b87d0ec44 100644 --- a/queue-5.10/kvm-don-t-clobber-irqfd-routing-type-when-deassigning-irqfd.patch +++ b/queue-5.10/kvm-don-t-clobber-irqfd-routing-type-when-deassigning-irqfd.patch @@ -122,12 +122,12 @@ Link: https://patch.msgid.link/20260113174606.104978-2-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- - virt/kvm/eventfd.c | 44 ++++++++++++++++++++++++-------------------- - 1 file changed, 24 insertions(+), 20 deletions(-) + virt/kvm/eventfd.c | 34 ++++++++++++++-------------------- + 1 file changed, 14 insertions(+), 20 deletions(-) --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c -@@ -147,21 +147,28 @@ irqfd_shutdown(struct work_struct *work) +@@ -147,21 +147,18 @@ irqfd_shutdown(struct work_struct *work) } @@ -136,16 +136,6 @@ Signed-off-by: Greg Kroah-Hartman -irqfd_is_active(struct kvm_kernel_irqfd *irqfd) +static bool irqfd_is_active(struct kvm_kernel_irqfd *irqfd) { -+ /* -+ * Assert that either irqfds.lock or SRCU is held, as irqfds.lock must -+ * be held to prevent false positives (on the irqfd being active), and -+ * while false negatives are impossible as irqfds are never added back -+ * to the list once they're deactivated, the caller must at least hold -+ * SRCU to guard against routing changes if the irqfd is deactivated. -+ */ -+ lockdep_assert_once(lockdep_is_held(&irqfd->kvm->irqfds.lock) || -+ srcu_read_lock_held(&irqfd->kvm->irq_srcu)); -+ return list_empty(&irqfd->list) ? false : true; } @@ -163,7 +153,7 @@ Signed-off-by: Greg Kroah-Hartman BUG_ON(!irqfd_is_active(irqfd)); list_del_init(&irqfd->list); -@@ -198,8 +205,15 @@ irqfd_wakeup(wait_queue_entry_t *wait, u +@@ -198,8 +195,15 @@ irqfd_wakeup(wait_queue_entry_t *wait, u seq = read_seqcount_begin(&irqfd->irq_entry_sc); irq = irqfd->irq_entry; } while (read_seqcount_retry(&irqfd->irq_entry_sc, seq)); @@ -181,7 +171,7 @@ Signed-off-by: Greg Kroah-Hartman KVM_USERSPACE_IRQ_SOURCE_ID, 1, false) == -EWOULDBLOCK) schedule_work(&irqfd->inject); -@@ -536,18 +550,8 @@ kvm_irqfd_deassign(struct kvm *kvm, stru +@@ -536,18 +540,8 @@ kvm_irqfd_deassign(struct kvm *kvm, stru spin_lock_irq(&kvm->irqfds.lock); list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) { -- 2.47.3