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 B6730A0547 for ; Mon, 19 Apr 2021 10:58:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACC8F40040; Mon, 19 Apr 2021 10:58:03 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 0FCA940040 for ; Mon, 19 Apr 2021 10:58:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618822682; 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: in-reply-to:in-reply-to:references:references; bh=0gQIaiAhuXVENX8Vej8EPe81XIB/aC4nNKaFj9bxXoM=; b=CoFZt7x8t8MFQlWtaKCgihwC589WiTx0FO5mYRYdM2lpcgfl/GZgb17gpKUnLaD6KxXVCK FDT0v7Mq75+OIcSc1o0wv1dXhpvEu5sJpCoK3e+QYYXQM7xa3eYhwL2keD+5JYSHIsZAMC F0zWTB6+V6EkBR8Jc0bRRzMDW7EG2wA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-LzpvTUrwN-mdDK3RcHOsuA-1; Mon, 19 Apr 2021 04:56:54 -0400 X-MC-Unique: LzpvTUrwN-mdDK3RcHOsuA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4A80107ACC7; Mon, 19 Apr 2021 08:56:52 +0000 (UTC) Received: from [10.36.112.162] (ovpn-112-162.ams2.redhat.com [10.36.112.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id A867A5D742; Mon, 19 Apr 2021 08:56:51 +0000 (UTC) To: Viacheslav Ovsiienko , stable@dpdk.org Cc: bluca@debian.org, Christian Ehrhardt References: <20210417183808.5668-1-viacheslavo@nvidia.com> From: Kevin Traynor Message-ID: <28f44936-21de-95aa-1ebc-a61fcaa496ef@redhat.com> Date: Mon, 19 Apr 2021 09:56:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210417183808.5668-1-viacheslavo@nvidia.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [PATCH] net/mlx5: fix buffer leakage on Tx queue release X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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" Relevant for 19.11 and 20.11 LTS +cc Christian (19.11 LTS maintainer) On 17/04/2021 19:38, Viacheslav Ovsiienko wrote: > On Tx queue release the mlx5 PMD freed the mbufs stored > in the elts array (holds buffers being transmitted) only > for zero reference counter. The one reference is hold > for the queue release call. Hence, on device stop call > the reference counter was at least 2 and elts array was > not freed. If application called the device start without > queue release the elts array was cleaned up and the > remaining mbufs were lost. > > Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx queues") > > Signed-off-by: Viacheslav Ovsiienko > > --- > This patch is applicable for 19.11LTS only (and possible for > preceeding releases), no bug in 20.11 and Upstream. > > drivers/net/mlx5/mlx5_txq.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c > index 9c929a57ea..d9576e7a64 100644 > --- a/drivers/net/mlx5/mlx5_txq.c > +++ b/drivers/net/mlx5/mlx5_txq.c > @@ -1415,6 +1415,8 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx) > txq = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); > if (txq->obj && !mlx5_txq_obj_release(txq->obj)) > txq->obj = NULL; > + if (rte_atomic32_read(&txq->refcnt <= 2) > + txq_free_elts(txq); > if (rte_atomic32_dec_and_test(&txq->refcnt)) { > txq_free_elts(txq); > mlx5_mr_btree_free(&txq->txq.mr_ctrl.cache_bh); >