Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93111
b: refs/heads/master
c: 6131a26
h: refs/heads/master
i:
  93109: 8234612
  93107: 9a81a62
  93103: 910bb71
v: v3
  • Loading branch information
Francois Romieu authored and Jeff Garzik committed Apr 25, 2008
1 parent fcc9c5a commit e308d8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a0e2cd51145748c4fd44d0c3a06d39eb87e8725
refs/heads/master: 6131a2601f42cd7fdbac0e960713396fe68af59f
14 changes: 14 additions & 0 deletions trunk/drivers/net/tehuti.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,12 @@ static void __init bdx_firmware_endianess(void)
s_firmLoad[i] = CPU_CHIP_SWAP32(s_firmLoad[i]);
}

static int bdx_range_check(struct bdx_priv *priv, u32 offset)
{
return (offset > (u32) (BDX_REGS_SIZE / priv->nic->port_num)) ?
-EINVAL : 0;
}

static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
{
struct bdx_priv *priv = ndev->priv;
Expand All @@ -646,6 +652,9 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
switch (data[0]) {

case BDX_OP_READ:
error = bdx_range_check(priv, data[1]);
if (error < 0)
return error;
data[2] = READ_REG(priv, data[1]);
DBG("read_reg(0x%x)=0x%x (dec %d)\n", data[1], data[2],
data[2]);
Expand All @@ -655,6 +664,11 @@ 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;
WRITE_REG(priv, data[1], data[2]);
DBG("write_reg(0x%x, 0x%x)\n", data[1], data[2]);
break;
Expand Down

0 comments on commit e308d8e

Please sign in to comment.