From: sashiko-bot@kernel.org
To: "Eric Davis" <eric.davis@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next v2 05/13] RDMA/core: extended address handle attributes
Date: Tue, 20 Oct 2026 08:40:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-178596@kernel.org> (raw)
In-Reply-To: <20261019-uet-ib-core-v2-5-8bd654f25370@broadcom.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] RDMA/uverbs: missing uverbs_finalize_uobj_create() in AH_EX_CREATE handler
--
commit 4cd859f734837412850e0706a926ea891c66f8a6
Author: Eric Davis <eric.davis@broadcom.com>
RDMA/core: extended address handle attributes
This commit introduces struct rdma_ah_attr_ex to carry extended address
handle attributes such as remote_qpn for UET transports, updates
rdma_create_user_ah() to accept struct rdma_ah_init_attr, and adds the
UVERBS_METHOD_AH_EX_CREATE ioctl method.
> diff --git a/drivers/infiniband/core/uverbs_std_types.c b/drivers/infiniband/core/uverbs_std_types.c
> index e160786e1df16..27cc1d1622939 100644
> --- a/drivers/infiniband/core/uverbs_std_types.c
> +++ b/drivers/infiniband/core/uverbs_std_types.c
> @@ -184,6 +184,73 @@ DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_MW,
> UVERBS_TYPE_ALLOC_IDR(uverbs_free_mw),
> &UVERBS_METHOD(UVERBS_METHOD_MW_DESTROY));
>
> +/* Creating an address handle is still a write() command whose request
> + * struct cannot grow. A transport (reliable unconnected) that resolves a
> + * peer using both transport and network addresses requires additional
> + * fields in the address handle. Here the address handle create command is
> + * made available as an ioctl method, where additional attributes can be
> + * carried.
> + */
> +static int UVERBS_HANDLER(UVERBS_METHOD_AH_EX_CREATE)(
> + struct uverbs_attr_bundle *attrs)
> +{
[ ... ]
> + ah = rdma_create_user_ah(pd, &init_attr, &attrs->driver_udata);
> + if (IS_ERR(ah))
> + return PTR_ERR(ah);
> +
> + ah->uobject = uobj;
> + uobj->object = ah;
> +
> + return 0;
> +}
[Severity: High]
Should UVERBS_HANDLER(UVERBS_METHOD_AH_EX_CREATE) call
uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_CREATE_AH_EX_HANDLE) before
returning 0?
Because UVERBS_METHOD_AH_EX_CREATE includes UVERBS_ATTR_UHW(),
ib_uverbs_run_method() can call uverbs_set_output() for UVERBS_ATTR_UHW_OUT
after the handler succeeds:
drivers/infiniband/core/uverbs_ioctl.c:ib_uverbs_run_method() {
ret = handler(bundle);
if (ret)
return ret;
if (!ret && bundle->method_elm->has_udata) {
const struct uverbs_attr *attr =
uverbs_attr_get(bundle, UVERBS_ATTR_UHW_OUT);
if (!IS_ERR(attr))
ret = uverbs_set_output(bundle, attr);
}
}
If uverbs_set_output() fails with -EFAULT, ib_uverbs_cmd_verbs() aborts the
command via bundle_destroy(pbundle, false) -> uverbs_finalize_object() ->
rdma_alloc_abort_uobject():
drivers/infiniband/core/rdma_core.c:rdma_alloc_abort_uobject() {
if (hw_obj_valid) {
uverbs_get_cleared_udata(attrs);
ret = uobj->uapi_object->type_class->destroy_hw(
uobj, RDMA_REMOVE_ABORT, attrs);
...
}
}
Without uverbs_finalize_uobj_create() setting the bit in
pbundle->uobj_hw_obj_valid, hw_obj_valid is false on abort, so destroy_hw
(uverbs_free_ah() -> rdma_destroy_ah_user()) is skipped. Does this leak the
newly created struct ib_ah, its ah->sgid_attr reference, and its pd->usecnt
reference?
[ ... ]
> +DECLARE_UVERBS_NAMED_METHOD(
> + UVERBS_METHOD_AH_EX_CREATE,
> + UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_AH_EX_HANDLE,
> + UVERBS_OBJECT_AH,
> + UVERBS_ACCESS_NEW,
> + UA_MANDATORY),
> + UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_AH_EX_PD_HANDLE,
> + UVERBS_OBJECT_PD,
> + UVERBS_ACCESS_READ,
> + UA_MANDATORY),
> + UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_AH_EX_AH_ATTR_EX,
> + UVERBS_ATTR_STRUCT(struct ib_uverbs_ah_attr_ex,
> + remote_qpn),
> + UA_MANDATORY),
> + UVERBS_ATTR_UHW());
[ ... ]
> --
> 2.51.2
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019-uet-ib-core-v2-0-8bd654f25370@broadcom.com?part=5
next prev parent reply other threads:[~2026-10-20 8:40 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 3:03 [PATCH rdma-next v2 00/13] RDMA/core: Ultra Ethernet transport verbs Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 3:03 ` [PATCH rdma-next v2 01/13] RDMA/core: widen the uverbs object key Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:10 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 02/13] RDMA/core: add the UET GID types Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:16 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 03/13] RDMA/core: report the reliable unconnected device capabilities Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:19 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 04/13] RDMA/core: add the reliable unconnected queue pair type Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:28 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 05/13] RDMA/core: extended address handle attributes Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:40 ` sashiko-bot [this message]
2026-10-20 3:03 ` [PATCH rdma-next v2 06/13] RDMA/core: query the semantics a queue pair type guarantees Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:45 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 07/13] RDMA/core: job and job key objects Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 8:59 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 08/13] RDMA/uverbs: factor out the queue pair attribute copy Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 9:02 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 09/13] RDMA/core: create a queue pair ready to send Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 9:25 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 10/13] RDMA/core: queue pair attributes for unconnected transports Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 9:53 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 11/13] RDMA/core: extended memory registration Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 10:04 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 12/13] RDMA/core: 64-bit memory keys Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 10:09 ` sashiko-bot
2026-10-20 3:03 ` [PATCH rdma-next v2 13/13] RDMA/core: attach a memory region to a queue pair Eric Davis
2026-10-20 3:03 ` Eric Davis via B4 Relay
2026-10-20 10:21 ` sashiko-bot
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=sashiko-outbox-178596@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eric.davis@broadcom.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.