From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ADC4546080; Mon, 27 Jan 2025 11:54:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D96140275; Mon, 27 Jan 2025 11:54:01 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 6F53340265 for ; Mon, 27 Jan 2025 11:53:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737975238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8jxf4MH5keVeltxTSvxLT3snvHc4rSypFZL8rCxbNbo=; b=JMPb6dA3eiBcS0YmM9/HLtK+WDYjjnRe6SLnPm9rJUasXkFaU6cJrdAYlMp0CTJFqsXc+n xqdjKtT0ljGYzS0rRQZlxBmB/9G7QVkC7andwJd+ERjDdHr8jrn206hycSDRZYHepxJDCb Ilyydxxs5yN94rWEMMUxcCuIe9X/Vz4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-eR9tQY6vPhq0Z6r5gpzz1w-1; Mon, 27 Jan 2025 05:53:57 -0500 X-MC-Unique: eR9tQY6vPhq0Z6r5gpzz1w-1 X-Mimecast-MFC-AGG-ID: eR9tQY6vPhq0Z6r5gpzz1w Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B02518009B8; Mon, 27 Jan 2025 10:53:55 +0000 (UTC) Received: from dmarchan.com (unknown [10.45.224.253]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4065E195608A; Mon, 27 Jan 2025 10:53:51 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Dariusz Sosnowski , Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad , Xiaoyu Min Subject: [PATCH] net/mlx5: fix leak in HWS flow counter action Date: Mon, 27 Jan 2025 11:53:47 +0100 Message-ID: <20250127105347.1077802-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 9oFimtuT-VufwmngOoBpZKJTeYMQA0fT7XPzrIO3Muk_1737975235 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This was caught by our internal covscan. mp_name can be leaked in case of errors. Fixes: 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/mlx5/mlx5_hws_cnt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c index 0197c098f6..eaceedd5ba 100644 --- a/drivers/net/mlx5/mlx5_hws_cnt.c +++ b/drivers/net/mlx5/mlx5_hws_cnt.c @@ -723,7 +723,7 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, if (priv->sh->cnt_svc == NULL) { ret = mlx5_hws_cnt_svc_init(priv->sh, error); if (ret) - return ret; + goto error; } cparam.fetch_sz = HWS_CNT_CACHE_FETCH_DEFAULT; cparam.preload_sz = HWS_CNT_CACHE_PRELOAD_DEFAULT; @@ -767,6 +767,7 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev, MLX5_ASSERT(ret); mlx5_hws_cnt_pool_destroy(priv->sh, cpool); priv->hws_cpool = NULL; + mlx5_free(mp_name); return ret; } -- 2.47.1