DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, kai.ji@intel.com,
	Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [PATCH v2 2/3] crypto/qat: fix unnecessary session check
Date: Tue, 18 Oct 2022 14:53:33 +0100	[thread overview]
Message-ID: <20221018135334.34873-2-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20221018135334.34873-1-arkadiuszx.kusztal@intel.com>

Removed unncessary session check which could lead to segfault,
in case api was changed.

Fixes: 002486db239e ("crypto/qat: refactor asymmetric session")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
v2:
- fixed compilation issues
- split into 3 patches

 drivers/crypto/qat/qat_asym.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 3d7a800392..0eb5ba79bc 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -808,15 +808,15 @@ qat_asym_build_request(void *in_op, uint8_t *out_msg, void *op_cookie,
 	int err = 0;
 
 	op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
-	if (unlikely(qat_session == NULL)) {
-		QAT_DP_LOG(ERR, "Session was not created for this device");
-		op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
-		goto error;
-	}
-
 	switch (op->sess_type) {
 	case RTE_CRYPTO_OP_WITH_SESSION:
 		request_init(qat_req);
+		if (unlikely(qat_session == NULL)) {
+			QAT_DP_LOG(ERR,
+				"Session was not created for this device");
+			op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+			goto error;
+		}
 		xform = &qat_session->xform;
 		break;
 	case RTE_CRYPTO_OP_SESSIONLESS:
-- 
2.13.6


  reply	other threads:[~2022-10-18 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 13:53 [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Arek Kusztal
2022-10-18 13:53 ` Arek Kusztal [this message]
2022-10-21  8:29   ` [PATCH v2 2/3] crypto/qat: fix unnecessary session check Power, Ciara
2022-10-18 13:53 ` [PATCH v2 3/3] crypto/qat: fix not set rsa lengths Arek Kusztal
2022-10-21  8:29   ` Power, Ciara
2022-10-21  8:29 ` [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Power, Ciara
2022-10-21 13:29   ` 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=20221018135334.34873-2-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@intel.com \
    /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).