All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dima Stepanov <dimastep@yandex-team.ru>
To: qemu-devel@nongnu.org
Cc: wrfsh@yandex-team.ru, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] memory: fix possible NULL pointer dereference
Date: Tue, 19 Jun 2018 17:12:16 +0300	[thread overview]
Message-ID: <20180619141216.GA16512@dimastep-nix> (raw)
In-Reply-To: <1528877995-5043-3-git-send-email-dimastep@yandex-team.ru>

Ping. I believe i forgot to add the maintainer to CC.

+ pbonzini@redhat.com

Regards, Dima.

On Wed, Jun 13, 2018 at 11:19:55AM +0300, Dima Stepanov wrote:
> In the memory_region_do_invalidate_mmio_ptr() routine the section
> variable is intialized by the memory_region_find() call. The section.mr
> field can be set to NULL.
> 
> Add the check for NULL before trying to drop a section.
> 
> Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru>
> ---
>  memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/memory.c b/memory.c
> index 3212acc..bb45248 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -2712,7 +2712,7 @@ static void memory_region_do_invalidate_mmio_ptr(CPUState *cpu,
>      /* Reset dirty so this doesn't happen later. */
>      cpu_physical_memory_test_and_clear_dirty(offset, size, 1);
>  
> -    if (section.mr != mr) {
> +    if (section.mr && (section.mr != mr)) {
>          /* memory_region_find add a ref on section.mr */
>          memory_region_unref(section.mr);
>          if (MMIO_INTERFACE(section.mr->owner)) {
> -- 
> 2.7.4
> 
> 

  reply	other threads:[~2018-06-19 14:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13  8:19 [Qemu-devel] [PATCH v2 0/2] misc fixes found by static analyzer Dima Stepanov
2018-06-13  8:19 ` [Qemu-devel] [PATCH v2 1/2] memfd: fix possible usage of the uninitialized file descriptor Dima Stepanov
2018-06-13 10:00   ` Marc-André Lureau
2018-08-31 17:16   ` Thomas Huth
2018-06-13  8:19 ` [Qemu-devel] [PATCH v2 2/2] memory: fix possible NULL pointer dereference Dima Stepanov
2018-06-19 14:12   ` Dima Stepanov [this message]
2018-07-11  8:34     ` Dima Stepanov
2018-07-11 13:47       ` Philippe Mathieu-Daudé
2018-07-11 14:09         ` Peter Maydell
2018-07-11 16:03           ` Dima Stepanov
2018-07-11 16:01         ` Dima Stepanov

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=20180619141216.GA16512@dimastep-nix \
    --to=dimastep@yandex-team.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wrfsh@yandex-team.ru \
    /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.