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 88594A0096 for ; Thu, 11 Apr 2019 12:23:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5524144C3; Thu, 11 Apr 2019 12:23:16 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id DE0C044C3 for ; Thu, 11 Apr 2019 12:23:14 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190411102313euoutp02d354e26f39a8b30f2592a4248e504c5d~UZG28ob381760617606euoutp020 for ; Thu, 11 Apr 2019 10:23:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190411102313euoutp02d354e26f39a8b30f2592a4248e504c5d~UZG28ob381760617606euoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1554978193; bh=SGgW5a+nPwKBqGsDLJQfYLUwh/cObeqQpX/hOs02B+Q=; h=From:To:Cc:Subject:Date:References:From; b=rm7m7WMPDB5AvggZ7IckylmiinZiTZJqGwl3QxpybB2/Oe6GigRz+PW1b08flXRDg jhrMAq1Jwt8NSn10th3nOLzNQ5ysSAl1rnZWGitmzxMLiknOUVwoDcMOHUgkvlyyC7 FTdH9isKkGGXFBpmMmAfLGpBaGOoEHXFKWY4HV30= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190411102313eucas1p252cb1995d4b2622b0f9c519b9cf42136~UZG2gxJcL2418924189eucas1p25; Thu, 11 Apr 2019 10:23:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 4D.9B.04377.1951FAC5; Thu, 11 Apr 2019 11:23:13 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274~UZG1stoQY2125221252eucas1p2S; Thu, 11 Apr 2019 10:23:12 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190411102312eusmtrp24e0aa570fa41132209bcc72370395085~UZG1WG9pz1143911439eusmtrp2N; Thu, 11 Apr 2019 10:23:12 +0000 (GMT) X-AuditID: cbfec7f4-12dff70000001119-d4-5caf1591fe97 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 43.FA.04146.0951FAC5; Thu, 11 Apr 2019 11:23:12 +0100 (BST) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190411102311eusmtip281d2c0277702b742fff8fafc6983b309~UZG00Ay7h1438914389eusmtip2m; Thu, 11 Apr 2019 10:23:11 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org, Maxime Coquelin Cc: Tiwei Bie , Jens Freimann , Dariusz Stojaczyk , David Marchand , Ilya Maximets , stable@dpdk.org Date: Thu, 11 Apr 2019 13:23:06 +0300 Message-Id: <20190411102306.11943-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRmVeSWpSXmKPExsWy7djPc7oTRdfHGHxtY7NYtr+VxWL7ii42 i3eftjNZXGn/yW5xbs1SFotjnXtYLP51/GG32Nrwn8mBw+PXgqWsHov3vGTyeL/vKptH35ZV jAEsUVw2Kak5mWWpRfp2CVwZ2xesZiqYyF3x8tN5lgbGeZxdjJwcEgImEn+Pz2XpYuTiEBJY wSix9uZsZgjnC6PE70cXmCCcz4wS6ze3sc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ISqzccYJ7AyLOAkWEVo0hqaXFuem6xoV5xYm5xaV66 XnJ+7iZGYCBuO/Zz8w7GSxuDDzEKcDAq8fBO+L02Rog1say4MvcQowQHs5IIbwjL+hgh3pTE yqrUovz4otKc1OJDjKZAyycyS4km5wOjJK8k3tDU0NzC0tDc2NzYzEJJnPe8QWWUkEB6Yklq dmpqQWoRTB8TB6dUAyPb6co5GeVfGN367GeU92Vz7995c42E4QLfCLMH7tIi2Qd5u4L/N8+P +fsg39Zu9YUPbNWr+9bvu772v8ysOrWJu56WmBXkX8t73bdjcdzhpoKrVsVdaq9OfAj6Vb38 /qSXKcHPfaUjkjNOvJAqznTnLIi5pGzo9EDUWkPVTd60qeDhAv1QFyWW4oxEQy3mouJEAAHg cmFaAgAA X-CMS-MailID: 20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190411102312eucas1p2c52abee0af4079ca87c8bb8af7b16274 References: Subject: [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" 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