Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "Brost, Matthew" <matthew.brost@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 5/6] drm/xe: Correct migration VM teardown order
Date: Wed, 15 Oct 2025 17:55:19 +0000	[thread overview]
Message-ID: <57cb5cea85a3eeed85a1c003a99196854663a118.camel@intel.com> (raw)
In-Reply-To: <aO7x2n5BKTY1toLJ@lstrano-desk.jf.intel.com>

On Tue, 2025-10-14 at 17:59 -0700, Matthew Brost wrote:
> On Tue, Oct 14, 2025 at 06:09:26PM +0000, Stuart Summers wrote:
> > Adjust the sequence of the migration teardown to match what
> > is happening in the init() function.
> > 
> > Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_migrate.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_migrate.c
> > b/drivers/gpu/drm/xe/xe_migrate.c
> > index 7345a5b65169..b1747e442a7b 100644
> > --- a/drivers/gpu/drm/xe/xe_migrate.c
> > +++ b/drivers/gpu/drm/xe/xe_migrate.c
> > @@ -100,8 +100,8 @@ static void xe_migrate_fini(void *arg)
> >         xe_bo_put(m->pt_bo);
> >         drm_suballoc_manager_fini(&m->vm_update_sa);
> >         mutex_destroy(&m->job_mutex);
> > -       xe_vm_close_and_put(m->q->vm);
> >         xe_exec_queue_put(m->q);
> > +       xe_vm_close_and_put(m->q->vm);
> 
> You have UAF here as m->q can be destroyed by xe_exec_queue_put.
> 
> If you want to switch up this ordering that is fine but m->q->vm
> needs
> to stored on the stack before xe_exec_queue_put.

Good catch Matt thanks. I'll fix and resubmit. Doing a little more
testing on BMG to make sure we don't have some regression here before I
post a new rev.

Thanks,
Stuart

> 
> Matt
> 
> >  }
> >  
> >  static u64 xe_migrate_vm_addr(u64 slot, u32 level)
> > -- 
> > 2.34.1
> > 


  reply	other threads:[~2025-10-15 17:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 18:09 [PATCH 0/6] Fix a couple of wedge corner-case memory leaks Stuart Summers
2025-10-14 18:09 ` [PATCH 1/6] drm/xe: Add additional trace points for LRCs Stuart Summers
2025-10-14 18:09 ` [PATCH 2/6] drm/xe: Add a trace point for VM close Stuart Summers
2025-10-14 18:09 ` [PATCH 3/6] drm/xe: Add the BO pointer info to the BO trace Stuart Summers
2025-10-14 18:09 ` [PATCH 4/6] drm/xe: Add new exec queue trace points Stuart Summers
2025-10-14 18:09 ` [PATCH 5/6] drm/xe: Correct migration VM teardown order Stuart Summers
2025-10-15  0:59   ` Matthew Brost
2025-10-15 17:55     ` Summers, Stuart [this message]
2025-10-14 18:09 ` [PATCH 6/6] drm/xe: Clean up GuC software state after a wedge Stuart Summers
2025-10-15 19:45   ` Summers, Stuart
2025-10-16  3:42     ` Matthew Brost
2025-10-16 17:50       ` Summers, Stuart
2025-10-16 22:10         ` Matthew Brost
2025-10-17 14:48           ` Summers, Stuart
2025-10-14 18:15 ` ✗ CI.checkpatch: warning for Fix a couple of wedge corner-case memory leaks (rev4) Patchwork
2025-10-14 18:16 ` ✓ CI.KUnit: success " Patchwork
2025-10-14 19:13 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-10-14 21:14   ` Summers, Stuart
2025-10-15  5:18 ` ✗ Xe.CI.Full: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-10-27 18:04 [PATCH 0/6] Fix a couple of wedge corner-case memory leaks Stuart Summers
2025-10-27 18:04 ` [PATCH 5/6] drm/xe: Correct migration VM teardown order Stuart Summers
2025-10-27 19:46   ` Matthew Brost

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=57cb5cea85a3eeed85a1c003a99196854663a118.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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