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 762F5A0552 for ; Mon, 27 Jun 2022 18:44:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A8C441141; Mon, 27 Jun 2022 18:44:47 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 9A86740685; Mon, 27 Jun 2022 18:44:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656348285; x=1687884285; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GPIBzR7xZ0FK1Umf7isA6ArGWASD5aM82F6mZoQKOgU=; b=cA55MSfZQj/HzBMCQ0lMlwVXTebDp5U7B2WCs9rFUOxJuOflZyXlj4Yk KsbGwepzXlfS8ix6x6w4HI37fnxElF6b4+fwlmZ+CLD7XbyjgWi6lKtw/ m2doyHtLh0Qh9TccIqf9ZLvW267dGeks+P9EyIp9FMLPC+BZWgej2NQn6 xTM++H58SILBi4OQt0F/KHAychxPbsVkfbiZG21gZfpicPd6L884E8PPh dQ8RrwDptZALA9C4kHQ+5rKytjtyUOtJfsri47IXI35vCZMnsYJpT63ZS ch46iOAT583d7uDhB/+lXSuFRjl7/o0i+ZSXuuSnr8NThyFDao+NhWbES Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="282227574" X-IronPort-AV: E=Sophos;i="5.92,226,1650956400"; d="scan'208";a="282227574" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 09:44:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,226,1650956400"; d="scan'208";a="616850061" Received: from silpixa00400885.ir.intel.com ([10.243.22.168]) by orsmga008.jf.intel.com with ESMTP; 27 Jun 2022 09:44:02 -0700 From: Rebecca Troy To: Fan Zhang , Arkadiusz Kusztal , Fiona Trahe , Tomasz Jozwiak Cc: dev@dpdk.org, Rebecca Troy , stable@dpdk.org Subject: [PATCH] crypto/qat: fix docsis segmentation fault Date: Mon, 27 Jun 2022 16:43:52 +0000 Message-Id: <20220627164352.181868-1-rebecca.troy@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Currently if AES or DES algorithms fail for Docsis test suite, a segmentation fault occurs when cryptodev_qat_autotest is ran. This is due to a duplicate call of EVP_CIPHER_CTX_free for the session context. Ctx is freed firstly in the bpi_cipher_ctx_init function and then again at the end of qat_sym_session_configure_cipher function. This commit fixes this bug by removing the first instance of EVP_CIPHER_CTX_free, leaving just the dedicated function in the upper level to free the ctx. Fixes: 98f060891615 ("crypto/qat: add symmetric session file") Cc: fiona.trahe@intel.com Cc: stable@dpdk.org Signed-off-by: Rebecca Troy --- drivers/crypto/qat/qat_sym_session.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index e40c042ba9..568792b753 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -111,12 +111,12 @@ bpi_cipher_ctx_init(enum rte_crypto_cipher_algorithm cryptodev_algo, const uint8_t *key, uint16_t key_length, void **ctx) { const EVP_CIPHER *algo = NULL; - int ret; + int ret = 0; *ctx = EVP_CIPHER_CTX_new(); if (*ctx == NULL) { ret = -ENOMEM; - goto ctx_init_err; + return ret; } if (cryptodev_algo == RTE_CRYPTO_CIPHER_DES_DOCSISBPI) @@ -130,14 +130,9 @@ bpi_cipher_ctx_init(enum rte_crypto_cipher_algorithm cryptodev_algo, /* IV will be ECB encrypted whether direction is encrypt or decrypt*/ if (EVP_EncryptInit_ex(*ctx, algo, NULL, key, 0) != 1) { ret = -EINVAL; - goto ctx_init_err; + return ret; } - return 0; - -ctx_init_err: - if (*ctx != NULL) - EVP_CIPHER_CTX_free(*ctx); return ret; } -- 2.34.1