Re: [PATCH 03/10] IB/uverbs: Use uverbs_api to manage the object type inside the uobject

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

 



On Fri, Aug 03, 2018 at 01:31:36PM -0600, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/core/rdma_core.c    | 97 ++++++++++++++------------
>  drivers/infiniband/core/rdma_core.h    |  2 +-
>  drivers/infiniband/core/uverbs_ioctl.c |  6 +-
>  include/rdma/ib_verbs.h                |  2 +-
>  include/rdma/uverbs_std_types.h        | 30 ++++----
>  include/rdma/uverbs_types.h            |  9 +--
>  6 files changed, 76 insertions(+), 70 deletions(-)

<...>

> -lookup_get_fd_uobject(const struct uverbs_obj_type *type,
> +lookup_get_fd_uobject(const struct uverbs_api_object *obj,
>  		      struct ib_uverbs_file *ufile, s64 id,
>  		      enum rdma_lookup_mode mode)
>  {
>  	struct file *f;
>  	struct ib_uobject *uobject;
>  	int fdno = id;
> -	const struct uverbs_obj_fd_type *fd_type =
> -		container_of(type, struct uverbs_obj_fd_type, type);
> +	// XXX

What did you want to say here?

> +	const struct uverbs_obj_fd_type *fd_type = container_of(
> +		obj->type_attrs, struct uverbs_obj_fd_type, type);
>

Thanks

Attachment: signature.asc
Description: PGP signature


[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