netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] hv_sock: Initializing vsk->trans to NULL to prevent a dangling pointer
@ 2024-11-06  9:36 Hyunwoo Kim
  2024-11-06  9:41 ` Stefano Garzarella
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Hyunwoo Kim @ 2024-11-06  9:36 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Stefano Garzarella, mst, jasowang
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, linux-hyperv, virtualization, netdev, gregkh,
	imv4bel, v4bel

When hvs is released, there is a possibility that vsk->trans may not
be initialized to NULL, which could lead to a dangling pointer.
This issue is resolved by initializing vsk->trans to NULL.

Fixes: ae0078fcf0a5 ("hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
---
v1 -> v2: Add fixes and cc tags
---
 net/vmw_vsock/hyperv_transport.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index e2157e387217..56c232cf5b0f 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -549,6 +549,7 @@ static void hvs_destruct(struct vsock_sock *vsk)
 		vmbus_hvsock_device_unregister(chan);
 
 	kfree(hvs);
+	vsk->trans = NULL;
 }
 
 static int hvs_dgram_bind(struct vsock_sock *vsk, struct sockaddr_vm *addr)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-11-09 17:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06  9:36 [PATCH v2] hv_sock: Initializing vsk->trans to NULL to prevent a dangling pointer Hyunwoo Kim
2024-11-06  9:41 ` Stefano Garzarella
2024-11-06  9:42 ` Michael S. Tsirkin
2024-11-07 19:29 ` Jakub Kicinski
2024-11-07 21:41   ` Michael S. Tsirkin
2024-11-07 21:52     ` Jakub Kicinski
2024-11-08  9:06       ` Hyunwoo Kim
2024-11-09 17:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).