net/vmw_vsock/virtio_transport_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Return a negative error code if the transport doesn't match. Don't
return success.
Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
From static analysis. Not tested.
net/vmw_vsock/virtio_transport_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index dcc8a1d5851e..77fbc6c541bf 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -1550,7 +1550,7 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb,
release_sock(child);
virtio_transport_reset_no_sock(t, skb);
sock_put(child);
- return ret;
+ return ret ?: -EINVAL;
}
if (virtio_transport_space_update(child, skb))
--
2.51.0
On Thu, Dec 11, 2025 at 10:45:47AM +0300, Dan Carpenter wrote:
>Return a negative error code if the transport doesn't match. Don't
>return success.
>
>Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
>Cc: stable@vger.kernel.org
>Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>---
>From static analysis. Not tested.
>
> net/vmw_vsock/virtio_transport_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>index dcc8a1d5851e..77fbc6c541bf 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -1550,7 +1550,7 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb,
> release_sock(child);
> virtio_transport_reset_no_sock(t, skb);
> sock_put(child);
>- return ret;
>+ return ret ?: -EINVAL;
Thanks for this fix. I think we have a similar issue also in
net/vmw_vsock/vmci_transport.c introduced by the same commit.
In net/vmw_vsock/hyperv_transport.c we have a similar pattern, but the
calling function return void, so no issue there.
Do you mind to fix also that one?
Sending a v2 to fix both or another patch just for that it's fine by me,
so:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
On Thu, Dec 11, 2025 at 09:30:06AM +0100, Stefano Garzarella wrote:
> On Thu, Dec 11, 2025 at 10:45:47AM +0300, Dan Carpenter wrote:
> > Return a negative error code if the transport doesn't match. Don't
> > return success.
> >
> > Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > From static analysis. Not tested.
> >
> > net/vmw_vsock/virtio_transport_common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> > index dcc8a1d5851e..77fbc6c541bf 100644
> > --- a/net/vmw_vsock/virtio_transport_common.c
> > +++ b/net/vmw_vsock/virtio_transport_common.c
> > @@ -1550,7 +1550,7 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb,
> > release_sock(child);
> > virtio_transport_reset_no_sock(t, skb);
> > sock_put(child);
> > - return ret;
> > + return ret ?: -EINVAL;
>
> Thanks for this fix. I think we have a similar issue also in
> net/vmw_vsock/vmci_transport.c introduced by the same commit.
> In net/vmw_vsock/hyperv_transport.c we have a similar pattern, but the
> calling function return void, so no issue there.
>
> Do you mind to fix also that one?
Sure. I will resend a v2.
The check doesn't catch that one because the != comparison is
hidden inside the vmci_check_transport() call. So I would have missed
it. Thanks for catching it.
regards,
dan carpenter
On Thu, Dec 11, 2025 at 10:45:47AM +0300, Dan Carpenter wrote:
> Return a negative error code if the transport doesn't match. Don't
> return success.
>
> Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> >From static analysis. Not tested.
>
> net/vmw_vsock/virtio_transport_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index dcc8a1d5851e..77fbc6c541bf 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -1550,7 +1550,7 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb,
> release_sock(child);
> virtio_transport_reset_no_sock(t, skb);
> sock_put(child);
> - return ret;
> + return ret ?: -EINVAL;
> }
>
> if (virtio_transport_space_update(child, skb))
> --
> 2.51.0
© 2016 - 2025 Red Hat, Inc.