mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
storage: Don't dereference driver object if virStorageSource is not initialized
virStorageFileReportBrokenChain uses data from the driver private data
pointer to print the user and group. This would lead to a crash in call
paths where we did not initialize the storage backend as recently added
in commit 24e47ee2b9
to qemuDomainDetermineDiskChain.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1522682
This commit is contained in:
parent
c277034ed7
commit
2d07f1f0eb
@ -419,19 +419,33 @@ virStorageFileReportBrokenChain(int errcode,
|
|||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
virStorageSourcePtr parent)
|
virStorageSourcePtr parent)
|
||||||
{
|
{
|
||||||
unsigned int access_user = src->drv->uid;
|
|
||||||
unsigned int access_group = src->drv->gid;
|
|
||||||
|
|
||||||
if (src == parent) {
|
if (src->drv) {
|
||||||
virReportSystemError(errcode,
|
unsigned int access_user = src->drv->uid;
|
||||||
_("Cannot access storage file '%s' "
|
unsigned int access_group = src->drv->gid;
|
||||||
"(as uid:%u, gid:%u)"),
|
|
||||||
src->path, access_user, access_group);
|
if (src == parent) {
|
||||||
|
virReportSystemError(errcode,
|
||||||
|
_("Cannot access storage file '%s' "
|
||||||
|
"(as uid:%u, gid:%u)"),
|
||||||
|
src->path, access_user, access_group);
|
||||||
|
} else {
|
||||||
|
virReportSystemError(errcode,
|
||||||
|
_("Cannot access backing file '%s' "
|
||||||
|
"of storage file '%s' (as uid:%u, gid:%u)"),
|
||||||
|
src->path, parent->path, access_user, access_group);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
virReportSystemError(errcode,
|
if (src == parent) {
|
||||||
_("Cannot access backing file '%s' "
|
virReportSystemError(errcode,
|
||||||
"of storage file '%s' (as uid:%u, gid:%u)"),
|
_("Cannot access storage file '%s'"),
|
||||||
src->path, parent->path, access_user, access_group);
|
src->path);
|
||||||
|
} else {
|
||||||
|
virReportSystemError(errcode,
|
||||||
|
_("Cannot access backing file '%s' "
|
||||||
|
"of storage file '%s'"),
|
||||||
|
src->path, parent->path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user