From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388751; b=atR3cX+JwoBh5osTSkr19QYfksVHHxNnktv1DEghKgHvtuhQeiKrCsBErCMu3xeIY+SI 23w9wDxTVLz0xDUm/h7n6zE5awOfhT0Ff+woGbpU0bLfauBgzFaxWv9/NY4YBTC2prC+D Bd2Wo86Niw7QXWZhcTTqqfEvyprsF1sESHiz9xV/K3eAIa/2KB5vChzqgdFRzkQAvVlr9 lH37e5++KJ7VBaIKQhx9JbVUL8DkmuR7TRa93WgBLdNLkw3oA2GbyAB3/jbjr7e/0ldOL cfDPX0rcQD4hdk1jzqSUBQStfMRJUyl7K8K75hBgP7f2MHT57FLoyw8sYtzbKSeUFtw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388751; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EyDyc2DGv36VW4C6mu2DN6UILsDwRC9n6sH8WnJ61BE=; b=U3TrfJ5l/M0+49PBUVW4/SO9OrOSBKBNerWftMGtHd9guGtbOZ372y0ZJmjmy2l2Bpb+ L8eI9kreMUCGR/rWBKPnxFYHwaMoUNE2SX0KuLz3rN5P2qwLcZR/QetGeiBQIeT5lxuPv 7RPAV9GAjV4sEv1+tG1b5SoK2wbSe403d+TWjpF9kfP7nUTbyPRvga7JJDqZTjDnzj2sw fgeFwDVKKBB1AfGJwYeihwUsmRK4zd9b2YT0pJDYmT9DueLdFfCevpkkoRgmCJdfRqTu7 +7522YGaprZkel4OdqIC1V1BY5Y5JlJxd8Ahpc/LzpYsOL10DJND8DD5kppdkqoULmQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2QV65QQB; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 083E6606A32C; Fri, 4 Dec 2026 12:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2QV65QQB Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF5631F000C2; Fri, 4 Dec 2026 12:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388750; bh=EyDyc2DGv36VW4C6mu2DN6UILsDwRC9n6sH8WnJ61BE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2QV65QQBORudjURh4vWK6Xhb66T2WkVQy9whBI+3JpvnrAQyjQiVg4ecc0o6lK9jy kECeO9zs6+cYePyeKDqoTguilPArgWcTNoCv0ZupzXopOPhMAEVC0CTKBVX0qdrXhO nwzRMCL3IBrjGOSnusGyTYN8vihReLSEkQqkeews= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Bryan Tan , Vishnu Dasa , Broadcom internal kernel review list , Arnd Bergmann , Josef Bacik , Sasha Levin Subject: [PATCH 6.1 0739/1059] misc: vmw_vmci: wait for callbacks in event unsubscribe Date: Fri, 4 Dec 2026 19:04:30 +0900 Message-ID: <20261204100703.123641901@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik [ 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 Cc: Bryan Tan Cc: Vishnu Dasa Cc: Broadcom internal kernel review list Cc: Arnd Bergmann Signed-off-by: Josef Bacik Link: https://patch.msgid.link/2026102715-escapable-quaintly-8530@gregkh Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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