Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wext: Pull top-level ioctl dispatch logic into helper function.

Signed-off-by: David S. Miller <davem@davemloft.net>

+20 -6
+20 -6
net/wireless/wext.c
··· 1079 1079 } 1080 1080 1081 1081 /* entry point from dev ioctl */ 1082 - int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 1083 - void __user *arg) 1082 + static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, 1083 + unsigned int cmd, 1084 + wext_ioctl_func standard, 1085 + wext_ioctl_func private) 1084 1086 { 1085 1087 int ret = wext_permission_check(cmd); 1086 1088 ··· 1091 1089 1092 1090 dev_load(net, ifr->ifr_name); 1093 1091 rtnl_lock(); 1094 - ret = wireless_process_ioctl(net, ifr, cmd, 1095 - ioctl_standard_call, 1096 - ioctl_private_call); 1092 + ret = wireless_process_ioctl(net, ifr, cmd, standard, private); 1097 1093 rtnl_unlock(); 1098 - if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq))) 1094 + 1095 + return ret; 1096 + } 1097 + 1098 + int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 1099 + void __user *arg) 1100 + { 1101 + int ret = wext_ioctl_dispatch(net, ifr, cmd, 1102 + ioctl_standard_call, 1103 + ioctl_private_call); 1104 + 1105 + if (ret >= 0 && 1106 + IW_IS_GET(cmd) && 1107 + copy_to_user(arg, ifr, sizeof(struct iwreq))) 1099 1108 return -EFAULT; 1109 + 1100 1110 return ret; 1101 1111 } 1102 1112