提交 eac9445e 编写于 作者: S Shivaprasad G Bhat 提交者: Michal Privoznik

check if console/channel PTY is null before attempting to open

Console/channel devices have their pty devices assigned when the emulator is
actually started. If time is spent in guest preparation, someone attempts
to open the console/channel, the libvirt crashes in virChrdevLockFilePath().
The patch attempts to fix the crash by adding a check before attempting to
open.
Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
上级 81b19ce4
......@@ -350,6 +350,11 @@ int virChrdevOpen(virChrdevsPtr devs,
switch (source->type) {
case VIR_DOMAIN_CHR_TYPE_PTY:
path = source->data.file.path;
if (!path) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("PTY device is not yet assigned"));
return -1;
}
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
path = source->data.nix.path;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册