From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D54641C32; Tue, 7 Feb 2023 19:15:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A500A4021F; Tue, 7 Feb 2023 19:15:50 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id DA57440151 for ; Tue, 7 Feb 2023 19:15:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675793749; x=1707329749; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=/Vif92Hea8ht49t0ZX0hmwhodwitWXxWBBAmsuqrZao=; b=UTgfjUbvtfEFSQHvDrs926FnO9hhsWdeE8rGrDZhMxpmyTCaIg8dRC+l QBQoNHaoiSSM8nFZqLk1HaFfiIYQnmk5ipl8ZPlnvwZOV/K6GfRgmXjq+ L/i2ok4QpnNz0euryiQdNhhrx2XIARd+DNdXeuoC/Yn9eQ92t1QSC51q6 n/1Cu3XYbJumaFQKEeszTn0yCyRhDnaWAFmlUoNWNTrvM9V6rM3MQor3Z Pm9MbCCBhgiE5ao53FSEtvnf00ooeFr6tp+mjW3ZAw6KSJTRf7nyXUIIi P2iNFjuI9N8SoJZdtMiKAamRqtGPBEXYml+QQwLGu7Br9azwLXGsT6JEj w==; X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="309231487" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="309231487" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2023 10:15:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="840864592" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="840864592" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.222.53]) by orsmga005.jf.intel.com with ESMTP; 07 Feb 2023 10:15:42 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH] pipeline: fix IPsec crypto session leak Date: Tue, 7 Feb 2023 18:15:42 +0000 Message-Id: <20230207181542.655091-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In case of rte_ipsec_session_prepare() error, the crypto session was not freed, leading to its leakage. Fixes: 20777eb5f913 ("pipeline: add IPsec") Coverity issue: 383139 Signed-off-by: Cristian Dumitrescu --- lib/pipeline/rte_swx_ipsec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pipeline/rte_swx_ipsec.c b/lib/pipeline/rte_swx_ipsec.c index b23056e23e..6c217ee797 100644 --- a/lib/pipeline/rte_swx_ipsec.c +++ b/lib/pipeline/rte_swx_ipsec.c @@ -1719,7 +1719,11 @@ ipsec_session_create(struct rte_swx_ipsec *ipsec, s->pkt_func.prepare.async = NULL; s->pkt_func.process = NULL; - return rte_ipsec_session_prepare(s); + status = rte_ipsec_session_prepare(s); + if (status) + goto error; + + return 0; error: /* sa. */ -- 2.34.1