Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John Harrison <john.c.harrison@intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Eugene Kobyak <eugene.kobyak@intel.com>,
	<intel-gfx@lists.freedesktop.org>, <jani.nikula@linux.intel.com>
Subject: Re: [PATCH v4] drm/i915: Fix NULL pointer dereference in capture_engine
Date: Mon, 2 Dec 2024 11:28:25 -0800	[thread overview]
Message-ID: <84588642-2a2f-4bb1-ba08-b924cfc070b7@intel.com> (raw)
In-Reply-To: <Z0mvqW3K2UMEpwGD@ashyti-mobl2.lan>

On 11/29/2024 04:12, Andi Shyti wrote:
> On Thu, Nov 28, 2024 at 06:32:28PM -0800, John Harrison wrote:
>> 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.
> do we need the guc_id at all?
>
> Andi
Huh?

Do you need any debug output at all? No. The driver will still work 
without it. However trying to debug problems because significantly more 
difficult. When using GuC submission, the guc_id is the unique 
identifier that lets you track a context/submission through the entire 
system. When tracking through H2G or G2H messaging or in the GuC log 
itself, the guc_id is the only identifier available.

John.


  reply	other threads:[~2024-12-02 19:28 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
2024-11-29 12:12   ` Andi Shyti
2024-12-02 19:28     ` John Harrison [this message]
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=84588642-2a2f-4bb1-ba08-b924cfc070b7@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