libxl: Do not trust backend in nic getinfo
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 3 May 2016 15:35:21 +0000 (16:35 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 2 Jun 2016 14:53:29 +0000 (15:53 +0100)
This is part of XSA-178.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c

index a4b8a41b9fff007589354653e1204d06a2b0ea7b..34791d424e4922802913f9c9018724a47c823896 100644 (file)
@@ -3753,10 +3753,8 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
     nicinfo->rref_tx = val ? strtoul(val, NULL, 10) : -1;
     val = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/rx-ring-ref", nicpath));
     nicinfo->rref_rx = val ? strtoul(val, NULL, 10) : -1;
-    nicinfo->frontend = xs_read(ctx->xsh, XBT_NULL,
-                                 GCSPRINTF("%s/frontend", nicinfo->backend), NULL);
-    val = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/frontend-id", nicinfo->backend));
-    nicinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
+    nicinfo->frontend = libxl__strdup(NOGC, nicpath);
+    nicinfo->frontend_id = domid;
 
     rc = 0;
  out: