Skip to content

Commit

Permalink
be2net: bug fix in be_change_mtu
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ajit Khaparde authored and David S. Miller committed Feb 12, 2010
1 parent 3f0d456 commit 34a89b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 34a89b8

Please sign in to comment.