public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Dong, Zhanjun" <zhanjun.dong@intel.com>
To: "Belgaumkar, Vinay" <vinay.belgaumkar@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v1 1/1] drm/xe: Fix null pointer dereference in devcoredump cleanup
Date: Tue, 7 Apr 2026 10:13:30 -0400	[thread overview]
Message-ID: <4ec2ccde-730d-4579-adb8-01eabc9a31de@intel.com> (raw)
In-Reply-To: <79b30bcc-b056-454b-a5ac-8035f7ce76c3@intel.com>



On 2026-04-01 4:57 p.m., Belgaumkar, Vinay wrote:
> 
> On 3/26/2026 11:10 AM, Zhanjun Dong wrote:
>> In xe_devcoredump_snapshot_free(), ss->gt may be NULL when the snapshot
>> was never fully populated (e.g., when cleanup is triggered without a
>> prior capture). Guard the xe_guc_capture_put_matched_nodes() call with
>> IS_ERR_OR_NULL() to prevent a null dereference.
>>
>> In xe_devcoredump_free(), the deferred work is only queued when a
>> coredump is captured, so guard cancel_work_sync() with a check on
>> coredump->captured.
>>
>> Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_devcoredump.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/ 
>> xe_devcoredump.c
>> index 558a1a9841a0..ec206f512795 100644
>> --- a/drivers/gpu/drm/xe/xe_devcoredump.c
>> +++ b/drivers/gpu/drm/xe/xe_devcoredump.c
>> @@ -149,7 +149,8 @@ static void xe_devcoredump_snapshot_free(struct 
>> xe_devcoredump_snapshot *ss)
>>       xe_guc_ct_snapshot_free(ss->guc.ct);
>>       ss->guc.ct = NULL;
>> -    xe_guc_capture_put_matched_nodes(&ss->gt->uc.guc);
>> +    if (!IS_ERR_OR_NULL(ss->gt))
>> +        xe_guc_capture_put_matched_nodes(&ss->gt->uc.guc);
> 
> How about the other pointers being used here? Like ss->guc and ss->ge?
Thanks for take time to review.

For ss->guc, guc is embedded struct within xe_devcoredump_snapshot, so 
no null pointer risk.
For ss->ge, it can be null, the good part here is all functions (within 
this function) take this parameter already check for null internally, so 
no additional guard needed.
ss->gt is the only case.

Regards,
Zhanjun Dong
> 
> Thanks,
> 
> Vinay.
> 
>>       ss->matched_node = NULL;
>>       xe_guc_exec_queue_snapshot_free(ss->ge);
>> @@ -254,7 +255,8 @@ static void xe_devcoredump_free(void *data)
>>       if (!data || !coredump_to_xe(coredump))
>>           return;
>> -    cancel_work_sync(&coredump->snapshot.work);
>> +    if (coredump->captured)
>> +        cancel_work_sync(&coredump->snapshot.work);
>>       mutex_lock(&coredump->lock);


      reply	other threads:[~2026-04-07 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 18:10 [PATCH v1 1/1] drm/xe: Fix null pointer dereference in devcoredump cleanup Zhanjun Dong
2026-03-26 18:16 ` ✓ CI.KUnit: success for series starting with [v1,1/1] " Patchwork
2026-03-26 19:09 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-27 10:25 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-01 20:57 ` [PATCH v1 1/1] " Belgaumkar, Vinay
2026-04-07 14:13   ` Dong, Zhanjun [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=4ec2ccde-730d-4579-adb8-01eabc9a31de@intel.com \
    --to=zhanjun.dong@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=vinay.belgaumkar@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