Re: [PATCH] virPerfEventIsEnabled: Accept NULL @perf

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

 



On 05/04/2017 04:41 PM, Daniel P. Berrange wrote:
> 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@xxxxxxxxxx>
>> ---
>>  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
> 
> 

Thanks, pushed.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux