* [PATCH net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init
@ 2024-10-15 8:17 Felix Fietkau
2024-10-15 12:39 ` Simon Horman
2024-10-17 10:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Felix Fietkau @ 2024-10-15 8:17 UTC (permalink / raw)
To: netdev, Sean Wang, Mark Lee, Lorenzo Bianconi, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
Jacob Keller
Cc: linux-kernel, linux-arm-kernel, linux-mediatek
The loop responsible for allocating up to MTK_FQ_DMA_LENGTH buffers must
only touch as many descriptors, otherwise it ends up corrupting unrelated
memory. Fix the loop iteration count accordingly.
Fixes: c57e55819443 ("net: ethernet: mtk_eth_soc: handle dma buffer size soc specific")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 16ca427cf4c3..ed7313c10a05 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1171,7 +1171,7 @@ static int mtk_init_fq_dma(struct mtk_eth *eth)
if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr)))
return -ENOMEM;
- for (i = 0; i < cnt; i++) {
+ for (i = 0; i < len; i++) {
struct mtk_tx_dma_v2 *txd;
txd = eth->scratch_ring + (j * MTK_FQ_DMA_LENGTH + i) * soc->tx.desc_size;
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init
2024-10-15 8:17 [PATCH net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init Felix Fietkau
@ 2024-10-15 12:39 ` Simon Horman
2024-10-17 10:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-10-15 12:39 UTC (permalink / raw)
To: Felix Fietkau
Cc: netdev, Sean Wang, Mark Lee, Lorenzo Bianconi, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Matthias Brugger, AngeloGioacchino Del Regno, Frank Wunderlich,
Jacob Keller, linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, Oct 15, 2024 at 10:17:55AM +0200, Felix Fietkau wrote:
> The loop responsible for allocating up to MTK_FQ_DMA_LENGTH buffers must
> only touch as many descriptors, otherwise it ends up corrupting unrelated
> memory. Fix the loop iteration count accordingly.
>
> Fixes: c57e55819443 ("net: ethernet: mtk_eth_soc: handle dma buffer size soc specific")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init
2024-10-15 8:17 [PATCH net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init Felix Fietkau
2024-10-15 12:39 ` Simon Horman
@ 2024-10-17 10:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-17 10:10 UTC (permalink / raw)
To: Felix Fietkau
Cc: netdev, sean.wang, Mark-MC.Lee, lorenzo, andrew+netdev, davem,
edumazet, kuba, pabeni, matthias.bgg, angelogioacchino.delregno,
frank-w, jacob.e.keller, linux-kernel, linux-arm-kernel,
linux-mediatek
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 15 Oct 2024 10:17:55 +0200 you wrote:
> The loop responsible for allocating up to MTK_FQ_DMA_LENGTH buffers must
> only touch as many descriptors, otherwise it ends up corrupting unrelated
> memory. Fix the loop iteration count accordingly.
>
> Fixes: c57e55819443 ("net: ethernet: mtk_eth_soc: handle dma buffer size soc specific")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>
> [...]
Here is the summary with links:
- [net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init
https://git.kernel.org/netdev/net/c/88806efc034a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-17 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 8:17 [PATCH net] net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init Felix Fietkau
2024-10-15 12:39 ` Simon Horman
2024-10-17 10:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).