lxc: don't try to reference NULL when mounting filesystems

<filesystem type='ram' accessmode='passthrough'>
    <source usage='524288' units='KiB'/>
    <target dir='/dev/shm'/>
  </filesystem>

would lead to lxcContainerMountAllFS calling STRPREFIX
on a NLL pointer because it failed to check if fs->src->path
was non-NULL. This is a regression caused by

  commit da665fbd48
  Author: Olga Krishtal <okrishtal@virtuozzo.com>
  Date:   Thu Jul 14 16:52:38 2016 +0300

    filesystem: adds possibility to use storage pool as fs source

    Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2016-08-11 14:02:48 +01:00
parent 81aa4385d7
commit 57487085dc

View File

@ -1627,8 +1627,7 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0) if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
return -1; return -1;
if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path &&
if (!(vmDef->fss[i]->src &&
STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) && STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) &&
lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0) lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0)
return -1; return -1;