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 rdma-rc v2 04/15] RDMA/bnxt_re: Avoid any race while handling the hash list of CQ
Date: Tue, 16 Jun 2026 12:04:07 -0300 [thread overview]
Message-ID: <20260616150407.GA3885854@nvidia.com> (raw)
In-Reply-To: <20260615224751.232802-5-selvin.xavier@broadcom.com>
On Mon, Jun 15, 2026 at 03:47:40PM -0700, Selvin Xavier wrote:
> Add/Delete to/from hash list needs to be synchronized with the traversing
> of the hash list. Add a mutex for this synchronization. Also add a
> reference for the CQ to avoid any usage of the CQ structures after the
> CQ is freed.
Arg, this is messed up like this because the driver didn't implement
the uapi properly:
> @@ -252,6 +255,7 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_GET_TOGGLE_MEM)(struct uverbs_attr_bund
> return -EINVAL;
>
> addr = (u64)cq->uctx_cq_page;
> + bnxt_re_put_cq(cq);
> break;
Passing in uobj's through anything but the normal UVERBS_ATTR_IDR is
completely wrong.
And now the security model is messed up because the broken
bnxt_re_search_for_cq() doesn't respect the uctx boundaries and the
userspace can pass in any cq belonging to any process for this
operation. That's illegal.
I said the same thing on the dbr patches and they were fixed to use
+ uobj = uverbs_attr_get_uobject(attrs, BNXT_RE_ALLOC_DBR_HANDLE);
Which is the correct way to reach into other objects and prevents
all of these bugs.
Fixing this by adding more mess to the driver isn't right, you need to
rely on the uobject system to do this. Once you find the driver object
you'll need to call some new uobject function to validate and lock it
properly using object locking. Do not add new refcounts and
completions.
Jason
next prev parent reply other threads:[~2026-06-16 15:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 22:47 [PATCH rdma-rc v2 00/15] RDMA/bnxt_re: Generic driver fixes Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 01/15] RDMA/bnxt_re: Initialize dpi variable to zero Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 02/15] RDMA/bnxt_re: Free SRQ toggle page after firmware teardown Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 03/15] RDMA/bnxt_re: Free CQ " Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 04/15] RDMA/bnxt_re: Avoid any race while handling the hash list of CQ Selvin Xavier
2026-06-16 15:04 ` Jason Gunthorpe [this message]
2026-06-15 22:47 ` [PATCH rdma-rc v2 05/15] RDMA/bnxt_re: Avoid any race while handling the hash list of SRQ Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 06/15] RDMA/bnxt_re: Add ownership check while getting the CQ toggle page Selvin Xavier
2026-06-16 15:04 ` Jason Gunthorpe
2026-06-15 22:47 ` [PATCH rdma-rc v2 07/15] RDMA/bnxt_re: Add ownership check while getting the SRQ " Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 08/15] RDMA/bnxt_re: Avoid displaying the kernel pointer Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 09/15] RDMA/bnxt_re: Add a max slot check for SQ Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 10/15] RDMA/bnxt_re: Proper rollback if the ioremap fails Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 11/15] RDMA/bnxt_re: Avoid repeated requests to allocate WC pages Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 12/15] RDMA/bnxt_re: Fix the cleanup upon error during SRQ create Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 13/15] RDMA/bnxt_re: Fix the cleanup upon error during CQ create Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 14/15] RDMA/bnxt_re: Fail DBR related page allocation UAPIs if the feature is disabled Selvin Xavier
2026-06-15 22:47 ` [PATCH rdma-rc v2 15/15] RDMA/bnxt_re: Reject GET_TOGGLE_MEM when toggle page was not allocated Selvin Xavier
2026-06-16 17:30 ` [PATCH rdma-rc v2 00/15] RDMA/bnxt_re: Generic driver fixes 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=20260616150407.GA3885854@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 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.