[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] virPerfEventIsEnabled: Accept NULL @perf



On Thu, May 04, 2017 at 04:32:50PM +0200, Michal Privoznik wrote:
> After bdcf6e481 there is a crasher in libvirt. The commit assumes
> that priv->perf is always set. That is not true. For inactive
> domains, the priv->perf is not allocated as it is set in
> qemuProcessLaunch(). Now, usually we differentiate between
> accesses to inactive and active definition and it works just
> fine. Except for 'domstats'. There priv->perf is accessed without
> prior check for domain inactivity. While we could check for that,
> more robust solution is to make virPerfEventIsEnabled() accept
> NULL.
> 
> How to reproduce:
> 1) ensure you have at least one inactive domain
> 2) virsh domstats
> 
> Signed-off-by: Michal Privoznik <mprivozn redhat com>
> ---
>  src/util/virperf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virperf.c b/src/util/virperf.c
> index fa5b6cc..2c832b3 100644
> --- a/src/util/virperf.c
> +++ b/src/util/virperf.c
> @@ -297,7 +297,7 @@ virPerfEventDisable(virPerfPtr perf,
>  bool virPerfEventIsEnabled(virPerfPtr perf,
>                             virPerfEventType type)
>  {
> -    return perf->events[type].enabled;
> +    return perf && perf->events[type].enabled;
>  }

ACK


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]