summaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_main.c
diff options
context:
space:
mode:
authorAjit Khaparde <ajitkhaparde@gmail.com>2010-02-09 02:32:43 +0100
committerDavid S. Miller <davem@davemloft.net>2010-02-12 21:27:58 +0100
commit34a89b8c75abe2873a95524552cc266fdd3b6a85 (patch)
treefc1af457d8100289e6a5798dcd3902c8a20d89e3 /drivers/net/benet/be_main.c
parentbe2net: bug fix for flashing the BladeEngine3 ASIC (diff)
downloadlinux-34a89b8c75abe2873a95524552cc266fdd3b6a85.tar.xz
linux-34a89b8c75abe2873a95524552cc266fdd3b6a85.zip
be2net: bug fix in be_change_mtu
Current code allows the new mtu to cross the supported value. This patch fixes the boundary checks. From: Suresh R <sureshr@serverengines.com> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r--drivers/net/benet/be_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 99061488eeb3..c65c63427d41 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -473,10 +473,12 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
{
struct be_adapter *adapter = netdev_priv(netdev);
if (new_mtu < BE_MIN_MTU ||
- new_mtu > BE_MAX_JUMBO_FRAME_SIZE) {
+ new_mtu > (BE_MAX_JUMBO_FRAME_SIZE -
+ (ETH_HLEN + ETH_FCS_LEN))) {
dev_info(&adapter->pdev->dev,
"MTU must be between %d and %d bytes\n",
- BE_MIN_MTU, BE_MAX_JUMBO_FRAME_SIZE);
+ BE_MIN_MTU,
+ (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN)));
return -EINVAL;
}
dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n",