From: Gagandeep Singh <G.Singh@nxp.com>
To: "dev@dpdk.org" <dev@dpdk.org>, Akhil Goyal <akhil.goyal@nxp.com>
Cc: Gagandeep Singh <G.Singh@nxp.com>
Subject: [dpdk-dev] [PATCH] crypto/caam_jr: fix memory leak and illegal memory access
Date: Tue, 9 Apr 2019 06:18:38 +0000 [thread overview]
Message-ID: <1554813675-13955-1-git-send-email-g.singh@nxp.com> (raw)
Message-ID: <20190409061838.d_XGluIl4z7vU6UQONWUf_Rc7JJvcWGOw536iDSHUjM@z> (raw)
Opendir() returns allocated storage which must be freed at the
end of function or in case any return on error. so freeing the
allocation using closedir in an error case.
Coverity issue: 323507
Coverity issue: 325880
Fixes: e7a45f3cc245 ("crypto/caam_jr: add UIO specific operations")
Cc: g.singh@nxp.com
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/crypto/caam_jr/caam_jr_uio.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index bf872a2..afd75c9 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -362,8 +362,8 @@
job_ring->register_base_addr,
(unsigned long)job_ring->map_size, strerror(errno));
} else
- CAAM_JR_DEBUG(" JR UIO memory unmapped at %p",
- job_ring->register_base_addr);
+ CAAM_JR_DEBUG("JR UIO memory is unmapped");
+
job_ring->register_base_addr = NULL;
}
@@ -445,7 +445,11 @@ uio_job_ring *config_job_ring(void)
ret = file_read_first_line(SEC_UIO_DEVICE_SYS_ATTR_PATH,
dir->d_name, "name", uio_name);
CAAM_JR_INFO("sec device uio name: %s", uio_name);
- SEC_ASSERT(ret == 0, -1, "file_read_first_line failed");
+ if (ret != 0) {
+ CAAM_JR_ERR("file_read_first_line failed\n");
+ closedir(d);
+ return -1;
+ }
if (file_name_match_extract(uio_name,
SEC_UIO_DEVICE_NAME,
--
1.9.1
next reply other threads:[~2019-04-09 6:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 6:18 Gagandeep Singh [this message]
2019-04-09 6:18 ` Gagandeep Singh
2019-04-16 13:47 ` Akhil Goyal
2019-04-16 13:47 ` Akhil Goyal
2019-04-16 14:51 ` Akhil Goyal
2019-04-16 14:51 ` Akhil Goyal
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=1554813675-13955-1-git-send-email-g.singh@nxp.com \
--to=g.singh@nxp.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@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).