From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Subject: [PATCH 2/2] drm/i915/perf: Remove sysfs group on OA config idr_alloc() failure
Date: Tue, 8 Sep 2026 16:15:14 -0700 [thread overview]
Message-ID: <20260908231511.1217426-6-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20260908231511.1217426-4-umesh.nerlige.ramappa@intel.com>
If idr_alloc() fails, the error path jumps to sysfs_err, which only drops
metrics_lock and falls through to reg_err, where i915_oa_config_put()
releases the last reference and frees the config. The sysfs group is
never removed. Fix the error path so that sysfs group is also cleaned up.
Fixes: f89823c21224 ("drm/i915/perf: Implement I915_PERF_ADD/REMOVE_CONFIG interface")
Reported-by: Martin Hodo <martin.hodo@intel.com>
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Assisted-by: Claude:claude-opus-5
---
drivers/gpu/drm/i915/i915_perf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 96823dcd3fae..abda7b1c4956 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -4728,7 +4728,7 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
drm_dbg(&perf->i915->drm,
"Failed to create sysfs entry for OA config\n");
err = oa_config->id;
- goto sysfs_err;
+ goto remove_sysfs;
}
id = oa_config->id;
@@ -4738,6 +4738,8 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
return id;
+remove_sysfs:
+ sysfs_remove_group(perf->metrics_kobj, &oa_config->sysfs_metric);
sysfs_err:
mutex_unlock(&perf->metrics_lock);
reg_err:
--
2.53.0
next prev parent reply other threads:[~2026-09-08 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 23:15 [PATCH 0/2] Minor fixes to OA in i915 Umesh Nerlige Ramappa
2026-09-08 23:15 ` [PATCH 1/2] drm/i915/perf: Enable the stream before installing its fd Umesh Nerlige Ramappa
2026-09-08 23:29 ` sashiko-bot
2026-09-08 23:15 ` Umesh Nerlige Ramappa [this message]
2026-09-08 23:26 ` [PATCH 2/2] drm/i915/perf: Remove sysfs group on OA config idr_alloc() failure sashiko-bot
2026-09-09 0:19 ` ✓ i915.CI.BAT: success for Minor fixes to OA in i915 Patchwork
2026-09-09 17:10 ` ✓ i915.CI.Full: " Patchwork
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=20260908231511.1217426-6-umesh.nerlige.ramappa@intel.com \
--to=umesh.nerlige.ramappa@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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