public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Doug Ledford <dledford@redhat.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Or Gerlitz <gerlitz.or@gmail.com>
Subject: Re: [PATCH rdma-next 4/6] RDMA/cm: Delete useless QPN masking
Date: Mon, 28 Oct 2019 15:13:33 +0200	[thread overview]
Message-ID: <20191028131333.GD5146@unreal> (raw)
In-Reply-To: <20191028125233.GA27317@ziepe.ca>

On Mon, Oct 28, 2019 at 09:52:33AM -0300, Jason Gunthorpe wrote:
> On Sun, Oct 20, 2019 at 10:15:57AM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > QPN is supplied by kernel users who controls and creates valid QPs,
> > such flow ensures that QPN is limited to 24bits and no need to mask
> > already valid QPN.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >  drivers/infiniband/core/cm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
> > index 7ffa16ea5fe3..2eb8e1fab962 100644
> > --- a/drivers/infiniband/core/cm.c
> > +++ b/drivers/infiniband/core/cm.c
> > @@ -2101,7 +2101,7 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id,
> >  	cm_id_priv->initiator_depth = param->initiator_depth;
> >  	cm_id_priv->responder_resources = param->responder_resources;
> >  	cm_id_priv->rq_psn = cm_rep_get_starting_psn(rep_msg);
> > -	cm_id_priv->local_qpn = cpu_to_be32(param->qp_num & 0xFFFFFF);
> > +	cm_id_priv->local_qpn = cpu_to_be32(param->qp_num);
>
> It does seem like this value comes from userspace:
>
> ucma_connect()
>   ucma_copy_conn_param()
>     	dst->qp_num = src->qp_num
>   rdma_connect(.., &dst)
> 	if (!id->qp) {
> 		id_priv->qp_num = conn_param->qp_num;
>
> vs
>
> cma_accept_ib()
> 	rep.qp_num = id_priv->qp_num;
>
> Maybe this needs to add some masking to ucma_copy_conn_param()?

Thanks for the callstack, Or pointed it to me too, but I missed this flow.
Let's create a pre-patch with QPN masking.

Thanks

>
> Jason

  reply	other threads:[~2019-10-28 13:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20  7:15 [PATCH rdma-next 0/6] CM cleanup Leon Romanovsky
2019-10-20  7:15 ` [PATCH rdma-next 1/6] RDMA/cm: Delete unused cm_is_active_peer function Leon Romanovsky
2019-10-20  7:15 ` [PATCH rdma-next 2/6] RDMA/cm: Use specific keyword to check define Leon Romanovsky
2019-10-20  7:15 ` [PATCH rdma-next 3/6] RDMA/cm: Update copyright together with SPDX tag Leon Romanovsky
2019-10-20  7:15 ` [PATCH rdma-next 4/6] RDMA/cm: Delete useless QPN masking Leon Romanovsky
2019-10-20  8:48   ` Or Gerlitz
2019-10-20  8:54     ` Leon Romanovsky
2019-10-28 12:52   ` Jason Gunthorpe
2019-10-28 13:13     ` Leon Romanovsky [this message]
2019-10-28 13:44       ` Jason Gunthorpe
2019-10-28 14:02         ` Leon Romanovsky
2019-10-20  7:15 ` [PATCH rdma-next 5/6] RDMA/cm: Provide private data size to CM users Leon Romanovsky
2019-10-20  7:15 ` [PATCH rdma-next 6/6] RDMA/srpt: Use private_data_len instead of hardcoded value Leon Romanovsky
2019-10-24 17:01   ` Bart Van Assche
2019-10-28 13:13   ` Jason Gunthorpe
2019-10-28 13:19     ` Leon Romanovsky
2019-10-28 13:43       ` Jason Gunthorpe
2019-10-28 14:06         ` Leon Romanovsky
2019-10-28 13:17 ` [PATCH rdma-next 0/6] CM cleanup Jason Gunthorpe
2019-10-28 13:20   ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191028131333.GD5146@unreal \
    --to=leon@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=gerlitz.or@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox