Commit 6b27adb6 authored by John W. Linville's avatar John W. Linville

[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: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e98fc4aa
...@@ -960,13 +960,21 @@ e1000_free_desc_rings(struct e1000_adapter *adapter) ...@@ -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); 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); pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma);
rxdr->desc = NULL;
}
kfree(txdr->buffer_info); kfree(txdr->buffer_info);
txdr->buffer_info = NULL;
kfree(rxdr->buffer_info); kfree(rxdr->buffer_info);
rxdr->buffer_info = NULL;
return; return;
} }
......
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