diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/net/socket.c b/net/socket.c index a714c6d4e4a1..bc16eee4dc80 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -791,9 +791,9 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
791 | */ | 791 | */ |
792 | 792 | ||
793 | static DEFINE_MUTEX(br_ioctl_mutex); | 793 | static DEFINE_MUTEX(br_ioctl_mutex); |
794 | static int (*br_ioctl_hook) (unsigned int cmd, void __user *arg) = NULL; | 794 | static int (*br_ioctl_hook) (struct net *, unsigned int cmd, void __user *arg) = NULL; |
795 | 795 | ||
796 | void brioctl_set(int (*hook) (unsigned int, void __user *)) | 796 | void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *)) |
797 | { | 797 | { |
798 | mutex_lock(&br_ioctl_mutex); | 798 | mutex_lock(&br_ioctl_mutex); |
799 | br_ioctl_hook = hook; | 799 | br_ioctl_hook = hook; |
@@ -803,9 +803,9 @@ void brioctl_set(int (*hook) (unsigned int, void __user *)) | |||
803 | EXPORT_SYMBOL(brioctl_set); | 803 | EXPORT_SYMBOL(brioctl_set); |
804 | 804 | ||
805 | static DEFINE_MUTEX(vlan_ioctl_mutex); | 805 | static DEFINE_MUTEX(vlan_ioctl_mutex); |
806 | static int (*vlan_ioctl_hook) (void __user *arg); | 806 | static int (*vlan_ioctl_hook) (struct net *, void __user *arg); |
807 | 807 | ||
808 | void vlan_ioctl_set(int (*hook) (void __user *)) | 808 | void vlan_ioctl_set(int (*hook) (struct net *, void __user *)) |
809 | { | 809 | { |
810 | mutex_lock(&vlan_ioctl_mutex); | 810 | mutex_lock(&vlan_ioctl_mutex); |
811 | vlan_ioctl_hook = hook; | 811 | vlan_ioctl_hook = hook; |
@@ -834,16 +834,20 @@ EXPORT_SYMBOL(dlci_ioctl_set); | |||
834 | static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | 834 | static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
835 | { | 835 | { |
836 | struct socket *sock; | 836 | struct socket *sock; |
837 | struct sock *sk; | ||
837 | void __user *argp = (void __user *)arg; | 838 | void __user *argp = (void __user *)arg; |
838 | int pid, err; | 839 | int pid, err; |
840 | struct net *net; | ||
839 | 841 | ||
840 | sock = file->private_data; | 842 | sock = file->private_data; |
843 | sk = sock->sk; | ||
844 | net = sk->sk_net; | ||
841 | if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { | 845 | if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { |
842 | err = dev_ioctl(cmd, argp); | 846 | err = dev_ioctl(net, cmd, argp); |
843 | } else | 847 | } else |
844 | #ifdef CONFIG_WIRELESS_EXT | 848 | #ifdef CONFIG_WIRELESS_EXT |
845 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | 849 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { |
846 | err = dev_ioctl(cmd, argp); | 850 | err = dev_ioctl(net, cmd, argp); |
847 | } else | 851 | } else |
848 | #endif /* CONFIG_WIRELESS_EXT */ | 852 | #endif /* CONFIG_WIRELESS_EXT */ |
849 | switch (cmd) { | 853 | switch (cmd) { |
@@ -869,7 +873,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
869 | 873 | ||
870 | mutex_lock(&br_ioctl_mutex); | 874 | mutex_lock(&br_ioctl_mutex); |
871 | if (br_ioctl_hook) | 875 | if (br_ioctl_hook) |
872 | err = br_ioctl_hook(cmd, argp); | 876 | err = br_ioctl_hook(net, cmd, argp); |
873 | mutex_unlock(&br_ioctl_mutex); | 877 | mutex_unlock(&br_ioctl_mutex); |
874 | break; | 878 | break; |
875 | case SIOCGIFVLAN: | 879 | case SIOCGIFVLAN: |
@@ -880,7 +884,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
880 | 884 | ||
881 | mutex_lock(&vlan_ioctl_mutex); | 885 | mutex_lock(&vlan_ioctl_mutex); |
882 | if (vlan_ioctl_hook) | 886 | if (vlan_ioctl_hook) |
883 | err = vlan_ioctl_hook(argp); | 887 | err = vlan_ioctl_hook(net, argp); |
884 | mutex_unlock(&vlan_ioctl_mutex); | 888 | mutex_unlock(&vlan_ioctl_mutex); |
885 | break; | 889 | break; |
886 | case SIOCADDDLCI: | 890 | case SIOCADDDLCI: |
@@ -903,7 +907,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
903 | * to the NIC driver. | 907 | * to the NIC driver. |
904 | */ | 908 | */ |
905 | if (err == -ENOIOCTLCMD) | 909 | if (err == -ENOIOCTLCMD) |
906 | err = dev_ioctl(cmd, argp); | 910 | err = dev_ioctl(net, cmd, argp); |
907 | break; | 911 | break; |
908 | } | 912 | } |
909 | return err; | 913 | return err; |