* [PATCH] net: e1000: Fix some bugs in error handling code of e1000_probe()
@ 2019-05-03 14:28 Jia-Ju Bai
0 siblings, 0 replies; only message in thread
From: Jia-Ju Bai @ 2019-05-03 14:28 UTC (permalink / raw)
To: jeffrey.t.kirsher, davem
Cc: intel-wired-lan, netdev, linux-kernel, Jia-Ju Bai
When "hw->ce4100_gbe_mdio_base_virt = ioremap(...)" fails, the driver
does not free the memory allocated in e1000_sw_init(), and also calls
"iounmap(hw->ce4100_gbe_mido_base_virt)" that is unnecessary.
Besides, when e1000_sw_init() fails, the driver also calls
"iounmap(hw->ce4100_gbe_mido_base_virt)" but
hw->ce4100_gbe_mido_base_virt has not been assigned.
These bugs are found by a runtime fuzzing tool named FIZZER written by us.
To fix these bugs, the error handling code of e1000_probe() is adjusted.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/net/ethernet/intel/e1000/e1000_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 8fe9af0e2ab7..7743c4d9723f 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -1227,12 +1227,12 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (hw->flash_address)
iounmap(hw->flash_address);
+ iounmap(hw->ce4100_gbe_mdio_base_virt);
+err_mdio_ioremap:
kfree(adapter->tx_ring);
kfree(adapter->rx_ring);
-err_dma:
err_sw_init:
-err_mdio_ioremap:
- iounmap(hw->ce4100_gbe_mdio_base_virt);
+err_dma:
iounmap(hw->hw_addr);
err_ioremap:
disable_dev = !test_and_set_bit(__E1000_DISABLED, &adapter->flags);
--
2.17.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-03 14:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-03 14:28 [PATCH] net: e1000: Fix some bugs in error handling code of e1000_probe() Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).