Skip to content

Commit

Permalink
bridge: use list_for_each_entry_continue_reverse
Browse files Browse the repository at this point in the history
use list_for_each_entry_continue_reverse to rollback in fdb_add_hw
when add address failed

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Li RongQing authored and David S. Miller committed Jun 21, 2014
1 parent 545a112 commit a3f5ee7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions net/bridge/br_fdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void fdb_rcu_free(struct rcu_head *head)
static void fdb_add_hw(struct net_bridge *br, const unsigned char *addr)
{
int err;
struct net_bridge_port *p, *tmp;
struct net_bridge_port *p;

ASSERT_RTNL();

Expand All @@ -107,11 +107,9 @@ static void fdb_add_hw(struct net_bridge *br, const unsigned char *addr)

return;
undo:
list_for_each_entry(tmp, &br->port_list, list) {
if (tmp == p)
break;
if (!br_promisc_port(tmp))
dev_uc_del(tmp->dev, addr);
list_for_each_entry_continue_reverse(p, &br->port_list, list) {
if (!br_promisc_port(p))
dev_uc_del(p->dev, addr);
}
}

Expand Down

0 comments on commit a3f5ee7

Please sign in to comment.