]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init
authorFelix Fietkau <nbd@nbd.name>
Tue, 15 Oct 2024 08:17:55 +0000 (10:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Nov 2024 01:02:31 +0000 (02:02 +0100)
commit68cd084e3ec1512cd383cb3e9cf0ab7ab413724c
tree966b894dfb669b370a830fefed717b5249ac3702
parentf82eb34fb59a8fb96c19f4f492c20eb774140bb5
net: ethernet: mtk_eth_soc: fix memory corruption during fq dma init

[ Upstream commit 88806efc034a9830f483963326b99930ad519af1 ]

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>
Link: https://patch.msgid.link/20241015081755.31060-1-nbd@nbd.name
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mediatek/mtk_eth_soc.c