Skip to content

Commit

Permalink
ixgb: fix race on rx_buffer_len in mtu change
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesse Brandeburg authored and Jeff Garzik committed Jul 11, 2008
1 parent 3433663 commit b5ca88e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/net/ixgb/ixgb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,14 +1573,18 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu)
return -EINVAL;
}

if (old_max_frame == max_frame)
return 0;

if (netif_running(netdev))
ixgb_down(adapter, true);

adapter->rx_buffer_len = max_frame + 8; /* + 8 for errata */

netdev->mtu = new_mtu;

if ((old_max_frame != max_frame) && netif_running(netdev)) {
ixgb_down(adapter, true);
if (netif_running(netdev))
ixgb_up(adapter);
}

return 0;
}
Expand Down

0 comments on commit b5ca88e

Please sign in to comment.