Commit b103bab0 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'vsock-return-errors-other-than-enomem-to-socket'

Arseniy Krasnov says:

====================
vsock: return errors other than -ENOMEM to socket

this patchset removes behaviour, where error code returned from any
transport was always switched to ENOMEM. This works in the same way as
patch from Bobby Eshleman:
commit c43170b7 ("vsock: return errors other than -ENOMEM to socket"),
but for receive calls. VMCI transport is also updated (both tx and rx
SOCK_STREAM callbacks), because it returns VMCI specific error code to
af_vsock.c (like VMCI_ERROR_*). Tx path is already merged to net, so it
was excluded from patchset in v4. At the same time, virtio and Hyper-V
transports are using general error codes, so there is no need to update
them.

vsock_test suite is also updated.

Link to v1:
https://lore.kernel.org/netdev/97f19214-ba04-c47e-7486-72e8aa16c690@sberdevices.ru/
Link to v2:
https://lore.kernel.org/netdev/60abc0da-0412-6e25-eeb0-8e32e3ec21e7@sberdevices.ru/
Link to v3:
https://lore.kernel.org/netdev/dead4842-333a-015e-028b-302151336ff9@sberdevices.ru/
====================

Link: https://lore.kernel.org/r/0d20e25a-640c-72c1-2dcb-7a53a05e3132@sberdevices.ruSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents b3803399 b5d54eb5
......@@ -2043,7 +2043,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg,
read = transport->stream_dequeue(vsk, msg, len - copied, flags);
if (read < 0) {
err = -ENOMEM;
err = read;
break;
}
......@@ -2094,7 +2094,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg,
msg_len = transport->seqpacket_dequeue(vsk, msg, flags);
if (msg_len < 0) {
err = -ENOMEM;
err = msg_len;
goto out;
}
......
......@@ -1831,10 +1831,17 @@ static ssize_t vmci_transport_stream_dequeue(
size_t len,
int flags)
{
ssize_t err;
if (flags & MSG_PEEK)
return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0);
err = vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0);
else
return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0);
err = vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0);
if (err < 0)
err = -ENOMEM;
return err;
}
static ssize_t vmci_transport_stream_enqueue(
......
......@@ -723,7 +723,7 @@ static void test_seqpacket_invalid_rec_buffer_server(const struct test_opts *opt
exit(EXIT_FAILURE);
}
if (errno != ENOMEM) {
if (errno != EFAULT) {
perror("unexpected errno of 'broken_buf'");
exit(EXIT_FAILURE);
}
......@@ -887,7 +887,7 @@ static void test_inv_buf_client(const struct test_opts *opts, bool stream)
exit(EXIT_FAILURE);
}
if (errno != ENOMEM) {
if (errno != EFAULT) {
fprintf(stderr, "unexpected recv(2) errno %d\n", errno);
exit(EXIT_FAILURE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment