summaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_ethtool.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2005-11-08 21:59:30 +0100
committerJohn W. Linville <linville@tuxdriver.com>2005-11-18 19:52:39 +0100
commit6b27adb607282addcfe2707783dfcc28ba3a753b (patch)
tree23cbb0796320ac9f77f3c5613d9dd6bcb4bf690a /drivers/net/e1000/e1000_ethtool.c
parent[PATCH] e1000: avoid leak when e1000_setup_loopback_test fails (diff)
downloadlinux-6b27adb607282addcfe2707783dfcc28ba3a753b.tar.xz
linux-6b27adb607282addcfe2707783dfcc28ba3a753b.zip
[PATCH] e1000: zero-out pointers in e1000_free_desc_rings
In e1000_free_desc_rings, zero-out pointers after the memory they point to is freed. The test rings are static and get re-used, and failures during subsequent test setups can cause e1000_free_desc_rings to get called with dirty pointers. Dirty pointers can cause oopses or crashes... Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r--drivers/net/e1000/e1000_ethtool.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 8584e9382c2c..8646914964e7 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -960,13 +960,21 @@ e1000_free_desc_rings(struct e1000_adapter *adapter)
}
}
- if(txdr->desc)
+ if(txdr->desc) {
pci_free_consistent(pdev, txdr->size, txdr->desc, txdr->dma);
- if(rxdr->desc)
+ txdr->desc = NULL;
+ }
+ if(rxdr->desc) {
pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma);
+ rxdr->desc = NULL;
+ }
kfree(txdr->buffer_info);
+ txdr->buffer_info = NULL;
+
kfree(rxdr->buffer_info);
+ rxdr->buffer_info = NULL;
+
return;
}