summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2008-04-25 03:11:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-05-01 14:49:00 -0700
commitf1b6098616f329d26199f278f228a7b27d36558d (patch)
treed5a3e4799d5a13ea2fb276261d3977dca586296e
parenta30678eb8ce99a7b4c716ad41c8c10a04d731127 (diff)
downloadkernel-common-f1b6098616f329d26199f278f228a7b27d36558d.tar.gz
kernel-common-f1b6098616f329d26199f278f228a7b27d36558d.tar.bz2
kernel-common-f1b6098616f329d26199f278f228a7b27d36558d.zip
tehuti: move ioctl perm check closer to function start (CVE-2008-1675)
Commit f946dffed6334f08da065a89ed65026ebf8b33b4 upstream Noticed by davem. Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/net/tehuti.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 3349e072545d..fe5be1b94460 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -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;