diff options
Diffstat (limited to 'net/wireless/wext.c')
-rw-r--r-- | net/wireless/wext.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index b8069afe0410..e8b3409d6c8b 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -673,7 +673,22 @@ static const struct seq_operations wireless_seq_ops = { | |||
673 | 673 | ||
674 | static int wireless_seq_open(struct inode *inode, struct file *file) | 674 | static int wireless_seq_open(struct inode *inode, struct file *file) |
675 | { | 675 | { |
676 | return seq_open(file, &wireless_seq_ops); | 676 | struct seq_file *seq; |
677 | int res; | ||
678 | res = seq_open(file, &wireless_seq_ops); | ||
679 | if (!res) { | ||
680 | seq = file->private_data; | ||
681 | seq->private = get_net(PROC_NET(inode)); | ||
682 | } | ||
683 | return res; | ||
684 | } | ||
685 | |||
686 | static int wireless_seq_release(struct inode *inode, struct file *file) | ||
687 | { | ||
688 | struct seq_file *seq = file->private_data; | ||
689 | struct net *net = seq->private; | ||
690 | put_net(net); | ||
691 | return seq_release(inode, file); | ||
677 | } | 692 | } |
678 | 693 | ||
679 | static const struct file_operations wireless_seq_fops = { | 694 | static const struct file_operations wireless_seq_fops = { |
@@ -681,17 +696,22 @@ static const struct file_operations wireless_seq_fops = { | |||
681 | .open = wireless_seq_open, | 696 | .open = wireless_seq_open, |
682 | .read = seq_read, | 697 | .read = seq_read, |
683 | .llseek = seq_lseek, | 698 | .llseek = seq_lseek, |
684 | .release = seq_release, | 699 | .release = wireless_seq_release, |
685 | }; | 700 | }; |
686 | 701 | ||
687 | int __init wext_proc_init(void) | 702 | int wext_proc_init(struct net *net) |
688 | { | 703 | { |
689 | /* Create /proc/net/wireless entry */ | 704 | /* Create /proc/net/wireless entry */ |
690 | if (!proc_net_fops_create(&init_net, "wireless", S_IRUGO, &wireless_seq_fops)) | 705 | if (!proc_net_fops_create(net, "wireless", S_IRUGO, &wireless_seq_fops)) |
691 | return -ENOMEM; | 706 | return -ENOMEM; |
692 | 707 | ||
693 | return 0; | 708 | return 0; |
694 | } | 709 | } |
710 | |||
711 | void wext_proc_exit(struct net *net) | ||
712 | { | ||
713 | proc_net_remove(net, "wireless"); | ||
714 | } | ||
695 | #endif /* CONFIG_PROC_FS */ | 715 | #endif /* CONFIG_PROC_FS */ |
696 | 716 | ||
697 | /************************** IOCTL SUPPORT **************************/ | 717 | /************************** IOCTL SUPPORT **************************/ |
@@ -1011,7 +1031,7 @@ static int ioctl_private_call(struct net_device *dev, struct ifreq *ifr, | |||
1011 | * Main IOCTl dispatcher. | 1031 | * Main IOCTl dispatcher. |
1012 | * Check the type of IOCTL and call the appropriate wrapper... | 1032 | * Check the type of IOCTL and call the appropriate wrapper... |
1013 | */ | 1033 | */ |
1014 | static int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) | 1034 | static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd) |
1015 | { | 1035 | { |
1016 | struct net_device *dev; | 1036 | struct net_device *dev; |
1017 | iw_handler handler; | 1037 | iw_handler handler; |
@@ -1020,7 +1040,7 @@ static int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) | |||
1020 | * The copy_to/from_user() of ifr is also dealt with in there */ | 1040 | * The copy_to/from_user() of ifr is also dealt with in there */ |
1021 | 1041 | ||
1022 | /* Make sure the device exist */ | 1042 | /* Make sure the device exist */ |
1023 | if ((dev = __dev_get_by_name(ifr->ifr_name)) == NULL) | 1043 | if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL) |
1024 | return -ENODEV; | 1044 | return -ENODEV; |
1025 | 1045 | ||
1026 | /* A bunch of special cases, then the generic case... | 1046 | /* A bunch of special cases, then the generic case... |
@@ -1054,7 +1074,7 @@ static int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) | |||
1054 | } | 1074 | } |
1055 | 1075 | ||
1056 | /* entry point from dev ioctl */ | 1076 | /* entry point from dev ioctl */ |
1057 | int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | 1077 | int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, |
1058 | void __user *arg) | 1078 | void __user *arg) |
1059 | { | 1079 | { |
1060 | int ret; | 1080 | int ret; |
@@ -1066,9 +1086,9 @@ int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | |||
1066 | && !capable(CAP_NET_ADMIN)) | 1086 | && !capable(CAP_NET_ADMIN)) |
1067 | return -EPERM; | 1087 | return -EPERM; |
1068 | 1088 | ||
1069 | dev_load(ifr->ifr_name); | 1089 | dev_load(net, ifr->ifr_name); |
1070 | rtnl_lock(); | 1090 | rtnl_lock(); |
1071 | ret = wireless_process_ioctl(ifr, cmd); | 1091 | ret = wireless_process_ioctl(net, ifr, cmd); |
1072 | rtnl_unlock(); | 1092 | rtnl_unlock(); |
1073 | if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct ifreq))) | 1093 | if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct ifreq))) |
1074 | return -EFAULT; | 1094 | return -EFAULT; |