]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/x25/x25_link.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[mirror_ubuntu-bionic-kernel.git] / net / x25 / x25_link.c
index 73e7b954ad288229df4d03bc164f07da183444cc..4cbc942f762a9308ed37016b9aaf5fd3db06ce56 100644 (file)
@@ -31,8 +31,8 @@
 #include <linux/init.h>
 #include <net/x25.h>
 
-static LIST_HEAD(x25_neigh_list);
-static DEFINE_RWLOCK(x25_neigh_list_lock);
+LIST_HEAD(x25_neigh_list);
+DEFINE_RWLOCK(x25_neigh_list_lock);
 
 static void x25_t20timer_expiry(unsigned long);
 
@@ -360,16 +360,20 @@ int x25_subscr_ioctl(unsigned int cmd, void __user *arg)
        dev_put(dev);
 
        if (cmd == SIOCX25GSUBSCRIP) {
+               read_lock_bh(&x25_neigh_list_lock);
                x25_subscr.extended          = nb->extended;
                x25_subscr.global_facil_mask = nb->global_facil_mask;
+               read_unlock_bh(&x25_neigh_list_lock);
                rc = copy_to_user(arg, &x25_subscr,
                                  sizeof(x25_subscr)) ? -EFAULT : 0;
        } else {
                rc = -EINVAL;
                if (!(x25_subscr.extended && x25_subscr.extended != 1)) {
                        rc = 0;
+                       write_lock_bh(&x25_neigh_list_lock);
                        nb->extended         = x25_subscr.extended;
                        nb->global_facil_mask = x25_subscr.global_facil_mask;
+                       write_unlock_bh(&x25_neigh_list_lock);
                }
        }
        x25_neigh_put(nb);
@@ -394,6 +398,7 @@ void __exit x25_link_free(void)
        list_for_each_safe(entry, tmp, &x25_neigh_list) {
                nb = list_entry(entry, struct x25_neigh, node);
                __x25_remove_neigh(nb);
+               dev_put(nb->dev);
        }
        write_unlock_bh(&x25_neigh_list_lock);
 }