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 461CC4624E for ; Mon, 17 Feb 2025 18:05:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C41D402C6; Mon, 17 Feb 2025 18:05:38 +0100 (CET) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id 80424402AB for ; Mon, 17 Feb 2025 18:05:36 +0100 (CET) Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-38f2b7ce2e5so1745887f8f.2 for ; Mon, 17 Feb 2025 09:05:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739811936; x=1740416736; 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=rgdItJXvFZHW893KwP1XHnXv6sWMXa4fTr6PAkIOpr8=; b=SWylrEZaX1p42NmEgwZcFDNQW1kb2nyLPKy0/oc3igfEy7Q9MrK/swOyRb1/CawPJw cE2Gh4141JLMpxZgJbaopu6dIXkoA/ak/EUAch5KiWeevOFBSTmf3UhvYxc+LB68sNAG gjt9AARB5ODQPNFSWXmU7MlULdMXy83ORxMB23RT5i7fOXTetIh6hsCDjbjtwgb0mfLE tCZIY3vJqJcHqNNFG7VUOujcocmpSMsc9GNCQFgW6rN5voydB6amSqc9pA3l8RnAJf9q rVM76vb5uKLWFt23rDaVEoJUgmw/yhPDuulXm/+QJ/MkbCyCBqhpIm+HLeyeip1e773K 0YAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739811936; x=1740416736; 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=rgdItJXvFZHW893KwP1XHnXv6sWMXa4fTr6PAkIOpr8=; b=e2odtgDAcnoPqEBtIdJuCyJnQZkmk+sVF1Cqj3pkNbVlGN7xtzajRuhdk6g4udV2pL PqS8Ul+eBxxEGpRwD3d1u2Xz4TuW95jQTbgHpzRsi18HCY707/hBMNLQNLKAb9C+xgDO OwfGMZ9l/vds/bHm/VoYz79Ez9qij1DJfslxVIbopfCNXVWD6UOK1Os/By7xjNU8U9Pj uvlLLHxWcnYosUAYyQ8d5TGz/ZdPeH9pUCcXtsFcNM4CVfgg7M7rQCjCy9N11ipI0sGS +mEy4YUcI+9qQlrHNVmF6UoXl7fOe9yR6RucNTKB0ssPF/mxDDqTCi44xjeY0CgquMt+ xVMQ== X-Forwarded-Encrypted: i=1; AJvYcCXP5TWACqz+46ytmQq7jyKUsrN31Is13lM4Nj2FU8sqBxdAIWa03syf/hPMcy/M0AL9SVYEACo=@dpdk.org X-Gm-Message-State: AOJu0YzOWoMxQO33Rxec1pjJO6k1781FYr5khMkedIqP8V3xUz5ayD+0 YdRhTBgFQUGH+FL/yDr0ey9h2g9zNsM6EGgav+ws9JGhRo07LalLYyEnjewkpEE= X-Gm-Gg: ASbGncvj9O4GeocFg9mxHIzqoPqvDEvR1j/Ien3hvS3EmJhgMFPeo2L8cZU3xdtSK94 Xo+XhsKUYv+dBptpyDP48lEODK5kXOJaerjmEZI+xacwdybQucd+h2p3KrdHq1nu2KMEbfFY2/N z5qA07RtTWwVjMO/kog4rvADx4B7qNFftZRqj5wRWmLFQEkXSUBy4VmXgyXWlbSfv4TVN/Ph6cH ahoBn5QE7ZPheei2+iypzPIKnXTAsBtSHMYtVqQoRGC8asziUSWCFVs8x3uGdWENF0J7BID1kil ioh7gih7S6QQsxNmJka95g== X-Google-Smtp-Source: AGHT+IFUN+afYqSZo4uCTNqtA+rDazzmf9Oro3njAWQ3ejqGJMzkAObMPKSWewYIK8t5sd7X3vNLdA== X-Received: by 2002:a5d:6d81:0:b0:38d:d0ca:fbd5 with SMTP id ffacd0b85a97d-38f33f44dd0mr6853135f8f.22.1739811935866; Mon, 17 Feb 2025 09:05:35 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:f83c:95e7:29fd:a997]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38f258dcf08sm12948541f8f.36.2025.02.17.09.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 09:05:35 -0800 (PST) From: luca.boccassi@gmail.com To: Vladimir Medvedkin Cc: Bruce Richardson , dpdk stable Subject: patch 'net/ice: fix memory leak in scalar Rx' has been queued to stable release 22.11.8 Date: Mon, 17 Feb 2025 17:03:47 +0000 Message-ID: <20250217170456.1068278-14-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250217170456.1068278-1-luca.boccassi@gmail.com> References: <20250217170456.1068278-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.8 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/19/25. 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/e2b8339be196c4704b5441d4fc484b9081e27ef4 Thanks. Luca Boccassi --- >From e2b8339be196c4704b5441d4fc484b9081e27ef4 Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin Date: Fri, 17 Jan 2025 17:52:05 +0000 Subject: [PATCH] net/ice: fix memory leak in scalar Rx [ upstream commit 07cbd0b43ce4af9d628c8ad751789934d0a8c4a7 ] If the buffer splitting feature is configured and the payload mbuf allocation fails, the previously allocated header mbuf may be returned not fully initialized or a memory leak may occur. This patch handles this case correctly by freeing the corresponding header buffer. Fixes: 629dad3ef325 ("net/ice: support buffer split in scalar Rx") Signed-off-by: Vladimir Medvedkin Acked-by: Bruce Richardson --- drivers/net/ice/ice_rxtx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 93b284ad87..0814c79bde 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -483,6 +483,7 @@ ice_alloc_rx_queue_mbufs(struct ice_rx_queue *rxq) struct rte_mbuf *mbuf_pay; mbuf_pay = rte_mbuf_raw_alloc(rxq->rxseg[1].mp); if (unlikely(!mbuf_pay)) { + rte_pktmbuf_free(mbuf); PMD_DRV_LOG(ERR, "Failed to allocate payload mbuf for RX"); return -ENOMEM; } @@ -1873,6 +1874,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) diag_pay = rte_mempool_get_bulk(rxq->rxseg[1].mp, (void *)mbufs_pay, rxq->rx_free_thresh); if (unlikely(diag_pay != 0)) { + rte_mempool_put_bulk(rxq->mp, (void *)rxep, + rxq->rx_free_thresh); PMD_RX_LOG(ERR, "Failed to get payload mbufs in bulk"); return -ENOMEM; } @@ -2579,6 +2582,13 @@ ice_recv_pkts(void *rx_queue, nmb_pay = rte_mbuf_raw_alloc(rxq->rxseg[1].mp); if (unlikely(!nmb_pay)) { rxq->vsi->adapter->pf.dev_data->rx_mbuf_alloc_failed++; + rxe->mbuf = NULL; + nb_hold--; + if (unlikely(rx_id == 0)) + rx_id = rxq->nb_rx_desc; + + rx_id--; + rte_pktmbuf_free(nmb); break; } -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-17 16:13:17.387522423 +0000 +++ 0014-net-ice-fix-memory-leak-in-scalar-Rx.patch 2025-02-17 16:13:16.798441593 +0000 @@ -1 +1 @@ -From 07cbd0b43ce4af9d628c8ad751789934d0a8c4a7 Mon Sep 17 00:00:00 2001 +From e2b8339be196c4704b5441d4fc484b9081e27ef4 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 07cbd0b43ce4af9d628c8ad751789934d0a8c4a7 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 0c7106c7e0..f58df9bdfe 100644 +index 93b284ad87..0814c79bde 100644 @@ -24 +25 @@ -@@ -484,6 +484,7 @@ ice_alloc_rx_queue_mbufs(struct ice_rx_queue *rxq) +@@ -483,6 +483,7 @@ ice_alloc_rx_queue_mbufs(struct ice_rx_queue *rxq) @@ -32 +33 @@ -@@ -1900,6 +1901,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) +@@ -1873,6 +1874,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) @@ -41 +42 @@ -@@ -2607,6 +2610,13 @@ ice_recv_pkts(void *rx_queue, +@@ -2579,6 +2582,13 @@ ice_recv_pkts(void *rx_queue,