All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: Re: [PATCH] tests/plugins: fix use-after-free bug
Date: Mon, 11 Mar 2024 09:30:56 +0100	[thread overview]
Message-ID: <717cd4bd-bea7-4997-9be8-d585d8e8f9b3@linaro.org> (raw)
In-Reply-To: <20240311081619.669832-1-pbonzini@redhat.com>

On 11/3/24 09:16, Paolo Bonzini wrote:
> rec->count.score is inside rec, which is freed before rec->count.score is.
> Reorder the instructions
> 
> Reported by Coverity as CID 1539967.
> 
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   contrib/plugins/howvec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
> index 2d10c87e0fb..94bbc53820a 100644
> --- a/contrib/plugins/howvec.c
> +++ b/contrib/plugins/howvec.c
> @@ -167,9 +167,9 @@ static gint cmp_exec_count(gconstpointer a, gconstpointer b)
>   static void free_record(gpointer data)
>   {
>       InsnExecCount *rec = (InsnExecCount *) data;
> +    qemu_plugin_scoreboard_free(rec->count.score);
>       g_free(rec->insn);
>       g_free(rec);
> -    qemu_plugin_scoreboard_free(rec->count.score);
>   }
>   
>   static void plugin_exit(qemu_plugin_id_t id, void *p)

Actually Pierrick sent the same:
https://lore.kernel.org/qemu-devel/20240311060456.218190-1-pierrick.bouvier@linaro.org/


      parent reply	other threads:[~2024-03-11  8:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11  8:16 [PATCH] tests/plugins: fix use-after-free bug Paolo Bonzini
2024-03-11  8:26 ` Philippe Mathieu-Daudé
2024-03-11  8:30 ` Philippe Mathieu-Daudé [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=717cd4bd-bea7-4997-9be8-d585d8e8f9b3@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.