From: David Marchand <david.marchand@redhat.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: dev <dev@dpdk.org>, Maxime Coquelin <maxime.coquelin@redhat.com>,
Tiwei Bie <tiwei.bie@intel.com>,
Jens Freimann <jfreimann@redhat.com>,
Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>,
dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] vhost: fix device leak on connection add failure
Date: Thu, 11 Apr 2019 16:06:44 +0200 [thread overview]
Message-ID: <CAJFAV8yoxCnqg=bNqzfd9bOotpR_Rcz5r3W6p-7tEOLpC8Uhyw@mail.gmail.com> (raw)
Message-ID: <20190411140644.g51Q8ZEfb-F6QvR8Pdv4PqIHpV81tEYLDPyuQHpy0B8@z> (raw)
In-Reply-To: <20190411102306.11943-1-i.maximets@samsung.com>
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
next prev parent reply other threads:[~2019-04-11 14:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274@eucas1p2.samsung.com>
2019-04-11 10:23 ` Ilya Maximets
2019-04-11 10:23 ` Ilya Maximets
2019-04-11 14:06 ` David Marchand [this message]
2019-04-11 14:06 ` David Marchand
2019-04-11 14:30 ` Jens Freimann
2019-04-11 14:30 ` Jens Freimann
2019-04-15 6:32 ` Tiwei Bie
2019-04-15 6:32 ` Tiwei Bie
2019-04-17 7:55 ` Maxime Coquelin
2019-04-17 7:55 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJFAV8yoxCnqg=bNqzfd9bOotpR_Rcz5r3W6p-7tEOLpC8Uhyw@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=dariuszx.stojaczyk@intel.com \
--cc=dev@dpdk.org \
--cc=i.maximets@samsung.com \
--cc=jfreimann@redhat.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).