Commit ee400a3f authored by Bo Chen's avatar Bo Chen Committed by Jeff Kirsher

e1000: ensure to free old tx/rx rings in set_ringparam()

In 'e1000_set_ringparam()', the tx_ring and rx_ring are updated with new value
and the old tx/rx rings are freed only when the device is up. There are resource
leaks on old tx/rx rings when the device is not up. This bug is reported by COD,
a tool for testing kernel module binaries I am building.

This patch fixes the bug by always calling 'kfree()' on old tx/rx rings in
'e1000_set_ringparam()'.
Signed-off-by: default avatarBo Chen <chenbo@pdx.edu>
Reviewed-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent cf1acec0
...@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev, ...@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev,
adapter->tx_ring = tx_old; adapter->tx_ring = tx_old;
e1000_free_all_rx_resources(adapter); e1000_free_all_rx_resources(adapter);
e1000_free_all_tx_resources(adapter); e1000_free_all_tx_resources(adapter);
kfree(tx_old);
kfree(rx_old);
adapter->rx_ring = rxdr; adapter->rx_ring = rxdr;
adapter->tx_ring = txdr; adapter->tx_ring = txdr;
err = e1000_up(adapter); err = e1000_up(adapter);
if (err) if (err)
goto err_setup; goto err_setup;
} }
kfree(tx_old);
kfree(rx_old);
clear_bit(__E1000_RESETTING, &adapter->flags); clear_bit(__E1000_RESETTING, &adapter->flags);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment