DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev v1] crypto/ipsec_mb: fix of qp NULL check
@ 2022-11-01 14:07 Kai Ji
  2022-11-02 11:04 ` Power, Ciara
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Ji @ 2022-11-01 14:07 UTC (permalink / raw)
  To: dev
  Cc: gakhil, Kai Ji, roy.fan.zhang, Pablo de Lara, Ray Kinsella, Ciara Power

This patch fix the NULL pointer check when dereference qp and ring
lookup.

Coverity issue: 381625
Fixes: c75542ae4200 ("crypto/ipsec_mb: introduce IPsec_mb framework")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Kai Ji <kai.ji@intel.com>
---
 drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index bf18d692bd..7bb3e4d46c 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -141,12 +141,13 @@ ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 	struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id];
 	struct rte_ring *r = NULL;
 
-	if (qp != NULL)
+	if (!qp)
 		return 0;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		r = rte_ring_lookup(qp->name);
-		rte_ring_free(r);
+		if (r)
+			rte_ring_free(r);
 
 #if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM
 		if (qp->mb_mgr)
-- 
2.17.1


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

end of thread, other threads:[~2022-11-03  8:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 14:07 [dpdk-dev v1] crypto/ipsec_mb: fix of qp NULL check Kai Ji
2022-11-02 11:04 ` Power, Ciara
2022-11-03  8:08   ` 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).