* [PATCH] media: xilinx-vipp: fix double fwnode_handle_put() in xvip_graph_parse_one()
@ 2026-12-04 17:07 Yuansheng Yang
0 siblings, 0 replies; only message in thread
From: Yuansheng Yang @ 2026-12-04 17:07 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab, Michal Simek
Cc: linux-media, linux-arm-kernel, linux-kernel, stable
fwnode_graph_get_next_endpoint() already drops the reference on its
previous endpoint `ep`, and the `err_notifier_cleanup:` path also calls
fwnode_handle_put(ep). Calling fwnode_handle_put(ep) inside the loop
body therefore drops `ep`'s reference a second time both on the next
iteration and on the v4l2_async_nf_add_fwnode() error path.
On OF graphs this underflows the endpoint node's refcount on overlay
teardown or repeated probes (deadlocking on devtree_lock when
of_node_release() formats %pOF from inside of_get_next_child()):
refcount_t: underflow; use-after-free.
Call Trace:
kobject_put
of_changeset_destroy
free_overlay_changeset
of_overlay_remove
Call Trace:
of_get_parent
...
of_node_release
of_get_next_child
of_graph_get_next_endpoint
xvip_graph_parse_one
xvip_composite_probe
Drop the redundant fwnode_handle_put(ep) inside the loop.
Fixes: d079f94c9046 ("media: platform: Switch to v4l2_async_notifier_add_subdev")
Cc: stable@vger.kernel.org
Signed-off-by: Yuansheng Yang <0xbeac@gmail.com>
---
Compiled with W=1 on x86_64 (0 warnings) and verified on v7.4-rc5 with a
DT overlay probing xilinx-video: before the fix, a single probe + overlay
removal hit refcount_t underflow and repeated rebinds hit the devtree_lock
stall inside xvip_composite_probe(); after the fix, 10 overlay cycles x 5
probes passed with 0 errors or warnings.
drivers/media/platform/xilinx/xilinx-vipp.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c
index 786e4f2e6..d997fed57 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -353,8 +353,6 @@ static int xvip_graph_parse_one(struct xvip_composite_device *xdev,
goto err_notifier_cleanup;
}
- fwnode_handle_put(ep);
-
/* Skip entities that we have already processed. */
if (remote == of_fwnode_handle(xdev->dev->of_node) ||
xvip_graph_find_entity(xdev, remote)) {
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-04 17:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 17:07 [PATCH] media: xilinx-vipp: fix double fwnode_handle_put() in xvip_graph_parse_one() Yuansheng Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox