IB/uverbs: Use uverbs_api to manage the object type inside the uobject
authorJason Gunthorpe <jgg@mellanox.com>
Fri, 10 Aug 2018 02:14:37 +0000 (20:14 -0600)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 10 Aug 2018 22:06:24 +0000 (16:06 -0600)
commit6b0d08f4a27134e6fb49aa33ceb53356081bc92e
tree7781178fde4ef9aeb01acf736274de2fca581a5a
parent9ed3e5f447723a41de6bcc29633e9f7e6246d2f7
IB/uverbs: Use uverbs_api to manage the object type inside the uobject

Currently the struct uverbs_obj_type stored in the ib_uobject is part of
the .rodata segment of the module that defines the object. This is a
problem if drivers define new uapi objects as we will be left with a
dangling pointer after device disassociation.

Switch the uverbs_obj_type for struct uverbs_api_object, which is
allocated memory that is part of the uverbs_api and is guaranteed to
always exist. Further this moves the 'type_class' into this memory which
means access to the IDR/FD function pointers is also guaranteed. Drivers
cannot define new types.

This makes it safe to continue to use all uobjects, including driver
defined ones, after disassociation.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/rdma_core.c
drivers/infiniband/core/rdma_core.h
drivers/infiniband/core/uverbs_ioctl.c
include/rdma/ib_verbs.h
include/rdma/uverbs_std_types.h
include/rdma/uverbs_types.h