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 <ryos…@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,
[PATCH net] vsock: avoid narrowing the receive queue length to int
- From
- ryos…@ikotaslabs.com (Ryosuke Iwahashi)
- Organization
- Usenet Network
- Message-ID
- <CAN2…@mail.gmail.com>
- Date
- Newsgroups
- linux.kernel.netdev