DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/nfp: close sockfd before return if errors
@ 2019-04-08 11:02 Alejandro Lucero
  2019-04-08 11:02 ` Alejandro Lucero
  2019-04-08 16:59 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Alejandro Lucero @ 2019-04-08 11:02 UTC (permalink / raw)
  To: dev; +Cc: 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 <alejandro.lucero@netronome.com>
---
 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-08 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 11:02 [dpdk-dev] [PATCH] net/nfp: close sockfd before return if errors Alejandro Lucero
2019-04-08 11:02 ` Alejandro Lucero
2019-04-08 16:59 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-04-08 16:59   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).