Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org,
	andrew.gospodarek@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com,
	sriharsha.basavapatna@broadcom.com
Subject: Re: [PATCH for-next v2 2/2] RDMA/bnxt_re: Add uverbs object handle path for CQ/SRQ toggle page
Date: Mon, 29 Jun 2026 10:15:07 -0300	[thread overview]
Message-ID: <20260629131507.GB7481@nvidia.com> (raw)
In-Reply-To: <20260624223927.521882-3-selvin.xavier@broadcom.com>

On Wed, Jun 24, 2026 at 03:39:27PM -0700, Selvin Xavier wrote:
> +		} else {
> +			/*
> +			 * Legacy path: old libbnxt_re sends TYPE + RES_ID.
> +			 * Look up the CQ or SRQ in the per-context XArray
> +			 */
> +			enum bnxt_re_get_toggle_mem_type res_type;
> +			u32 res_id;
> +
> +			err = uverbs_get_const(&res_type, attrs,
> +					       BNXT_RE_TOGGLE_MEM_TYPE);
> +			if (err)
> +				return err;
> +			err = uverbs_copy_from(&res_id, attrs,
> +					       BNXT_RE_TOGGLE_MEM_RES_ID);
> +			if (err)
> +				return err;
> +
> +			if (res_type == BNXT_RE_CQ_TOGGLE_MEM) {
> +				struct bnxt_re_cq *cq;
> +
> +				xa_lock(&uctx->cq_xa);
> +				cq = xa_load(&uctx->cq_xa, res_id);
> +				if (cq)
> +					addr = (u64)cq->uctx_cq_page;
> +				xa_unlock(&uctx->cq_xa);

Does this have the same basic UAF issue on addr?

Can you change this around so it tracks the uobject in the xarray an
uses proper uobject locking consistently in both legs?

If I understand this right it should also be holding onto a refcount
of the uobject while the toggle mem exists to ensure it doesn't free
in the wrong order?

Jason

  reply	other threads:[~2026-06-29 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 22:39 [PATCH for-next v2 0/2] RDMA/bnxt_re: Update the toggle page handling of CQ and SRQ Selvin Xavier
2026-06-24 22:39 ` [PATCH for-next v2 1/2] RDMA/bnxt_re: Replace per-device hash tables with per-context XArray Selvin Xavier
2026-06-24 22:39 ` [PATCH for-next v2 2/2] RDMA/bnxt_re: Add uverbs object handle path for CQ/SRQ toggle page Selvin Xavier
2026-06-29 13:15   ` Jason Gunthorpe [this message]
2026-06-30 10:15     ` Selvin Xavier

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=20260629131507.GB7481@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=selvin.xavier@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.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