From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A9928A0093; Fri, 10 Dec 2021 15:10:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6DBE4114F; Fri, 10 Dec 2021 15:10:10 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 39EDA40041; Fri, 10 Dec 2021 15:10:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639145409; x=1670681409; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y9tyIKyMehYB2qtIL1KJFrDrfjJXO9WwVVPQ7kBEOqU=; b=dOiWm3T/cY5Xtlym4UhixUPoAM4HIfAP2ZSKiBZmG7rW6fQE1+5usK2y NPiSAUiEzs5QitZaedmJaoAyF1M9Du79t5tiv3LxCQGa8vsClKK8mP8R1 Y2gKHj10llw4YttremdXBF+dkzg+b/5pMEflSnCYU3jq/BvXEph4stolX 2gurwNofBzIxM8B4O1TXZuqNec5WD0IEIw6IzLmP/q55KKksC3+eJBbPu 1svEr50HuBRh7Q4SJVCjX1w+clkhi2FtTBplmWI5/iza1NigWhvED8THS K8IgjWCUj1HJb2fsfO2iytjt2nrbUvXwH+PZAf/awpMHQrMyrg6edcaDF w==; X-IronPort-AV: E=McAfee;i="6200,9189,10193"; a="324613225" X-IronPort-AV: E=Sophos;i="5.88,195,1635231600"; d="scan'208";a="324613225" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2021 06:10:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,195,1635231600"; d="scan'208";a="612936994" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.49]) by orsmga004.jf.intel.com with ESMTP; 10 Dec 2021 06:10:06 -0800 From: Ciara Power To: dev@dpdk.org Cc: stable@dpdk.org, john.mcnamara@intel.com, roy.fan.zhang@intel.com, Ciara Power , Pablo de Lara Subject: [PATCH 2/3] crypto/ipsec_mb: fix qp cleanup null pointer dereference Date: Fri, 10 Dec 2021 14:09:51 +0000 Message-Id: <20211210140952.2907974-2-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210140952.2907974-1-ciara.power@intel.com> References: <20211210140952.2907974-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The qp was being used in the cleanup without checking if it was non NULL. A check is now added to verify qp is non NULL before use. Coverity issue: 374375 Fixes: c75542ae4200 ("crypto/ipsec_mb: introduce IPsec_mb framework") Cc: roy.fan.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Ciara Power --- 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 6efa417d67..1ebd23e8f0 100644 --- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c +++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c @@ -285,6 +285,8 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, return 0; qp_setup_cleanup: + if (qp == NULL) + return ret; #if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM if (qp->mb_mgr) free_mb_mgr(qp->mb_mgr); @@ -294,8 +296,7 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->mb_mgr_mz) rte_memzone_free(qp->mb_mgr_mz); #endif - if (qp) - rte_free(qp); + rte_free(qp); return ret; } -- 2.25.1