FAILED: patch "[PATCH] misc: vmw_vmci: wait for callbacks in event unsubscribe" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 824a27d391cf934d3232e8e2dabee221fc4e18ae
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112527-revert-unable-e720@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 824a27d391cf934d3232e8e2dabee221fc4e18ae Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Tue, 27 Oct 2026 17:58:16 +0100
Subject: [PATCH] misc: vmw_vmci: wait for callbacks in event unsubscribe
event_deliver() calls the callbacks of the subscribers inside an RCU read side critical section. vmci_event_unsubscribe() used to call synchronize_rcu() before it freed the subscription. This did more than to protect the struct vmci_subscription: when the function returned, no callback was running any more, and its callers rely on that.
vmci_transport_free_resources() unsubscribes from VMCI_EVENT_QP_PEER_DETACH and frees the struct vmci_transport, which is the callback data, a few lines later:
CPU0 CPU1
event_deliver()
rcu_read_lock()
vmci_transport_peer_detach_cb()
vmci_event_unsubscribe()
list_del_rcu(&s->node)
kvfree_rcu_mightsleep(s)
kfree(transport)
spin_lock_bh(&trans->lock)The event is sent when the peer of the queue pair detaches, so the other end of a vsock connection chooses the time. vmci_transport_exit() and vmci_guest_remove_device() unsubscribe callbacks which are gone with their module.
kvfree_rcu_mightsleep() only waits for a grace period if it cannot allocate memory. Bring the synchronize_rcu() back. The cleanup work of the vmci transport now waits for one grace period per socket again.
drivers/misc/vmw_vmci/vmci_event.c +6 -1
@@ -213,7 +213,12 @@ int vmci_event_unsubscribe(u32 sub_id)if (!s)return VMCI_ERROR_NOT_FOUND ; -kvfree_rcu_mightsleep (s); +/* +* Wait for event_deliver(): the caller is going to free what the +* callback works on. +*/ +synchronize_rcu (); +kfree (s);return VMCI_SUCCESS ; }