linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Long Li <longli@microsoft.com>
To: Konstantin Taranov <kotaranov@linux.microsoft.com>,
	Konstantin Taranov <kotaranov@microsoft.com>,
	"sharmaajay@microsoft.com" <sharmaajay@microsoft.com>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"leon@kernel.org" <leon@kernel.org>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH rdma-next 5/6] RDMA/mana_ib: boundary check before installing cq callbacks
Date: Tue, 23 Apr 2024 23:45:18 +0000	[thread overview]
Message-ID: <SJ1PR21MB345784B523805F2D590ADA4FCE112@SJ1PR21MB3457.namprd21.prod.outlook.com> (raw)
In-Reply-To: <1713459125-14914-6-git-send-email-kotaranov@linux.microsoft.com>

> Subject: [PATCH rdma-next 5/6] RDMA/mana_ib: boundary check before
> installing cq callbacks
> 
> From: Konstantin Taranov <kotaranov@microsoft.com>
> 
> Add a boundary check inside mana_ib_install_cq_cb to prevent index
> overflow.

How is this condition possible that we are getting an out of bound queue id from SOC?

> 
> Fixes: 2a31c5a7e0d8 ("RDMA/mana_ib: Introduce mana_ib_install_cq_cb
> helper function")
> Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
> ---
>  drivers/infiniband/hw/mana/cq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/mana/cq.c
> b/drivers/infiniband/hw/mana/cq.c index 6c3bb8c..8323085 100644
> --- a/drivers/infiniband/hw/mana/cq.c
> +++ b/drivers/infiniband/hw/mana/cq.c
> @@ -70,6 +70,8 @@ int mana_ib_install_cq_cb(struct mana_ib_dev *mdev,
> struct mana_ib_cq *cq)
>  	struct gdma_context *gc = mdev_to_gc(mdev);
>  	struct gdma_queue *gdma_cq;
> 
> +	if (cq->queue.id >= gc->max_num_cqs)
> +		return -EINVAL;
>  	/* Create CQ table entry */
>  	WARN_ON(gc->cq_table[cq->queue.id]);
>  	gdma_cq = kzalloc(sizeof(*gdma_cq), GFP_KERNEL);
> --
> 2.43.0


  reply	other threads:[~2024-04-23 23:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 16:51 [PATCH rdma-next 0/6] RDMA/mana_ib: Implement RNIC CQs Konstantin Taranov
2024-04-18 16:52 ` [PATCH rdma-next 1/6] RDMA/mana_ib: create EQs for " Konstantin Taranov
2024-04-23 23:24   ` Long Li
2024-04-18 16:52 ` [PATCH rdma-next 2/6] RDMA/mana_ib: create and destroy RNIC cqs Konstantin Taranov
2024-04-23 23:30   ` Long Li
2024-04-18 16:52 ` [PATCH rdma-next 3/6] RDMA/mana_ib: replace duplicate cqe with buf_size Konstantin Taranov
2024-04-23 23:34   ` Long Li
2024-04-24  8:43     ` Konstantin Taranov
2024-04-25 20:17       ` Long Li
2024-04-18 16:52 ` [PATCH rdma-next 4/6] RDMA/mana_ib: introduce a helper to remove cq callbacks Konstantin Taranov
2024-04-23 23:42   ` Long Li
2024-04-24  8:50     ` Konstantin Taranov
2024-04-25 20:29       ` Long Li
2024-04-18 16:52 ` [PATCH rdma-next 5/6] RDMA/mana_ib: boundary check before installing " Konstantin Taranov
2024-04-23 23:45   ` Long Li [this message]
2024-04-24  8:58     ` Konstantin Taranov
2024-04-25 20:31   ` Long Li
2024-04-18 16:52 ` [PATCH rdma-next 6/6] RDMA/mana_ib: implement uapi for creation of rnic cq Konstantin Taranov
2024-04-23 23:57   ` Long Li
2024-04-30 12:37     ` Leon Romanovsky
2024-04-30 12:57       ` 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=SJ1PR21MB345784B523805F2D590ADA4FCE112@SJ1PR21MB3457.namprd21.prod.outlook.com \
    --to=longli@microsoft.com \
    --cc=jgg@ziepe.ca \
    --cc=kotaranov@linux.microsoft.com \
    --cc=kotaranov@microsoft.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sharmaajay@microsoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).