From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0674C23E342; Mon, 13 Apr 2026 16:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098777; cv=none; b=WwrU3ZwyQn22OYwA7pbxog9VX98O8HsfXjnGp7CT+S2bDdFjnDhVQ1WBho6hHbCmteppUyD0wLedSzAtOzPAwVQWZWvNUJ3seh/5U1jjYf2IZ1ITFVnVMW62mdv4/Qb+hdryBXqPMlU77Fw/oSyMIbQDOKRexrBLxhUIipc7WWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098777; c=relaxed/simple; bh=+32/NHL/Hs/S7OSCUX8XQJyiAPRoev1Ms/TxaNTFma8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KZmMyEDBlGTUFV24bZYIPMxtx/zGgYKF4XV0nHMp51peiXuozrj/k4whFcO/+FcNV4g8+8wr/VkLs1G/aDoGp49HhZeXK6hJXiTgM0d1xeDF0q6BzgEDxO0u96Ue6sxz23JrSCtrEWWd8TSZsXQW5mitIw5ED8bKfXNQHNeCQp0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lzHI/cAR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lzHI/cAR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A086C2BCAF; Mon, 13 Apr 2026 16:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776098776; bh=+32/NHL/Hs/S7OSCUX8XQJyiAPRoev1Ms/TxaNTFma8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lzHI/cARHDMoZ65nmGsAc5c8ZkGqCNh+0dg4UKbCzMuL0qgo6ICaoC2yg/AYWqKkY QuWHQS2hbNT5AfbHLxV9p9xod+VxUubSYOIr0mmVk1qh4hev7SeD9xFvDgRhWvvvlM gQg0JWa5CharSOb7IQFFE7ExKPKoR6CdTGCSVnok= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Matt Vollrath , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 085/491] e1000/e1000e: Fix leak in DMA error cleanup Date: Mon, 13 Apr 2026 17:55:30 +0200 Message-ID: <20260413155822.226231287@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matt Vollrath [ Upstream commit e94eaef11142b01f77bf8ba4d0b59720b7858109 ] If an error is encountered while mapping TX buffers, the driver should unmap any buffers already mapped for that skb. Because count is incremented after a successful mapping, it will always match the correct number of unmappings needed when dma_error is reached. Decrementing count before the while loop in dma_error causes an off-by-one error. If any mapping was successful before an unsuccessful mapping, exactly one DMA mapping would leak. In these commits, a faulty while condition caused an infinite loop in dma_error: Commit 03b1320dfcee ("e1000e: remove use of skb_dma_map from e1000e driver") Commit 602c0554d7b0 ("e1000: remove use of skb_dma_map from e1000 driver") Commit c1fa347f20f1 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()") fixed the infinite loop, but introduced the off-by-one error. This issue may still exist in the igbvf driver, but I did not address it in this patch. Fixes: c1fa347f20f1 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()") Assisted-by: Claude:claude-4.6-opus Signed-off-by: Matt Vollrath Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e1000/e1000_main.c | 2 -- drivers/net/ethernet/intel/e1000e/netdev.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 0b75029029132..d7e7c619a98e2 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -2951,8 +2951,6 @@ static int e1000_tx_map(struct e1000_adapter *adapter, dma_error: dev_err(&pdev->dev, "TX DMA map failed\n"); buffer_info->dma = 0; - if (count) - count--; while (count--) { if (i == 0) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index b700663a634d2..902ada6a3b06c 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5633,8 +5633,6 @@ static int e1000_tx_map(struct e1000_ring *tx_ring, struct sk_buff *skb, dma_error: dev_err(&pdev->dev, "Tx DMA map failed\n"); buffer_info->dma = 0; - if (count) - count--; while (count--) { if (i == 0) -- 2.51.0