Re: [PATCHv1.5 17/27] snapshot: conf: Fix NULL dereference when <driver> element is empty

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

 



On 11/27/2013 04:15 AM, Michal Privoznik wrote:
> On 26.11.2013 17:48, Peter Krempa wrote:
>> Consider the following valid snapshot XML as the <driver> element is
>> allowed to be empty in the domainsnapshot.rng schema:
>>
>> $ cat snap.xml
>> <domainsnapshot>
>>   <disks>
>>     <disk name='vda' snapshot='external'>
>>       <source file='/tmp/foo'/>
>>       <driver/>
>>     </disk>
>>   </disks>
>> </domainsnapshot>
>>
>> produces the following error:
>>
>> $ virsh snapshot-create domain snap.xml
>> error: internal error: unknown disk snapshot driver '(null)'
>>
>> The driver type is parsed as NULL from the XML as the attribute is not
>> present and then directly used to produce the error message.
>>
>> With this patch the attempt to parse the driver type is skipped if not
>> present to avoid changing the schema to forbid the empty driver element.
>> ---
>>  src/conf/snapshot_conf.c | 16 +++++++++-------
>>  1 file changed, 9 insertions(+), 7 deletions(-)

Shouldn't we add this example somewhere in the tests/ subdirectory to
ensure we don't regress?

> 
> ACK and worth backporting on *-maint branches.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]