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 2E24742B24; Tue, 16 May 2023 17:25:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0383D42D5C; Tue, 16 May 2023 17:24:42 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 179C942D4D for ; Tue, 16 May 2023 17:24:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684250680; x=1715786680; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/AwgAqNyv1lq10+EcbZE9FuE8XCBSJXZ0p1gIKrKhZs=; b=dFuNOYjJ99xWVNkvYHRtYL4dpx7hg2rb8fUTA4nmAa23/YAgpyccLkJk hVYVVc6aLHDTqBxUFk4T9iDm85kynzImK5HlztZFvaCBLx6f4k1UjNpF5 p9wK5670s9QNBh3INRNnEC+n13HDk+lvQPGKjVgLAbMDCoE5O7CJyizHi SdjqZpdZfrokK9ZkQDXgn8d+1FBRqLr2yIevCJgxj1iYaoqWersqSrBbL GMKvxSvXjHcUkYOgWubc0+pWf6albPcrDJ6hgEgrbUIENzmChVOIh+8QF YC5RpyqU4dOqUBg4brCblI2MMELnO+xTHA0zV3xzm1m4hQhaJEh2/VkFc w==; X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="353789148" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="353789148" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 08:24:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="695500724" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="695500724" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by orsmga007.jf.intel.com with ESMTP; 16 May 2023 08:24:38 -0700 From: Ciara Power To: dev@dpdk.org Cc: kai.ji@intel.com, gakhil@marvell.com, Pablo de Lara Subject: [PATCH v2 7/8] crypto/ipsec_mb: do not free linear_sgl always Date: Tue, 16 May 2023 15:24:21 +0000 Message-Id: <20230516152422.606617-8-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230516152422.606617-1-ciara.power@intel.com> References: <20230421131221.1732314-1-ciara.power@intel.com> <20230516152422.606617-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 From: Pablo de Lara linear_sgl buffer only needs to be freed if it was allocated previously. Signed-off-by: Pablo de Lara --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index 58faf3502c..f83738a5eb 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -1898,6 +1898,7 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job) struct rte_crypto_op *op = (struct rte_crypto_op *)job->user_data; struct aesni_mb_session *sess = NULL; uint8_t *linear_buf = NULL; + int sgl = 0; #ifdef AESNI_MB_DOCSIS_SEC_ENABLED uint8_t is_docsis_sec = 0; @@ -1923,6 +1924,8 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job) op->sym->m_dst->nb_segs > 1)) && !imb_lib_support_sgl_algo(job->cipher_mode)) { linear_buf = (uint8_t *) job->user_data2; + sgl = 1; + post_process_sgl_linear(op, job, sess, linear_buf); } @@ -1952,7 +1955,8 @@ post_process_mb_job(struct ipsec_mb_qp *qp, IMB_JOB *job) default: op->status = RTE_CRYPTO_OP_STATUS_ERROR; } - rte_free(linear_buf); + if (sgl) + rte_free(linear_buf); } /* Free session if a session-less crypto op */ -- 2.25.1