wext: Pull top-level ioctl dispatch logic into helper function.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@ -1079,8 +1079,10 @@ static int wext_permission_check(unsigned int cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* entry point from dev ioctl */
|
/* entry point from dev ioctl */
|
||||||
int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
|
static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,
|
||||||
void __user *arg)
|
unsigned int cmd,
|
||||||
|
wext_ioctl_func standard,
|
||||||
|
wext_ioctl_func private)
|
||||||
{
|
{
|
||||||
int ret = wext_permission_check(cmd);
|
int ret = wext_permission_check(cmd);
|
||||||
|
|
||||||
@ -1089,12 +1091,24 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
|
|||||||
|
|
||||||
dev_load(net, ifr->ifr_name);
|
dev_load(net, ifr->ifr_name);
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
ret = wireless_process_ioctl(net, ifr, cmd,
|
ret = wireless_process_ioctl(net, ifr, cmd, standard, private);
|
||||||
|
rtnl_unlock();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
|
||||||
|
void __user *arg)
|
||||||
|
{
|
||||||
|
int ret = wext_ioctl_dispatch(net, ifr, cmd,
|
||||||
ioctl_standard_call,
|
ioctl_standard_call,
|
||||||
ioctl_private_call);
|
ioctl_private_call);
|
||||||
rtnl_unlock();
|
|
||||||
if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq)))
|
if (ret >= 0 &&
|
||||||
|
IW_IS_GET(cmd) &&
|
||||||
|
copy_to_user(arg, ifr, sizeof(struct iwreq)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user