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 9DC6CA0597 for ; Wed, 8 Apr 2020 05:14:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 76A2A1BFC0; Wed, 8 Apr 2020 05:14:55 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 1270A1BF60 for ; Wed, 8 Apr 2020 05:14:50 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200408031449euoutp014ba03f45e55affc6b91d48263aa01441~DubcEqW221461214612euoutp01G for ; Wed, 8 Apr 2020 03:14:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200408031449euoutp014ba03f45e55affc6b91d48263aa01441~DubcEqW221461214612euoutp01G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586315689; bh=sCO9XcrD4PyGG+Zcp+KKj387AgtiVcHhRhOPgGMgGic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Es4GchucSSkoZCJPdpRwUujxrqP6JlboWjoW9w3Elqpi8AIn/5ulNTbKQGFmIEWHp Tb/PzGVrg93oWrRjPqTGOVKXQeOxf8KJaHU6WP5rARZn6xwYnA/okhIlBos2UJDHCN N2bGDeDEaObmCs8RkeAKjRbOgwyVUYRmoNwniL5Y= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200408031449eucas1p2a8d1c39005f0922f3d36654a197942c7~Dubb4d-P-2966729667eucas1p2-; Wed, 8 Apr 2020 03:14:49 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 7E.1B.61286.9A14D8E5; Wed, 8 Apr 2020 04:14:49 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200408031448eucas1p2d6df7ff419bb093606a2f9115297f45a~Dubbf8ZGC3008430084eucas1p2a; Wed, 8 Apr 2020 03:14:48 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200408031448eusmtrp2fc03eecda968a7c78e8250a8ef4d0c6e~DubbfYmTB0734007340eusmtrp2i; Wed, 8 Apr 2020 03:14:48 +0000 (GMT) X-AuditID: cbfec7f2-ef1ff7000001ef66-67-5e8d41a9c434 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C1.DA.08375.8A14D8E5; Wed, 8 Apr 2020 04:14:48 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200408031448eusmtip17b6f42317642d8c4c3c2c249f614e7fd~Duba2asTJ2835528355eusmtip1d; Wed, 8 Apr 2020 03:14:48 +0000 (GMT) From: Lukasz Wojciechowski To: Akhil Goyal , Declan Doherty , Radu Nicolau , Boris Pismenny , Aviad Yehezkel Cc: dev@dpdk.org, stable@dpdk.org Date: Wed, 8 Apr 2020 05:13:41 +0200 Message-Id: <20200408031351.4288-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200408031351.4288-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBIsWRmVeSWpSXmKPExsWy7djP87orHXvjDJq+cFqsPzOP0eLD5CWM Fsd+tLNbvHnQxGLx7tN2Jou2LgGLfx1/2B3YPX4tWMrqsXjPSyaPZ9MPM3lsfLeDKYAlissm JTUnsyy1SN8ugStjyfWTbAUt3BWX/35laWBcy9nFy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AEm4CtxJGZX1lBEiICZxglOh5cYwNpZhZQlujbYgVSIyxgLrHs1i6wehYB VYkjN/rAbF4BF4lvM1+wQSyQl1i94QAzSCungKvE7rNcEOfUSxy+e5ltAiPfAkaGVYwiqaXF uem5xYZ6xYm5xaV56XrJ+bmbGIFBuu3Yz807GC9tDD7EKMDBqMTD+yCxJ06INbGsuDL3EKME B7OSCK9Ub2ecEG9KYmVValF+fFFpTmrxIUZToJsmMkuJJucDIyivJN7Q1NDcwtLQ3Njc2MxC SZy3Q+BgjJBAemJJanZqakFqEUwfEwenVAPjIv7I+F0W/6bUXfj5T4ZNJP35DQX13kaPN1pz 1LSmWl4591tYaMWUygD+A7z3Zk9UXKf752H0xIc6M4r51mfdmca5dfmss5Me6Tg8nHBSgp/3 wewp6cJv4v9bbzrlMyHmzMq6bQ5Tvdy/V+6fcnK+VtKmvafkrpx4NsPkn13dZLvMF3mTGKYf zFBiKc5INNRiLipOBADmWHQHaAIAAA== X-CMS-MailID: 20200408031448eucas1p2d6df7ff419bb093606a2f9115297f45a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200408031448eucas1p2d6df7ff419bb093606a2f9115297f45a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200408031448eucas1p2d6df7ff419bb093606a2f9115297f45a References: <20200312151654.7218-1-l.wojciechow@partner.samsung.com> <20200408031351.4288-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-stable] [PATCH v2 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 f1b4a894e..ae57d3421 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