DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/qat: fix secure session check
@ 2022-07-01  8:57 Rebecca Troy
  2022-07-01 18:31 ` [EXT] " Akhil Goyal
  2022-07-05 13:28 ` [dpdk-dev v2] " Kai Ji
  0 siblings, 2 replies; 4+ messages in thread
From: Rebecca Troy @ 2022-07-01  8:57 UTC (permalink / raw)
  To: Fan Zhang; +Cc: dev, Rebecca Troy, kai.ji, stable

Currently when running the dpdk-perf-test with docsis
security sessions, a segmentation fault occurs. This
is due to the check being made that the session is not
equal to op->sym->sec_session. This check passes the
first time but on the second iteration fails and doesn't
create the build_request.

This commit fixes that error by getting the ctx first
from the private session data and then comparing ctx,
rather than op->sym->sec_session, with the sess.

Fixes: fb3b9f492205 ("crypto/qat: rework burst data path")
Cc: kai.ji@intel.com
Cc: stable@dpdk.org

Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
---
 drivers/crypto/qat/qat_sym.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 3477cd89ad..e5ae670b3a 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -105,16 +105,16 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 
 #ifdef RTE_LIB_SECURITY
 	else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
-		if ((void *)sess != (void *)op->sym->sec_session) {
-			struct rte_cryptodev *cdev;
-			struct qat_cryptodev_private *internals;
-
-			ctx = get_sec_session_private_data(
+		ctx = get_sec_session_private_data(
 					op->sym->sec_session);
 			if (unlikely(!ctx)) {
 				QAT_DP_LOG(ERR, "No session for this device");
 				return -EINVAL;
 			}
+		if (sess != (uintptr_t)ctx) {
+			struct rte_cryptodev *cdev;
+			struct qat_cryptodev_private *internals;
+
 			if (unlikely(ctx->bpi_ctx == NULL)) {
 				QAT_DP_LOG(ERR, "QAT PMD only supports security"
 						" operation requests for"
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXT] [PATCH] crypto/qat: fix secure session check
  2022-07-01  8:57 [PATCH] crypto/qat: fix secure session check Rebecca Troy
@ 2022-07-01 18:31 ` Akhil Goyal
  2022-07-05 13:28 ` [dpdk-dev v2] " Kai Ji
  1 sibling, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2022-07-01 18:31 UTC (permalink / raw)
  To: Rebecca Troy, Fan Zhang; +Cc: dev, kai.ji, stable

> Currently when running the dpdk-perf-test with docsis
> security sessions, a segmentation fault occurs. This
> is due to the check being made that the session is not
> equal to op->sym->sec_session. This check passes the
> first time but on the second iteration fails and doesn't
> create the build_request.
> 
> This commit fixes that error by getting the ctx first
> from the private session data and then comparing ctx,
> rather than op->sym->sec_session, with the sess.
> 
> Fixes: fb3b9f492205 ("crypto/qat: rework burst data path")
> Cc: kai.ji@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
> ---
>  drivers/crypto/qat/qat_sym.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
> index 3477cd89ad..e5ae670b3a 100644
> --- a/drivers/crypto/qat/qat_sym.c
> +++ b/drivers/crypto/qat/qat_sym.c
> @@ -105,16 +105,16 @@ qat_sym_build_request(void *in_op, uint8_t
> *out_msg,
> 
>  #ifdef RTE_LIB_SECURITY
>  	else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
> -		if ((void *)sess != (void *)op->sym->sec_session) {
> -			struct rte_cryptodev *cdev;
> -			struct qat_cryptodev_private *internals;
> -
> -			ctx = get_sec_session_private_data(
> +		ctx = get_sec_session_private_data(
>  					op->sym->sec_session);
>  			if (unlikely(!ctx)) {
>  				QAT_DP_LOG(ERR, "No session for this
> device");
>  				return -EINVAL;
>  			}
Fix formatting of above if check.

> +		if (sess != (uintptr_t)ctx) {
> +			struct rte_cryptodev *cdev;
> +			struct qat_cryptodev_private *internals;
> +
>  			if (unlikely(ctx->bpi_ctx == NULL)) {
>  				QAT_DP_LOG(ERR, "QAT PMD only supports
> security"
>  						" operation requests for"
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev v2] crypto/qat: fix secure session check
  2022-07-01  8:57 [PATCH] crypto/qat: fix secure session check Rebecca Troy
  2022-07-01 18:31 ` [EXT] " Akhil Goyal
@ 2022-07-05 13:28 ` Kai Ji
  2022-07-05 16:32   ` [EXT] " Akhil Goyal
  1 sibling, 1 reply; 4+ messages in thread
From: Kai Ji @ 2022-07-05 13:28 UTC (permalink / raw)
  To: dev; +Cc: gakhil, Rebecca Troy, stable, Kai Ji

From: Rebecca Troy <rebecca.troy@intel.com>

Currently when running the dpdk-perf-test with docsis
security sessions, a segmentation fault occurs. This
is due to the check being made that the session is not
equal to op->sym->sec_session. This check passes the
first time but on the second iteration fails and doesn't
create the build_request.

This commit fixes that error by getting the ctx first
from the private session data and then comparing ctx,
rather than op->sym->sec_session, with the sess.

Fixes: fb3b9f492205 ("crypto/qat: rework burst data path")
Cc: stable@dpdk.org

Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
Signed-off-by: Kai Ji <kai.ji@intel.com>
---
 drivers/crypto/qat/qat_sym.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 3477cd89ad..db6316fbe9 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -105,16 +105,15 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 
 #ifdef RTE_LIB_SECURITY
 	else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
-		if ((void *)sess != (void *)op->sym->sec_session) {
+		ctx = get_sec_session_private_data(op->sym->sec_session);
+		if (unlikely(!ctx)) {
+			QAT_DP_LOG(ERR, "No session for this device");
+			return -EINVAL;
+		}
+		if (sess != (uintptr_t)ctx) {
 			struct rte_cryptodev *cdev;
 			struct qat_cryptodev_private *internals;
 
-			ctx = get_sec_session_private_data(
-					op->sym->sec_session);
-			if (unlikely(!ctx)) {
-				QAT_DP_LOG(ERR, "No session for this device");
-				return -EINVAL;
-			}
 			if (unlikely(ctx->bpi_ctx == NULL)) {
 				QAT_DP_LOG(ERR, "QAT PMD only supports security"
 						" operation requests for"
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXT] [dpdk-dev v2] crypto/qat: fix secure session check
  2022-07-05 13:28 ` [dpdk-dev v2] " Kai Ji
@ 2022-07-05 16:32   ` Akhil Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2022-07-05 16:32 UTC (permalink / raw)
  To: Kai Ji, dev; +Cc: Rebecca Troy, stable

> ----------------------------------------------------------------------
> From: Rebecca Troy <rebecca.troy@intel.com>
> 
> Currently when running the dpdk-perf-test with docsis
> security sessions, a segmentation fault occurs. This
> is due to the check being made that the session is not
> equal to op->sym->sec_session. This check passes the
> first time but on the second iteration fails and doesn't
> create the build_request.
> 
> This commit fixes that error by getting the ctx first
> from the private session data and then comparing ctx,
> rather than op->sym->sec_session, with the sess.
> 
> Fixes: fb3b9f492205 ("crypto/qat: rework burst data path")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
> Signed-off-by: Kai Ji <kai.ji@intel.com>
Applied to dpdk-next-crypto
Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-05 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01  8:57 [PATCH] crypto/qat: fix secure session check Rebecca Troy
2022-07-01 18:31 ` [EXT] " Akhil Goyal
2022-07-05 13:28 ` [dpdk-dev v2] " Kai Ji
2022-07-05 16:32   ` [EXT] " Akhil Goyal

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).