summaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2008-05-19 19:00:51 +0200
committerJeff Garzik <jgarzik@redhat.com>2008-05-22 06:26:32 -0400
commitfa701bd24d6e64a2283d6fa386554775fd4336e7 (patch)
tree980f65214d2abc363b30762d6fac7b569805af47 /drivers/net/wan
parent4ecc8c066f3cecb55807644a01435084d8ed638a (diff)
downloadop-kernel-dev-fa701bd24d6e64a2283d6fa386554775fd4336e7.zip
op-kernel-dev-fa701bd24d6e64a2283d6fa386554775fd4336e7.tar.gz
WAN: protect HDLC proto list while insmod/rmmod
WAN: protect protocol list in hdlc.c with RTNL. Signed-off-by: Krzysztof HaƂasa <khc@pm.waw.pl> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/hdlc.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 9a83c9d..7f98489 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();
}
OpenPOWER on IntegriCloud