[Qemu-devel] [PATCH] hmp: fix migrate status timer leak

Marc-André Lureau posted 1 patch 7 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180901134652.25884-1-marcandre.lureau@redhat.com
Test docker-clang@ubuntu failed
Test checkpatch passed
hmp.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH] hmp: fix migrate status timer leak
Posted by Marc-André Lureau 7 years, 2 months ago
Spotted by ASAN doing some manual testing:

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f5fcdc75e50 in calloc (/lib64/libasan.so.5+0xeee50)
    #1 0x7f5fcd47241d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
    #2 0x55f989be92ce in timer_new /home/elmarco/src/qq/include/qemu/timer.h:561
    #3 0x55f989be92ff in timer_new_ms /home/elmarco/src/qq/include/qemu/timer.h:630
    #4 0x55f989c0219d in hmp_migrate /home/elmarco/src/qq/hmp.c:2038
    #5 0x55f98955927b in handle_hmp_command /home/elmarco/src/qq/monitor.c:3498
    #6 0x55f98955fb8c in monitor_command_cb /home/elmarco/src/qq/monitor.c:4371
    #7 0x55f98ad40f11 in readline_handle_byte /home/elmarco/src/qq/util/readline.c:393
    #8 0x55f98955fa4f in monitor_read /home/elmarco/src/qq/monitor.c:4354
    #9 0x55f98aae30d7 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:175
    #10 0x55f98aae317a in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:187
    #11 0x55f98aae940c in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.c:66
    #12 0x55f98ab63018 in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84
    #13 0x7f5fcd46c8ac in g_main_dispatch gmain.c:3177

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hmp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hmp.c b/hmp.c
index 4975fa56b0..52a4279e51 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2001,6 +2001,7 @@ static void hmp_migrate_status_cb(void *opaque)
         }
         monitor_resume(status->mon);
         timer_del(status->timer);
+        timer_free(status->timer);
         g_free(status);
     }
 
-- 
2.19.0.rc1


Re: [Qemu-devel] [PATCH] hmp: fix migrate status timer leak
Posted by Dr. David Alan Gilbert 7 years, 2 months ago
* Marc-André Lureau (marcandre.lureau@redhat.com) wrote:
> Spotted by ASAN doing some manual testing:
> 
> Direct leak of 48 byte(s) in 1 object(s) allocated from:
>     #0 0x7f5fcdc75e50 in calloc (/lib64/libasan.so.5+0xeee50)
>     #1 0x7f5fcd47241d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
>     #2 0x55f989be92ce in timer_new /home/elmarco/src/qq/include/qemu/timer.h:561
>     #3 0x55f989be92ff in timer_new_ms /home/elmarco/src/qq/include/qemu/timer.h:630
>     #4 0x55f989c0219d in hmp_migrate /home/elmarco/src/qq/hmp.c:2038
>     #5 0x55f98955927b in handle_hmp_command /home/elmarco/src/qq/monitor.c:3498
>     #6 0x55f98955fb8c in monitor_command_cb /home/elmarco/src/qq/monitor.c:4371
>     #7 0x55f98ad40f11 in readline_handle_byte /home/elmarco/src/qq/util/readline.c:393
>     #8 0x55f98955fa4f in monitor_read /home/elmarco/src/qq/monitor.c:4354
>     #9 0x55f98aae30d7 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:175
>     #10 0x55f98aae317a in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:187
>     #11 0x55f98aae940c in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.c:66
>     #12 0x55f98ab63018 in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84
>     #13 0x7f5fcd46c8ac in g_main_dispatch gmain.c:3177
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Thanks, I'll add that to my HMP list.


Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hmp.c b/hmp.c
> index 4975fa56b0..52a4279e51 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -2001,6 +2001,7 @@ static void hmp_migrate_status_cb(void *opaque)
>          }
>          monitor_resume(status->mon);
>          timer_del(status->timer);
> +        timer_free(status->timer);
>          g_free(status);
>      }
>  
> -- 
> 2.19.0.rc1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

Re: [Qemu-devel] [PATCH] hmp: fix migrate status timer leak
Posted by Dr. David Alan Gilbert 7 years, 1 month ago
* Dr. David Alan Gilbert (dgilbert@redhat.com) wrote:
> * Marc-André Lureau (marcandre.lureau@redhat.com) wrote:
> > Spotted by ASAN doing some manual testing:
> > 
> > Direct leak of 48 byte(s) in 1 object(s) allocated from:
> >     #0 0x7f5fcdc75e50 in calloc (/lib64/libasan.so.5+0xeee50)
> >     #1 0x7f5fcd47241d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
> >     #2 0x55f989be92ce in timer_new /home/elmarco/src/qq/include/qemu/timer.h:561
> >     #3 0x55f989be92ff in timer_new_ms /home/elmarco/src/qq/include/qemu/timer.h:630
> >     #4 0x55f989c0219d in hmp_migrate /home/elmarco/src/qq/hmp.c:2038
> >     #5 0x55f98955927b in handle_hmp_command /home/elmarco/src/qq/monitor.c:3498
> >     #6 0x55f98955fb8c in monitor_command_cb /home/elmarco/src/qq/monitor.c:4371
> >     #7 0x55f98ad40f11 in readline_handle_byte /home/elmarco/src/qq/util/readline.c:393
> >     #8 0x55f98955fa4f in monitor_read /home/elmarco/src/qq/monitor.c:4354
> >     #9 0x55f98aae30d7 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:175
> >     #10 0x55f98aae317a in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:187
> >     #11 0x55f98aae940c in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.c:66
> >     #12 0x55f98ab63018 in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84
> >     #13 0x7f5fcd46c8ac in g_main_dispatch gmain.c:3177
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Thanks, I'll add that to my HMP list.

Queued

> 
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> 
> > ---
> >  hmp.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/hmp.c b/hmp.c
> > index 4975fa56b0..52a4279e51 100644
> > --- a/hmp.c
> > +++ b/hmp.c
> > @@ -2001,6 +2001,7 @@ static void hmp_migrate_status_cb(void *opaque)
> >          }
> >          monitor_resume(status->mon);
> >          timer_del(status->timer);
> > +        timer_free(status->timer);
> >          g_free(status);
> >      }
> >  
> > -- 
> > 2.19.0.rc1
> > 
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK