mirror of https://gitee.com/openkylin/linux.git
IB/ipoib: Ensure that MTU isn't less than minimum permitted
It is illegal to change MTU to a value lower than the minimum MTU stated in ethernet spec. In addition to that we need to add 4 bytes for encapsulation header (IPOIB_ENCAP_LEN). Before "ifconfig ib0 mtu 0" command, succeeds while it obviously shouldn't. Signed-off-by: Muhammad Sammar <muhammads@mellanox.com> Reviewed-by: Feras Daoud <ferasda@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
6c75520f7e
commit
142a9c2876
|
@ -243,7 +243,8 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu))
|
||||
if (new_mtu < (ETH_MIN_MTU + IPOIB_ENCAP_LEN) ||
|
||||
new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu))
|
||||
return -EINVAL;
|
||||
|
||||
priv->admin_mtu = new_mtu;
|
||||
|
|
Loading…
Reference in New Issue