Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] i915: two teardown fixes (gen6 ppgtt ERR_PTR, OA config sysfs leak)
@ 2026-11-04  7:33 Chengyu Liu
  2026-11-04  7:33 ` [PATCH 1/2] i915/gt: tolerate ERR_PTR pd in gen6_ppgtt teardown Chengyu Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Chengyu Liu @ 2026-11-04  7:33 UTC (permalink / raw)
  To: intel-gfx
  Cc: dri-devel, jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin,
	Chengyu Liu

Two independent small fixes found by static analysis:

1/2: gen6_ppgtt_create() stores an ERR_PTR in ppgtt->base.pd when
     gen6_alloc_top_pd() fails; the teardown path
     (gen6_ppgtt_cleanup -> gen6_ppgtt_free_pd) dereferences it and
     crashes in the async release worker.  Guard both teardown sites
     with IS_ERR_OR_NULL() so an allocation failure under memory
     pressure stays a plain -ENOMEM.

2/2: i915_perf_add_config_ioctl() creates the dynamic sysfs entry
     before idr_alloc(); if idr_alloc() fails the error path frees the
     config without removing the sysfs entry, leaving attributes that
     point into freed memory (UAF read via the embedded show()
     callback).  Remove the group on that path, mirroring the remove
     ioctl's ordering.

Signed-off-by: Chengyu Liu <lui2012qwq@gmail.com>
---

Chengyu Liu (2):
  i915/gt: tolerate ERR_PTR pd in gen6_ppgtt teardown
  i915/perf: remove sysfs entry if idr_alloc() fails in add_config

 drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 5 ++++-
 drivers/gpu/drm/i915/i915_perf.c     | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-05 14:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  7:33 [PATCH 0/2] i915: two teardown fixes (gen6 ppgtt ERR_PTR, OA config sysfs leak) Chengyu Liu
2026-11-04  7:33 ` [PATCH 1/2] i915/gt: tolerate ERR_PTR pd in gen6_ppgtt teardown Chengyu Liu
2026-11-04 15:18   ` Ville Syrjälä
2026-11-05  6:04     ` Chengyu Liu
2026-11-04  7:33 ` [PATCH 2/2] i915/perf: remove sysfs entry if idr_alloc() fails in add_config Chengyu Liu
2026-11-04 21:42 ` ✗ LGCI.VerificationFailed: failure for i915: two teardown fixes (gen6 ppgtt ERR_PTR, OA config sysfs leak) Patchwork
2026-11-05  4:09 ` ✓ i915.CI.BAT: success for i915: two teardown fixes (gen6 ppgtt ERR_PTR, OA config sysfs leak) (rev2) Patchwork
2026-11-05  6:41 ` ✓ i915.CI.Full: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox