netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] au1000_eth: possible NULL dereference of aup->mii_bus->irq in au1000_probe()
@ 2009-08-31  8:40 Roel Kluin
  2009-08-31 12:38 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-08-31  8:40 UTC (permalink / raw)
  To: netdev, Andrew Morton, David S. Miller

aup->mii_bus->irq allocation may fail, prevent a dereference of NULL.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index d3c734f..02e4be0 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -1157,6 +1157,9 @@ static struct net_device * au1000_probe(int port_num)
 	aup->mii_bus->name = "au1000_eth_mii";
 	snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
 	aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+	if (aup->mii_bus->irq == NULL)
+		goto err_out;
+
 	for(i = 0; i < PHY_MAX_ADDR; ++i)
 		aup->mii_bus->irq[i] = PHY_POLL;
 

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

* Re: [PATCH] au1000_eth: possible NULL dereference of aup->mii_bus->irq in au1000_probe()
  2009-08-31  8:40 [PATCH] au1000_eth: possible NULL dereference of aup->mii_bus->irq in au1000_probe() Roel Kluin
@ 2009-08-31 12:38 ` Florian Fainelli
  2009-09-02  0:45   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2009-08-31 12:38 UTC (permalink / raw)
  To: Roel Kluin; +Cc: netdev, Andrew Morton, David S. Miller

Hello Roel,

Le lundi 31 août 2009 10:40:15, Roel Kluin a écrit :
> aup->mii_bus->irq allocation may fail, prevent a dereference of NULL.

Good catch.

>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Acked-by: Florian Fainelli <florian@openwrt.org>

> ---
> diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
> index d3c734f..02e4be0 100644
> --- a/drivers/net/au1000_eth.c
> +++ b/drivers/net/au1000_eth.c
> @@ -1157,6 +1157,9 @@ static struct net_device * au1000_probe(int port_num)
>  	aup->mii_bus->name = "au1000_eth_mii";
>  	snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
>  	aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
> +	if (aup->mii_bus->irq == NULL)
> +		goto err_out;
> +
>  	for(i = 0; i < PHY_MAX_ADDR; ++i)
>  		aup->mii_bus->irq[i] = PHY_POLL;
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Cordialement, Florian Fainelli
------------------------------

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

* Re: [PATCH] au1000_eth: possible NULL dereference of aup->mii_bus->irq in au1000_probe()
  2009-08-31 12:38 ` Florian Fainelli
@ 2009-09-02  0:45   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-09-02  0:45 UTC (permalink / raw)
  To: f.fainelli; +Cc: roel.kluin, netdev, akpm

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 31 Aug 2009 14:38:55 +0200

> Hello Roel,
> 
> Le lundi 31 août 2009 10:40:15, Roel Kluin a écrit :
>> aup->mii_bus->irq allocation may fail, prevent a dereference of NULL.
> 
> Good catch.
> 
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> 
> Acked-by: Florian Fainelli <florian@openwrt.org>

Applied.

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

end of thread, other threads:[~2009-09-02  0:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31  8:40 [PATCH] au1000_eth: possible NULL dereference of aup->mii_bus->irq in au1000_probe() Roel Kluin
2009-08-31 12:38 ` Florian Fainelli
2009-09-02  0:45   ` David Miller

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).