search for: err_used

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

2017 Oct 31
2
[PATCH net-next] vhost_net: conditionally enable tx polling
...UIO_MAXIOV; } vhost_discard_vq_desc(vq, 1); + if (err == -EAGAIN) + vhost_net_enable_vq(net, vq); break; } if (err != len) @@ -1145,9 +1148,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) r = vhost_vq_init_access(vq); if (r) goto err_used; - r = vhost_net_enable_vq(n, vq); - if (r) - goto err_used; + if (index == VHOST_NET_VQ_RX) { + r = vhost_net_enable_vq(n, vq); + if (r) + goto err_used; + } oldubufs = nvq->ubufs; nvq->ubufs = ubufs; -- 2.7.4
2017 Oct 31
2
[PATCH net-next] vhost_net: conditionally enable tx polling
...UIO_MAXIOV; } vhost_discard_vq_desc(vq, 1); + if (err == -EAGAIN) + vhost_net_enable_vq(net, vq); break; } if (err != len) @@ -1145,9 +1148,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) r = vhost_vq_init_access(vq); if (r) goto err_used; - r = vhost_net_enable_vq(n, vq); - if (r) - goto err_used; + if (index == VHOST_NET_VQ_RX) { + r = vhost_net_enable_vq(n, vq); + if (r) + goto err_used; + } oldubufs = nvq->ubufs; nvq->ubufs = ubufs; -- 2.7.4
2017 Nov 01
2
[PATCH net-next] vhost_net: conditionally enable tx polling
...e of tun_sock_write_space() and for the errors other than -EAGAIN, they have nothing to do with polling. >> @@ -1145,9 +1148,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) >> r = vhost_vq_init_access(vq); >> if (r) >> goto err_used; >> - r = vhost_net_enable_vq(n, vq); >> - if (r) >> - goto err_used; >> + if (index == VHOST_NET_VQ_RX) { >> + r = vhost_net_enable_vq(n, vq); >> + if (r) >> + goto err_used; >> + } >> >> oldubufs = nvq->ubufs; >...
2017 Nov 01
2
[PATCH net-next] vhost_net: conditionally enable tx polling
...e of tun_sock_write_space() and for the errors other than -EAGAIN, they have nothing to do with polling. >> @@ -1145,9 +1148,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) >> r = vhost_vq_init_access(vq); >> if (r) >> goto err_used; >> - r = vhost_net_enable_vq(n, vq); >> - if (r) >> - goto err_used; >> + if (index == VHOST_NET_VQ_RX) { >> + r = vhost_net_enable_vq(n, vq); >> + if (r) >> + goto err_used; >> + } >> >> oldubufs = nvq->ubufs; >...
2012 Dec 27
3
[PATCH 1/2] vhost_net: correct error hanlding in vhost_net_set_backend()
...d08b2..629d6b5 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -834,8 +834,10 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) vhost_net_enable_vq(n, vq); r = vhost_init_used(vq); - if (r) - goto err_vq; + if (r) { + sock = NULL; + goto err_used; + } n->tx_packets = 0; n->tx_zcopy_err = 0; @@ -859,8 +861,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) mutex_unlock(&n->dev.mutex); return 0; +err_used: + if (oldubufs) + vhost_ubuf_put_and_wait(oldubufs); + if (oldsock) + fput...
2012 Dec 27
3
[PATCH 1/2] vhost_net: correct error hanlding in vhost_net_set_backend()
...d08b2..629d6b5 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -834,8 +834,10 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) vhost_net_enable_vq(n, vq); r = vhost_init_used(vq); - if (r) - goto err_vq; + if (r) { + sock = NULL; + goto err_used; + } n->tx_packets = 0; n->tx_zcopy_err = 0; @@ -859,8 +861,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) mutex_unlock(&n->dev.mutex); return 0; +err_used: + if (oldubufs) + vhost_ubuf_put_and_wait(oldubufs); + if (oldsock) + fput...
2017 Oct 31
0
[PATCH net-next] vhost_net: conditionally enable tx polling
...net, vq); > break; > } > if (err != len) I would probably just enable it unconditionally here. Why not? > @@ -1145,9 +1148,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) > r = vhost_vq_init_access(vq); > if (r) > goto err_used; > - r = vhost_net_enable_vq(n, vq); > - if (r) > - goto err_used; > + if (index == VHOST_NET_VQ_RX) { > + r = vhost_net_enable_vq(n, vq); > + if (r) > + goto err_used; > + } > > oldubufs = nvq->ubufs; > nvq->ubufs = ubufs; This last chun...
2017 Nov 01
0
[PATCH net-next] vhost_net: conditionally enable tx polling
...e miss a code things get stuck - It's just easier not to add extra code IMHO. > > > @@ -1145,9 +1148,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) > > > r = vhost_vq_init_access(vq); > > > if (r) > > > goto err_used; > > > - r = vhost_net_enable_vq(n, vq); > > > - if (r) > > > - goto err_used; > > > + if (index == VHOST_NET_VQ_RX) { > > > + r = vhost_net_enable_vq(n, vq); > > > + if (r) > > > + goto err_used; > > > + } > &g...
2016 Feb 10
2
[PATCH 2/2] vhost: disentangle vring endianness stuff from the core code
...> @@ -917,6 +917,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) > > vhost_net_disable_vq(n, vq); > vq->private_data = sock; > + > + vhost_adjust_vring_endian(vq); > + > r = vhost_init_used(vq); > if (r) > goto err_used; This is in fact a bug in existing code: if vhost_init_used fails, it preferably should not have side-effects. It's best to update it last thing. > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c > index 29cfc57d496e..5a8363bfcb74 100644 > --- a/drivers/vhost/scsi.c > ++...
2016 Feb 10
2
[PATCH 2/2] vhost: disentangle vring endianness stuff from the core code
...> @@ -917,6 +917,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) > > vhost_net_disable_vq(n, vq); > vq->private_data = sock; > + > + vhost_adjust_vring_endian(vq); > + > r = vhost_init_used(vq); > if (r) > goto err_used; This is in fact a bug in existing code: if vhost_init_used fails, it preferably should not have side-effects. It's best to update it last thing. > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c > index 29cfc57d496e..5a8363bfcb74 100644 > --- a/drivers/vhost/scsi.c > ++...
2013 Jan 06
2
[PATCH V3 0/2] handle polling errors
This is an update version of last version to fix the handling of polling errors in vhost/vhost_net. Currently, vhost and vhost_net ignore polling errors which can lead kernel crashing when it tries to remove itself from waitqueue after the polling failure. Fix this by checking the poll->wqh before the removing and report an error when meet polling errors. Changes from v2: - check poll->wqh
2013 Jan 06
2
[PATCH V3 0/2] handle polling errors
This is an update version of last version to fix the handling of polling errors in vhost/vhost_net. Currently, vhost and vhost_net ignore polling errors which can lead kernel crashing when it tries to remove itself from waitqueue after the polling failure. Fix this by checking the poll->wqh before the removing and report an error when meet polling errors. Changes from v2: - check poll->wqh
2013 Jun 20
4
[PATCH net] vhost-net: fix use-after-free in vhost_net_flush
..., unsigned index, int fd) mutex_unlock(&vq->mutex); if (oldubufs) { - vhost_net_ubuf_put_and_wait(oldubufs); + vhost_net_ubuf_put_wait_and_free(oldubufs); mutex_lock(&vq->mutex); vhost_zerocopy_signal_used(n, vq); mutex_unlock(&vq->mutex); @@ -1091,7 +1096,7 @@ err_used: vq->private_data = oldsock; vhost_net_enable_vq(n, vq); if (ubufs) - vhost_net_ubuf_put_and_wait(ubufs); + vhost_net_ubuf_put_wait_and_free(ubufs); err_ubufs: fput(sock->file); err_vq: -- MST
2013 Jun 20
4
[PATCH net] vhost-net: fix use-after-free in vhost_net_flush
..., unsigned index, int fd) mutex_unlock(&vq->mutex); if (oldubufs) { - vhost_net_ubuf_put_and_wait(oldubufs); + vhost_net_ubuf_put_wait_and_free(oldubufs); mutex_lock(&vq->mutex); vhost_zerocopy_signal_used(n, vq); mutex_unlock(&vq->mutex); @@ -1091,7 +1096,7 @@ err_used: vq->private_data = oldsock; vhost_net_enable_vq(n, vq); if (ubufs) - vhost_net_ubuf_put_and_wait(ubufs); + vhost_net_ubuf_put_wait_and_free(ubufs); err_ubufs: fput(sock->file); err_vq: -- MST
2016 Feb 10
1
[PATCH 2/2] vhost: disentangle vring endianness stuff from the core code
On Wed, 10 Feb 2016 14:08:43 +0100 Greg Kurz <gkurz at linux.vnet.ibm.com> wrote: > But you are right, there is a bug: we should rollback if vhost_init_used() > fails. Something like below: > > err_used: > vq->private_data = oldsock; > vhost_net_enable_vq(n, vq); > + vhost_adjust_vring_endian(vq); Shouldn't we switch back before we reenable? Or have I lost myself in this maze here again? > if (ubufs) > vhost_net_ubuf_put_wait_an...
2018 Mar 09
0
[PATCH net 2/3] vhost_net: keep private_data and rx_ring synced
...ic long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) vhost_net_disable_vq(n, vq); vq->private_data = sock; vhost_net_buf_unproduce(nvq); - if (index == VHOST_NET_VQ_RX) - nvq->rx_ring = get_tap_ptr_ring(fd); r = vhost_vq_init_access(vq); if (r) goto err_used; r = vhost_net_enable_vq(n, vq); if (r) goto err_used; + if (index == VHOST_NET_VQ_RX) + nvq->rx_ring = get_tap_ptr_ring(fd); oldubufs = nvq->ubufs; nvq->ubufs = ubufs; -- 2.7.4
2016 Feb 10
1
[PATCH 2/2] vhost: disentangle vring endianness stuff from the core code
On Wed, 10 Feb 2016 14:08:43 +0100 Greg Kurz <gkurz at linux.vnet.ibm.com> wrote: > But you are right, there is a bug: we should rollback if vhost_init_used() > fails. Something like below: > > err_used: > vq->private_data = oldsock; > vhost_net_enable_vq(n, vq); > + vhost_adjust_vring_endian(vq); Shouldn't we switch back before we reenable? Or have I lost myself in this maze here again? > if (ubufs) > vhost_net_ubuf_put_wait_an...
2018 Mar 09
7
[PATCH net 0/3] Several fixes for vhost_net ptr_ring usage
Hi: This small series try to fix several bugs of ptr_ring usage in vhost_net. Please review. Thanks Alexander Potapenko (1): vhost_net: initialize rx_ring in vhost_net_open() Jason Wang (2): vhost_net: keep private_data and rx_ring synced vhost_net: examine pointer types during un-producing drivers/net/tun.c | 3 ++- drivers/vhost/net.c | 8 +++++--- include/linux/if_tun.h | 4
2017 Jan 26
2
[BUG/RFC] vhost: net: big endian viring access despite virtio 1
...(ubufs); goto err_ubufs; } vhost_net_disable_vq(n, vq); ==> vq->private_data = sock; /* now vq->private_data is NULL */ ==> r = vhost_vq_init_access(vq); if (r) goto err_used; /* vq endianness has been reset to BE on s390 */ r = vhost_net_enable_vq(n, vq); if (r) goto err_used; ==> oldubufs = nvq->ubufs; /* here oldubufs might become != 0 */ nvq->ubufs = ubufs;...
2017 Jan 26
2
[BUG/RFC] vhost: net: big endian viring access despite virtio 1
...(ubufs); goto err_ubufs; } vhost_net_disable_vq(n, vq); ==> vq->private_data = sock; /* now vq->private_data is NULL */ ==> r = vhost_vq_init_access(vq); if (r) goto err_used; /* vq endianness has been reset to BE on s390 */ r = vhost_net_enable_vq(n, vq); if (r) goto err_used; ==> oldubufs = nvq->ubufs; /* here oldubufs might become != 0 */ nvq->ubufs = ubufs;...