Skip to content

Commit e8ef090

Browse files
yishaihjgunthorpe
authored andcommitted
IB/mlx5: Destroy the DEVX object upon error flow
Upon DEVX object creation the object must be destroyed upon a follows error flow. Fixes: 7efce36 ("IB/mlx5: Add obj create and destroy functionality") Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
1 parent a9360ab commit e8ef090

File tree

1 file changed

+4
-1
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+4
-1
lines changed

drivers/infiniband/hw/mlx5/devx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
723723
attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE);
724724
struct mlx5_ib_ucontext *c = to_mucontext(uobj->context);
725725
struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
726+
u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
726727
struct devx_obj *obj;
727728
int err;
728729

@@ -754,10 +755,12 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
754755

755756
err = uverbs_copy_to(attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, cmd_out, cmd_out_len);
756757
if (err)
757-
goto obj_free;
758+
goto obj_destroy;
758759

759760
return 0;
760761

762+
obj_destroy:
763+
mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
761764
obj_free:
762765
kfree(obj);
763766
return err;

0 commit comments

Comments
 (0)