All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: ethernet: ixp4xx: Add error handling in ixp4xx_eth_probe()
@ 2020-04-22  1:09 Tang Bin
  2020-04-23  0:21 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Tang Bin @ 2020-04-22  1:09 UTC (permalink / raw)
  To: kuba, khalasa, davem, linus.walleij
  Cc: netdev, linux-kernel, Tang Bin, Zhang Shengju

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: f458ac479777 ("ARM/net: ixp4xx: Pass ethernet physical base as resource")

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
v2:
 - add fixed tag
---
 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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] net: ethernet: ixp4xx: Add error handling in ixp4xx_eth_probe()
  2020-04-22  1:09 [PATCH v2] net: ethernet: ixp4xx: Add error handling in ixp4xx_eth_probe() Tang Bin
@ 2020-04-23  0:21 ` Jakub Kicinski
  2020-04-23  1:49   ` [PATCH v2] net: ethernet: ixp4xx: Add error handling inixp4xx_eth_probe() Tang Bin
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-04-23  0:21 UTC (permalink / raw)
  To: Tang Bin
  Cc: khalasa, davem, linus.walleij, netdev, linux-kernel, Zhang Shengju

On Wed, 22 Apr 2020 09:09:22 +0800 Tang Bin wrote:
> 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: f458ac479777 ("ARM/net: ixp4xx: Pass ethernet physical base as resource")
> 

No extra lines, between the tags, though, please.

> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] net: ethernet: ixp4xx: Add error handling inixp4xx_eth_probe()
  2020-04-23  0:21 ` Jakub Kicinski
@ 2020-04-23  1:49   ` Tang Bin
  0 siblings, 0 replies; 3+ messages in thread
From: Tang Bin @ 2020-04-23  1:49 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: khalasa, davem, linus.walleij, netdev, linux-kernel

Hi, Jackub:

On 2020/4/23 8:21, Jakub Kicinski wrote:
> On Wed, 22 Apr 2020 09:09:22 +0800 Tang Bin wrote:
>> 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: f458ac479777 ("ARM/net: ixp4xx: Pass ethernet physical base as resource")
>>
> No extra lines, between the tags, though, please.

Got it, thanks for your guidance, I'll fix it and send v3 for you.

Thanks,

Tang Bin

>
>> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-23  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  1:09 [PATCH v2] net: ethernet: ixp4xx: Add error handling in ixp4xx_eth_probe() Tang Bin
2020-04-23  0:21 ` Jakub Kicinski
2020-04-23  1:49   ` [PATCH v2] net: ethernet: ixp4xx: Add error handling inixp4xx_eth_probe() Tang Bin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.