Set of fixes
Subsystems (2)
cover Set of fixes
From: Leon Romanovsky <[email protected]>
Small set of fixes for -next, only Aharon's fix has potential to be taken to the -rc.
Thanks
Aharon Landau (1):
RDMA/umem: Avoid undefined behavior of rounddown_pow_of_two
Mark Bloch (1):
RDMA/mlx5: Fix wrong free of blue flame register on error
Parav Pandit (3):
IB/mlx5: Fix error unwinding when set_has_smi_cap fails IB/mlx5: Add mutex destroy call to cap_mask_mutex mutex IB/mlx5: Make function static
drivers/infiniband/core/umem.c | 2 +- drivers/infiniband/hw/mlx5/mad.c | 4 ++-- drivers/infiniband/hw/mlx5/main.c | 15 +++++++-------- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-)
--
2.29.2
PATCH 1/5 RDMA/umem: Avoid undefined behavior of rounddown_pow_of_two
From: Aharon Landau <[email protected]>
rounddown_pow_of_two is undefined when the input is 0. Therefore we need to avoid it in ib_umem_find_best_pgsz and return 0. Otherwise, it could result in incorrect page size.
--- drivers/infiniband/core/umem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/umem.c +1 -1
@@ -137,7 +137,7 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,*/ if (mask) pgsz_bitmap &=GENMASK (count_trailing_zeros (mask),0 ); -return rounddown_pow_of_two (pgsz_bitmap); +return pgsz_bitmap ?rounddown_pow_of_two (pgsz_bitmap) :0 ; }EXPORT_SYMBOL (ib_umem_find_best_pgsz);
--
2.29.2
PATCH 2/5 IB/mlx5: Fix error unwinding when set_has_smi_cap fails
In reply to Leon RomanovskyFrom: Parav Pandit <[email protected]>
When set_has_smi_cap() fails, multiport master cleanup is missed. Fix it by doing correct error unwinding.
--- drivers/infiniband/hw/mlx5/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -3978,7 +3978,7 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev) err =set_has_smi_cap (dev);if (err) -return err; + goto err_mp;if (!mlx5_core_mp_enabled (mdev)) {for (i =1 ; i <= dev->num_ports; i++) {
--
2.29.2
PATCH 3/5 IB/mlx5: Add mutex destroy call to cap_mask_mutex mutex
In reply to Leon RomanovskyFrom: Parav Pandit <[email protected]>
Mutex destroy call for device's cap_mask_mutex mutex is missing, let's add it to annotate destruction.
--- drivers/infiniband/hw/mlx5/main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/infiniband/hw/mlx5/main.c +5 -6
@@ -3951,7 +3951,7 @@ static void mlx5_ib_stage_init_cleanup(struct mlx5_ib_dev *dev)mlx5_ib_cleanup_multiport_master (dev);WARN_ON (!xa_empty (&dev->odp_mkeys));cleanup_srcu_struct (&dev->odp_srcu); - +mutex_destroy (&dev->cap_mask_mutex);WARN_ON (!xa_empty (&dev->sig_mrs));WARN_ON (!bitmap_empty (dev->dm.memic_alloc_pages,MLX5_MAX_MEMIC_PAGES )); }
@@ -4002,6 +4002,10 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev) dev->ib_dev.dev.parent = mdev->device; dev->ib_dev.lag_flags =RDMA_LAG_FLAGS_HASH_ALL_SLAVES ; + err =init_srcu_struct (&dev->odp_srcu); +if (err) + goto err_mp; +mutex_init (&dev->cap_mask_mutex);INIT_LIST_HEAD (&dev->qp_list);spin_lock_init (&dev->reset_flow_resource_lock);
@@ -4011,11 +4015,6 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)spin_lock_init (&dev->dm.lock); dev->dm.dev = mdev; - - err =init_srcu_struct (&dev->odp_srcu); -if (err) - goto err_mp; -return 0 ; err_mp:
--
2.29.2
PATCH 4/5 IB/mlx5: Make function static
In reply to Leon RomanovskyFrom: Parav Pandit <[email protected]>
mlx5_query_mad_ifc_smp_attr_node_info() is internal to mad.c Hence, make it static.
--- drivers/infiniband/hw/mlx5/mad.c | 4 ++-- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/mad.c +2 -2
@@ -308,8 +308,8 @@ int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port)return err; } -int mlx5_query_mad_ifc_smp_attr_node_info (struct ib_device *ibdev, -struct ib_smp *out_mad) +static int mlx5_query_mad_ifc_smp_attr_node_info (struct ib_device *ibdev, +struct ib_smp *out_mad) {struct ib_smp *in_mad =NULL ;int err = -ENOMEM ;
drivers/infiniband/hw/mlx5/mlx5_ib.h +0 -2
@@ -1280,8 +1280,6 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,int mlx5_ib_alloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata);int mlx5_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata);int mlx5_query_ext_port_caps (struct mlx5_ib_dev *dev,u8 port); -int mlx5_query_mad_ifc_smp_attr_node_info (struct ib_device *ibdev, -struct ib_smp *out_mad);int mlx5_query_mad_ifc_system_image_guid (struct ib_device *ibdev,__be64 *sys_image_guid); int mlx5_query_mad_ifc_max_pkeys(struct ib_device *ibdev,
--
2.29.2
PATCH 5/5 RDMA/mlx5: Fix wrong free of blue flame register on error
In reply to Leon RomanovskyFrom: Mark Bloch <[email protected]>
If the allocation of the fast path blue flame register fails, the driver should free the regular blue flame register.
--- drivers/infiniband/hw/mlx5/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -4340,7 +4340,7 @@ static int mlx5_ib_stage_bfrag_init(struct mlx5_ib_dev *dev) err =mlx5_alloc_bfreg (dev->mdev, &dev->fp_bfreg, false, true);if (err) -mlx5_free_bfreg (dev->mdev, &dev->fp_bfreg); +mlx5_free_bfreg (dev->mdev, &dev->bfreg);return err; }
--
2.29.2
Jason Gunthorpe
maintainerQuoted 3 lines · Leon Romanovsky
RDMA/umem: Avoid undefined behavior of
rounddown_pow_of_twoRDMA/mlx5: Fix wrong free of blue flame register on error IB/mlx5: Fix error unwinding whenset_has_smi_capfails
I took these ones to for-rc
Thanks,
Jason
Quoted 7 lines · Jason Gunthorpe
Quoted 3 lines · Leon Romanovsky
RDMA/umem: Avoid undefined behavior of
rounddown_pow_of_twoRDMA/mlx5: Fix wrong free of blue flame register on error IB/mlx5: Fix error unwinding whenset_has_smi_capfailsI took these ones to for-rc
It is your call, personally, I'm sending two types of patches to -rc:
crashes and "new bugs".
Thanks
Quoted 3 lines
Thanks,
Jason
Jason Gunthorpe
maintainerQuoted 9 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Small set of fixes for -next, only Aharon's fix has potential to be taken to the -rc.
Thanks
IB/mlx5: Add mutex destroy call to
cap_mask_mutexmutex IB/mlx5: Make function static
These two applied to for-next, thanks
Jason