Re: [PATCH v2 rdma-rc] RDMA/restrack: don't use uaccess_kernel()

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

 



On Wed, Feb 14, 2018 at 06:43:36PM -0800, Steve Wise wrote:
> uaccess_kernel() isn't sufficient to determine if an rdma resource is
> user-mode or not.  For example, resources allocated in the add_one()
> function of an ib_client get falsely labeled as user mode, when they
> are kernel mode allocations.  EG: mad qps.
>
> The result is that these qps are skipped over during a nldev query
> because of an erroneous namespace mismatch.
>
> So now we determine if the resource is user-mode by looking at the object
> struct's uobject or similar pointer to know if it was allocated for user
> mode applications.
>
> Fixes: 02d8883f520e ("RDMA/restrack: Add general infrastructure to track RDMA resources")
> Signed-off-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>
>
> ---
>
> Changes since v1:
>
> changed _create_qp() to take the qp ib_uobject ptr so it is availble to
> rdma_restrack_add()
>
> ---
>  drivers/infiniband/core/core_priv.h  |  4 +++-
>  drivers/infiniband/core/restrack.c   | 35 +++++++++++++++++++++++++++++++++--
>  drivers/infiniband/core/uverbs_cmd.c |  4 ++--
>  drivers/infiniband/core/verbs.c      |  3 +--
>  4 files changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
> index c4560d8..39b8332 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -305,7 +305,8 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map,
>  static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
>  					  struct ib_pd *pd,
>  					  struct ib_qp_init_attr *attr,
> -					  struct ib_udata *udata)
> +					  struct ib_udata *udata,
> +					  struct ib_uobject *uobj)

I'm fine with this solution either, but believe that v1 was cleaner way
to address this issue, because udata tells us already that we are
creating user/kernel QP and QP has already PD associated with it.

Also I tried to move to _ib_create_qp() as less as possible initialization
logic.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>

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