Skip to content

Commit

Permalink
[netdrvr] tehuti: move ioctl perm check closer to function start
Browse files Browse the repository at this point in the history
Noticed by davem.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Jeff Garzik authored and Jeff Garzik committed Apr 25, 2008
1 parent d4f73c8 commit f946dff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/tehuti.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,9 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]);
}

if (!capable(CAP_NET_ADMIN))
return -EPERM;

switch (data[0]) {

case BDX_OP_READ:
Expand All @@ -664,8 +667,6 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
break;

case BDX_OP_WRITE:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
error = bdx_range_check(priv, data[1]);
if (error < 0)
return error;
Expand Down

0 comments on commit f946dff

Please sign in to comment.