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 99D42A0096 for ; Thu, 11 Apr 2019 16:07:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A67E5B36; Thu, 11 Apr 2019 16:07:00 +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 865105911 for ; Thu, 11 Apr 2019 16:06:55 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id n4so3549894vsm.3 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=SjLC7zPDsPLQq+yLvRkXU4TVdTIaxo1xDqdcOC59lg6nENJqhNSrW04ILUynb2FWgl DDJDpuPOGO6UVAVv92cyS/P4qttXug095BAIMBcp4pbrnPxfb5TI5S2KbBdSVISobVsL GHGJfvYKZ/TumDycbQvhG8qqIBzZ7DkfgilcO81TngxW0ahbem5JfRuNfxaZmeeoV6Ah seqDQZxug/U8T7+3xcUP5T3ECTYVVKJX9BK8HC96sskJMtKjEtscJs0uNCxRfikZYKm1 qiciiciF2kNWeVmRkU0vpnfyeQ2Q8uJAIQJtbFOPGcD/bHiafhg3C5aSAva4PgYhn+uS Bu8Q== X-Gm-Message-State: APjAAAUjTWeAXs2r3ECBpuip3Ndq0us+UJH1xJq1ZqCoJ+jfvdl/iEUk UNK/mVeaiWBr3vduqiDsNIBbAW0/Vzzm0cP1tiwbXA== 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-stable] [PATCH] vhost: fix device leak on connection add failure X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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