]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
RDMA/core: Allow the ioctl layer to abort a fully created uobject
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 19 May 2020 07:27:05 +0000 (10:27 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 21 May 2020 23:10:46 +0000 (20:10 -0300)
commit0ac8903cbbe618d947b5815d6e0f7b044ee83aa3
tree7eeceaf743d60cd7558b2d385c4178f10d0b1047
parenteafd47fc200ee759c0e8d205b9cc7342bd0f4199
RDMA/core: Allow the ioctl layer to abort a fully created uobject

While creating a uobject every create reaches a point where the uobject is
fully initialized. For ioctls that go on to copy_to_user this means they
need to open code the destruction of a fully created uobject - ie the
RDMA_REMOVE_DESTROY sort of flow.

Open coding this creates bugs, eg the CQ does not properly flush the
events list when it does its error unwind.

Provide a uverbs_finalize_uobj_create() function which indicates that the
uobject is fully initialized and that abort should call to destroy_hw to
destroy the uobj->object and related.

Methods can call this function if they go on to have error cases after
setting uobj->object. Once done those error cases can simply do return,
without an error unwind.

Link: https://lore.kernel.org/r/20200519072711.257271-2-leon@kernel.org
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
13 files changed:
drivers/infiniband/core/rdma_core.c
drivers/infiniband/core/rdma_core.h
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_ioctl.c
drivers/infiniband/core/uverbs_std_types_cq.c
drivers/infiniband/core/uverbs_std_types_mr.c
drivers/infiniband/hw/mlx5/devx.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qos.c
include/rdma/ib_verbs.h
include/rdma/uverbs_ioctl.h
include/rdma/uverbs_std_types.h
include/rdma/uverbs_types.h