diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-07-08 18:51:42 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-11 01:20:27 -0400 |
commit | b5ca88eb335580dc48ef5ebb3b86719bdb5a4113 (patch) | |
tree | 72e203e8a8ef8e3e090baf7b63a0c037ebf1a3ae /drivers/net/ixgb/ixgb_main.c | |
parent | 34336635467c5102777ea8acf34fc8bf391f98c0 (diff) |
ixgb: fix race on rx_buffer_len in mtu change
some random coverage testing found that when changing mtu
under heavy traffic load, NAPI would use the rx_buffer_len variable
after it had been changed by change_mtu.
Similar to e1000 bugs found long ago.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/ixgb/ixgb_main.c')
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 4bf6bbc65822..c3234c451043 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1573,14 +1573,18 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu) | |||
1573 | return -EINVAL; | 1573 | return -EINVAL; |
1574 | } | 1574 | } |
1575 | 1575 | ||
1576 | if (old_max_frame == max_frame) | ||
1577 | return 0; | ||
1578 | |||
1579 | if (netif_running(netdev)) | ||
1580 | ixgb_down(adapter, true); | ||
1581 | |||
1576 | adapter->rx_buffer_len = max_frame + 8; /* + 8 for errata */ | 1582 | adapter->rx_buffer_len = max_frame + 8; /* + 8 for errata */ |
1577 | 1583 | ||
1578 | netdev->mtu = new_mtu; | 1584 | netdev->mtu = new_mtu; |
1579 | 1585 | ||
1580 | if ((old_max_frame != max_frame) && netif_running(netdev)) { | 1586 | if (netif_running(netdev)) |
1581 | ixgb_down(adapter, true); | ||
1582 | ixgb_up(adapter); | 1587 | ixgb_up(adapter); |
1583 | } | ||
1584 | 1588 | ||
1585 | return 0; | 1589 | return 0; |
1586 | } | 1590 | } |