DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] compress/isal: fix use after free
@ 2019-05-21 14:47 Stephen Hemminger
  2019-05-21 15:07 ` Daly, Lee
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2019-05-21 14:47 UTC (permalink / raw)
  To: lee.daly; +Cc: dev, Stephen Hemminger

The release function was using qp->stream after already
releasing it and the null pointer checking was missing.

Also since rte_free(NULL) is a no-op, remove unnecessary
checks for NULL.

Coverity issure: 340860
Fixes: dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/compress/isal/isal_compress_pmd_ops.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c b/drivers/compress/isal/isal_compress_pmd_ops.c
index fe9995992304..77ac6fcf21fc 100644
--- a/drivers/compress/isal/isal_compress_pmd_ops.c
+++ b/drivers/compress/isal/isal_compress_pmd_ops.c
@@ -171,18 +171,12 @@ isal_comp_pmd_qp_release(struct rte_compressdev *dev, uint16_t qp_id)
 	if (qp == NULL)
 		return -EINVAL;
 
-	if (qp->stream != NULL)
-		rte_free(qp->stream);
-
-	if (qp->stream->level_buf != NULL)
+	if (qp->stream)
 		rte_free(qp->stream->level_buf);
 
-	if (qp->state != NULL)
-		rte_free(qp->state);
-
-	if (qp->processed_pkts != NULL)
-		rte_ring_free(qp->processed_pkts);
-
+	rte_free(qp->state);
+	rte_ring_free(qp->processed_pkts);
+	rte_free(qp->stream);
 	rte_free(qp);
 	dev->data->queue_pairs[qp_id] = NULL;
 
-- 
2.20.1


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

end of thread, other threads:[~2019-06-19 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 14:47 [dpdk-dev] [PATCH] compress/isal: fix use after free Stephen Hemminger
2019-05-21 15:07 ` Daly, Lee
2019-05-27 16:00   ` Trahe, Fiona
2019-06-19 14:54     ` Akhil Goyal

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