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 48A1BA056D; Thu, 12 Mar 2020 16:17:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D7ACF2BE6; Thu, 12 Mar 2020 16:17:11 +0100 (CET) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id A5E842BE6 for ; Thu, 12 Mar 2020 16:17:09 +0100 (CET) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200312151709euoutp025b4c0dad3e6f44394525fef3f1f18d31~7l3Z_Kxi52975029750euoutp02I for ; Thu, 12 Mar 2020 15:17:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200312151709euoutp025b4c0dad3e6f44394525fef3f1f18d31~7l3Z_Kxi52975029750euoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1584026229; bh=yqKjO09WUlDl03fF1ubf0yfsJpW107DL2GKAdWZPBrs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ugdugJGXZt/azJkT0sJKm2a5TmtaCHvRVHM0P80xz0HGQidhYW/Kt0fvQmJy9eqDz YK3E7F/qhtVQxDVCWvnmulsXECM/8s315MAGI3njRYZH77crCwv3omVvXd8nobuO8u gSLf1ay5kLwwm6xTcuSN37ZB1pN1jZb0SnSixMXA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200312151709eucas1p14391317f5d6a8da00989ac48ea63f4ce~7l3Z3lsNi0788307883eucas1p13 for ; Thu, 12 Mar 2020 15:17:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 6A.B9.60698.4725A6E5; Thu, 12 Mar 2020 15:17:08 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200312151708eucas1p2536ef1df74b35ead436db85f8a5628b4~7l3Zqell81996519965eucas1p2m for ; Thu, 12 Mar 2020 15:17:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200312151708eusmtrp2bca861c93403c48c6db3df9a7f1a03cb~7l3Zo0A-v1238312383eusmtrp2I for ; Thu, 12 Mar 2020 15:17:08 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-a3-5e6a52747a06 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 71.3F.08375.4725A6E5; Thu, 12 Mar 2020 15:17:08 +0000 (GMT) Received: from Padamandas.example.org (unknown [106.120.51.19]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200312151708eusmtip1617f4b268e9bb934eeba9bd047c57cd2~7l3ZVVyC91553915539eusmtip1O for ; Thu, 12 Mar 2020 15:17:08 +0000 (GMT) From: Lukasz Wojciechowski To: dev@dpdk.org Date: Thu, 12 Mar 2020 16:16:44 +0100 Message-Id: <20200312151654.7218-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200312151654.7218-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djP87qlQVlxBjN4Ld592s7kwOjxa8FS 1gDGKC6blNSczLLUIn27BK6MKx9VCz5wVez5PJu1gXEVZxcjB4eEgInE/2upXYxcHEICKxgl XmxcwtjFyAnktDNJTJrkBpFoY5KYdu0SO0gCpKF7ykx2iKLljBLvzntCFAE1LHz4jwUkwSZg K3Fk5ldWEFtEQEDic+diNhBbWMBaYvreN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1KL8uOLSnNSiw8xmgIdNZFZSjQ5HxjSeSXxhqaG5haWhubG5sZmFkrivB0C B2OEBNITS1KzU1MLUotg+pg4OKUaGPl1p59qiGhiPK45oTTpzp6v5t3CR0Ibgs2EGeae8rpR Wnt5j6yapE5d8ul+7X+TVr1k41/wfOkiK72yjcI6bOt+HFS+an8rY8pzvagnnzt+Hb77ZPtZ nqA37huvFqxYU7iCy3HJP8enGqwZL9MOZDGvXiTrb6W8MNZ+G8uxluc7D1v/jwz9EqHEUpyR aKjFXFScCAAS5G4mMQIAAA== X-CMS-MailID: 20200312151708eucas1p2536ef1df74b35ead436db85f8a5628b4 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200312151708eucas1p2536ef1df74b35ead436db85f8a5628b4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200312151708eucas1p2536ef1df74b35ead436db85f8a5628b4 References: <20200312151654.7218-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH 03/13] librte_security: fix session counter 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" Fix session counter to be decreased in rte_security_session_destroy only when session was successfully destoyed. 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. Signed-off-by: Lukasz Wojciechowski Change-Id: I75ebfc26811ec2159b973fae36b2c9fb08868f11 --- 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 40a0e9ce5..74a314903 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -87,14 +87,16 @@ rte_security_session_destroy(struct rte_security_ctx *instance, RTE_PTR_OR_ERR_RET(instance->ops->session_destroy, -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