Netdev List
 help / color / mirror / Atom feed
* [PATCH net] vsock: avoid narrowing the receive queue length to int
@ 2026-12-04 16:35 Ryosuke Iwahashi
  2026-12-04 16:37 ` netdev-bot+sinfo
  0 siblings, 1 reply; 3+ messages in thread
From: Ryosuke Iwahashi @ 2026-12-04 16:35 UTC (permalink / raw)
  To: sgarzare
  Cc: bobbyeshleman, davem, edumazet, kuba, pabeni, willemb, horms,
	virtualization, netdev, arseny.krasnov

For virtio stream sockets, vsock_connectible_has_data() returns the
number of queued bytes as an s64. If the receive queue grows beyond
INT_MAX, vsock_connectible_wait_data() can narrow that count to a
negative int. Its callers then report an error even though data is
available.

Both callers only test whether the return value is positive. Return
one when data is available, preserving the zero and error cases.

Fixes: b3f7fd54881b ("af_vsock: separate wait data loop")
Signed-off-by: Ryosuke Iwahashi <ryosuke@ikotaslabs.com>
---
 net/vmw_vsock/af_vsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 1d7d53542724..3bfc0bf9bd1d 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -2468,7 +2468,7 @@ static int vsock_connectible_wait_data(struct sock *sk,
 	if (data < 0)
 		return -ENOMEM;

-	return data;
+	return data > 0;
 }

 static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg,

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

end of thread, other threads:[~2026-12-04 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 16:35 [PATCH net] vsock: avoid narrowing the receive queue length to int Ryosuke Iwahashi
2026-12-04 16:37 ` netdev-bot+sinfo
2026-12-04 16:39   ` Ryosuke Iwahashi

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