diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/net/socket.c b/net/socket.c index 510ae18d220a..e3c21d5ec288 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -68,6 +68,7 @@ | |||
68 | #include <linux/netdevice.h> | 68 | #include <linux/netdevice.h> |
69 | #include <linux/proc_fs.h> | 69 | #include <linux/proc_fs.h> |
70 | #include <linux/seq_file.h> | 70 | #include <linux/seq_file.h> |
71 | #include <linux/mutex.h> | ||
71 | #include <linux/wanrouter.h> | 72 | #include <linux/wanrouter.h> |
72 | #include <linux/if_bridge.h> | 73 | #include <linux/if_bridge.h> |
73 | #include <linux/if_frad.h> | 74 | #include <linux/if_frad.h> |
@@ -826,36 +827,36 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, | |||
826 | * with module unload. | 827 | * with module unload. |
827 | */ | 828 | */ |
828 | 829 | ||
829 | static DECLARE_MUTEX(br_ioctl_mutex); | 830 | static DEFINE_MUTEX(br_ioctl_mutex); |
830 | static int (*br_ioctl_hook)(unsigned int cmd, void __user *arg) = NULL; | 831 | static int (*br_ioctl_hook)(unsigned int cmd, void __user *arg) = NULL; |
831 | 832 | ||
832 | void brioctl_set(int (*hook)(unsigned int, void __user *)) | 833 | void brioctl_set(int (*hook)(unsigned int, void __user *)) |
833 | { | 834 | { |
834 | down(&br_ioctl_mutex); | 835 | mutex_lock(&br_ioctl_mutex); |
835 | br_ioctl_hook = hook; | 836 | br_ioctl_hook = hook; |
836 | up(&br_ioctl_mutex); | 837 | mutex_unlock(&br_ioctl_mutex); |
837 | } | 838 | } |
838 | EXPORT_SYMBOL(brioctl_set); | 839 | EXPORT_SYMBOL(brioctl_set); |
839 | 840 | ||
840 | static DECLARE_MUTEX(vlan_ioctl_mutex); | 841 | static DEFINE_MUTEX(vlan_ioctl_mutex); |
841 | static int (*vlan_ioctl_hook)(void __user *arg); | 842 | static int (*vlan_ioctl_hook)(void __user *arg); |
842 | 843 | ||
843 | void vlan_ioctl_set(int (*hook)(void __user *)) | 844 | void vlan_ioctl_set(int (*hook)(void __user *)) |
844 | { | 845 | { |
845 | down(&vlan_ioctl_mutex); | 846 | mutex_lock(&vlan_ioctl_mutex); |
846 | vlan_ioctl_hook = hook; | 847 | vlan_ioctl_hook = hook; |
847 | up(&vlan_ioctl_mutex); | 848 | mutex_unlock(&vlan_ioctl_mutex); |
848 | } | 849 | } |
849 | EXPORT_SYMBOL(vlan_ioctl_set); | 850 | EXPORT_SYMBOL(vlan_ioctl_set); |
850 | 851 | ||
851 | static DECLARE_MUTEX(dlci_ioctl_mutex); | 852 | static DEFINE_MUTEX(dlci_ioctl_mutex); |
852 | static int (*dlci_ioctl_hook)(unsigned int, void __user *); | 853 | static int (*dlci_ioctl_hook)(unsigned int, void __user *); |
853 | 854 | ||
854 | void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)) | 855 | void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)) |
855 | { | 856 | { |
856 | down(&dlci_ioctl_mutex); | 857 | mutex_lock(&dlci_ioctl_mutex); |
857 | dlci_ioctl_hook = hook; | 858 | dlci_ioctl_hook = hook; |
858 | up(&dlci_ioctl_mutex); | 859 | mutex_unlock(&dlci_ioctl_mutex); |
859 | } | 860 | } |
860 | EXPORT_SYMBOL(dlci_ioctl_set); | 861 | EXPORT_SYMBOL(dlci_ioctl_set); |
861 | 862 | ||
@@ -899,10 +900,10 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
899 | if (!br_ioctl_hook) | 900 | if (!br_ioctl_hook) |
900 | request_module("bridge"); | 901 | request_module("bridge"); |
901 | 902 | ||
902 | down(&br_ioctl_mutex); | 903 | mutex_lock(&br_ioctl_mutex); |
903 | if (br_ioctl_hook) | 904 | if (br_ioctl_hook) |
904 | err = br_ioctl_hook(cmd, argp); | 905 | err = br_ioctl_hook(cmd, argp); |
905 | up(&br_ioctl_mutex); | 906 | mutex_unlock(&br_ioctl_mutex); |
906 | break; | 907 | break; |
907 | case SIOCGIFVLAN: | 908 | case SIOCGIFVLAN: |
908 | case SIOCSIFVLAN: | 909 | case SIOCSIFVLAN: |
@@ -910,10 +911,10 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
910 | if (!vlan_ioctl_hook) | 911 | if (!vlan_ioctl_hook) |
911 | request_module("8021q"); | 912 | request_module("8021q"); |
912 | 913 | ||
913 | down(&vlan_ioctl_mutex); | 914 | mutex_lock(&vlan_ioctl_mutex); |
914 | if (vlan_ioctl_hook) | 915 | if (vlan_ioctl_hook) |
915 | err = vlan_ioctl_hook(argp); | 916 | err = vlan_ioctl_hook(argp); |
916 | up(&vlan_ioctl_mutex); | 917 | mutex_unlock(&vlan_ioctl_mutex); |
917 | break; | 918 | break; |
918 | case SIOCGIFDIVERT: | 919 | case SIOCGIFDIVERT: |
919 | case SIOCSIFDIVERT: | 920 | case SIOCSIFDIVERT: |
@@ -927,9 +928,9 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
927 | request_module("dlci"); | 928 | request_module("dlci"); |
928 | 929 | ||
929 | if (dlci_ioctl_hook) { | 930 | if (dlci_ioctl_hook) { |
930 | down(&dlci_ioctl_mutex); | 931 | mutex_lock(&dlci_ioctl_mutex); |
931 | err = dlci_ioctl_hook(cmd, argp); | 932 | err = dlci_ioctl_hook(cmd, argp); |
932 | up(&dlci_ioctl_mutex); | 933 | mutex_unlock(&dlci_ioctl_mutex); |
933 | } | 934 | } |
934 | break; | 935 | break; |
935 | default: | 936 | default: |