[libvirt] [PATCH] security: selinux: Fix crash when releasing non-existent label

Cole Robinson crobinso at redhat.com
Mon Mar 22 15:12:37 UTC 2010


On 03/22/2010 11:05 AM, Daniel P. Berrange wrote:
> On Mon, Mar 22, 2010 at 10:48:32AM -0400, Cole Robinson wrote:
>> This can be triggered by the qemuStartVMDaemon cleanup path if a
>> VM references a non-existent USB device (by product) in the XML.
>>
>> Signed-off-by: Cole Robinson <crobinso at redhat.com>
>> ---
>>  src/security/security_selinux.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
>> index 975b315..6680e2d 100644
>> --- a/src/security/security_selinux.c
>> +++ b/src/security/security_selinux.c
>> @@ -632,7 +632,8 @@ SELinuxReleaseSecurityLabel(virDomainObjPtr vm)
>>  {
>>      const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
>>  
>> -    if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC)
>> +    if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC ||
>> +        secdef->label == NULL)
>>          return 0;
>>  
>>      context_t con = context_new(secdef->label);
> 
> ACK
> 

Thanks, pushed now.

- Cole




More information about the libvir-list mailing list