]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.17/cpmac-do-not-leak-struct-net_device-on-phy_connect-errors.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / cpmac-do-not-leak-struct-net_device-on-phy_connect-errors.patch
CommitLineData
a0402406
GKH
1From ed770f01360b392564650bf1553ce723fa46afec Mon Sep 17 00:00:00 2001
2From: Florian Fainelli <florian@openwrt.org>
3Date: Sun, 20 Jun 2010 22:07:48 +0000
4Subject: cpmac: do not leak struct net_device on phy_connect errors
5
6From: Florian Fainelli <florian@openwrt.org>
7
8commit ed770f01360b392564650bf1553ce723fa46afec upstream.
9
10If the call to phy_connect fails, we will return directly instead of freeing
11the previously allocated struct net_device.
12
13Signed-off-by: Florian Fainelli <florian@openwrt.org>
14Signed-off-by: David S. Miller <davem@davemloft.net>
15Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16
17---
18 drivers/net/cpmac.c | 3 ++-
19 1 file changed, 2 insertions(+), 1 deletion(-)
20
21--- a/drivers/net/cpmac.c
22+++ b/drivers/net/cpmac.c
23@@ -1176,7 +1176,8 @@ static int __devinit cpmac_probe(struct
24 if (netif_msg_drv(priv))
25 printk(KERN_ERR "%s: Could not attach to PHY\n",
26 dev->name);
27- return PTR_ERR(priv->phy);
28+ rc = PTR_ERR(priv->phy);
29+ goto fail;
30 }
31
32 if ((rc = register_netdev(dev))) {