net: e1000: fix warning in iounmap on probe failure
Subsystems (4)
PATCH v5 1/1 net: e1000: fix warning in iounmap on probe failure
In e1000_probe(), the error unwinding path at err_sw_init unconditionally calls iounmap(hw->ce4100_gbe_mdio_base_virt). On non-CE4100 hardware, hw->ce4100_gbe_mdio_base_virt remains NULL.
Passing NULL to iounmap() triggers a WARN_ON_ONCE on x86 architectures. Furthermore, on CE4100 hardware, if probe fails before or during MDIO mapping, ce4100_gbe_mdio_base_virt is also NULL.
Fix this by adding a NULL pointer check before calling iounmap() on hw->ce4100_gbe_mdio_base_virt. iounmap(hw->hw_addr) remains unconditional because every code path reaching err_sw_init occurs after hw->hw_addr has been successfully mapped.
---
v5:
- Updated commit message and changelog to accurately describe the NULL pointer check implemented in the diff.
- Fixed subject string in the Fixes: tag to match commit 13acde8fffc0.
v4:
- Actually include the code changes (v3 was sent un-staged by mistake)
v3:
- Switched from pointer null-checks to checking hw->mac_type == e1000_ce4100
- Removed redundant check for hw->hw_addr since it cannot be NULL here
- Added missing Cc: stable tag and Closes tag
v2:
- Expanded commit message to answer reviewer questions (reproduction details)
- Added appropriate Fixes tags
drivers/net/ethernet/intel/e1000/e1000_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +2 -1
@@ -1227,7 +1227,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)kfree (adapter->rx_ring); err_dma: err_sw_init: -iounmap (hw->ce4100_gbe_mdio_base_virt); +if (hw->ce4100_gbe_mdio_base_virt) +iounmap (hw->ce4100_gbe_mdio_base_virt);iounmap (hw->hw_addr); err_ioremap: disable_dev = !test_and_set_bit (__E1000_DISABLED, &adapter->flags);
Signature · 1 line
2.47.3
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Quoted 77 lines
-----Original Message-----
From: Svyatoslav Nikolenko <[email protected]>
Sent: Monday, September 28, 2026 2:38 PM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]; Svyatoslav Nikolenko <[email protected]>; [email protected]; [email protected]
Subject: [PATCH net v5] net: e1000: fix warning in iounmap on probe failureIn
e1000_probe(), the error unwinding path aterr_sw_initunconditionally callsiounmap(hw->ce4100_gbe_mdio_base_virt). On non- CE4100 hardware,hw->ce4100_gbe_mdio_base_virtremains NULL.
Passing NULL toiounmap()triggers aWARN_ON_ONCEon x86 architectures.
Furthermore, on CE4100 hardware, if probe fails before or during MDIO mapping,ce4100_gbe_mdio_base_virtis also NULL.Fix this by adding a NULL pointer check before calling
iounmap()onhw->ce4100_gbe_mdio_base_virt.iounmap(hw->hw_addr)remainshw->unconditional
because every code path reachingerr_sw_initoccurs afterhw->hw_addrhas been successfully mapped.Reported-by [email protected]Fixes 13acde8fffc0 ("e1000: cleanup CE4100 MDIO registers access")Signed-off-by Svyatoslav Nikolenko <[email protected]>---
v5:
- Updated commit message and changelog to accurately describe the
NULL pointer
check implemented in the diff.
- Fixed subject string in the Fixes: tag to match commit13acde8fffc0.
v4:
- Actually include the code changes (v3 was sent un-staged by
mistake)
v3:
- Switched from pointer null-checks to checkinghw->mac_type==e1000_ce4100
- Removed redundant check forhw->hw_addrsince it cannot be NULL
here
- Added missing Cc: stable tag and Closes tag
v2:
- Expanded commit message to answer reviewer questions (reproduction
details)
- Added appropriate Fixes tagsdrivers/net/ethernet/intel/e1000/e1000_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/e1000/e1000_main.c +2
-1@@ -1227,7 +1227,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) kfree(adapter->rx_ring); err_dma: err_sw_init: -iounmap (hw->ce4100_gbe_mdio_base_virt); +if (hw->ce4100_gbe_mdio_base_virt) +iounmap (hw->ce4100_gbe_mdio_base_virt);iounmap (hw->hw_addr); err_ioremap:
disable_dev= !test_and_set_bit(__E1000_DISABLED, &adapter-
Quoted 3 lines
Quoted 1 line
flags);
--
2.47.3