* [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure
[not found] <CGME20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274@eucas1p2.samsung.com>
@ 2019-04-11 10:23 ` Ilya Maximets
2019-04-11 14:06 ` David Marchand
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ilya Maximets @ 2019-04-11 10:23 UTC (permalink / raw)
To: dev, Maxime Coquelin
Cc: Tiwei Bie, Jens Freimann, Dariusz Stojaczyk, David Marchand,
Ilya Maximets, stable
Need to destroy allocated device if application fails to
add new connection or we have fdset failure.
Fixes: acbff5c67ea7 ("vhost: fix crash when exceeding file descriptors")
Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close")
Cc: stable@dpdk.org
Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
lib/librte_vhost/socket.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 43f091d10..c34668004 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -240,7 +240,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)
RTE_LOG(ERR, VHOST_CONFIG,
"failed to add vhost user connection with fd %d\n",
fd);
- goto err;
+ goto err_cleanup;
}
}
@@ -257,7 +257,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)
if (vsocket->notify_ops->destroy_connection)
vsocket->notify_ops->destroy_connection(conn->vid);
- goto err;
+ goto err_cleanup;
}
pthread_mutex_lock(&vsocket->conn_mutex);
@@ -267,6 +267,8 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)
fdset_pipe_notify(&vhost_user.fdset);
return;
+err_cleanup:
+ vhost_destroy_device(vid);
err:
free(conn);
close(fd);
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure
2019-04-11 10:23 ` [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure Ilya Maximets
@ 2019-04-11 14:06 ` David Marchand
2019-04-11 14:30 ` Jens Freimann
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2019-04-11 14:06 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Tiwei Bie, Jens Freimann,
Dariusz Stojaczyk, dpdk stable
On Thu, Apr 11, 2019 at 12:23 PM Ilya Maximets <i.maximets@samsung.com>
wrote:
> Need to destroy allocated device if application fails to
> add new connection or we have fdset failure.
>
> Fixes: acbff5c67ea7 ("vhost: fix crash when exceeding file descriptors")
> Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close")
> Cc: stable@dpdk.org
>
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
> lib/librte_vhost/socket.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
> index 43f091d10..c34668004 100644
> --- a/lib/librte_vhost/socket.c
> +++ b/lib/librte_vhost/socket.c
> @@ -240,7 +240,7 @@ vhost_user_add_connection(int fd, struct
> vhost_user_socket *vsocket)
> RTE_LOG(ERR, VHOST_CONFIG,
> "failed to add vhost user connection with
> fd %d\n",
> fd);
> - goto err;
> + goto err_cleanup;
> }
> }
>
> @@ -257,7 +257,7 @@ vhost_user_add_connection(int fd, struct
> vhost_user_socket *vsocket)
> if (vsocket->notify_ops->destroy_connection)
> vsocket->notify_ops->destroy_connection(conn->vid);
>
> - goto err;
> + goto err_cleanup;
> }
>
> pthread_mutex_lock(&vsocket->conn_mutex);
> @@ -267,6 +267,8 @@ vhost_user_add_connection(int fd, struct
> vhost_user_socket *vsocket)
> fdset_pipe_notify(&vhost_user.fdset);
> return;
>
> +err_cleanup:
> + vhost_destroy_device(vid);
> err:
> free(conn);
> close(fd);
> --
> 2.17.1
>
Thanks Ilya.
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure
2019-04-11 10:23 ` [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure Ilya Maximets
2019-04-11 14:06 ` David Marchand
@ 2019-04-11 14:30 ` Jens Freimann
2019-04-15 6:32 ` Tiwei Bie
2019-04-17 7:55 ` Maxime Coquelin
3 siblings, 0 replies; 5+ messages in thread
From: Jens Freimann @ 2019-04-11 14:30 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Tiwei Bie, Dariusz Stojaczyk,
David Marchand, stable
On Thu, Apr 11, 2019 at 01:23:06PM +0300, Ilya Maximets wrote:
>Need to destroy allocated device if application fails to
>add new connection or we have fdset failure.
>
>Fixes: acbff5c67ea7 ("vhost: fix crash when exceeding file descriptors")
>Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close")
>Cc: stable@dpdk.org
>
>Reported-by: David Marchand <david.marchand@redhat.com>
>Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>---
> lib/librte_vhost/socket.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure
2019-04-11 10:23 ` [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure Ilya Maximets
2019-04-11 14:06 ` David Marchand
2019-04-11 14:30 ` Jens Freimann
@ 2019-04-15 6:32 ` Tiwei Bie
2019-04-17 7:55 ` Maxime Coquelin
3 siblings, 0 replies; 5+ messages in thread
From: Tiwei Bie @ 2019-04-15 6:32 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Jens Freimann, Dariusz Stojaczyk,
David Marchand, stable
On Thu, Apr 11, 2019 at 01:23:06PM +0300, Ilya Maximets wrote:
> Need to destroy allocated device if application fails to
> add new connection or we have fdset failure.
>
> Fixes: acbff5c67ea7 ("vhost: fix crash when exceeding file descriptors")
> Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close")
> Cc: stable@dpdk.org
>
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
> lib/librte_vhost/socket.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure
2019-04-11 10:23 ` [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure Ilya Maximets
` (2 preceding siblings ...)
2019-04-15 6:32 ` Tiwei Bie
@ 2019-04-17 7:55 ` Maxime Coquelin
3 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2019-04-17 7:55 UTC (permalink / raw)
To: Ilya Maximets, dev
Cc: Tiwei Bie, Jens Freimann, Dariusz Stojaczyk, David Marchand, stable
On 4/11/19 12:23 PM, Ilya Maximets wrote:
> Need to destroy allocated device if application fails to
> add new connection or we have fdset failure.
>
> Fixes: acbff5c67ea7 ("vhost: fix crash when exceeding file descriptors")
> Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close")
> Cc:stable@dpdk.org
>
> Reported-by: David Marchand<david.marchand@redhat.com>
> Signed-off-by: Ilya Maximets<i.maximets@samsung.com>
> ---
> lib/librte_vhost/socket.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Applied to dpdk-next-virtio/master.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-17 7:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274@eucas1p2.samsung.com>
2019-04-11 10:23 ` [dpdk-stable] [PATCH] vhost: fix device leak on connection add failure Ilya Maximets
2019-04-11 14:06 ` David Marchand
2019-04-11 14:30 ` Jens Freimann
2019-04-15 6:32 ` Tiwei Bie
2019-04-17 7:55 ` Maxime Coquelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).