* FAILED: patch "[PATCH] misc: vmw_vmci: wait for callbacks in event unsubscribe" failed to apply to 6.1-stable tree
@ 2026-11-25 11:30 gregkh
2026-11-26 15:09 ` [PATCH 6.1.y 1/2] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2026-11-25 11:30 UTC (permalink / raw)
To: josef, arnd, bcm-kernel-feedback-list, bryan-bt.tan, gregkh,
stable, vishnu.dasa
Cc: stable
The 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 <stable@vger.kernel.org>.
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 '<stable@vger.kernel.org>' --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 <josef@toxicpanda.com>
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.
Fixes: 6da3f33770e0 ("misc: vmw_vmci: Switch to kvfree_rcu() API")
Cc: stable <stable@kernel.org>
Cc: Bryan Tan <bryan-bt.tan@broadcom.com>
Cc: Vishnu Dasa <vishnu.dasa@broadcom.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/2026102715-escapable-quaintly-8530@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index c3ef3b98c432..57d3a63678ac 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 6.1.y 1/2] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
2026-11-25 11:30 FAILED: patch "[PATCH] misc: vmw_vmci: wait for callbacks in event unsubscribe" failed to apply to 6.1-stable tree gregkh
@ 2026-11-26 15:09 ` Sasha Levin
2026-11-26 15:09 ` [PATCH 6.1.y 2/2] misc: vmw_vmci: wait for callbacks in event unsubscribe Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-11-26 15:09 UTC (permalink / raw)
To: stable
Cc: Uladzislau Rezki (Sony), Bryan Tan, Vishnu Dasa,
Greg Kroah-Hartman, Paul E. McKenney, Joel Fernandes (Google),
Sasha Levin
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
[ Upstream commit 09b2286af617bc6f9480404b565393628f86037d ]
The kvfree_rcu() macro's single-argument form is deprecated. Therefore
switch to the new kvfree_rcu_mightsleep() variant. The goal is to
avoid accidental use of the single-argument forms, which can introduce
functionality bugs in atomic contexts and latency bugs in non-atomic
contexts.
Cc: Bryan Tan <bryantan@vmware.com>
Cc: Vishnu Dasa <vdasa@vmware.com>
Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Stable-dep-of: 824a27d391cf ("misc: vmw_vmci: wait for callbacks in event unsubscribe")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/misc/vmw_vmci/vmci_context.c | 2 +-
drivers/misc/vmw_vmci/vmci_event.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index 172696abce31b..f22b44827e929 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -687,7 +687,7 @@ int vmci_ctx_remove_notification(u32 context_id, u32 remote_cid)
spin_unlock(&context->lock);
if (notifier)
- kvfree_rcu(notifier);
+ kvfree_rcu_mightsleep(notifier);
vmci_ctx_put(context);
diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index 5c35874671783..89ab9f05b88c5 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -213,7 +213,7 @@ int vmci_event_unsubscribe(u32 sub_id)
if (!s)
return VMCI_ERROR_NOT_FOUND;
- kvfree_rcu(s);
+ kvfree_rcu_mightsleep(s);
return VMCI_SUCCESS;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 6.1.y 2/2] misc: vmw_vmci: wait for callbacks in event unsubscribe
2026-11-26 15:09 ` [PATCH 6.1.y 1/2] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Sasha Levin
@ 2026-11-26 15:09 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-11-26 15:09 UTC (permalink / raw)
To: stable
Cc: Josef Bacik, stable, Bryan Tan, Vishnu Dasa,
Broadcom internal kernel review list, Arnd Bergmann,
Greg Kroah-Hartman, Sasha Levin
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 824a27d391cf934d3232e8e2dabee221fc4e18ae ]
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.
Fixes: 6da3f33770e0 ("misc: vmw_vmci: Switch to kvfree_rcu() API")
Cc: stable <stable@kernel.org>
Cc: Bryan Tan <bryan-bt.tan@broadcom.com>
Cc: Vishnu Dasa <vishnu.dasa@broadcom.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/2026102715-escapable-quaintly-8530@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/misc/vmw_vmci/vmci_event.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index 89ab9f05b88c5..dcfe639abcb5e 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -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;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-26 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 11:30 FAILED: patch "[PATCH] misc: vmw_vmci: wait for callbacks in event unsubscribe" failed to apply to 6.1-stable tree gregkh
2026-11-26 15:09 ` [PATCH 6.1.y 1/2] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Sasha Levin
2026-11-26 15:09 ` [PATCH 6.1.y 2/2] misc: vmw_vmci: wait for callbacks in event unsubscribe Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.