提交 5bb680d6 编写于 作者: M Michal Schmidt 提交者: David S. Miller

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: NMichal Schmidt <mschmidt@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 058eec41
......@@ -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;
}
......
......@@ -11636,6 +11636,8 @@ static int bnx2x_init_bp(struct bnx2x *bp)
bp->min_msix_vec_cnt = 2;
BNX2X_DEV_INFO("bp->min_msix_vec_cnt %d", bp->min_msix_vec_cnt);
bp->dump_preset_idx = 1;
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册