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 B4651A0597 for ; Thu, 9 Apr 2020 19:25:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E18D61D17A; Thu, 9 Apr 2020 19:25:38 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 71D5E1C247 for ; Thu, 9 Apr 2020 19:25:32 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200409172532euoutp02bdb8757e2a90caa710c7f2df7f5949d8~ENrfoFtG-2096020960euoutp02h for ; Thu, 9 Apr 2020 17:25:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200409172532euoutp02bdb8757e2a90caa710c7f2df7f5949d8~ENrfoFtG-2096020960euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586453132; bh=OlcosswvJXilB/2xJwKx19G4Sv0RWdYzyzXv2rY0p38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JDSy/aC1pzE+tWOiTDjnge2uayt3wENVo9rW719bcYR9zG0PLXnTy9lB7wnAl5XWz g81ZVo47wp8lrEY3Pkoe+WGeyrKxz0kDwd3e/KFedgj4RAJKalzwDpIrYUbgzrhezH suU37ZZDiBvDfZjLWyKR9qYDln2AVpQxIpF6hWNY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200409172532eucas1p1cfe4b7d36652caceb9f46255a4fc81c6~ENrfc-xN50986409864eucas1p1u; Thu, 9 Apr 2020 17:25:32 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id C1.F2.61286.B8A5F8E5; Thu, 9 Apr 2020 18:25:32 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200409172531eucas1p1c3ec21532e5e232ff2d68d56f096e71c~ENre_MOBB2193421934eucas1p1E; Thu, 9 Apr 2020 17:25:31 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200409172531eusmtrp12170ba3be553e58eadab0a8448dcb4a2~ENre9nqCH2463624636eusmtrp1D; Thu, 9 Apr 2020 17:25:31 +0000 (GMT) X-AuditID: cbfec7f2-ef1ff7000001ef66-2f-5e8f5a8b37b2 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A3.48.07950.B8A5F8E5; Thu, 9 Apr 2020 18:25:31 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200409172530eusmtip1e7e97b2a043377aa5cbe5be2d81b6e80~ENreVcUOs1096110961eusmtip1p; Thu, 9 Apr 2020 17:25:30 +0000 (GMT) From: Lukasz Wojciechowski To: Akhil Goyal , Declan Doherty , Boris Pismenny , Radu Nicolau , Aviad Yehezkel Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 9 Apr 2020 19:24:52 +0200 Message-Id: <20200409172502.1693-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200409172502.1693-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOIsWRmVeSWpSXmKPExsWy7djPc7o9Uf1xBk8XMVqsPzOP0eLD5CWM Fsd+tLNbvHnQxGLx7tN2Jou2LgGLfx1/2B3YPX4tWMrqsXjPSyaPZ9MPM3lsfLeDKYAlissm JTUnsyy1SN8ugSuj8007W0ELd8XtP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Cjxb8IbRpAEm4CtxJGZX1lBEiICZxgldq2bwALSzCygLNG3xQqkRljAXOLDy8dMIDaL gKrExcN3WUBsXgEXidc3DzJCLJCXWL3hADOIzSngKnHr+CUwW0igXuJ21x/GCYx8CxgZVjGK pJYW56bnFhvpFSfmFpfmpesl5+duYgQG6rZjP7fsYOx6F3yIUYCDUYmH14ChP06INbGsuDL3 EKMEB7OSCK93U2+cEG9KYmVValF+fFFpTmrxIUZToKMmMkuJJucDoyivJN7Q1NDcwtLQ3Njc 2MxCSZy3Q+BgjJBAemJJanZqakFqEUwfEwenVAPjnFmhoZnBzLIHp8xXUrmd4rGJQWza/10z MnblJ5cK79AuT2W0fDNx3aFn9nuO6H7NVew5Kf/KhinltgeDUa3h49dacxY9F+Ve6Xe2a4ei v8neBxdWC0g0tmT/tqrnsFH0uTz3rpqNhcbr32+Cii/WCd47bB1VcIGNwe1td75r49EO4dfP L75RYinOSDTUYi4qTgQAr5lcmmoCAAA= X-CMS-MailID: 20200409172531eucas1p1c3ec21532e5e232ff2d68d56f096e71c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200409172531eucas1p1c3ec21532e5e232ff2d68d56f096e71c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200409172531eucas1p1c3ec21532e5e232ff2d68d56f096e71c References: <20200408031351.4288-1-l.wojciechow@partner.samsung.com> <20200409172502.1693-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-stable] [PATCH v3 03/13] security: fix session counter 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" Fix session counter to be decreased in rte_security_session_destroy only when session was successfully destroyed. Formerly session counter was decreased prior session destroying and returning session object to mempool. It remained decreased even if session was not destroyed and mempool object released making counter invalid. Fixes: c261d1431bd8 ("security: introduce security API and framework") Cc: akhil.goyal@nxp.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski --- lib/librte_security/rte_security.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c index 38ccc2ea9..d475b0977 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -90,14 +90,16 @@ rte_security_session_destroy(struct rte_security_ctx *instance, -ENOTSUP); RTE_PTR_OR_ERR_RET(sess, -EINVAL); + ret = instance->ops->session_destroy(instance->device, sess); + if (ret != 0) + return ret; + + rte_mempool_put(rte_mempool_from_obj(sess), (void *)sess); + if (instance->sess_cnt) instance->sess_cnt--; - ret = instance->ops->session_destroy(instance->device, sess); - if (!ret) - rte_mempool_put(rte_mempool_from_obj(sess), (void *)sess); - - return ret; + return 0; } int -- 2.17.1