[libvirt] [PATCH 4/7] qemu: Fix segfault if defining a domain without <seclabel>

Cole Robinson crobinso at redhat.com
Wed Jan 12 17:23:00 UTC 2011


If the selinux driver is the default, it will lead to a null dereference.
This change should still yeild the intended result, since a null model
basically implies 'use the default'.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/security/security_driver.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/security/security_driver.c b/src/security/security_driver.c
index 5711aee..7d2e0de 100644
--- a/src/security/security_driver.c
+++ b/src/security/security_driver.c
@@ -82,7 +82,8 @@ virSecurityIsSpecifiedDriver(virSecurityManagerPtr mgr,
 {
     bool ret = true;
 
-    if (!STREQ(virSecurityManagerGetModel(mgr), def->seclabel.model)) {
+    if (def->seclabel.model &&
+        !STREQ(virSecurityManagerGetModel(mgr), def->seclabel.model)) {
         virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
                                _("security label driver mismatch: "
                                  "'%s' model configured for domain, but "
-- 
1.7.3.2




More information about the libvir-list mailing list