Re: [libvirt] [PATCH v2] check if console/channel PTY is null before attempting to open

2015-06-03 Thread Michal Privoznik
On 31.05.2015 17:55, Shivaprasad G Bhat wrote:
 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: Shivaprasad G Bhat sb...@linux.vnet.ibm.com
 ---
  src/conf/virchrdev.c |5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c
 index 5f28f29..701b326 100644
 --- a/src/conf/virchrdev.c
 +++ b/src/conf/virchrdev.c
 @@ -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;
 

ACKed and pushed.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2] check if console/channel PTY is null before attempting to open

2015-05-31 Thread Shivaprasad G Bhat
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: Shivaprasad G Bhat sb...@linux.vnet.ibm.com
---
 src/conf/virchrdev.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c
index 5f28f29..701b326 100644
--- a/src/conf/virchrdev.c
+++ b/src/conf/virchrdev.c
@@ -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;

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list