From: Alejandro Lucero <alejandro.lucero@netronome.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/nfp: close sockfd before return if errors
Date: Mon, 8 Apr 2019 12:02:04 +0100 [thread overview]
Message-ID: <20190408110204.19161-1-alejandro.lucero@netronome.com> (raw)
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
next reply other threads:[~2019-04-08 11:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 11:02 Alejandro Lucero [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190408110204.19161-1-alejandro.lucero@netronome.com \
--to=alejandro.lucero@netronome.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).