Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103128
b: refs/heads/master
c: 67dd760
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller authored and David S. Miller committed Jun 17, 2008
1 parent 9e564af commit 6d914fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d88174e4d295f0880e5f9cb6d42f26b0367c8fd9
refs/heads/master: 67dd7608078b17f63f29ff2108fc5bf2407ddcec
22 changes: 15 additions & 7 deletions trunk/net/wireless/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,18 +1061,26 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned i
return -EOPNOTSUPP;
}

/* If command is `set a parameter', or `get the encoding parameters',
* check if the user has the right to do it.
*/
static int wext_permission_check(unsigned int cmd)
{
if ((IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || cmd == SIOCGIWENCODEEXT)
&& !capable(CAP_NET_ADMIN))
return -EPERM;

return 0;
}

/* entry point from dev ioctl */
int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
void __user *arg)
{
int ret;
int ret = wext_permission_check(cmd);

/* If command is `set a parameter', or
* `get the encoding parameters', check if
* the user has the right to do it */
if ((IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || cmd == SIOCGIWENCODEEXT)
&& !capable(CAP_NET_ADMIN))
return -EPERM;
if (ret)
return ret;

dev_load(net, ifr->ifr_name);
rtnl_lock();
Expand Down

0 comments on commit 6d914fa

Please sign in to comment.