search for: virtio_transport_get_ops

Displaying 20 results from an estimated 65 matches for "virtio_transport_get_ops".

2019 Sep 27
0
[RFC PATCH 06/13] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
Since now the 'struct vsock_sock' object contains a pointer to the transport, this patch adds a parameter to the vsock_core_get_transport() to return the right transport assigned to the socket. This patch modifies also the virtio_transport_get_ops(), that uses the vsock_core_get_transport(), adding the 'struct vsock_sock *' parameter. Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> --- include/net/af_vsock.h | 2 +- net/vmw_vsock/af_vsock.c | 4 ++-- net/vmw_vsock/virtio_transport_co...
2019 Oct 23
0
[PATCH net-next 06/14] vsock: add 'struct vsock_sock *' param to vsock_core_get_transport()
Since now the 'struct vsock_sock' object contains a pointer to the transport, this patch adds a parameter to the vsock_core_get_transport() to return the right transport assigned to the socket. This patch modifies also the virtio_transport_get_ops(), that uses the vsock_core_get_transport(), adding the 'struct vsock_sock *' parameter. Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com> Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> --- RFC -> v1: - Removed comment about protecting transport_single (Stefa...
2019 Dec 13
3
[PATCH net 0/2] vsock/virtio: fix null-pointer dereference and related precautions
...CH 2 adds a WARN_ON check for the same potential issue and a returned error in the virtio_transport_send_pkt_info() function to avoid crashing the kernel. Stefano Garzarella (2): vsock/virtio: fix null-pointer dereference in virtio_transport_recv_listen() vsock/virtio: add WARN_ON check on virtio_transport_get_ops() net/vmw_vsock/virtio_transport_common.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) -- 2.23.0
2016 Dec 08
1
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs > u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); > void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); > > +static inline const struct virtio_transport *virtio_transport_get_ops(void) > +{ > + const struct vsock_transport *t = vsock_core_get_transport(); > + > + return container_of(t, struct virtio_transport, transport); > +} > + > #endif /* _LINUX_VIRTIO_VSOCK_H */ > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > index 8a398...
2016 Dec 08
1
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs > u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); > void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); > > +static inline const struct virtio_transport *virtio_transport_get_ops(void) > +{ > + const struct vsock_transport *t = vsock_core_get_transport(); > + > + return container_of(t, struct virtio_transport, transport); > +} > + > #endif /* _LINUX_VIRTIO_VSOCK_H */ > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > index 8a398...
2019 Mar 05
4
[PATCH] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
...ock_pkt *pkt) { + const struct virtio_transport *t; struct virtio_vsock_pkt_info info = { .op = VIRTIO_VSOCK_OP_RST, .type = le16_to_cpu(pkt->hdr.type), @@ -680,7 +681,11 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) if (!pkt) return -ENOMEM; - return virtio_transport_get_ops()->send_pkt(pkt); + t = virtio_transport_get_ops(); + if (!t) + return -ENOTCONN; + + return t->send_pkt(pkt); } static void virtio_transport_wait_close(struct sock *sk, long timeout) -- 2.21.0
2019 Mar 05
4
[PATCH] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
...ock_pkt *pkt) { + const struct virtio_transport *t; struct virtio_vsock_pkt_info info = { .op = VIRTIO_VSOCK_OP_RST, .type = le16_to_cpu(pkt->hdr.type), @@ -680,7 +681,11 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) if (!pkt) return -ENOMEM; - return virtio_transport_get_ops()->send_pkt(pkt); + t = virtio_transport_get_ops(); + if (!t) + return -ENOTCONN; + + return t->send_pkt(pkt); } static void virtio_transport_wait_close(struct sock *sk, long timeout) -- 2.21.0
2016 Dec 07
0
[PATCH 4/4] vsock: cancel packets when failing to connect
...56,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); +static inline const struct virtio_transport *virtio_transport_get_ops(void) +{ + const struct vsock_transport *t = vsock_core_get_transport(); + + return container_of(t, struct virtio_transport, transport); +} + #endif /* _LINUX_VIRTIO_VSOCK_H */ diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 8a398b3..ebb50d6 100644 --- a/net/vmw_vsock/af_vso...
2016 Dec 07
0
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...56,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); +static inline const struct virtio_transport *virtio_transport_get_ops(void) +{ + const struct vsock_transport *t = vsock_core_get_transport(); + + return container_of(t, struct virtio_transport, transport); +} + #endif /* _LINUX_VIRTIO_VSOCK_H */ diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 8a398b3..ebb50d6 100644 --- a/net/vmw_vsock/af_vso...
2019 Mar 06
2
[PATCH] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
...sock_pkt_info info = { > > .op = VIRTIO_VSOCK_OP_RST, > > .type = le16_to_cpu(pkt->hdr.type), > > @@ -680,7 +681,11 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) > > if (!pkt) > > return -ENOMEM; > > > > - return virtio_transport_get_ops()->send_pkt(pkt); > > + t = virtio_transport_get_ops(); > > + if (!t) > > + return -ENOTCONN; > > pkt is leaked here. This is an easy mistake to make because the code is > unclear. Thank you for your kind words :) > The pkt argument is the received packet that...
2019 Mar 06
2
[PATCH] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
...sock_pkt_info info = { > > .op = VIRTIO_VSOCK_OP_RST, > > .type = le16_to_cpu(pkt->hdr.type), > > @@ -680,7 +681,11 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) > > if (!pkt) > > return -ENOMEM; > > > > - return virtio_transport_get_ops()->send_pkt(pkt); > > + t = virtio_transport_get_ops(); > > + if (!t) > > + return -ENOTCONN; > > pkt is leaked here. This is an easy mistake to make because the code is > unclear. Thank you for your kind words :) > The pkt argument is the received packet that...
2016 Dec 07
8
[PATCH v2 0/4] vsock: cancel connect packets when failing to connect
Currently, if a connect call fails on a signal or timeout (e.g., guest is still in the process of starting up), we'll just return to caller and leave the connect packet queued and they are sent even though the connection is considered a failure, which can confuse applications with unwanted false connect attempt. The patchset enables vsock (both host and guest) to cancel queued packets when a
2016 Dec 07
8
[PATCH v2 0/4] vsock: cancel connect packets when failing to connect
Currently, if a connect call fails on a signal or timeout (e.g., guest is still in the process of starting up), we'll just return to caller and leave the connect packet queued and they are sent even though the connection is considered a failure, which can confuse applications with unwanted false connect attempt. The patchset enables vsock (both host and guest) to cancel queued packets when a
2016 Dec 07
2
[PATCH 08/10] vsock/virtio: mark an internal function static
...; > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c > index a53b3a1..6120384 100644 > --- a/net/vmw_vsock/virtio_transport_common.c > +++ b/net/vmw_vsock/virtio_transport_common.c > @@ -32,7 +32,7 @@ static const struct virtio_transport *virtio_transport_get_ops(void) > return container_of(t, struct virtio_transport, transport); > } > > -struct virtio_vsock_pkt * > +static struct virtio_vsock_pkt * > virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, > size_t len, > u32 src_cid, Git grep shows...
2019 Mar 06
0
[PATCH] vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
...ransport *t; > struct virtio_vsock_pkt_info info = { > .op = VIRTIO_VSOCK_OP_RST, > .type = le16_to_cpu(pkt->hdr.type), > @@ -680,7 +681,11 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) > if (!pkt) > return -ENOMEM; > > - return virtio_transport_get_ops()->send_pkt(pkt); > + t = virtio_transport_get_ops(); > + if (!t) > + return -ENOTCONN; pkt is leaked here. This is an easy mistake to make because the code is unclear. The pkt argument is the received packet that we must reply to. The reply packet is allocated just before line 680...
2016 Dec 07
2
[PATCH 08/10] vsock/virtio: mark an internal function static
...; > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c > index a53b3a1..6120384 100644 > --- a/net/vmw_vsock/virtio_transport_common.c > +++ b/net/vmw_vsock/virtio_transport_common.c > @@ -32,7 +32,7 @@ static const struct virtio_transport *virtio_transport_get_ops(void) > return container_of(t, struct virtio_transport, transport); > } > > -struct virtio_vsock_pkt * > +static struct virtio_vsock_pkt * > virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, > size_t len, > u32 src_cid, Git grep shows...
2016 Dec 07
7
[PATCH 0/4] vsock: cancel connect packets when failing to connect
Currently, if a connect call fails on a signal or timeout (e.g., guest is still in the process of starting up), we'll just return to caller and leave the connect packet queued and they are sent even though the connection is considered a failure, which can confuse applications with unwanted false connect attempt. The patchset enables vsock (both host and guest) to cancel queued packets when a
2016 Dec 07
7
[PATCH 0/4] vsock: cancel connect packets when failing to connect
Currently, if a connect call fails on a signal or timeout (e.g., guest is still in the process of starting up), we'll just return to caller and leave the connect packet queued and they are sent even though the connection is considered a failure, which can confuse applications with unwanted false connect attempt. The patchset enables vsock (both host and guest) to cancel queued packets when a
2019 Sep 27
0
[RFC PATCH 02/13] vsock: remove vm_sockets_get_local_cid()
vm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport. Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> --- include/linux/vm_sockets.h | 2 -- net/vmw_vsock/af_vsock.c | 10 ---------- net/vmw_vsock/virtio_transport_common.c | 2 +- 3 f...
2019 Oct 23
0
[PATCH net-next 02/14] vsock: remove vm_sockets_get_local_cid()
vm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport. Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com> Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> --- include/linux/vm_sockets.h | 2 -- net/vmw_vsock/af_vsock.c | 10 ----...