Re: [PATCH 2/4] snapshot: conf: Avoid dereferencing NULL snapshot parent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/21/13 11:45, Jiri Denemark wrote:
On Thu, Jan 17, 2013 at 14:12:03 +0100, Peter Krempa wrote:
virDomainSnapshotDropParent tried to dereference the parent even in case
the snapshot didn't have a parent. This should not be possible as the
snapshots use metaroot now, but bugs may induce this failure.
---
  src/conf/snapshot_conf.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 0c5b005..c3a8494 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -995,6 +995,9 @@ virDomainSnapshotDropParent(virDomainSnapshotObjPtr snapshot)
      virDomainSnapshotObjPtr prev = NULL;
      virDomainSnapshotObjPtr curr = NULL;

+    if (!snapshot || !snapshot->parent)
+        return;
+
      snapshot->parent->nchildren--;
      curr = snapshot->parent->first_child;
      while (curr != snapshot) {

I'm slightly against this patch as I prefer a crashing daemon to silent
propagation of bug.

Hm, yeah. I agree. The snapshot metaroot patch that caused this problem expects that all snapshots except the metaroot have parents so this may disclose other potential bugs.


Peter


Jirka


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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]