aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-05-24 07:02:25 +0000
committerDavid S. Miller <davem@davemloft.net>2010-05-24 18:42:12 -0700
commitf16d3d57486cd079b29ae7a6c3b31c90e69c9c44 (patch)
tree73e03ec33a20fef68f43e24196847f43e03ca264 /drivers/net
parent556ae19110f2de5ace4733e0c19e5fa01fad08b3 (diff)
downloadkernel_samsung_espresso10-f16d3d57486cd079b29ae7a6c3b31c90e69c9c44.zip
kernel_samsung_espresso10-f16d3d57486cd079b29ae7a6c3b31c90e69c9c44.tar.gz
kernel_samsung_espresso10-f16d3d57486cd079b29ae7a6c3b31c90e69c9c44.tar.bz2
macvlan: do proper cleanup in macvlan_common_newlink() V2
Fixes possible memory leak. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/macvlan.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 4e238af..87e8d4c 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -634,11 +634,18 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
err = register_netdevice(dev);
if (err < 0)
- return err;
+ goto destroy_port;
list_add_tail(&vlan->list, &port->vlans);
netif_stacked_transfer_operstate(lowerdev, dev);
+
return 0;
+
+destroy_port:
+ if (list_empty(&port->vlans))
+ macvlan_port_destroy(lowerdev);
+
+ return err;
}
EXPORT_SYMBOL_GPL(macvlan_common_newlink);