提交 2bb07e15 编写于 作者: T Tariq Toukan 提交者: David S. Miller

net/mlx4_core: Fix access to uninitialized index

Prevent using uninitialized or negative index when handling
steering entries.

Fixes: b12d93d6 ('mlx4: Add support for promiscuous mode in the new steering model.')
Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2ffd7e03
......@@ -1102,7 +1102,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
struct mlx4_cmd_mailbox *mailbox;
struct mlx4_mgm *mgm;
u32 members_count;
int index, prev;
int index = -1, prev;
int link = 0;
int i;
int err;
......@@ -1181,7 +1181,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
goto out;
out:
if (prot == MLX4_PROT_ETH) {
if (prot == MLX4_PROT_ETH && index != -1) {
/* manage the steering entry for promisc mode */
if (new_entry)
err = new_steering_entry(dev, port, steer,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册