Re: [PATCH] xenconfig: xm: check for driver on disk format

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

 




On 05/25/2016 02:21 AM, Jim Fehlig wrote:
> On 05/24/2016 04:56 AM, Joao Martins wrote:
>> When reviewing libxl vif typename series[0] I found out a bug
> 
> s/out//
> 
>> on xen-xm formatter where this "virsh domxml-to-native xen-xm file.xml"
> 
> s/this//
> 
>> can lead to a NULL dereference if the disk driver isn't specified.
>> Fix this by checking for driver before writing/testing it down.
>>
>> [0] https://www.redhat.com/archives/libvir-list/2016-April/msg01434.html
>>
>> Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
>> ---
>>  src/xenconfig/xen_xm.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
>> index 34d57de..3658c59 100644
>> --- a/src/xenconfig/xen_xm.c
>> +++ b/src/xenconfig/xen_xm.c
>> @@ -297,9 +297,12 @@ xenFormatXMDisk(virConfValuePtr list,
>>                  type = "aio";
>>              else
>>                  type = virStorageFileFormatTypeToString(format);
>> -            virBufferAsprintf(&buf, "%s:", driver);
>> -            if (STREQ(driver, "tap"))
>> -                virBufferAsprintf(&buf, "%s:", type);
>> +
>> +            if (driver) {
>> +                virBufferAsprintf(&buf, "%s:", driver);
>> +                if (STREQ(driver, "tap"))
>> +                    virBufferAsprintf(&buf, "%s:", type);
>> +            }
>>          } else {
>>              switch (virDomainDiskGetType(disk)) {
>>              case VIR_STORAGE_TYPE_FILE:
> 
> ACK. I've pushed the patch after the minor commit message tweak. Thanks!
> 
Thanks!

> Regards,
> Jim
> 

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