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 31C42A0096 for ; Mon, 8 Apr 2019 13:02:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D9D264D27; Mon, 8 Apr 2019 13:02:09 +0200 (CEST) Received: from netronome.com (unknown [217.38.71.146]) by dpdk.org (Postfix) with ESMTP id 252122BD8; Mon, 8 Apr 2019 13:02:05 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.15.2/8.15.2/Debian-10) with ESMTP id x38B25fA019207; Mon, 8 Apr 2019 12:02:05 +0100 Received: (from root@localhost) by netronome.com (8.15.2/8.15.2/Submit) id x38B258B019206; Mon, 8 Apr 2019 12:02:05 +0100 From: Alejandro Lucero To: dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 8 Apr 2019 12:02:04 +0100 Message-Id: <20190408110204.19161-1-alejandro.lucero@netronome.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] net/nfp: close sockfd before return if errors 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" Not closing the socket implies a resource leak. Coverity issue: 336865 Fixes: 29a62d1476b6 ("net/nfp: add CPP bridge as service") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfp_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index d4c94d7cc..b2ff03a67 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -3301,6 +3301,7 @@ nfp_cpp_bridge_service_func(void *args) if (ret < 0) { RTE_LOG(ERR, PMD, "%s: bind error (%d). Service failed\n", __func__, errno); + close(sockfd); return ret; } @@ -3308,6 +3309,7 @@ nfp_cpp_bridge_service_func(void *args) if (ret < 0) { RTE_LOG(ERR, PMD, "%s: listen error(%d). Service failed\n", __func__, errno); + close(sockfd); return ret; } @@ -3317,6 +3319,7 @@ nfp_cpp_bridge_service_func(void *args) RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n", __func__, errno); RTE_LOG(ERR, PMD, "%s: service failed\n", __func__); + close(sockfd); return -EIO; } -- 2.17.1