[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200412092728.8396-1-tangbin@cmss.chinamobile.com>
Date: Sun, 12 Apr 2020 17:27:28 +0800
From: Tang Bin <tangbin@...s.chinamobile.com>
To: khalasa@...p.pl, davem@...emloft.net
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Tang Bin <tangbin@...s.chinamobile.com>,
Shengju Zhang <zhangshengju@...s.chinamobile.com>
Subject: [PATCH] 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.
Signed-off-by: Tang Bin <tangbin@...s.chinamobile.com>
Signed-off-by: Shengju Zhang <zhangshengju@...s.chinamobile.com>
---
drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 269596c15..2e5202923 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1387,6 +1387,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
return -ENODEV;
regs_phys = res->start;
port->regs = devm_ioremap_resource(dev, res);
+ if (IS_ERR(port->regs))
+ return PTR_ERR(port->regs);
switch (port->id) {
case IXP4XX_ETH_NPEA:
--
2.20.1.windows.1
Powered by blists - more mailing lists