netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/7] be2net: bug fix in be_change_mtu
@ 2010-02-09 11:32 Ajit Khaparde
  2010-02-12 20:29 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ajit Khaparde @ 2010-02-09 11:32 UTC (permalink / raw)
  To: davem, netdev

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>
---
 drivers/net/benet/be_main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 1d773db..f1136a3 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",
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/7] be2net: bug fix in be_change_mtu
  2010-02-09 11:32 [PATCH 3/7] be2net: bug fix in be_change_mtu Ajit Khaparde
@ 2010-02-12 20:29 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-02-12 20:29 UTC (permalink / raw)
  To: ajitk, ajitkhaparde; +Cc: netdev

From: Ajit Khaparde <ajitkhaparde@gmail.com>
Date: Tue, 9 Feb 2010 17:02:43 +0530

> 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>

Applied to net-next-2.6

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-12 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 11:32 [PATCH 3/7] be2net: bug fix in be_change_mtu Ajit Khaparde
2010-02-12 20:29 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).