commit
2bb07e155bb3e0c722c806723f737cf8020961ef upstream.
Prevent using uninitialized or negative index when handling
steering entries.
Fixes:
b12d93d63c32 ('mlx4: Add support for promiscuous mode in the new steering model.')
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
struct mlx4_mgm *mgm;
u32 members_count;
u16 hash;
struct mlx4_mgm *mgm;
u32 members_count;
u16 hash;
int link = 0;
int i;
int err;
int link = 0;
int i;
int err;
- if (prot == MLX4_PROT_ETH) {
+ if (prot == MLX4_PROT_ETH && index != -1) {
/* manage the steering entry for promisc mode */
if (new_entry)
new_steering_entry(dev, 0, port, steer, index, qp->qpn);
/* manage the steering entry for promisc mode */
if (new_entry)
new_steering_entry(dev, 0, port, steer, index, qp->qpn);