OSDN Git Service

net: stmmac: Do not accept invalid MTU values
authorJose Abreu <Jose.Abreu@synopsys.com>
Wed, 18 Dec 2019 10:17:37 +0000 (11:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Dec 2019 20:04:17 +0000 (12:04 -0800)
commiteaf4fac478077d4ed57cbca2c044c4b58a96bd98
tree8dc4dc1f04b454a052cc614ea0fd6c2fc00fa1ad
parent5d626c879e238be9585bd59a61eb606c9408178a
net: stmmac: Do not accept invalid MTU values

The maximum MTU value is determined by the maximum size of TX FIFO so
that a full packet can fit in the FIFO. Add a check for this in the MTU
change callback.

Also check if provided and rounded MTU does not passes the maximum limit
of 16K.

Changes from v2:
- Align MTU before checking if its valid

Fixes: 7ac6653a085b ("stmmac: Move the STMicroelectronics driver")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c