Commit 6ed79cec authored by Tang Bin's avatar Tang Bin Committed by David S. Miller

net: ethernet: ixp4xx: Add error handling in ixp4xx_eth_probe()

The function ixp4xx_eth_probe() does not perform sufficient error
checking after executing devm_ioremap_resource(), which can result
in crashes if a critical error path is encountered.

Fixes: f458ac47 ("ARM/net: ixp4xx: Pass ethernet physical base as resource")
Signed-off-by: default avatarZhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: default avatarTang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce222748
...@@ -1387,6 +1387,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) ...@@ -1387,6 +1387,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
regs_phys = res->start; regs_phys = res->start;
port->regs = devm_ioremap_resource(dev, res); port->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(port->regs))
return PTR_ERR(port->regs);
switch (port->id) { switch (port->id) {
case IXP4XX_ETH_NPEA: case IXP4XX_ETH_NPEA:
......
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