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>, <jani.nikula@linux.intel.com>
Subject: Re: [PATCH v4] drm/i915: Fix NULL pointer dereference in capture_engine
Date: Thu, 28 Nov 2024 18:32:28 -0800	[thread overview]
Message-ID: <c74dd6ad-e9b4-41c7-a93f-c08370360fd3@intel.com> (raw)
In-Reply-To: <sspixcrejd5nbhijuo7o3z5agbgyq637wc7gph7ajrs3lnls6g@5ljanfmvccyf>

On 11/28/2024 13:28, Eugene Kobyak wrote:
> When the intel_context structure contains NULL,
> it raises a NULL pointer dereference error in drm_info().
>
> Fixes: e8a3319c31a1 ("drm/i915: Allow error capture without a request")
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12309
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: <stable@vger.kernel.org> # v6.3+
> Signed-off-by: Eugene Kobyak <eugene.kobyak@intel.com>
> ---
> v2:
>    - return drm_info to separate condition
> v3:
>    - create separate condition which generate string if intel_context exist
> v4:
>    - rollback and add check intel_context in log condition
>   drivers/gpu/drm/i915/i915_gpu_error.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 135ded17334e..56f05a18870c 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1643,7 +1643,7 @@ 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) && ce)
>   		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);
>   
But now you don't get a message when there is a request without the 
context pointer. Which can clearly happen because otherwise you wouldn't 
have hit a null pointer dereference in the first place.

John.


  parent reply	other threads:[~2024-11-29  2:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 21:28 [PATCH v4] drm/i915: Fix NULL pointer dereference in capture_engine Eugene Kobyak
2024-11-28 22:34 ` ✓ i915.CI.BAT: success for " Patchwork
2024-11-28 23:06 ` [PATCH v4] " Andi Shyti
2024-11-29  2:32 ` John Harrison [this message]
2024-11-29 12:12   ` Andi Shyti
2024-12-02 19:28     ` John Harrison
2024-11-29  3:07 ` ✗ i915.CI.Full: failure for " 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=c74dd6ad-e9b4-41c7-a93f-c08370360fd3@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 \
    --cc=jani.nikula@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