patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/nfp: fix resource leak
@ 2019-04-08 10:49 Alejandro Lucero
  2019-04-08 16:50 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Lucero @ 2019-04-08 10:49 UTC (permalink / raw)
  To: dev; +Cc: stable

Coverity issue: 32806
Fixes: ef28aa96e53b ("net/nfp: support multiprocess")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index 33baa989b..0b9db974e 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -690,12 +690,16 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
 	lockfile = calloc(strlen(home_path) + strlen(lockname) + 1,
 			  sizeof(char));
 
+	if (!lockfile)
+		return -ENOMEM;
+
 	strcat(lockfile, home_path);
 	strcat(lockfile, "/.lock_nfp_secondary");
 	desc->secondary_lock = open(lockfile, O_RDWR | O_CREAT | O_NONBLOCK,
 				    0666);
 	if (desc->secondary_lock < 0) {
 		RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");
+		free(lockfile);
 		return desc->secondary_lock;
 	}
 
@@ -707,6 +711,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc)
 		close(desc->secondary_lock);
 	}
 
+	free(lockfile);
 	return rc;
 }
 
-- 
2.17.1


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

* Re: [dpdk-stable] [PATCH] net/nfp: fix resource leak
  2019-04-08 10:49 [dpdk-stable] [PATCH] net/nfp: fix resource leak Alejandro Lucero
@ 2019-04-08 16:50 ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2019-04-08 16:50 UTC (permalink / raw)
  To: Alejandro Lucero, dev; +Cc: stable

On 4/8/2019 11:49 AM, Alejandro Lucero wrote:
> Coverity issue: 32806
> Fixes: ef28aa96e53b ("net/nfp: support multiprocess")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>

Applied to dpdk-next-net/master, thanks.

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

* [dpdk-stable] [PATCH] net/nfp: fix resource leak
@ 2017-11-08 12:14 Alejandro Lucero
  0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Lucero @ 2017-11-08 12:14 UTC (permalink / raw)
  To: dev; +Cc: stable

File descriptor is not released in any potential exit path
inside the function.

Fixes: f37d8a4b67b2 ("net/nfp: add NSP FW upload command")
Coverity: 195018

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfp_nspu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
index a2819a1..3c8cdad 100644
--- a/drivers/net/nfp/nfp_nspu.c
+++ b/drivers/net/nfp/nfp_nspu.c
@@ -351,12 +351,14 @@
 		RTE_LOG(INFO, PMD, "fw file too big: %" PRIu64
 				   " bytes (%" PRIu64 " max)",
 				  (uint64_t)fsize, (uint64_t)size);
+		close(fw_f);
 		return -EINVAL;
 	}
 
 	fw_buf = malloc((size_t)size);
 	if (!fw_buf) {
 		RTE_LOG(INFO, PMD, "malloc failed for fw buffer");
+		close(fw_f);
 		return -ENOMEM;
 	}
 	memset(fw_buf, 0, size);
@@ -367,12 +369,14 @@
 				   "Just %" PRIu64 " of %" PRIu64 " bytes read.",
 				   (uint64_t)bytes, (uint64_t)fsize);
 		free(fw_buf);
+		close(fw_f);
 		return -EIO;
 	}
 
 	ret = nspu_command(nspu_desc, NSP_CMD_FW_LOAD, 0, 1, fw_buf, 0, bytes);
 
 	free(fw_buf);
+	close(fw_f);
 
 	return ret;
 }
-- 
1.9.1

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 10:49 [dpdk-stable] [PATCH] net/nfp: fix resource leak Alejandro Lucero
2019-04-08 16:50 ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2017-11-08 12:14 Alejandro Lucero

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).