]> err.no Git - linux-2.6/commitdiff
[netdrvr] tehuti: move ioctl perm check closer to function start
authorJeff Garzik <jeff@garzik.org>
Fri, 25 Apr 2008 07:11:31 +0000 (03:11 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 25 Apr 2008 07:11:31 +0000 (03:11 -0400)
Noticed by davem.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/tehuti.c

index d2e1b219673d4ea0cb063fe9324ee935a9b78f60..e83b166aa6b9a53aeeb00a70224d10e46660f638 100644 (file)
@@ -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:
@@ -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;