DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] compress/isal: check allocation in qp setup
@ 2020-11-02 11:36 wangyunjian
  2020-11-12 21:15 ` Akhil Goyal
  2020-11-19 10:50 ` Daly, Lee
  0 siblings, 2 replies; 4+ messages in thread
From: wangyunjian @ 2020-11-02 11:36 UTC (permalink / raw)
  To: dev; +Cc: lee.daly, jerry.lilijun, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

The function rte_zmalloc() could return NULL, the return value
need to be checked.

Fixes: dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
Fixes: 7bf4f0630af6 ("compress/isal: add ISA-L decomp functionality")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/compress/isal/isal_compress_pmd_ops.c | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c b/drivers/compress/isal/isal_compress_pmd_ops.c
index 31c4559915..7d03749da3 100644
--- a/drivers/compress/isal/isal_compress_pmd_ops.c
+++ b/drivers/compress/isal/isal_compress_pmd_ops.c
@@ -249,16 +249,27 @@ isal_comp_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
 	qp->stream = rte_zmalloc_socket("Isa-l compression stream ",
 			sizeof(struct isal_zstream),  RTE_CACHE_LINE_SIZE,
 			socket_id);
-
+	if (qp->stream == NULL) {
+		ISAL_PMD_LOG(ERR, "Failed to allocate compression stream memory");
+		goto qp_setup_cleanup;
+	}
 	/* Initialize memory for compression level buffer */
 	qp->stream->level_buf = rte_zmalloc_socket("Isa-l compression lev_buf",
 			ISAL_DEF_LVL3_DEFAULT, RTE_CACHE_LINE_SIZE,
 			socket_id);
+	if (qp->stream->level_buf == NULL) {
+		ISAL_PMD_LOG(ERR, "Failed to allocate compression level_buf memory");
+		goto qp_setup_cleanup;
+	}
 
 	/* Initialize memory for decompression state structure */
 	qp->state = rte_zmalloc_socket("Isa-l decompression state",
 			sizeof(struct inflate_state), RTE_CACHE_LINE_SIZE,
 			socket_id);
+	if (qp->state == NULL) {
+		ISAL_PMD_LOG(ERR, "Failed to allocate decompression state memory");
+		goto qp_setup_cleanup;
+	}
 
 	qp->id = qp_id;
 	dev->data->queue_pairs[qp_id] = qp;
@@ -284,8 +295,11 @@ isal_comp_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
 	return 0;
 
 qp_setup_cleanup:
-	if (qp)
-		rte_free(qp);
+	if (qp->stream)
+		rte_free(qp->stream->level_buf);
+	rte_free(qp->stream);
+	rte_free(qp->state);
+	rte_free(qp);
 
 	return -1;
 }
-- 
2.23.0


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

* Re: [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup
  2020-11-02 11:36 [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup wangyunjian
@ 2020-11-12 21:15 ` Akhil Goyal
  2020-11-19 10:50 ` Daly, Lee
  1 sibling, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2020-11-12 21:15 UTC (permalink / raw)
  To: wangyunjian, dev, lee.daly; +Cc: jerry.lilijun, xudingke, stable

> Subject: [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The function rte_zmalloc() could return NULL, the return value
> need to be checked.
> 
> Fixes: dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
> Fixes: 7bf4f0630af6 ("compress/isal: add ISA-L decomp functionality")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
Acks please !!


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

* Re: [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup
  2020-11-02 11:36 [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup wangyunjian
  2020-11-12 21:15 ` Akhil Goyal
@ 2020-11-19 10:50 ` Daly, Lee
  2020-11-22 11:14   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Daly, Lee @ 2020-11-19 10:50 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: jerry.lilijun, xudingke, stable

> From: wangyunjian <wangyunjian@huawei.com>
> Sent: Monday, November 2, 2020 11:36 AM
> To: dev@dpdk.org
> Cc: Daly, Lee <lee.daly@intel.com>; jerry.lilijun@huawei.com;
> xudingke@huawei.com; Yunjian Wang <wangyunjian@huawei.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The function rte_zmalloc() could return NULL, the return value need to be
> checked.
> 
> Fixes: dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
> Fixes: 7bf4f0630af6 ("compress/isal: add ISA-L decomp functionality")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/compress/isal/isal_compress_pmd_ops.c | 20 ++++++++++++++++-
> --
Thanks for patch.
Acked-by: Lee Daly <lee.daly@intel.com>

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

* Re: [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup
  2020-11-19 10:50 ` Daly, Lee
@ 2020-11-22 11:14   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2020-11-22 11:14 UTC (permalink / raw)
  To: wangyunjian; +Cc: dev, jerry.lilijun, xudingke, stable, Daly, Lee

> > The function rte_zmalloc() could return NULL, the return value need to be
> > checked.
> > 
> > Fixes: dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
> > Fixes: 7bf4f0630af6 ("compress/isal: add ISA-L decomp functionality")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > ---
> >  drivers/compress/isal/isal_compress_pmd_ops.c | 20 ++++++++++++++++-
> > --
> Thanks for patch.
> Acked-by: Lee Daly <lee.daly@intel.com>

Applied, thanks



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

end of thread, other threads:[~2020-11-22 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 11:36 [dpdk-dev] [PATCH] compress/isal: check allocation in qp setup wangyunjian
2020-11-12 21:15 ` Akhil Goyal
2020-11-19 10:50 ` Daly, Lee
2020-11-22 11:14   ` Thomas Monjalon

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