:p
atchew
Login
Reviewing the sources, I found, that in function lxcContainerMountAllFS() pointers vmDef->fss[i]->src and vmDef->fss[i]->src->path are checked for NULL after dereferencing in VIR_DEBUG() macro. Fixes: 57487085dc ("lxc: don't try to reference NULL when mounting filesystems") --- src/lxc/lxc_container.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index XXXXXXX..XXXXXXX 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -XXX,XX +XXX,XX @@ static int lxcContainerMountAllFS(virDomainDef *vmDef, if (STREQ(vmDef->fss[i]->dst, "/")) continue; + if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path)) + return -1; + VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src->path, vmDef->fss[i]->dst); if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0) return -1; - if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path && - STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) && + if (!STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst) && lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0) return -1; -- 2.34.1
vmDef->fss[i]->src->path may be NULL, so check is needed before passing it to VIR_DEBUG. Also removed checking vmDef->fss[i]->src for NULL, since it may not be NULL. Fixes: 57487085dc ("lxc: don't try to reference NULL when mounting filesystems") Signed-off-by: Dmitry Frolov <frolov@swemel.ru> --- src/lxc/lxc_container.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index XXXXXXX..XXXXXXX 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -XXX,XX +XXX,XX @@ static int lxcContainerMountAllFS(virDomainDef *vmDef, if (STREQ(vmDef->fss[i]->dst, "/")) continue; - VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src->path, vmDef->fss[i]->dst); + VIR_DEBUG("Mounting '%s' -> '%s'", NULLSTR(vmDef->fss[i]->src->path), vmDef->fss[i]->dst); if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0) return -1; - if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path && + if (!(vmDef->fss[i]->src->path && STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) && lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0) return -1; -- 2.34.1