diff options
author | Arseniy Krasnov <avkrasnov@sberdevices.ru> | 2023-04-03 14:24:17 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-04-04 12:46:24 +0200 |
commit | f59f3006ca7b2fc9bf38fbf44e3dc4b1fbd686c1 (patch) | |
tree | 2557264e7c961928676552cc5a8d849cf3f084aa /net/vmw_vsock | |
parent | b3803399196e961ca190561d26ccf567f26841e6 (diff) | |
download | lwn-f59f3006ca7b2fc9bf38fbf44e3dc4b1fbd686c1.tar.gz lwn-f59f3006ca7b2fc9bf38fbf44e3dc4b1fbd686c1.zip |
vsock/vmci: convert VMCI error code to -ENOMEM on receive
This adds conversion of VMCI specific error code to general -ENOMEM. It
is preparation for the next patch, which changes af_vsock.c behaviour
on receive to pass value returned from transport to the user.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/vmw_vsock')
-rw-r--r-- | net/vmw_vsock/vmci_transport.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index 36eb16a40745..a5375c97f5b0 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -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( |