* [PATCH] drm/etnaviv: erase context from active_contexts on open failure
@ 2026-09-07 20:46 Changyul Lee
0 siblings, 0 replies; only message in thread
From: Changyul Lee @ 2026-09-07 20:46 UTC (permalink / raw)
To: Lucas Stach
Cc: Russell King, Christian Gmeiner, David Airlie, Simona Vetter,
etnaviv, dri-devel, linux-kernel, Changyul Lee
etnaviv_open() allocates an ID in priv->active_contexts for the new
struct etnaviv_file_private. When etnaviv_iommu_context_init() fails,
the error path frees ctx but does not remove the entry from the
XArray, so the entry keeps a dangling pointer.
Erase the entry before freeing the context on that path.
Fixes: d306788b6e1b ("drm/etnaviv: allocate unique ID per drm_file")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 08aca9035fc1..ceb8c00d66c0 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -79,7 +79,7 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
priv->cmdbuf_suballoc);
if (!ctx->mmu) {
ret = -ENOMEM;
- goto out_free;
+ goto out_free_id;
}
for (i = 0; i < ETNA_MAX_PIPES; i++) {
@@ -98,6 +98,8 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
return 0;
+out_free_id:
+ xa_erase(&priv->active_contexts, ctx->id);
out_free:
kfree(ctx);
return ret;
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-07 20:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07 20:46 [PATCH] drm/etnaviv: erase context from active_contexts on open failure Changyul Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®