From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 881EAA0524
	for <public@inbox.dpdk.org>; Fri,  5 Feb 2021 12:31:06 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 827D640682;
	Fri,  5 Feb 2021 12:31:06 +0100 (CET)
Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com
 [209.85.221.48])
 by mails.dpdk.org (Postfix) with ESMTP id 24E8B188945
 for <stable@dpdk.org>; Fri,  5 Feb 2021 12:31:05 +0100 (CET)
Received: by mail-wr1-f48.google.com with SMTP id z6so7260331wrq.10
 for <stable@dpdk.org>; Fri, 05 Feb 2021 03:31:05 -0800 (PST)
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=OCY2i5zGngzryLnW8oKyXxoO14nwSqnsVW5XXaB/WT8=;
 b=fGxtFD1XHLZloYQ6NlAnYWIogH/3oXkoqfpslQf0FAPAeCJ2Gch0IpdQDq7we/ZDgY
 gDLvAtSq7/CPq9idsxzp/GV7DpgSH4d4AJhryHVoq2QMU5zVjqRFIarn8815ysNZGWJ0
 ljeY99AgaWuZA7BzIEY2ZOQNdT1KL4L1Q0cMTegrxaH8C/zNQK7TyDPTUWqT13vVz5je
 zZdiInBjyIf8agBgrDV9TcYh+mgbukcpj56FY1ULlYyj+V0jdtlXho4ubg5X3Jibzju+
 eNQcqiob3tLMg7hRlpU0ozwPXukESNLfknw8/OODQlrQI72LPAygFPFJotVpQWSRcTlh
 bj1Q==
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=OCY2i5zGngzryLnW8oKyXxoO14nwSqnsVW5XXaB/WT8=;
 b=fBLM8bLSImeiu+Z6XV1mHO4877OdJyj59ZeveH8bJ0IlxGZULdiyW8+P2lZflXs0Bh
 5blrLsTESUueyck84bOl0gwuXoHQSXbxeaxtgVKKic5oKRP3NmtCRbIiHLmBvORpY3P3
 Uxn2Yb1rXClIWv6K3NEH2QTk77ZIFZH26fAGAHPw015G16T8ZEMTUHZPwSwJVD1Vdgic
 swZmKbBcd8OYsTdSOJLrzkDW+1xsjLHjcH/tqqAJfxQjr3Dq3j8Q6ZMWvL3lgTODactw
 xqxoW1ic0EGktyHF3mLQ+JZeF8Xj6t7soUf5PWpthM1d6nrNejGIaLK6KcOoK075N2US
 l/fg==
X-Gm-Message-State: AOAM532+PMC+AgUQNOvirtDr3tZ5WofJ0zWS13s5nKHkcZXN7JVwYzMv
 kLZFtrEOLuuTyGS2O2Vm0TE=
X-Google-Smtp-Source: ABdhPJyit/fQR68mdYbasMoUID5WOaXiteexUpPd8LRim2QQ5a5NygwzPj1j9XOqZeeD5cG9r0aAxQ==
X-Received: by 2002:a5d:4e8f:: with SMTP id e15mr4649631wru.9.1612524664938;
 Fri, 05 Feb 2021 03:31:04 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id i7sm18010501wmq.2.2021.02.05.03.31.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 05 Feb 2021 03:31:04 -0800 (PST)
From: luca.boccassi@gmail.com
To: Michael Baum <michaelba@nvidia.com>
Cc: Matan Azrad <matan@nvidia.com>,
	dpdk stable <stable@dpdk.org>
Date: Fri,  5 Feb 2021 11:16:39 +0000
Message-Id: <20210205111920.1272063-113-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com>
References: <20210205111920.1272063-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'net/mlx5: fix leak on ASO SQ creation failure'
 has been queued to stable release 20.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
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 20.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/07/21. 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.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/bc316de164b02f7675023aa1d27ac6a0c63ba5ee

Thanks.

Luca Boccassi

---
>From bc316de164b02f7675023aa1d27ac6a0c63ba5ee Mon Sep 17 00:00:00 2001
From: Michael Baum <michaelba@nvidia.com>
Date: Wed, 6 Jan 2021 08:19:25 +0000
Subject: [PATCH] net/mlx5: fix leak on ASO SQ creation failure

[ upstream commit 0e8273176e60d813a8a905e4ce38bbd18a1e2470 ]

In ASO SQ creation, the PMD allocates umem buffer for SQ.

When umem buffer allocation fails, the MR and CQ memory are not freed
what caused a memory leak.

Free it.

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_age.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_age.c b/drivers/net/mlx5/mlx5_flow_age.c
index cea2cf769d..0ea61be4eb 100644
--- a/drivers/net/mlx5/mlx5_flow_age.c
+++ b/drivers/net/mlx5/mlx5_flow_age.c
@@ -278,7 +278,8 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket,
 				   sizeof(*sq->db_rec) * 2, 4096, socket);
 	if (!sq->umem_buf) {
 		DRV_LOG(ERR, "Can't allocate wqe buffer.");
-		return -ENOMEM;
+		rte_errno = ENOMEM;
+		goto error;
 	}
 	sq->wqe_umem = mlx5_glue->devx_umem_reg(ctx,
 						(void *)(uintptr_t)sq->umem_buf,
-- 
2.29.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-02-05 11:18:34.294325380 +0000
+++ 0113-net-mlx5-fix-leak-on-ASO-SQ-creation-failure.patch	2021-02-05 11:18:28.986694539 +0000
@@ -1 +1 @@
-From 0e8273176e60d813a8a905e4ce38bbd18a1e2470 Mon Sep 17 00:00:00 2001
+From bc316de164b02f7675023aa1d27ac6a0c63ba5ee Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 0e8273176e60d813a8a905e4ce38bbd18a1e2470 ]
+
@@ -14 +15,0 @@
-Cc: stable@dpdk.org
@@ -23 +24 @@
-index 1f15f19800..e8676071fc 100644
+index cea2cf769d..0ea61be4eb 100644
@@ -26 +27 @@
-@@ -279,7 +279,8 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket,
+@@ -278,7 +278,8 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket,
@@ -34 +35 @@
- 	sq->wqe_umem = mlx5_os_umem_reg(ctx,
+ 	sq->wqe_umem = mlx5_glue->devx_umem_reg(ctx,