From 03f0e3608d44d468b22ed17c30144d87edeb3ee9 Mon Sep 17 00:00:00 2001 From: Rebecca Troy Date: Wed, 29 Jun 2022 16:10:36 +0000 Subject: [PATCH] crypto/qat: fix DOCSIS crash 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: stable@dpdk.org Signed-off-by: Rebecca Troy Acked-by: Fan Zhang --- drivers/crypto/qat/qat_sym_session.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index e40c042ba9..b30396487e 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -136,8 +136,10 @@ bpi_cipher_ctx_init(enum rte_crypto_cipher_algorithm cryptodev_algo, return 0; ctx_init_err: - if (*ctx != NULL) + if (*ctx != NULL) { EVP_CIPHER_CTX_free(*ctx); + *ctx = NULL; + } return ret; } -- 2.39.5