compress/isal: fix use after free
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
--- 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
@@ -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
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 freeThe release function was using
qp->streamafter 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")Signed-off-by Stephen Hemminger <[email protected]>--- drivers/compress/isal/isal_compress_pmd_ops.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)(quoted diff) +0
-0
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 freeThe release function was using
qp->streamafter 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 <[email protected]>---
Akhil Goyal
AppliedQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
The release function was using
qp->streamafter 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")Signed-off-by Stephen Hemminger <[email protected]>---
Acked-by Lee Daly <[email protected]>Acked-by Fiona Trahe <[email protected]>
Applied to dpdk-next-crypto
Thanks.