net: stmmac: use correct DMA buffer size in the RX descriptor
authorAaro Koskinen <aaro.koskinen@nokia.com>
Wed, 27 Mar 2019 20:35:35 +0000 (22:35 +0200)
committerzihuan.ling <zihuan.ling@amlogic.com>
Fri, 1 Nov 2019 10:57:21 +0000 (18:57 +0800)
commit231f1d4c1c1184bfa6b59031eb40958be50393d3
treeb3ed6f83257fbe8f998656c551f4e71705873681
parent7cdf81e92ac936b8da69a41ead7c77c27f5a7f20
net: stmmac: use correct DMA buffer size in the RX descriptor

PD#TV-11316

[ Upstream commit 583e6361414903c5206258a30e5bd88cb03c0254 ]

We always program the maximum DMA buffer size into the receive descriptor,
although the allocated size may be less. E.g. with the default MTU size
we allocate only 1536 bytes. If somebody sends us a bigger frame, then
memory may get corrupted.

Fix by using exact buffer sizes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Change-Id: I32f3f0758ee6df0217dd9d1275c08b04163d811b
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
Signed-off-by: zihuan.ling <zihuan.ling@amlogic.com>
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/descs_com.h
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
drivers/net/ethernet/stmicro/stmmac/enh_desc.c
drivers/net/ethernet/stmicro/stmmac/norm_desc.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c