From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>,
dri-devel@lists.freedesktop.org, netdev@vger.kernel.org,
riana.tauro@intel.com, aravind.iddamsetty@linux.intel.com,
rodrigo.vivi@intel.com, raag.jadav@intel.com,
simona.vetter@ffwll.ch, airlied@gmail.com, kuba@kernel.org,
ogabbay@kernel.org, lizhi.hou@amd.com,
karol.wachowski@linux.intel.com
Cc: carl.vanderlip@oss.qualcomm.com, troy.hanson@oss.qualcomm.com,
youssef.abdulrahman@oss.qualcomm.com,
Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v4 1/4] drm/drm_ras: Reference-count nodes across netlink handlers
Date: Tue, 24 Nov 2026 09:18:26 -0700 [thread overview]
Message-ID: <f521ca85-3cbb-4209-9ee4-63e3c8cdf0db@oss.qualcomm.com> (raw)
In-Reply-To: <20261117233442.407877-2-zachary.mckevitt@oss.qualcomm.com>
On 11/17/2026 4:34 PM, Zack McKevitt wrote:
> The drm_ras generic netlink family sets .parallel_ops = true, so its
> handlers can run concurrently with each other and with
> drm_ras_node_unregister(). Every handler looks a node up with a bare
> xa_load() and then dereferences the returned pointer across GFP_KERNEL
> allocations and sleeping driver callbacks, while drm_ras_node_unregister()
> only calls xa_erase() and the driver frees the node immediately afterwards.
> xa_load() only holds the RCU read lock for the duration of the walk, so the
> node can be unregistered and freed while a handler is still using it.
>
> Give each node a reference count. A node holds one reference for being
> registered; drm_ras_node_get()/drm_ras_node_get_next() take an additional
> reference under the xarray lock, which serialises them against the
> xa_erase() in drm_ras_node_unregister() so the bump can never race with the
> free. Handlers drop their reference with drm_ras_node_put() once they are
> done touching the node. drm_ras_node_unregister() removes the node from
> the xarray, drops the registration reference and waits for any in-flight
> handler to drop theirs before returning, so the driver can still free the
> node as soon as unregister() returns.
>
> drm_ras_nl_error_event() is left unchanged: it is called by the driver with
> its own node, whose lifetime the caller already guarantees.
>
> Fixes: c36218dc49f5 ("drm/ras: Introduce the DRM RAS infrastructure over generic netlink")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/patchset/20261106181225.3333260-1-zachary.mckevitt@oss.qualcomm.com
> Signed-off-by: Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>
Looks like you break reverse christmas tree ordering in some places
where you modify function local variables, but I'm not sure if that is
the expected style or it just happens to look that way.
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
next prev parent reply other threads:[~2026-11-24 16:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 23:34 [PATCH v4 0/4] Extend drm_ras for qaic telemetry Zack McKevitt
2026-11-17 23:34 ` [PATCH v4 1/4] drm/drm_ras: Reference-count nodes across netlink handlers Zack McKevitt
2026-11-24 15:20 ` Rodrigo Vivi
2026-11-24 16:18 ` Jeff Hugo [this message]
2026-11-17 23:34 ` [PATCH v4 2/4] drm/drm_ras: Remove admin-perm flag from list-nodes operation Zack McKevitt
2026-11-17 23:34 ` [PATCH v4 3/4] drm/drm_ras: Extend DRM RAS interface to include telemetry nodes Zack McKevitt
2026-11-17 23:34 ` [PATCH v4 4/4] accel/qaic: Add callbacks for DRM RAS netlink telemetry Zack McKevitt
2026-11-24 15:22 ` Rodrigo Vivi
2026-11-24 16:20 ` Jeff Hugo
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=f521ca85-3cbb-4209-9ee4-63e3c8cdf0db@oss.qualcomm.com \
--to=jeff.hugo@oss.qualcomm.com \
--cc=airlied@gmail.com \
--cc=aravind.iddamsetty@linux.intel.com \
--cc=carl.vanderlip@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=kuba@kernel.org \
--cc=lizhi.hou@amd.com \
--cc=netdev@vger.kernel.org \
--cc=ogabbay@kernel.org \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=sashiko-bot@kernel.org \
--cc=simona.vetter@ffwll.ch \
--cc=troy.hanson@oss.qualcomm.com \
--cc=youssef.abdulrahman@oss.qualcomm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox