Skip to contentSkip to conversation

compress/isal: fix use after free

PATCH Applied Stephen Hemminger 4 participants 4 messages May 21, 2019 – Jun 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compress/isal: fix use after free

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")
---
 drivers/compress/isal/isal_compress_pmd_ops.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/compress/isal/isal_compress_pmd_ops.c +4 -10
index fe9995992304..77ac6fcf21fc 100644
@@ -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;
 
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw

Hi Stephen,
Thanks for the patch.

Quoted 12 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Tuesday, May 21, 2019 3:47 PM
To: Daly, Lee <[email protected]>
Cc: [email protected]; Stephen Hemminger <[email protected]>
Subject: [PATCH] compress/isal: fix use after free

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.

Review

Quoted 8 lines

Coverity issure: 340860

Fixes dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
---
 drivers/compress/isal/isal_compress_pmd_ops.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
(quoted diff) +0 -0
Acked-by Lee Daly Acked-by
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: Daly, Lee
Sent: Tuesday, May 21, 2019 4:08 PM
To: Stephen Hemminger <[email protected]>
Cc: [email protected]; Trahe, Fiona <[email protected]>
Subject: RE: [PATCH] compress/isal: fix use after free

Quoted 19 lines

Hi Stephen,
Thanks for the patch.

Quoted 16 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Tuesday, May 21, 2019 3:47 PM
To: Daly, Lee <[email protected]>
Cc: [email protected]; Stephen Hemminger <[email protected]>
Subject: [PATCH] compress/isal: fix use after free

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

---

Applied
#3 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

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

---

Applied to dpdk-next-crypto

Thanks.