Commit 13aa698a authored by Tariq Toukan's avatar Tariq Toukan Committed by Kleber Sacilotto de Souza

net/mlx4_core: Fix access to uninitialized index

BugLink: https://bugs.launchpad.net/bugs/1878232

commit 2bb07e15 upstream.

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: default avatarTariq Toukan <tariqt@mellanox.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent a8232c0f
...@@ -1109,7 +1109,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], ...@@ -1109,7 +1109,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
struct mlx4_cmd_mailbox *mailbox; struct mlx4_cmd_mailbox *mailbox;
struct mlx4_mgm *mgm; struct mlx4_mgm *mgm;
u32 members_count; u32 members_count;
int index, prev; int index = -1, prev;
int link = 0; int link = 0;
int i; int i;
int err; int err;
...@@ -1188,7 +1188,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], ...@@ -1188,7 +1188,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
goto out; goto out;
out: out:
if (prot == MLX4_PROT_ETH) { if (prot == MLX4_PROT_ETH && index != -1) {
/* manage the steering entry for promisc mode */ /* manage the steering entry for promisc mode */
if (new_entry) if (new_entry)
err = new_steering_entry(dev, port, steer, err = new_steering_entry(dev, port, steer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment