diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2013-07-01 17:23:06 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-07-02 00:15:56 -0700 |
commit | 5bb680d6cbe36de9d7ba12b05f845c91a8692318 (patch) | |
tree | 5d9fc010a25a9cd1dfbff75e6b191e70e50005b3 /drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |
parent | 058eec4116935c5640299913e1e0715e87ec622a (diff) | |
download | lwn-5bb680d6cbe36de9d7ba12b05f845c91a8692318.tar.gz lwn-5bb680d6cbe36de9d7ba12b05f845c91a8692318.zip |
bnx2x: fix dump flag handling
bnx2x interprets the dump flag as an index of a register preset.
It is important to validate the index to avoid out of bounds
memory accesses.
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index 4f75ae854b3d..cf5cebc358b8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c @@ -959,6 +959,9 @@ static int bnx2x_set_dump(struct net_device *dev, struct ethtool_dump *val) struct bnx2x *bp = netdev_priv(dev); /* Use the ethtool_dump "flag" field as the dump preset index */ + if (val->flag < 1 || val->flag > DUMP_MAX_PRESETS) + return -EINVAL; + bp->dump_preset_idx = val->flag; return 0; } |