Message ID | fb3308c0-4a7a-a0b0-dbfd-92e50985600e@sberdevices.ru (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vsock: return errors other than -ENOMEM to socket | expand |
On Sun, Apr 02, 2023 at 09:15:49PM +0300, Arseniy Krasnov wrote: >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> >--- > net/vmw_vsock/vmci_transport.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) LGTM! Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> > >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( >-- >2.25.1 >
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(