aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@o2.pl>2007-02-13 15:35:26 -0500
committerDavid S. Miller <davem@davemloft.net>2007-02-13 15:35:26 -0500
commita10d567c89dfba90dde2e0515e25760fd74cde06 (patch)
tree86fec06aa1dfe1976d489d3d35c9930405d2caa0
parentbbf4a6bc8c4d59a0a9033fc2cb96ec03430c96e4 (diff)
[BRIDGE] br_if: Fix oops in port_carrier_check
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>
-rw-r--r--net/bridge/br_if.c8
-rw-r--r--net/bridge/br_notify.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index f35c1a378d0f..aff6a779c9c8 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -108,6 +108,7 @@ static void port_carrier_check(struct work_struct *work)
108 spin_unlock_bh(&br->lock); 108 spin_unlock_bh(&br->lock);
109 } 109 }
110done: 110done:
111 dev_put(dev);
111 rtnl_unlock(); 112 rtnl_unlock();
112} 113}
113 114
@@ -161,7 +162,8 @@ static void del_nbp(struct net_bridge_port *p)
161 162
162 dev_set_promiscuity(dev, -1); 163 dev_set_promiscuity(dev, -1);
163 164
164 cancel_delayed_work(&p->carrier_check); 165 if (cancel_delayed_work(&p->carrier_check))
166 dev_put(dev);
165 167
166 spin_lock_bh(&br->lock); 168 spin_lock_bh(&br->lock);
167 br_stp_disable_port(p); 169 br_stp_disable_port(p);
@@ -444,7 +446,9 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
444 spin_lock_bh(&br->lock); 446 spin_lock_bh(&br->lock);
445 br_stp_recalculate_bridge_id(br); 447 br_stp_recalculate_bridge_id(br);
446 br_features_recompute(br); 448 br_features_recompute(br);
447 schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE); 449 if (schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE))
450 dev_hold(dev);
451
448 spin_unlock_bh(&br->lock); 452 spin_unlock_bh(&br->lock);
449 453
450 dev_set_mtu(br->dev, br_min_mtu(br)); 454 dev_set_mtu(br->dev, br_min_mtu(br));
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 8cd3e4229070..3311c4e30829 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -56,7 +56,9 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
56 56
57 case NETDEV_CHANGE: 57 case NETDEV_CHANGE:
58 if (br->dev->flags & IFF_UP) 58 if (br->dev->flags & IFF_UP)
59 schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE); 59 if (schedule_delayed_work(&p->carrier_check,
60 BR_PORT_DEBOUNCE))
61 dev_hold(dev);
60 break; 62 break;
61 63
62 case NETDEV_FEAT_CHANGE: 64 case NETDEV_FEAT_CHANGE: