From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CF66A04F8 for ; Tue, 17 Dec 2019 10:47:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B763F1BF71; Tue, 17 Dec 2019 10:47:11 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 4C7F41BF6C for ; Tue, 17 Dec 2019 10:47:10 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 305141A06AB; Tue, 17 Dec 2019 10:47:10 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2914C1A0E34; Tue, 17 Dec 2019 10:47:08 +0100 (CET) Received: from GDB1.ap.freescale.net (gdb1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id CB4AC402DF; Tue, 17 Dec 2019 17:47:05 +0800 (SGT) From: Nipun Gupta To: ktraynor@redhat.com Cc: stable@dpdk.org, Hemant Agrawal Date: Tue, 17 Dec 2019 15:00:45 +0530 Message-Id: <20191217093045.12659-5-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191217093045.12659-1-nipun.gupta@nxp.com> References: <20191217093045.12659-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-stable] [PATCH 18.11 5/5] test/crypto: fix session init failure for wireless case X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Hemant Agrawal 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 Acked-by: Akhil Goyal --- 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