]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitdb3a713a7d70156667969599c4021daecdf4999c
tree8dc4dc1f04b454a052cc614ea0fd6c2fc00fa1ad
parent52ea3e4705b5f06de84880a15e137c68d16b4251
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: b79e142dc092 ("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