patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Nipun Gupta <nipun.gupta@nxp.com>
To: ktraynor@redhat.com
Cc: stable@dpdk.org, Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: [dpdk-stable] [PATCH 18.11 5/5] test/crypto: fix session init failure for wireless case
Date: Tue, 17 Dec 2019 15:00:45 +0530	[thread overview]
Message-ID: <20191217093045.12659-5-nipun.gupta@nxp.com> (raw)
In-Reply-To: <20191217093045.12659-1-nipun.gupta@nxp.com>

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch add the support to handle the failure in session
create for wireless related cases. Else it will cause
segment fault due to I/O on un-initialized sessions.

Fixes: b3bbd9e5f2659 ("cryptodev: support device independent sessions")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 test/test/test_cryptodev.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index fbe8c21e6..d7ee88e40 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -2300,6 +2300,7 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 	enum rte_crypto_auth_algorithm algo)
 {
 	uint8_t hash_key[key_len];
+	int status;
 
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2322,8 +2323,10 @@ create_wireless_algo_hash_session(uint8_t dev_id,
 	ut_params->sess = rte_cryptodev_sym_session_create(
 			ts_params->session_mpool);
 
+	status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->auth_xform, ts_params->session_mpool);
+	TEST_ASSERT_EQUAL(status, 0, "session init failed");
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2336,7 +2339,7 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 			uint8_t iv_len)
 {
 	uint8_t cipher_key[key_len];
-
+	int status;
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
@@ -2359,8 +2362,10 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
 	ut_params->sess = rte_cryptodev_sym_session_create(
 			ts_params->session_mpool);
 
+	status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->cipher_xform, ts_params->session_mpool);
+	TEST_ASSERT_EQUAL(status, 0, "session init failed");
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2438,6 +2443,7 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 
 {
 	uint8_t cipher_auth_key[key_len];
+	int status;
 
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2475,9 +2481,11 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
 	ut_params->sess = rte_cryptodev_sym_session_create(
 			ts_params->session_mpool);
 
+	status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->cipher_xform, ts_params->session_mpool);
 
+	TEST_ASSERT_EQUAL(status, 0, "session init failed");
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2492,6 +2500,7 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 {
 	const uint8_t key_len = tdata->key.len;
 	uint8_t cipher_auth_key[key_len];
+	int status;
 
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2534,9 +2543,11 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
 	ut_params->sess = rte_cryptodev_sym_session_create(
 			ts_params->session_mpool);
 
+	status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->cipher_xform, ts_params->session_mpool);
 
+	TEST_ASSERT_EQUAL(status, 0, "session init failed");
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 	return 0;
 }
@@ -2562,7 +2573,7 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 		uint8_t cipher_iv_len)
 {
 	uint8_t auth_cipher_key[key_len];
-
+	int status;
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
@@ -2596,9 +2607,11 @@ create_wireless_algo_auth_cipher_session(uint8_t dev_id,
 	ut_params->sess = rte_cryptodev_sym_session_create(
 			ts_params->session_mpool);
 
+	status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 	rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
 			&ut_params->auth_xform, ts_params->session_mpool);
 
+	TEST_ASSERT_EQUAL(status, 0, "session init failed");
 	TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
 
 	return 0;
-- 
2.17.1


  parent reply	other threads:[~2019-12-17  9:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17  9:30 [dpdk-stable] [PATCH 18.11 1/5] net/dpaa2: add retry and timeout in packet enqueue API Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 2/5] raw/dpaa2_cmdif: " Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 3/5] net/dpaa2: set port in mbuf Nipun Gupta
2019-12-17  9:30 ` [dpdk-stable] [PATCH 18.11 4/5] bus/dpaa: fix dpaa_sec blacklist Nipun Gupta
2019-12-17  9:30 ` Nipun Gupta [this message]
2019-12-17 14:08 ` [dpdk-stable] [PATCH 18.11 1/5] net/dpaa2: add retry and timeout in packet enqueue API Kevin Traynor
2019-12-18  5:02   ` Nipun Gupta

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=20191217093045.12659-5-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=ktraynor@redhat.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).