From: sashiko-bot@kernel.org
To: "Zack McKevitt" <zachary.mckevitt@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/drm_ras: Remove admin-perm flag from list-nodes operation
Date: Sat, 10 Oct 2026 17:36:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-166783@kernel.org> (raw)
In-Reply-To: <20261009173152.2436195-2-zachary.mckevitt@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] core: UAF in drm_ras_xa lookups during Netlink operations
- [High] core: uninitialized variable leak in Netlink dumpit handlers
- [Low] netlink: missing NLM_F_DUMP_INTR flag for lockless dump iteration
--
commit 46092107989be3447885b1e58b5d130104004fba
Author: Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>
drm/drm_ras: Remove admin-perm flag from list-nodes operation
Drivers may want to avoid requiring CAP_NET_ADMIN for subsequent
drm-ras operations. So, drop the CAP_NET_ADMIN requirement for dumping
RAS nodes so that drivers with different permission requirements are
still able to use the interface.
> diff --git a/drivers/gpu/drm/drm_ras_nl.c b/drivers/gpu/drm/drm_ras_nl.c
> index c9f5e0ceb3b5f..ff0dc406c27c8 100644
> --- a/drivers/gpu/drm/drm_ras_nl.c
> +++ b/drivers/gpu/drm/drm_ras_nl.c
> @@ -46,7 +46,7 @@ static const struct genl_split_ops drm_ras_nl_ops[] = {
> {
> .cmd = DRM_RAS_CMD_LIST_NODES,
> .dumpit = drm_ras_nl_list_nodes_dumpit,
> - .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
> + .flags = GENL_CMD_CAP_DUMP,
[Severity: Critical]
Does dropping the admin permission here safely handle the pointer management
in drm_ras_nl_list_nodes_dumpit() and get_node_error_counter()?
In drm_ras_nl_list_nodes_dumpit(), xa_for_each_start() iterates over the
xarray:
xa_for_each_start(&drm_ras_xa, id, node, ctx->restart) {
hdr = genlmsg_iput(skb, info);
...
ret = nla_put_string(skb, DRM_RAS_A_NODE_ATTRS_DEVICE_NAME,
node->device_name);
The xa_for_each_start() macro drops the RCU read lock before returning,
leaving the node pointer unprotected against concurrent freeing.
Could an unprivileged user concurrently querying the list while nodes are
unregistered trigger a use-after-free when node->device_name is read,
leading to memory corruption or data leaks?
A similar unprotected access occurs in get_node_error_counter():
node = xa_load(&drm_ras_xa, node_id);
if (!node || !node->query_error_counter)
return -ENOENT;
...
return node->query_error_counter(node, error_id, name, value);
Does xa_load() protect the returned node pointer from being freed before the
query_error_counter() function pointer is dereferenced?
[Severity: High]
Can exposing drm_ras_nl_list_nodes_dumpit() to unprivileged users leak kernel
stack memory?
In drm_ras_nl_list_nodes_dumpit(), the ret variable is uninitialized:
int ret;
xa_for_each_start(&drm_ras_xa, id, node, ctx->restart) {
...
If the drm_ras_xa xarray is empty, the loop will not execute, and the
function will return the uninitialized stack value. The same issue exists
in drm_ras_nl_get_error_counter_dumpit().
Additionally, if the loop does execute and the socket buffer is full, ret is
set to -EMSGSIZE and returned:
if (ret == -EMSGSIZE)
ctx->restart = id;
return ret;
Does returning -EMSGSIZE break multi-part netlink dumps entirely by failing
to return skb->len when the buffer fills up?
[Severity: Low]
Is the NLM_F_DUMP_INTR flag required for this lockless dump iteration?
drm_ras_nl_list_nodes_dumpit() iterates over the lockless drm_ras_xa data
structure. If concurrent node registrations or unregistrations occur, the
iteration could skip or repeat items.
According to the Netlink subsystem rules, should such dumps maintain a
generation counter and set NLM_F_DUMP_INTR on the affected messages to
notify userspace of inconsistent states?
> },
> {
> .cmd = DRM_RAS_CMD_GET_ERROR_COUNTER,
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009173152.2436195-1-zachary.mckevitt@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-10-10 17:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 17:31 [PATCH 0/3] Extend drm_ras for qaic telemetry Zack McKevitt
2026-10-09 17:31 ` [PATCH 1/3] drm/drm_ras: Remove admin-perm flag from list-nodes operation Zack McKevitt
2026-10-10 17:36 ` sashiko-bot [this message]
2026-10-09 17:31 ` [PATCH 2/3] drm/drm_ras: Extend DRM RAS interface to include telemetry nodes Zack McKevitt
2026-10-10 17:36 ` sashiko-bot
2026-10-09 17:31 ` [PATCH 3/3] accel/qaic: Add callbacks for DRM RAS netlink telemetry Zack McKevitt
2026-10-10 17:36 ` sashiko-bot
2026-10-10 9:42 ` [syzbot ci] Re: Extend drm_ras for qaic telemetry syzbot ci
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-166783@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zachary.mckevitt@oss.qualcomm.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.