Skip to content

Commit

Permalink
bridge: Propagate vlan add failure to user
Browse files Browse the repository at this point in the history
Disallow adding interfaces to a bridge when vlan filtering operation
failed. Send the failure code to the user.

Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Elad Raz authored and David S. Miller committed Jan 6, 2016
1 parent 00ce3a1 commit 08474cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if (br_fdb_insert(br, p, dev->dev_addr, 0))
netdev_err(dev, "failed insert local address bridge forwarding table\n");

if (nbp_vlan_init(p))
err = nbp_vlan_init(p);
if (err) {
netdev_err(dev, "failed to initialize vlan filtering on this port\n");
goto err6;
}

spin_lock_bh(&br->lock);
changed_addr = br_stp_recalculate_bridge_id(br);
Expand All @@ -533,6 +536,12 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)

return 0;

err6:
list_del_rcu(&p->list);
br_fdb_delete_by_port(br, p, 0, 1);
nbp_update_port_count(br);
netdev_upper_dev_unlink(dev, br->dev);

err5:
dev->priv_flags &= ~IFF_BRIDGE_PORT;
netdev_rx_handler_unregister(dev);
Expand Down

0 comments on commit 08474cc

Please sign in to comment.