Re: [bug report] {net, IB}/mlx5: Manage port association for multiport RoCE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 19, 2021 at 05:18:33PM +0300, Dan Carpenter wrote:
> Hello Daniel Jurgens,
> 
> The patch 32f69e4be269: "{net, IB}/mlx5: Manage port association for
> multiport RoCE" from Jan 4, 2018, leads to the following static
> checker warning:
> 
> 	drivers/infiniband/hw/mlx5/main.c:3285 mlx5_ib_init_multiport_master()
> 	warn: iterator 'mpi->list.next' changed during iteration

Thanks Dan for the report, I'll prepare the fix.

> 
> drivers/infiniband/hw/mlx5/main.c
>   3285                  list_for_each_entry(mpi, &mlx5_ib_unaffiliated_port_list,
>                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> We're iterating through the unafiliated list.
> 
>   3286                                      list) {
>   3287                          if (dev->sys_image_guid == mpi->sys_image_guid &&
>   3288                              (mlx5_core_native_port_num(mpi->mdev) - 1) == i) {
>   3289                                  bound = mlx5_ib_bind_slave_port(dev, mpi);
> 
> The mlx5_ib_bind_slave_port() function returns true on success and
> false on failure.  On the failure path it calls:
> 
> 	mlx5_ib_unbind_slave_port(ibdev, mpi);
> 
> Which adds our "mpi" as the last item on the unaffiliated list.  I don't
> think anything good can come from adding a list item to a list twice.
> 
>   3290                          }
>   3291  
>   3292                          if (bound) {
>   3293                                  dev_dbg(mpi->mdev->device,
>   3294                                          "removing port from unaffiliated list.\n");
>   3295                                  mlx5_ib_dbg(dev, "port %d bound\n", i + 1);
>   3296                                  list_del(&mpi->list);
>   3297                                  break;
>   3298                          }
>   3299                  }
>   3300                  if (!bound)
>   3301                          mlx5_ib_dbg(dev, "no free port found for port %d\n",
>   3302                                      i + 1);
> 
> regards,
> dan carpenter



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux