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 9BD37454E8 for ; Tue, 25 Jun 2024 01:59:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9673A40EE7; Tue, 25 Jun 2024 01:59:55 +0200 (CEST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id E66AA400EF for ; Tue, 25 Jun 2024 01:59:54 +0200 (CEST) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-42198492353so41504135e9.1 for ; Mon, 24 Jun 2024 16:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273594; x=1719878394; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HitB3WnEdH3ti3E4SoD1dv6aReYXSG5jSb6PdSndZbI=; b=ZaTnk/bHXTZdlardwX/9cfZZseXoFezWwuKVE3jJNlG1EVVn/ChRxobuPKKWtrzHJJ d+CcwoVy39oDT5b7cT0Gf6ijizR00pHz7DuLUaRBvnmd5hrp4NDr2P/2s2iqH0medS1d qqa9JckggmA/QG4599bM9+go5luusTNACUKkcKTWuM+w+WtwTc8ym3psWzKWXTUbq1DC mm9b/k1i8LfZFhoEIgr151++5oqwk3NJOTHFEtwJDsu2fYzDFjGvQoPMr7iUmjdiKwDQ temA+MrD0tHfRqQ/mJY6XSxhUzlY3Zei0ItPDDR9pyerGcKt9W4XucBnhkBT1YmleWFR GyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273594; x=1719878394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HitB3WnEdH3ti3E4SoD1dv6aReYXSG5jSb6PdSndZbI=; b=IzCVAYOSEU8mLcqXdiGTY226PzYMgesLpFrYUZYG4YjLZCeBiWJpd/lUeTEXoV73Dh NboUlKx1/7rEylvjWpbqumcE7IAKU36wYPyY9wBVD7+CtqsrTBgsAIUKXH20Zuynz1Hp IVSM1916o+treFOzPnVrC/kL3UtO4Lq4Z+vOhle+E9u5U9RK8OuVdfo36ni33u5pABv6 HHxhplEtGb4BVRmonszE4f2lBGOQa5kpVsyGN5thfG69fQRBthes0GnB6WSPOZYB/iDL 05ObNRx9XSBWibHfmvrY+lYVXiwgc/n1w6Yx/Fj5ap4FsmLa9e2t3xjHgiKSt/OdI3+E wkrg== X-Forwarded-Encrypted: i=1; AJvYcCUyuTHS8D/fAlMDEBGAi3A36KSiEsUdZDHLY+54SIkQm7674MAdb3Ccp4ZWJOr2T3WyoZYqxcg8P3OwNwXEjXY= X-Gm-Message-State: AOJu0YzXFEL08e+PrA6lwzHYOvaC3lJn3taK4UTd0xPwPSvpppE26t/O Dn7uK+vGJ+u4tcpOcas+2ZWrovDzvH72HBc9SxoXmurNB64weI3pIjXvaw== X-Google-Smtp-Source: AGHT+IEUGwgiCwPZtOrGwttnUvS5XcnSHNB90fZWw3wXKSgvcPg7N2bjJtnCzN5GDkD47aWy4aff8Q== X-Received: by 2002:a05:600c:4907:b0:423:b633:75e8 with SMTP id 5b1f17b1804b1-4248cc3517bmr40725915e9.20.1719273594519; Mon, 24 Jun 2024 16:59:54 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a2f8268sm11292949f8f.79.2024.06.24.16.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 16:59:54 -0700 (PDT) From: luca.boccassi@gmail.com To: Dengdui Huang Cc: Jie Hai , dpdk stable Subject: patch 'net/hns3: fix double free for Rx/Tx queue' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:57:58 +0100 Message-Id: <20240624235907.885628-12-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 22.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 06/27/24. 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/8ec7b95de7673fe8085ae92aa829a5e71b200211 Thanks. Luca Boccassi --- >From 8ec7b95de7673fe8085ae92aa829a5e71b200211 Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Wed, 3 Apr 2024 18:16:21 +0800 Subject: [PATCH] net/hns3: fix double free for Rx/Tx queue [ upstream commit bbf6fcc0cc62031a26517608a471873339423d8c ] The Pointers to some resources on the Rx/Tx queue need to be set to NULL after free inside the hns3_rx/tx_queue_release(), as this function is called from multiple threads (reset thread, device config thread, etc), leading to double memory free error. Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Signed-off-by: Dengdui Huang Signed-off-by: Jie Hai --- drivers/net/hns3/hns3_rxtx.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 392df0bae5..c0479a44dc 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -86,9 +86,14 @@ hns3_rx_queue_release(void *queue) struct hns3_rx_queue *rxq = queue; if (rxq) { hns3_rx_queue_release_mbufs(rxq); - if (rxq->mz) + if (rxq->mz) { rte_memzone_free(rxq->mz); - rte_free(rxq->sw_ring); + rxq->mz = NULL; + } + if (rxq->sw_ring) { + rte_free(rxq->sw_ring); + rxq->sw_ring = NULL; + } rte_free(rxq); } } @@ -99,10 +104,18 @@ hns3_tx_queue_release(void *queue) struct hns3_tx_queue *txq = queue; if (txq) { hns3_tx_queue_release_mbufs(txq); - if (txq->mz) + if (txq->mz) { rte_memzone_free(txq->mz); - rte_free(txq->sw_ring); - rte_free(txq->free); + txq->mz = NULL; + } + if (txq->sw_ring) { + rte_free(txq->sw_ring); + txq->sw_ring = NULL; + } + if (txq->free) { + rte_free(txq->free); + txq->free = NULL; + } rte_free(txq); } } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:14.280983267 +0100 +++ 0012-net-hns3-fix-double-free-for-Rx-Tx-queue.patch 2024-06-25 00:22:13.089183692 +0100 @@ -1 +1 @@ -From bbf6fcc0cc62031a26517608a471873339423d8c Mon Sep 17 00:00:00 2001 +From 8ec7b95de7673fe8085ae92aa829a5e71b200211 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit bbf6fcc0cc62031a26517608a471873339423d8c ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 55311402fe..bf10da1928 100644 +index 392df0bae5..c0479a44dc 100644