qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: gerben@altlinux.org
Cc: farosas@suse.de, clg@redhat.com, qemu-devel@nongnu.org,
	sdl.qemu@linuxtesting.org
Subject: Re: [PATCH] migration/migration: fix null pointer dereference in migration block
Date: Thu, 7 Nov 2024 10:04:17 -0500	[thread overview]
Message-ID: <ZyzW8Vi71srvqwTZ@x1n> (raw)
In-Reply-To: <20241107114256.106831-1-gerben@altlinux.org>

On Thu, Nov 07, 2024 at 02:42:56PM +0300, gerben@altlinux.org wrote:
> From: Denis Rastyogin <gerben@altlinux.org>

Hi, Denis,

Thanks for the patch, there's an identical patch already on the list to fix
it:

https://lore.kernel.org/r/20241105182725.2393425-1-peterx@redhat.com

> 
> In this merge, the migration_is_idle() function was replaced with migrate_is_running().
> However, the null pointer check for `s` was removed, leading to a dereference of `s` 
> when using qemu-system-x86_64 -hda *.vdi.
> A null check for `s` has been added before its use to prevent the dereference.

This is more severe than I thought..  I think I'll send the pull sooner,
and I'll update the commit message a bit too to reflect your report here.

> 
> Fixes: cbad455118 ("Merge tag 'migration-20241030-pull-request' of https://gitlab.com/peterx/qemu into staging")

Definitely not the merge commit to blame..

> Signed-off-by: Denis Rastyogin <gerben@altlinux.org>

Thanks,

> ---
>  migration/migration.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index aedf7f0751..8c5bd0a75c 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1117,6 +1117,10 @@ bool migration_is_running(void)
>  {
>      MigrationState *s = current_migration;
>  
> +    if (!s) {
> +        return false;
> +    }
> +
>      switch (s->state) {
>      case MIGRATION_STATUS_ACTIVE:
>      case MIGRATION_STATUS_POSTCOPY_ACTIVE:
> -- 
> 2.42.2
> 

-- 
Peter Xu



           reply	other threads:[~2024-11-07 15:05 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20241107114256.106831-1-gerben@altlinux.org>]

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=ZyzW8Vi71srvqwTZ@x1n \
    --to=peterx@redhat.com \
    --cc=clg@redhat.com \
    --cc=farosas@suse.de \
    --cc=gerben@altlinux.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sdl.qemu@linuxtesting.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;
as well as URLs for NNTP newsgroup(s).