From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 82052A0093
	for <public@inbox.dpdk.org>; Tue, 19 May 2020 15:06:01 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 7620E1D5FA;
	Tue, 19 May 2020 15:06:01 +0200 (CEST)
Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com
 [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 72B661D5FA
 for <stable@dpdk.org>; Tue, 19 May 2020 15:06:00 +0200 (CEST)
Received: by mail-wr1-f67.google.com with SMTP id k13so13744298wrx.3
 for <stable@dpdk.org>; Tue, 19 May 2020 06:06:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=MboASrLUhm+9xl6tX2Cn2c0jSoBDGCxpAL1NxtENXdI=;
 b=fsuQl0koJbZUPdIlyLwWEnhSTZhkBuh+dnzkBsRb2vI3SPUOBturpb5kNW8nGW1VW4
 NpMYf7jyPYo9SKpV1JiNRoz5Dxe4H2c3n+YOQeO1ORRDWNX/tW7wQsKhxaPcO/l0e//5
 jP+grCort5bjJaQ1XXrnLRkjeml9EJrTc/hBM/PNyPfvYxude/4U+0opZ9wllhwRGj9n
 jI+PAp95MKMVdj5KezFb+En3w+lqZ8d41/WiaG7zIFNdFOA+QwVpXMQzAbkBdlzGjuPV
 wqulAeeW1c05rFqTR+E8nqbT0zJ0pZXEZt2P2NRA+mu+utsunDH5z16XjI+dCzr34lyq
 rWEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=MboASrLUhm+9xl6tX2Cn2c0jSoBDGCxpAL1NxtENXdI=;
 b=E8QUex13QCGjJf50NxVUlAO9AsLUf/UOQs1DSNBRtFEsZQV9EVEXV8Mz5zfrG9kyE9
 ikfZN10jIhjCp5H8N5nFxj5aJTz8t/2sI11xcRAVej68EwFXncttvtL76AYCCkl0QyEl
 6oGdJ1cIFrv1O+JpLyeuAJ5H2FPIltKN0hT1p8lcJyN0GHevDb/NgKZjU+oSSptz1ybN
 nv3i4qcokNgRhEXEche8ruYH9BtITKJKm/lyRSsTW5dvR5eG/4myMjcGB/CJdC7jwwtH
 Ox4mkjHzl43eYGzu6fFj2z+hoSQ0zix70jDSz9Ox/rYbAatC843/LU7DpUt0e2nppwVD
 Fa+g==
X-Gm-Message-State: AOAM531xUFeBugvJPbx3ndUswHFe81WU8QZVldHZHCenUkmCNrUoIryx
 uGlXruZKhXuzZhssnsCZxWE=
X-Google-Smtp-Source: ABdhPJyPud2OFt/RF/GOe4GBiPVB3ZO4O1BmUs9p25JeQbrhigohD2fYOLh9HF0fqg4npfnryRhKmw==
X-Received: by 2002:a5d:604b:: with SMTP id j11mr25331236wrt.193.1589893560046; 
 Tue, 19 May 2020 06:06:00 -0700 (PDT)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id r2sm21205059wrg.84.2020.05.19.06.05.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 19 May 2020 06:05:59 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Cc: Anoob Joseph <anoobj@marvell.com>, Akhil Goyal <akhil.goyal@nxp.com>,
 dpdk stable <stable@dpdk.org>
Date: Tue, 19 May 2020 14:02:17 +0100
Message-Id: <20200519130549.112823-2-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com>
References: <20200519125804.104349-1-luca.boccassi@gmail.com>
 <20200519130549.112823-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'security: fix session counter' has been queued
	to stable release 19.11.3
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From b54822ff2fd386be55dd03ecd32a4609a22ec2d8 Mon Sep 17 00:00:00 2001
From: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Date: Thu, 9 Apr 2020 19:24:52 +0200
Subject: [PATCH] security: fix session counter

[ upstream commit e36b5a87d6d0e1e209d85dc22419924cbe02056c ]

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")

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 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 38ccc2ea9c..d475b09771 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.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:44.705199725 +0100
+++ 0002-security-fix-session-counter.patch	2020-05-19 14:04:44.048645327 +0100
@@ -1,8 +1,10 @@
-From e36b5a87d6d0e1e209d85dc22419924cbe02056c Mon Sep 17 00:00:00 2001
+From b54822ff2fd386be55dd03ecd32a4609a22ec2d8 Mon Sep 17 00:00:00 2001
 From: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
 Date: Thu, 9 Apr 2020 19:24:52 +0200
 Subject: [PATCH] security: fix session counter
 
+[ upstream commit e36b5a87d6d0e1e209d85dc22419924cbe02056c ]
+
 Fix session counter to be decreased in rte_security_session_destroy
 only when session was successfully destroyed.
 
@@ -12,7 +14,6 @@
 invalid.
 
 Fixes: c261d1431bd8 ("security: introduce security API and framework")
-Cc: stable@dpdk.org
 
 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
 Acked-by: Anoob Joseph <anoobj@marvell.com>