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 34744A04B3; Mon, 16 Dec 2019 08:34:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 37BD71C127; Mon, 16 Dec 2019 08:34:57 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 18C1B1C126 for ; Mon, 16 Dec 2019 08:34:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Dec 2019 23:34:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,320,1571727600"; d="scan'208";a="389373109" Received: from silpixa00390850.ir.intel.com (HELO silpixa00390850.ger.corp.intel.com) ([10.237.222.84]) by orsmga005.jf.intel.com with ESMTP; 15 Dec 2019 23:34:54 -0800 From: Savinay Dharmappa To: dev@dpdk.org Cc: konstantin.ananyev@intel.com Date: Mon, 16 Dec 2019 07:34:49 +0000 Message-Id: <20191216073450.29390-1-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191213114956.12062-1-savinay.dharmappa@intel.com> References: <20191213114956.12062-1-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v3] examples/ipsec-secgw: fix application crash. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" if algo is NULL set the status to error and return. This change prevent crashing of ipsec-secgw application when a specific cipher/auth/aead algo are not supported by application. Fixes: 0d547ed03717 ("examples/ipsec-secgw: support configuration file") Signed-off-by: Savinay Dharmappa Acked-by: Konstantin Ananyev --- examples/ipsec-secgw/sa.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 7f046e3ed..c75a5a15f 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -314,6 +314,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->cipher_algo = algo->algo; rule->block_size = algo->block_size; rule->iv_len = algo->iv_len; @@ -378,6 +381,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->auth_algo = algo->algo; rule->auth_key_len = algo->key_len; rule->digest_len = algo->digest_len; @@ -433,6 +439,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->aead_algo = algo->algo; rule->cipher_key_len = algo->key_len; rule->digest_len = algo->digest_len; -- 2.17.1