Skip to contentSkip to conversation

cpmac: do not leak struct net_device on phy_connect errors

PATCH In review Florian Fainelli 2 participants 3 messages Jun 21, 2010 – Jun 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpmac: do not leak struct net_device on phy_connect errors

If the call to phy_connect fails, we will return directly instead of freeing the previously allocated struct net_device.

---

drivers/net/cpmac.c +2 -1
index 3c58db5..23786ee 100644
@@ -1181,7 +1181,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
 		if (netif_msg_drv(priv))
 			printk(KERN_ERR "%s: Could not attach to PHY\n",
 			       dev->name);
-		return PTR_ERR(priv->phy);
+		rc = PTR_ERR(priv->phy);
+		goto fail;
 	}
 
 	if ((rc = register_netdev(dev))) {
#1 lore raw

Hi David,

Forgot to mention that this is relevant for -stable and current net-next-2.6. Thanks!

Quoted 20 lines · Fainelli

If the call to phy_connect fails, we will return directly instead of freeing the previously allocated struct net_device.

---

drivers/net/cpmac.c +2 -1
index 3c58db5..23786ee 100644
@@ -1181,7 +1181,8 @@ static int __devinit cpmac_probe(struct
 platform_device *pdev) if (netif_msg_drv(priv))
 			printk(KERN_ERR "%s: Could not attach to PHY\n",
 			       dev->name);
-		return PTR_ERR(priv->phy);
+		rc = PTR_ERR(priv->phy);
+		goto fail;
 	}
 
 	if ((rc = register_netdev(dev))) {
maintainer
#2 lore raw

From: Florian Fainelli <[email protected]>
Date: Sun, 27 Jun 2010 19:05:24 +0200

Quoted 1 line

Forgot to mention that this is relevant for -stable and current net-next-2.6

I put it into net-2.6 and since you CC:'d stable it should show up there automatically.