From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id A2B41A0096 for ; Thu, 11 Apr 2019 16:06:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 10F0D5911; Thu, 11 Apr 2019 16:06:57 +0200 (CEST) Received: from mail-vs1-f66.google.com (mail-vs1-f66.google.com [209.85.217.66]) by dpdk.org (Postfix) with ESMTP id 82D2C58FE for ; Thu, 11 Apr 2019 16:06:55 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id f15so3535230vsk.9 for ; Thu, 11 Apr 2019 07:06:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3nhYBLZdwMGE1CB9Rlyou/hdXbh25Emd1WPGSQD+Fv8=; b=M1tQ+rWzQMKmLqDKI4pNz9oLOG5SFXNcj7S5EWg+lou1EN0FGYp0hch/ZJyfcj99hP Ct6dyGW27U5J42yW8aR4/w6FYBPle7Qo8MLYDYbWq7jB4px/78j2p0NmZLkVQQaZHhG3 Ol9FQbrw5WPqGqBDvUNIE76CkUi5S4wdUVynFdwyqzO2jq0YUY8yBwfmC6pG3J5fJ1rt b1F7/4agQkTVkBP240xfnrLYlQOwRP58uKHtPArfgCK2+cWcvL4lD6yIpOrlw9dCO/Us 9uGc3kOetZnrVF5QMaH9ILhoxS8LxNComP9cweOssiDbqTWn5QhlliD55atulxmJi5Gx L8Og== X-Gm-Message-State: APjAAAWLoti8I1XF62oo6AmyHwmN3DGn+ehQFXNm4PPxjsrD4uF0T5Rp 8Hri49RqOGk5PVBi8pzkl3qzlJDK+gEbJYMhEosyRA== X-Google-Smtp-Source: APXvYqzzt2KCnxtanN16Twr9gRTbFpcBV/deoymHfhhzoBI7Fw/Mfm5+smEX+83YyhQ0CUd54ch21DgSvPD+ygm8ZJo= X-Received: by 2002:a05:6102:199:: with SMTP id r25mr26070865vsq.166.1554991614924; Thu, 11 Apr 2019 07:06:54 -0700 (PDT) MIME-Version: 1.0 References: <20190411102306.11943-1-i.maximets@samsung.com> In-Reply-To: <20190411102306.11943-1-i.maximets@samsung.com> From: David Marchand Date: Thu, 11 Apr 2019 16:06:44 +0200 Message-ID: To: Ilya Maximets Cc: dev , Maxime Coquelin , Tiwei Bie , Jens Freimann , Dariusz Stojaczyk , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] vhost: fix device leak on connection add failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190411140644.g51Q8ZEfb-F6QvR8Pdv4PqIHpV81tEYLDPyuQHpy0B8@z> On Thu, Apr 11, 2019 at 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 > Signed-off-by: Ilya Maximets > --- > 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