[libvirt] [PATCH 3/6] conf: forbid seclabel duplicates for domain devices

Erik Skultety eskultet at redhat.com
Fri Feb 6 18:13:25 UTC 2015


Parser checks for per-domain seclabel duplicates, so it would be nice if
it checked for per-device seclabel duplicates the same way

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1165485
---
 src/conf/domain_conf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a36dace..c43aded 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5323,6 +5323,15 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
                     break;
                 }
             }
+
+            /* check for duplicate seclabels */
+            for (j = 0; j < i; j++) {
+                if (STREQ_NULLABLE(model, seclabels[j]->model)) {
+                    virReportError(VIR_ERR_XML_DETAIL,
+                                   _("seclabel for model %s is already provided"), model);
+                    goto error;
+                }
+            }
             seclabels[i]->model = model;
         }
 
-- 
1.9.3




More information about the libvir-list mailing list