net: stmmac: fix dropping of multi-descriptor RX frames
authorAaro Koskinen <aaro.koskinen@nokia.com>
Wed, 27 Mar 2019 20:35:39 +0000 (22:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:22:51 +0000 (07:22 +0200)
commitf3b6acbaff395b2d3ad5704da18552081f0d356b
treeb1c9ba3effd793f957769c9c9806830e71675a26
parente6b88961c8886b95e62e9f837882be6abbdc8fe1
net: stmmac: fix dropping of multi-descriptor RX frames

[ Upstream commit 8ac0c24fe1c256af6644caf3d311029440ec2fbd ]

Packets without the last descriptor set should be dropped early. If we
receive a frame larger than the DMA buffer, the HW will continue using the
next descriptor. Driver mistakes these as individual frames, and sometimes
a truncated frame (without the LD set) may look like a valid packet.

This fixes a strange issue where the system replies to 4098-byte ping
although the MTU/DMA buffer size is set to 4096, and yet at the same
time it's logging an oversized packet.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/enh_desc.c