bridge: Fix error path in nbp_vlan_init
authorYotam Gigi <yotamg@mellanox.com>
Wed, 1 Mar 2017 14:50:45 +0000 (16:50 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Mar 2017 22:55:28 +0000 (14:55 -0800)
Fix error path order in nbp_vlan_init, so if switchdev_port_attr_set
call failes, the vlan_hash wouldn't be destroyed before inited.

Fixes: efa5356b0d97 ("bridge: per vlan dst_metadata netlink support")
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_vlan.c

index 62e68c0dc68740bc1364204902ea7e97e44a7e92..b838213c408e24eab36adea29819d98d145dff15 100644 (file)
@@ -997,10 +997,10 @@ err_vlan_add:
        RCU_INIT_POINTER(p->vlgrp, NULL);
        synchronize_rcu();
        vlan_tunnel_deinit(vg);
-err_vlan_enabled:
 err_tunnel_init:
        rhashtable_destroy(&vg->vlan_hash);
 err_rhtbl:
+err_vlan_enabled:
        kfree(vg);
 
        goto out;