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(-)
> 
> I took this to for-rc, but when I fixed the XRCD conflict with Leon's
> patch I ended up retyping it to this - don't really need all rambly
> boilerplate. Someone should fix the other one too..

I don't know what you mean by 'rambly boilerplate'?

> 
> static bool res_is_user(struct rdma_restrack_entry *res)
> {
> 	switch (res->type) {
> 	case RDMA_RESTRACK_PD:
> 		return container_of(res, struct ib_pd, res)->uobject;
> 	case RDMA_RESTRACK_CQ:
> 		return container_of(res, struct ib_cq, res)->uobject;
> 	case RDMA_RESTRACK_QP:
> 		return container_of(res, struct ib_qp, res)->uobject;
> 	default:
> 		WARN_ONCE(true, "Wrong resource tracking type %u\n",
> res->type);
> 		return false;
> 	}
> }

This looks clean to me.  Thanks.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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