dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Konstantin Sinyuk" <ksinyuk@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 03/12] drm/fabric: implement query netlink operations
Date: Tue, 25 Aug 2026 08:10:34 +0000	[thread overview]
Message-ID: <20260825081035.17E9D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <fea1fb8ce49d7b673a0ccd9e950cdc0fc0565c68.1787552412.git.ksinyuk@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Ambiguity check bypass in endpoint resolution when busname is provided.
--

--- Patch [3]: [RFC PATCH 03/12] drm/fabric: implement query netlink operations ---
commit ec7b295b3219dced2d6c1d65d7829fa5aa0283c3
Author: Konstantin Sinyuk <ksinyuk@kernel.org>
Subject: drm/fabric: implement query netlink operations

This commit registers the drm-fabric Generic Netlink family and connects
read-only query commands to the core object model. It supports single-object
lookup and multipart dumps for fabrics, endpoints, and ports.

> diff --git a/drivers/gpu/drm/fabric/drm_fabric_netlink.c b/drivers/gpu/drm/fabric/drm_fabric_netlink.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/gpu/drm/fabric/drm_fabric_netlink.c

[ ... ]

> +/* Identified by core-assigned id, or by bus + dev name. */
> +static struct drm_fabric_endpoint *
> +drm_fabric_resolve_endpoint(struct genl_info *info)
> +{
> +	struct nlattr **attrs = info->attrs;
> +	const char *devname = NULL;
> +	const char *busname = NULL;
> +	struct drm_fabric_endpoint *ep;
> +
> +	lockdep_assert_held(&drm_fabric_lock);
> +
> +	if (attrs[DRM_FABRIC_A_DEV_NAME])
> +		devname = nla_data(attrs[DRM_FABRIC_A_DEV_NAME]);
> +	if (attrs[DRM_FABRIC_A_BUS_NAME])
> +		busname = nla_data(attrs[DRM_FABRIC_A_BUS_NAME]);

[ ... ]

> +	if (!devname)
> +		return ERR_PTR(-EINVAL);
> +
> +	ep = drm_fabric_endpoint_find_by_dev_name(devname, busname);

[Severity: High]
Does this lookup bypass the ambiguity check when both devname and busname are
provided?

Looking at drm_fabric_endpoint_find_by_dev_name() in drm_fabric.c:

drm_fabric_endpoint_find_by_dev_name() {
    ...
    xa_for_each(&drm_fabric_ep_xa, idx, ep) {
        if (strcmp(dev_name(ep->parent), devname))
            continue;

        if (busname) {
            if (strcmp(dev_bus_name(ep->parent), busname))
                continue;
            return ep;
        }
    ...
}

When busname is matched, the loop immediately returns the first matched
endpoint instead of assigning it to the match variable and continuing the
loop. If multiple endpoints are registered by the same physical device
(sharing the exact same devname and busname), could this cause userspace
queries to silently succeed and operate on the wrong endpoint instead of
returning an ambiguity error?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787552412.git.ksinyuk@kernel.org?part=3

  reply	other threads:[~2026-08-25  8:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:09 [RFC PATCH 0/12] drm/fabric: vendor-neutral topology infrastructure for scale-up accelerator interconnects Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 01/12] drm/fabric: add core object model and provider API Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 02/12] drm/fabric: add query uAPI and generated headers Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 03/12] drm/fabric: implement query netlink operations Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot [this message]
2026-08-24  8:09 ` [RFC PATCH 04/12] drm/fabric: add read-only synthetic provider Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 05/12] drm/fabric: add object-model KUnit tests Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 06/12] drm/fabric: add YNL query and policy selftests Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 07/12] drm/fabric: add topology-provisioning core Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 08/12] drm/fabric: add provisioning netlink uAPI Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 09/12] drm/fabric: implement mutation netlink operations Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 10/12] drm/fabric: make the synthetic provider writable Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 11/12] drm/fabric: add mutation KUnit tests Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 12/12] drm/fabric: add mutation netlink selftests Konstantin Sinyuk
2026-08-26  9:32 ` [RFC PATCH 0/12] drm/fabric: vendor-neutral topology infrastructure for scale-up accelerator interconnects Leon Romanovsky
2026-08-26 15:38   ` Konstantin Sinyuk
2026-08-27 17:09     ` Leon Romanovsky
2026-08-28 16:13       ` Rodrigo Vivi
2026-08-27 12:35 ` Jiri Pirko
2026-08-28 16:28   ` Rodrigo Vivi
2026-08-28 17:03     ` 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=20260825081035.17E9D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ksinyuk@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox