mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] vsock: preserve child namespace mode on an empty write
@ 2026-09-15 11:14 Aldo Ariel Panzardo
  2026-09-15 14:15 ` [PATCH v2] vsock: ignore empty child namespace mode writes Aldo Ariel Panzardo
  2026-09-17 14:20 ` [PATCH] vsock: preserve child namespace mode on an empty write netdev-bot+sashiko
  0 siblings, 2 replies; 10+ messages in thread
From: Aldo Ariel Panzardo @ 2026-09-15 11:14 UTC (permalink / raw)
  To: Stefano Garzarella
  Cc: virtualization, netdev, linux-kernel, stable, Aldo Ariel Panzardo

__vsock_net_mode_string() returns success without updating new_mode when
the write length is zero. Its caller then reads the uninitialized enum and
may permanently store a stack-derived value in the write-once child mode.

Initialize new_mode from the current child mode so that an empty write is
a no-op.

Fixes: eafb64f40ca4 ("vsock: add netns to vsock core")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
---
 net/vmw_vsock/af_vsock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 622dbd0467..61163357ae 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -2878,6 +2878,7 @@ static int vsock_net_child_mode_string(const struct ctl_table *table, int write,
 	int ret;
 
 	net = container_of(table->data, struct net, vsock.child_ns_mode);
+	new_mode = vsock_net_child_mode(net);
 
 	ret = __vsock_net_mode_string(table, write, buffer, lenp, ppos,
 				      vsock_net_child_mode(net), &new_mode);
-- 
2.43.0


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

end of thread, other threads:[~2026-09-17 14:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 11:14 [PATCH] vsock: preserve child namespace mode on an empty write Aldo Ariel Panzardo
2026-09-15 14:15 ` [PATCH v2] vsock: ignore empty child namespace mode writes Aldo Ariel Panzardo
2026-09-15 16:32   ` Luigi Leonardi
2026-09-15 16:57     ` Stefano Garzarella
2026-09-15 16:50   ` Stefano Garzarella
2026-09-15 17:29   ` Aldo Ariel Panzardo
2026-09-15 17:30   ` [PATCH v3] " Aldo Ariel Panzardo
2026-09-16 15:38     ` Stefano Garzarella
2026-09-16 16:53     ` Bobby Eshleman
2026-09-17 14:20 ` [PATCH] vsock: preserve child namespace mode on an empty write netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®