From: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
To: Krzysztof Karas <krzysztof.karas@intel.com>,
<intel-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH] drm/i915/selftests: avoid using uninitialized context
Date: Mon, 27 Jan 2025 15:49:36 +0000 [thread overview]
Message-ID: <D7CZ3AVS19E8.G23B4OTLA8GJ@intel.com> (raw)
In-Reply-To: <57xcbkebno22cops66u2uknknrhalp52jqmswj3daihkpwrd3h@h77t4o7kgkki>
Hi Krzysztof,
On Mon Jan 27, 2025 at 11:46 AM UTC, Krzysztof Karas wrote:
> There is an error path in igt_ppgtt_alloc(), which leads to ww
> object being passed down to i915_gem_ww_ctx_fini() without
> initialization. Correct that by zeroing the struct.
>
> Fixes: 480ae79537b2 ("drm/i915/selftests: Prepare gtt tests for obj->mm.lock removal")
> Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
> ---
> drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index 5816d515203a..29b9c75557da 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -154,7 +154,7 @@ static int igt_ppgtt_alloc(void *arg)
> {
> struct drm_i915_private *dev_priv = arg;
> struct i915_ppgtt *ppgtt;
> - struct i915_gem_ww_ctx ww;
> + struct i915_gem_ww_ctx ww = {};
I don't thing it's a best idea to just initialize ww here, you still have
incorrect path that try to fini ww before it was initialize.
I would probably do something like this instead.
------------------------------------
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 5816d515203a..526518bc4dba 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -167,8 +167,10 @@ static int igt_ppgtt_alloc(void *arg)
if (IS_ERR(ppgtt))
return PTR_ERR(ppgtt);
- if (!ppgtt->vm.allocate_va_range)
- goto err_ppgtt_cleanup;
+ if (!ppgtt->vm.allocate_va_range) {
+ i915_vm_put(&ppgtt->vm);
+ return 0;
+ }
------------------------------------
--
Best regards,
Sebastian
next prev parent reply other threads:[~2025-01-27 15:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 11:46 [PATCH] drm/i915/selftests: avoid using uninitialized context Krzysztof Karas
2025-01-27 13:22 ` ✗ i915.CI.BAT: failure for " Patchwork
2025-01-27 13:54 ` Krzysztof Karas
2025-01-27 15:49 ` Sebastian Brzezinka [this message]
2025-01-28 12:11 ` [PATCH] " Krzysztof Karas
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=D7CZ3AVS19E8.G23B4OTLA8GJ@intel.com \
--to=sebastian.brzezinka@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=krzysztof.karas@intel.com \
--cc=maarten.lankhorst@linux.intel.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