Commit f946dffe authored by Jeff Garzik's avatar Jeff Garzik Committed by Jeff Garzik

[netdrvr] tehuti: move ioctl perm check closer to function start

Noticed by davem.
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent d4f73c8e
...@@ -649,6 +649,9 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) ...@@ -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]); DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]);
} }
if (!capable(CAP_NET_ADMIN))
return -EPERM;
switch (data[0]) { switch (data[0]) {
case BDX_OP_READ: case BDX_OP_READ:
...@@ -664,8 +667,6 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) ...@@ -664,8 +667,6 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
break; break;
case BDX_OP_WRITE: case BDX_OP_WRITE:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
error = bdx_range_check(priv, data[1]); error = bdx_range_check(priv, data[1]);
if (error < 0) if (error < 0)
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment