c3a4cc
From df1c2b3e2b3412c851a7ecaa056d1653d2f9f650 Mon Sep 17 00:00:00 2001
c3a4cc
From: Ian Jackson <ian.jackson@eu.citrix.com>
c3a4cc
Date: Wed, 4 May 2016 16:20:05 +0100
c3a4cc
Subject: [PATCH 15/21] libxl: Do not trust backend for nic in devid_to_device
c3a4cc
c3a4cc
libxl_devid_to_device_nic should read the information it needs from
c3a4cc
the /libxl/device path, not the backend.
c3a4cc
c3a4cc
This is part of XSA-178.
c3a4cc
c3a4cc
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
c3a4cc
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
c3a4cc
---
c3a4cc
 tools/libxl/libxl.c | 10 +++-------
c3a4cc
 1 file changed, 3 insertions(+), 7 deletions(-)
c3a4cc
c3a4cc
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
c3a4cc
index 0f6648a..8cc9114 100644
c3a4cc
--- a/tools/libxl/libxl.c
c3a4cc
+++ b/tools/libxl/libxl.c
c3a4cc
@@ -3635,7 +3635,7 @@ int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
c3a4cc
                               int devid, libxl_device_nic *nic)
c3a4cc
 {
c3a4cc
     GC_INIT(ctx);
c3a4cc
-    char *libxl_dom_path, *path;
c3a4cc
+    char *libxl_dom_path, *libxl_path;
c3a4cc
     int rc = ERROR_FAIL;
c3a4cc
 
c3a4cc
     libxl_device_nic_init(nic);
c3a4cc
@@ -3643,13 +3643,9 @@ int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
c3a4cc
     if (!libxl_dom_path)
c3a4cc
         goto out;
c3a4cc
 
c3a4cc
-    path = libxl__xs_read(gc, XBT_NULL,
c3a4cc
-                          GCSPRINTF("%s/device/vif/%d/backend", libxl_dom_path,
c3a4cc
-                                    devid));
c3a4cc
-    if (!path)
c3a4cc
-        goto out;
c3a4cc
+    libxl_path = GCSPRINTF("%s/device/vif/%d", libxl_dom_path, devid);
c3a4cc
 
c3a4cc
-    rc = libxl__device_nic_from_xenstore(gc, path, nic);
c3a4cc
+    rc = libxl__device_nic_from_xenstore(gc, libxl_path, nic);
c3a4cc
     if (rc) goto out;
c3a4cc
 
c3a4cc
     rc = 0;
c3a4cc
-- 
c3a4cc
2.1.4
c3a4cc