[PATCH] qemu_conf: Fix double free problem for cfg->firmwares

Tuguoyi tu.guoyi at h3c.com
Thu Dec 3 01:47:01 UTC 2020


> -----Original Message-----
> From: Michal Privoznik [mailto:mprivozn at redhat.com]
> Sent: Tuesday, December 01, 2020 9:28 PM
> To: tuguoyi (Cloud) <tu.guoyi at h3c.com>; Ján Tomko <jtomko at redhat.com>
> Cc: libvir-list at redhat.com
> Subject: Re: [PATCH] qemu_conf: Fix double free problem for cfg->firmwares
> 
> On 12/1/20 2:50 AM, Tuguoyi wrote:
> >> -----Original Message-----
> >> From: Ján Tomko [mailto:jtomko at redhat.com]
> >> Sent: Tuesday, November 24, 2020 6:57 PM
> >> To: tuguoyi (Cloud) <tu.guoyi at h3c.com>
> >> Cc: libvir-list at redhat.com
> >> Subject: Re: [PATCH] qemu_conf: Fix double free problem for
> cfg->firmwares
> >>
> >> On a Tuesday in 2020, Tuguoyi wrote:
> >>> cfg->firmwares still points to the original memory address after being
> >>> freed by virFirmwareFreeList(). As cfg get freed, it will be freed again
> >>> even if cfg->nfirmwares=0 which eventually lead to crash.
> >>>
> >>> The patch fix it by setting cfg->firmwares to NULL explicitly after
> >>> virFirmwareFreeList() returns
> >>>
> >>> Signed-off-by: Tuguoyi <tu.guoyi at h3c.com>
> >>
> >> Should there be a space separating your name(s)?
> >>
> >>> ---
> >>> src/qemu/qemu_conf.c | 1 +
> >>> 1 file changed, 1 insertion(+)
> >>>
> >>
> >> Reviewed-by: Ján Tomko <jtomko at redhat.com>
> >>
> >> Jano
> >
> > Hi there,
> >
> > It's my first time to submit patch to libvirt, so I'm wondering will this patch
> be applied to the upstream?
> >
> 
> Oh yeah, sorry. I've pushed it now:
> 
> 
> https://gitlab.com/libvirt/libvirt/-/commit/c4f4e195a14c86b7daff2c45f1cbfd2
> 3ac16aaa8
> 
> Congratulations on your first libvirt contribution!
> 
> Michal

Thanks a lot




More information about the libvir-list mailing list