[libvirt] [PATCH 2/3] vz: fix crash when parsing unexpected disk configuration

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Tue Jun 7 06:24:59 UTC 2016



On 06.06.2016 20:59, Maxim Nestratov wrote:
> As it turned out PrlVmDev_GetStackIndex can return negative values
> without reporting an error, which is incorrect but nevertheless.
> After that we feed this negative index to virIndexToDiskName,
> which in turn returns NULL and we set it to virDomainDiskDef.dst.
> Using virDiskNameToBusDeviceIndex with a virDomainDiskDef structure
> which has NULL dst field crashes.
> Fix this by returning an error in prlsdkGetDiskId in such cases.
> 
> Signed-off-by: Maxim Nestratov <mnestratov at virtuozzo.com>
> ---
>  src/vz/vz_sdk.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index 7eb78ca..947db3a 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -543,6 +543,9 @@ prlsdkGetDiskId(PRL_HANDLE disk, bool isCt, int *bus, char **dst)
>          return -1;
>      }
>  
> +    if (NULL == *dst)
> +        return -1;
> +
>      return 0;
>  }
>  
> 

ACK




More information about the libvir-list mailing list