Skip to content

Commit

Permalink
[BRIDGE] br_if: Fix oops in port_carrier_check
Browse files Browse the repository at this point in the history
Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>
Acked-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Feb 13, 2007
1 parent bbf4a6b commit a10d567
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static void port_carrier_check(struct work_struct *work)
spin_unlock_bh(&br->lock);
}
done:
dev_put(dev);
rtnl_unlock();
}

Expand Down Expand Up @@ -161,7 +162,8 @@ static void del_nbp(struct net_bridge_port *p)

dev_set_promiscuity(dev, -1);

cancel_delayed_work(&p->carrier_check);
if (cancel_delayed_work(&p->carrier_check))
dev_put(dev);

spin_lock_bh(&br->lock);
br_stp_disable_port(p);
Expand Down Expand Up @@ -444,7 +446,9 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
spin_lock_bh(&br->lock);
br_stp_recalculate_bridge_id(br);
br_features_recompute(br);
schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE);
if (schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE))
dev_hold(dev);

spin_unlock_bh(&br->lock);

dev_set_mtu(br->dev, br_min_mtu(br));
Expand Down
4 changes: 3 additions & 1 deletion net/bridge/br_notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v

case NETDEV_CHANGE:
if (br->dev->flags & IFF_UP)
schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE);
if (schedule_delayed_work(&p->carrier_check,
BR_PORT_DEBOUNCE))
dev_hold(dev);
break;

case NETDEV_FEAT_CHANGE:
Expand Down

0 comments on commit a10d567

Please sign in to comment.