Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John Harrison <john.c.harrison@intel.com>
To: Eugene Kobyak <eugene.kobyak@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: <andi.shyti@linux.intel.com>
Subject: Re: [PATCH v2] drm/i915: Fixed NULL pointer dereference in capture_engine
Date: Thu, 21 Nov 2024 15:44:25 -0800	[thread overview]
Message-ID: <990bda14-e5f6-4bce-bcd5-351d50f51334@intel.com> (raw)
In-Reply-To: <jpbxlab2hz4gozye45lcl635zc4nrfb7rsrvgk4jlfgww2yo6g@qriixepb57au>

On 11/20/2024 07:03, Eugene Kobyak wrote:
> When the intel_context structure contains NULL,
> it raises a NULL pointer dereference error in drm_info().
>
> This patch aims to resolve issue:
> https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12309
>
> Signed-off-by: Eugene Kobyak <eugene.kobyak@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_gpu_error.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 135ded17334e..acf403e4e5d6 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1643,9 +1643,12 @@ capture_engine(struct intel_engine_cs *engine,
>   		return NULL;
>   
>   	intel_engine_get_hung_entity(engine, &ce, &rq);
> -	if (rq && !i915_request_started(rq))
> +	if (rq && !i915_request_started(rq)) {
> +		u16 guc_id = ce ? ce->guc_id.id : 0;
Note that zero is a valid GuC id. You should either set it to -1 or 
actually make the print conditional to not include the id at all.

John.

> +
>   		drm_info(&engine->gt->i915->drm, "Got hung context on %s with active request %lld:%lld [0x%04X] not yet started\n",
> -			 engine->name, rq->fence.context, rq->fence.seqno, ce->guc_id.id);
> +			 engine->name, rq->fence.context, rq->fence.seqno, guc_id);
> +	}
>   
>   	if (rq) {
>   		capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL);


      parent reply	other threads:[~2024-11-21 23:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 15:03 [PATCH v2] drm/i915: Fixed NULL pointer dereference in capture_engine Eugene Kobyak
2024-11-20 15:12 ` Andi Shyti
2024-11-20 15:55 ` ✓ Fi.CI.BAT: success for drm/i915: Fixed NULL pointer dereference in capture_engine (rev2) Patchwork
2024-11-21  9:24 ` ✗ i915.CI.Full: failure " Patchwork
2024-11-21 23:44 ` John Harrison [this message]

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=990bda14-e5f6-4bce-bcd5-351d50f51334@intel.com \
    --to=john.c.harrison@intel.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=eugene.kobyak@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