diff options
| author | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-11 14:36:25 +0100 | 
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-11 14:36:25 +0100 | 
| commit | a8931ef380c92d121ae74ecfb03b2d63f72eea6f (patch) | |
| tree | 980fb6b019e11e6cb1ece55b7faff184721a8053 /drivers/net/wan/hdlc.c | |
| parent | 90574d0a4d4b73308ae54a2a57a4f3f1fa98e984 (diff) | |
| parent | e5a5816f7875207cb0a0a7032e39a4686c5e10a4 (diff) | |
| download | olio-linux-3.10-a8931ef380c92d121ae74ecfb03b2d63f72eea6f.tar.xz olio-linux-3.10-a8931ef380c92d121ae74ecfb03b2d63f72eea6f.zip  | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/net/wan/hdlc.c')
| -rw-r--r-- | drivers/net/wan/hdlc.c | 19 | 
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 9a83c9d5b8c..7f984895b0d 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c @@ -43,8 +43,7 @@ static const char* version = "HDLC support module revision 1.22";  #undef DEBUG_LINK -static struct hdlc_proto *first_proto = NULL; - +static struct hdlc_proto *first_proto;  static int hdlc_change_mtu(struct net_device *dev, int new_mtu)  { @@ -314,21 +313,25 @@ void detach_hdlc_protocol(struct net_device *dev)  void register_hdlc_protocol(struct hdlc_proto *proto)  { +	rtnl_lock();  	proto->next = first_proto;  	first_proto = proto; +	rtnl_unlock();  }  void unregister_hdlc_protocol(struct hdlc_proto *proto)  { -	struct hdlc_proto **p = &first_proto; -	while (*p) { -		if (*p == proto) { -			*p = proto->next; -			return; -		} +	struct hdlc_proto **p; + +	rtnl_lock(); +	p = &first_proto; +	while (*p != proto) { +		BUG_ON(!*p);  		p = &((*p)->next);  	} +	*p = proto->next; +	rtnl_unlock();  }  |