From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE4DBA046B for ; Tue, 23 Jul 2019 03:03:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD8FF1BFA1; Tue, 23 Jul 2019 03:03:52 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E01521BFC0 for ; Tue, 23 Jul 2019 03:03:49 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Jul 2019 04:03:47 +0300 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x6N11HgA026580; Tue, 23 Jul 2019 04:03:45 +0300 From: Yongseok Koh To: Ilya Maximets Cc: David Marchand , Jens Freimann , Tiwei Bie , dpdk stable Date: Mon, 22 Jul 2019 18:00:51 -0700 Message-Id: <20190723010115.6446-84-yskoh@mellanox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190723010115.6446-1-yskoh@mellanox.com> References: <20190723010115.6446-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'vhost: fix device leak on connection add failure' has been queued to LTS release 17.11.7 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" Hi, FYI, your patch has been queued to LTS release 17.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objection by 07/27/19. So please shout if anyone has objection. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Yongseok --- >From 97e6c612b762e72ff6e33d5a2e310851cf1030a7 Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Thu, 11 Apr 2019 13:23:06 +0300 Subject: [PATCH] vhost: fix device leak on connection add failure [ upstream commit a21510e750430914a5638a8925e87609a32cbbff ] 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") Reported-by: David Marchand Signed-off-by: Ilya Maximets Reviewed-by: David Marchand Reviewed-by: Jens Freimann Reviewed-by: Tiwei Bie --- 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 a3fd3dc23d..88be697c2f 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -241,7 +241,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; } } @@ -258,7 +258,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); @@ -266,6 +266,8 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) pthread_mutex_unlock(&vsocket->conn_mutex); return; +err_cleanup: + vhost_destroy_device(vid); err: free(conn); close(fd); -- 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-07-22 17:55:11.011245623 -0700 +++ 0084-vhost-fix-device-leak-on-connection-add-failure.patch 2019-07-22 17:55:06.392476000 -0700 @@ -1,14 +1,15 @@ -From a21510e750430914a5638a8925e87609a32cbbff Mon Sep 17 00:00:00 2001 +From 97e6c612b762e72ff6e33d5a2e310851cf1030a7 Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Thu, 11 Apr 2019 13:23:06 +0300 Subject: [PATCH] vhost: fix device leak on connection add failure +[ upstream commit a21510e750430914a5638a8925e87609a32cbbff ] + 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 @@ -20,10 +21,10 @@ 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c -index 3da9de62c4..f0fdb83f7d 100644 +index a3fd3dc23d..88be697c2f 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) +@@ -241,7 +241,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); @@ -32,7 +33,7 @@ } } -@@ -257,7 +257,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) +@@ -258,7 +258,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); @@ -41,8 +42,8 @@ } 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); +@@ -266,6 +266,8 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) + pthread_mutex_unlock(&vsocket->conn_mutex); return; +err_cleanup: