search for: virtio_transport_send_pkt

Displaying 20 results from an estimated 79 matches for "virtio_transport_send_pkt".

2019 May 31
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...;>>> Some questions after a quick glance: >>>>>> >>>>>> 1) It looks to me that the work could be queued from the path of >>>>>> vsock_transport_cancel_pkt() . Is that synchronized here? >>>>>> >>>>> Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can >>>>> queue work from the upper layer (socket). >>>>> >>>>> Setting the_virtio_vsock to NULL, should synchronize, but after a careful look >>>>> a rare issue could happen: >>>>> we are...
2019 May 31
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...;>>> Some questions after a quick glance: >>>>>> >>>>>> 1) It looks to me that the work could be queued from the path of >>>>>> vsock_transport_cancel_pkt() . Is that synchronized here? >>>>>> >>>>> Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can >>>>> queue work from the upper layer (socket). >>>>> >>>>> Setting the_virtio_vsock to NULL, should synchronize, but after a careful look >>>>> a rare issue could happen: >>>>> we are...
2019 Jun 13
1
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...ck glance: >>>>>>>> >>>>>>>> 1) It looks to me that the work could be queued from the path of >>>>>>>> vsock_transport_cancel_pkt() . Is that synchronized here? >>>>>>>> >>>>>>> Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can >>>>>>> queue work from the upper layer (socket). >>>>>>> >>>>>>> Setting the_virtio_vsock to NULL, should synchronize, but after a careful look >>>>>>> a rare issue could happ...
2019 May 30
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...; + virtio_vsock_flush_works(vsock); >>>> Some questions after a quick glance: >>>> >>>> 1) It looks to me that the work could be queued from the path of >>>> vsock_transport_cancel_pkt() . Is that synchronized here? >>>> >>> Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can >>> queue work from the upper layer (socket). >>> >>> Setting the_virtio_vsock to NULL, should synchronize, but after a careful look >>> a rare issue could happen: >>> we are setting the_virtio_vsock to NULL at the...
2019 May 30
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...; + virtio_vsock_flush_works(vsock); >>>> Some questions after a quick glance: >>>> >>>> 1) It looks to me that the work could be queued from the path of >>>> vsock_transport_cancel_pkt() . Is that synchronized here? >>>> >>> Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can >>> queue work from the upper layer (socket). >>> >>> Setting the_virtio_vsock to NULL, should synchronize, but after a careful look >>> a rare issue could happen: >>> we are setting the_virtio_vsock to NULL at the...
2019 May 30
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...er free. >>> + */ >>> + virtio_vsock_flush_works(vsock); >> >> Some questions after a quick glance: >> >> 1) It looks to me that the work could be queued from the path of >> vsock_transport_cancel_pkt() . Is that synchronized here? >> > Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can > queue work from the upper layer (socket). > > Setting the_virtio_vsock to NULL, should synchronize, but after a careful look > a rare issue could happen: > we are setting the_virtio_vsock to NULL at the start of .remove() and we > are freei...
2019 May 30
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...er free. >>> + */ >>> + virtio_vsock_flush_works(vsock); >> >> Some questions after a quick glance: >> >> 1) It looks to me that the work could be queued from the path of >> vsock_transport_cancel_pkt() . Is that synchronized here? >> > Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can > queue work from the upper layer (socket). > > Setting the_virtio_vsock to NULL, should synchronize, but after a careful look > a rare issue could happen: > we are setting the_virtio_vsock to NULL at the start of .remove() and we > are freei...
2019 Jun 06
0
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...> > > > > > > > > > > > > > 1) It looks to me that the work could be queued from the path of > > > > > > > vsock_transport_cancel_pkt() . Is that synchronized here? > > > > > > > > > > > > > Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can > > > > > > queue work from the upper layer (socket). > > > > > > > > > > > > Setting the_virtio_vsock to NULL, should synchronize, but after a careful look > > > > > > a rare issue could...
2019 May 29
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
On 2019/5/28 ??6:56, Stefano Garzarella wrote: > We flush all pending works before to call vdev->config->reset(vdev), > but other works can be queued before the vdev->config->del_vqs(vdev), > so we add another flush after it, to avoid use after free. > > Suggested-by: Michael S. Tsirkin <mst at redhat.com> > Signed-off-by: Stefano Garzarella <sgarzare at
2019 May 29
2
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
On 2019/5/28 ??6:56, Stefano Garzarella wrote: > We flush all pending works before to call vdev->config->reset(vdev), > but other works can be queued before the vdev->config->del_vqs(vdev), > so we add another flush after it, to avoid use after free. > > Suggested-by: Michael S. Tsirkin <mst at redhat.com> > Signed-off-by: Stefano Garzarella <sgarzare at
2016 Dec 07
1
[PATCH 3/4] vsock: add pkt cancel capability
..._transport.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 936d7ee..f88b6ed 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -170,6 +170,41 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) return len; } +static int +virtio_transport_cancel_pkt(struct vsock_sock *vsk) +{ + struct virtio_vsock *vsock; + struct virtio_vsock_pkt *pkt, *n; + int cnt = 0; + LIST_HEAD(freeme); + + vsock = virtio_vsock_get(); + if (!vsock) { + return -ENODEV; + } + + if (p...
2019 May 29
0
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...ck object to avoid use after free. > > + */ > > + virtio_vsock_flush_works(vsock); > > > Some questions after a quick glance: > > 1) It looks to me that the work could be queued from the path of > vsock_transport_cancel_pkt() . Is that synchronized here? > Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can queue work from the upper layer (socket). Setting the_virtio_vsock to NULL, should synchronize, but after a careful look a rare issue could happen: we are setting the_virtio_vsock to NULL at the start of .remove() and we are freeing the object pointed by it a...
2019 May 31
0
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...t; > > Some questions after a quick glance: > > > > > > > > > > 1) It looks to me that the work could be queued from the path of > > > > > vsock_transport_cancel_pkt() . Is that synchronized here? > > > > > > > > > Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can > > > > queue work from the upper layer (socket). > > > > > > > > Setting the_virtio_vsock to NULL, should synchronize, but after a careful look > > > > a rare issue could happen: > > > > we are sett...
2019 Jul 03
3
[PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
...DR_CID_ANY; > + goto out_rcu; > + } > > - return vsock->guest_cid; > + ret = vsock->guest_cid; > +out_rcu: > + rcu_read_unlock(); > + return ret; > } > > static void virtio_transport_loopback_work(struct work_struct *work) > @@ -197,14 +200,18 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) > struct virtio_vsock *vsock; > int len = pkt->len; > > - vsock = virtio_vsock_get(); > + rcu_read_lock(); > + vsock = rcu_dereference(the_virtio_vsock); > if (!vsock) { > virtio_transport_free_pkt(pkt); > - return -ENODEV...
2019 Jul 03
3
[PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
...DR_CID_ANY; > + goto out_rcu; > + } > > - return vsock->guest_cid; > + ret = vsock->guest_cid; > +out_rcu: > + rcu_read_unlock(); > + return ret; > } > > static void virtio_transport_loopback_work(struct work_struct *work) > @@ -197,14 +200,18 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) > struct virtio_vsock *vsock; > int len = pkt->len; > > - vsock = virtio_vsock_get(); > + rcu_read_lock(); > + vsock = rcu_dereference(the_virtio_vsock); > if (!vsock) { > virtio_transport_free_pkt(pkt); > - return -ENODEV...
2019 May 30
0
[PATCH 3/4] vsock/virtio: fix flush of works during the .remove()
...irtio_vsock_flush_works(vsock); > > > > > > Some questions after a quick glance: > > > > > > 1) It looks to me that the work could be queued from the path of > > > vsock_transport_cancel_pkt() . Is that synchronized here? > > > > > Both virtio_transport_send_pkt() and vsock_transport_cancel_pkt() can > > queue work from the upper layer (socket). > > > > Setting the_virtio_vsock to NULL, should synchronize, but after a careful look > > a rare issue could happen: > > we are setting the_virtio_vsock to NULL at the start of .remo...
2019 Jul 04
2
[PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
...;> - return vsock->guest_cid; >>> + ret = vsock->guest_cid; >>> +out_rcu: >>> + rcu_read_unlock(); >>> + return ret; >>> } >>> static void virtio_transport_loopback_work(struct work_struct *work) >>> @@ -197,14 +200,18 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) >>> struct virtio_vsock *vsock; >>> int len = pkt->len; >>> - vsock = virtio_vsock_get(); >>> + rcu_read_lock(); >>> + vsock = rcu_dereference(the_virtio_vsock); >>> if (!vsock) { >>> vi...
2019 Jul 04
2
[PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
...;> - return vsock->guest_cid; >>> + ret = vsock->guest_cid; >>> +out_rcu: >>> + rcu_read_unlock(); >>> + return ret; >>> } >>> static void virtio_transport_loopback_work(struct work_struct *work) >>> @@ -197,14 +200,18 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) >>> struct virtio_vsock *vsock; >>> int len = pkt->len; >>> - vsock = virtio_vsock_get(); >>> + rcu_read_lock(); >>> + vsock = rcu_dereference(the_virtio_vsock); >>> if (!vsock) { >>> vi...
2016 Dec 07
0
[PATCH v2 3/4] vsock: add pkt cancel capability
...nsport.c | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 936d7ee..a5f3833 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -170,6 +170,47 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) return len; } +static int +virtio_transport_cancel_pkt(struct vsock_sock *vsk) +{ + struct virtio_vsock *vsock; + struct virtio_vsock_pkt *pkt, *n; + int cnt = 0; + LIST_HEAD(freeme); + + vsock = virtio_vsock_get(); + if (!vsock) { + return -ENODEV; + } + + spin_...
2019 Jun 28
0
[PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
...rcu_dereference(the_virtio_vsock); + if (!vsock) { + ret = VMADDR_CID_ANY; + goto out_rcu; + } - return vsock->guest_cid; + ret = vsock->guest_cid; +out_rcu: + rcu_read_unlock(); + return ret; } static void virtio_transport_loopback_work(struct work_struct *work) @@ -197,14 +200,18 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) struct virtio_vsock *vsock; int len = pkt->len; - vsock = virtio_vsock_get(); + rcu_read_lock(); + vsock = rcu_dereference(the_virtio_vsock); if (!vsock) { virtio_transport_free_pkt(pkt); - return -ENODEV; + len = -ENODEV; + goto out_rcu; } - if (l...