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