From: Leon Romanovsky <leon@kernel.org>
To: "Hefty, Sean" <sean.hefty@intel.com>
Cc: Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-next] RDMA/ucma: Protect kernel from QPN larger than declared in IBTA
Date: Mon, 28 Oct 2019 17:26:09 +0200 [thread overview]
Message-ID: <20191028152609.GK5146@unreal> (raw)
In-Reply-To: <BYAPR11MB315708DABE251D7BDE8BB49F9E660@BYAPR11MB3157.namprd11.prod.outlook.com>
On Mon, Oct 28, 2019 at 03:09:26PM +0000, Hefty, Sean wrote:
> > IBTA declares QPN as 24bits, mask input to ensure that kernel
> > doesn't get higher bits.
> >
> > Fixes: 75216638572f ("RDMA/cma: Export rdma cm interface to userspace")
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > * Not fully tested yet, passed sanity tests for now.
> > ---
> > drivers/infiniband/core/ucma.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
> > index 0274e9b704be..57e68491a2fd 100644
> > --- a/drivers/infiniband/core/ucma.c
> > +++ b/drivers/infiniband/core/ucma.c
> > @@ -1045,7 +1045,7 @@ static void ucma_copy_conn_param(struct rdma_cm_id *id,
> > dst->retry_count = src->retry_count;
> > dst->rnr_retry_count = src->rnr_retry_count;
> > dst->srq = src->srq;
> > - dst->qp_num = src->qp_num;
> > + dst->qp_num = src->qp_num & 0xFFFFFF;
>
> Why not isolate IBTA restrictions in the ib_cm?
AFAIK, there are many places in IB/core code which assume that type of
restriction, so it is safer and cleaner to sanitize input as early as
possible.
Thanks
next prev parent reply other threads:[~2019-10-28 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 13:44 [PATCH rdma-next] RDMA/ucma: Protect kernel from QPN larger than declared in IBTA Leon Romanovsky
2019-10-28 13:45 ` Jason Gunthorpe
2019-10-28 13:57 ` Leon Romanovsky
2019-10-28 15:09 ` Hefty, Sean
2019-10-28 15:26 ` Leon Romanovsky [this message]
2019-10-31 19:05 ` Jason Gunthorpe
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=20191028152609.GK5146@unreal \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=jgg@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sean.hefty@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.