From 12653e22a4ce168d09c1453e3373e563725746f1 Mon Sep 17 00:00:00 2001 From: Krzysztof Halasa Date: Mon, 19 May 2008 19:00:51 +0200 Subject: [PATCH] --- yaml --- r: 97367 b: refs/heads/master c: fa701bd24d6e64a2283d6fa386554775fd4336e7 h: refs/heads/master i: 97365: ee3dff90a02c50b4203687d8f3a82a026d2fe667 97363: 54aebba02932845530782937ed2a7613397af56b 97359: fd949622516f4b8ed8fa1f8e521b48ba5520bf69 v: v3 --- [refs] | 2 +- trunk/drivers/net/wan/hdlc.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 7e7fd2c818d1..f5127b589364 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4ecc8c066f3cecb55807644a01435084d8ed638a +refs/heads/master: fa701bd24d6e64a2283d6fa386554775fd4336e7 diff --git a/trunk/drivers/net/wan/hdlc.c b/trunk/drivers/net/wan/hdlc.c index 9a83c9d5b8cf..7f984895b0d5 100644 --- a/trunk/drivers/net/wan/hdlc.c +++ b/trunk/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(); }