Skip to content

Commit

Permalink
RDMA/mlx5: Don't add slave port to unaffiliated list
Browse files Browse the repository at this point in the history
[ Upstream commit 7ce6095 ]

The mlx5_ib_bind_slave_port() doesn't remove multiport device from the
unaffiliated list, but mlx5_ib_unbind_slave_port() did it. This unbalanced
flow caused to the situation where mlx5_ib_unaffiliated_port_list was
changed during iteration.

Fixes: 32f69e4 ("{net, IB}/mlx5: Manage port association for multiport RoCE")
Link: https://lore.kernel.org/r/2726e6603b1e6ecfe76aa5a12a063af72173bcf7.1622477058.git.leonro@nvidia.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rleon authored and gregkh committed Jul 14, 2021
1 parent e3fdf2f commit 803ffe5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/mlx5/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3178,8 +3178,6 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev,

port->mp.mpi = NULL;

list_add_tail(&mpi->list, &mlx5_ib_unaffiliated_port_list);

spin_unlock(&port->mp.mpi_lock);

err = mlx5_nic_vport_unaffiliate_multiport(mpi->mdev);
Expand Down Expand Up @@ -3328,6 +3326,8 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev)
mlx5_ib_dbg(dev, "unbinding port_num: %u\n",
i + 1);
mlx5_ib_unbind_slave_port(dev, dev->port[i].mp.mpi);
list_add_tail(&dev->port[i].mp.mpi->list,
&mlx5_ib_unaffiliated_port_list);
}
}
}
Expand Down

0 comments on commit 803ffe5

Please sign in to comment.