From: David Baum <davidbaum461@gmail.com>
To: alexdeucher@gmail.com, christian.koenig@amd.com, lijo.lazar@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
David Baum <davidbaum461@gmail.com>
Subject: [PATCH] drm/amdgpu: fix resource leak in RAS error query on mode check failure
Date: Fri, 27 Mar 2026 18:40:27 -0500 [thread overview]
Message-ID: <20260327234027.44745-1-davidbaum461@gmail.com> (raw)
amdgpu_ras_query_error_status_with_event() calls
amdgpu_ras_error_data_init(&err_data) to allocate error data resources,
but when the subsequent amdgpu_ras_get_error_query_mode() call fails,
the function returns -EINVAL directly without calling
amdgpu_ras_error_data_fini() to release those resources.
Fix this by setting the return value and jumping to the existing
out_fini_err_data cleanup label, which is already used by the other
error paths in this function.
Signed-off-by: David Baum <davidbaum461@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index c0336ca9b..3c7ac9c13 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1515,8 +1515,10 @@ static int amdgpu_ras_query_error_status_with_event(struct amdgpu_device *adev,
if (ret)
return ret;
- if (!amdgpu_ras_get_error_query_mode(adev, &error_query_mode))
- return -EINVAL;
+ if (!amdgpu_ras_get_error_query_mode(adev, &error_query_mode)) {
+ ret = -EINVAL;
+ goto out_fini_err_data;
+ }
memset(&qctx, 0, sizeof(qctx));
qctx.evid.type = type;
--
2.50.1 (Apple Git-155)
reply other threads:[~2026-03-28 10:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260327234027.44745-1-davidbaum461@gmail.com \
--to=davidbaum461@gmail.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lijo.lazar@amd.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