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 0FA54A0527 for ; Mon, 9 Nov 2020 19:43:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0980C6883; Mon, 9 Nov 2020 19:43:58 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id AA6566883 for ; Mon, 9 Nov 2020 19:43:55 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id 23so9872162wrc.8 for ; Mon, 09 Nov 2020 10:43:55 -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=NETFGW3K/4ZeDXPhjO2yerXImrckS2eoFxgQ1v2aV1k=; b=B75o01KdbZO+8gQh7eInx5X9QPVUisN8zvfwwinWJQGJnY1P21bA+CrlwEThnVuFNa l9VKm7VjfE4z1Jkre1anbLfK171vzqLikJvjjJYZL+dKjvYJ3hJB251OI6UuGAy3iMDt DfnLpADHw02Sbt7d2X6m0/ApgBU1FES2hIX47WfNoRH+bwQpvh3qkw3JxZXCFm0fXIUb P11WwX3BHqQZzEhfbd/Cs247TdkSla6vrQYSTbNh/9DH3LPHBf/GuCgZZKJkXKChboYC P7dqH9T7oPYa59hGNpuUifZTujxz/+kXkqolyl/F40Y4ySqX4nwwC94dxPU+t5JYes/k Dy7A== 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=NETFGW3K/4ZeDXPhjO2yerXImrckS2eoFxgQ1v2aV1k=; b=hM4hG4vzGtbhKvXbeM0rHOxmqhhDQXv7gIbb0GJpYYIoFZ5uS9z3lwo+v0pvwWc2GN Q2OAaJaQXJXdHxwjGFgfZ9kpNVNbDS+ux9F6LfSQa6Nj11XgqPl8MVVdThtyEnVI2Wrm 0almqseSn02HDizeKJszLeeqTJ3VgE3Sx7dA0jfIpMOjdb1z1CS6FAm8HYLXLDmGjd8i Jui0SZwRF1EN++cVd557R55WZD9qUuWOjWvpckM8AGce1B2XWQDvosQ9UfjaBAFdVekB 4Ja0YuYRJ5O6RxUHMPGYyLR8z0skHbkNR8dFxJeg2fxOcvc37e+eWNhcGBvEAqYEnGYF qxtg== X-Gm-Message-State: AOAM5333+tMVkz/53J32d5D9dz4V8Kv8do+Ynvqw1gg38cL0RDqduy6v KDad7FfOqBGmTp8Xlse44LVGRaK8fsnWa+5T X-Google-Smtp-Source: ABdhPJzZRElFtJ4lI7jEVeCflnh1aEcaZSCnaXdYwO4EG2A6DXSiDRh64S4jbI9U9c4+5k84tzjpeg== X-Received: by 2002:a5d:69d1:: with SMTP id s17mr9073496wrw.104.1604947435491; Mon, 09 Nov 2020 10:43:55 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:7a8e:ed70:5c52:ea3]) by smtp.gmail.com with ESMTPSA id z14sm344083wmc.15.2020.11.09.10.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:43:54 -0800 (PST) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Liron Himi , dpdk stable Date: Mon, 9 Nov 2020 18:40:34 +0000 Message-Id: <20201109184111.3463090-46-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mvpp2: fix memory leak in error path' has been queued to stable release 19.11.6 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" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/11/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. 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/e30d958f1ec37a1a91f64a99b7b66a76fabbcfe5 Thanks. Luca Boccassi --- >From e30d958f1ec37a1a91f64a99b7b66a76fabbcfe5 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Thu, 22 Oct 2020 12:25:27 +0800 Subject: [PATCH] net/mvpp2: fix memory leak in error path [ upstream commit 1b2c17d60d978d2570baa9e5c478ebca1fce3859 ] In mrvl_create() allocated memory for 'mtr', we don't free it when profile get fails and it will lead to memory leak. We can get profile at the beginning of the function to fix it, before calling mtr = rte_zmalloc_socket(). Fixes: cdb53f8da628 ("net/mvpp2: support metering") Signed-off-by: Yunjian Wang Acked-by: Liron Himi --- drivers/net/mvpp2/mrvl_mtr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c index 39272acea4..2fa5cb43ad 100644 --- a/drivers/net/mvpp2/mrvl_mtr.c +++ b/drivers/net/mvpp2/mrvl_mtr.c @@ -329,6 +329,12 @@ mrvl_create(struct rte_eth_dev *dev, uint32_t mtr_id, struct mrvl_mtr_profile *profile; struct mrvl_mtr *mtr; + profile = mrvl_mtr_profile_from_id(priv, params->meter_profile_id); + if (!profile) + return -rte_mtr_error_set(error, EINVAL, + RTE_MTR_ERROR_TYPE_METER_PROFILE_ID, + NULL, "Profile id does not exist\n"); + mtr = mrvl_mtr_from_id(priv, mtr_id); if (mtr) return -rte_mtr_error_set(error, EEXIST, @@ -341,12 +347,6 @@ mrvl_create(struct rte_eth_dev *dev, uint32_t mtr_id, RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL, NULL); - profile = mrvl_mtr_profile_from_id(priv, params->meter_profile_id); - if (!profile) - return -rte_mtr_error_set(error, EINVAL, - RTE_MTR_ERROR_TYPE_METER_PROFILE_ID, - NULL, "Profile id does not exist\n"); - mtr->shared = shared; mtr->mtr_id = mtr_id; mtr->plcr_bit = MRVL_PLCR_BIT_INVALID; -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:12.990150595 +0000 +++ 0046-net-mvpp2-fix-memory-leak-in-error-path.patch 2020-11-09 18:40:11.167311842 +0000 @@ -1 +1 @@ -From 1b2c17d60d978d2570baa9e5c478ebca1fce3859 Mon Sep 17 00:00:00 2001 +From e30d958f1ec37a1a91f64a99b7b66a76fabbcfe5 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1b2c17d60d978d2570baa9e5c478ebca1fce3859 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org