]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - 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
1 From ed770f01360b392564650bf1553ce723fa46afec Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <florian@openwrt.org>
3 Date: Sun, 20 Jun 2010 22:07:48 +0000
4 Subject: cpmac: do not leak struct net_device on phy_connect errors
5
6 From: Florian Fainelli <florian@openwrt.org>
7
8 commit ed770f01360b392564650bf1553ce723fa46afec upstream.
9
10 If the call to phy_connect fails, we will return directly instead of freeing
11 the previously allocated struct net_device.
12
13 Signed-off-by: Florian Fainelli <florian@openwrt.org>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 Signed-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))) {