DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, ciara.power@intel.com,
	Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>,
	stable@dpdk.org
Subject: [PATCH] crypto/qat: fix ccm null aad pointer segfault
Date: Fri,  8 Mar 2024 08:25:12 +0000	[thread overview]
Message-ID: <20240308082512.5226-1-arkadiuszx.kusztal@intel.com> (raw)

This commit fixes a segfault, that occurs when NULL pointer
is being set to the aad pointer field.

Fixes: a815a04cea05 ("crypto/qat: support symmetric build op request")
Cc: stable@dpdk.org

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
 drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
index eebf2e6eb8..83a6c30218 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
@@ -881,10 +881,12 @@ enqueue_one_aead_job_gen1(struct qat_sym_session *ctx,
 		*(uint8_t *)&cipher_param->u.cipher_IV_array[0] =
 			q - ICP_QAT_HW_CCM_NONCE_OFFSET;
 
-		rte_memcpy((uint8_t *)aad->va +
-				ICP_QAT_HW_CCM_NONCE_OFFSET,
-			(uint8_t *)iv->va + ICP_QAT_HW_CCM_NONCE_OFFSET,
-			ctx->cipher_iv.length);
+		if (ctx->aad_len > 0) {
+			rte_memcpy((uint8_t *)aad->va +
+					ICP_QAT_HW_CCM_NONCE_OFFSET,
+				(uint8_t *)iv->va + ICP_QAT_HW_CCM_NONCE_OFFSET,
+				ctx->cipher_iv.length);
+		}
 		break;
 	default:
 		break;
-- 
2.13.6


             reply	other threads:[~2024-03-08  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  8:25 Arkadiusz Kusztal [this message]
2024-03-11 14:35 ` Power, Ciara
2024-03-13 14:51   ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308082512.5226-1-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).