From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
wei.liu2@citrix.com, ian.jackson@eu.citrix.com
Subject: [PATCH] libxl: don't segfault when creating domain with invalid pvusb device
Date: Tue, 7 Feb 2017 12:51:08 +0100 [thread overview]
Message-ID: <20170207115108.24592-1-jgross@suse.com> (raw)
Creating a domain with an invalid controller specification for a pvusb
device will currently segfault.
Avoid this by bailing out early in case of a mandatory xenstore path
not existing.
Signed-of-by: Juergen Gross <jgross@suse.com>
---
This patch is a backport candidate for 4.8
---
tools/libxl/libxl_usb.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c
index ea7a2ab..b235507 100644
--- a/tools/libxl/libxl_usb.c
+++ b/tools/libxl/libxl_usb.c
@@ -651,12 +651,13 @@ int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
usbctrlinfo->devid = usbctrl->devid;
-#define READ_SUBPATH(path, subpath) ({ \
- rc = libxl__xs_read_checked(gc, XBT_NULL, \
- GCSPRINTF("%s/" subpath, path), \
- &tmp); \
- if (rc) goto out; \
- (char *)tmp; \
+#define READ_SUBPATH(path, subpath) ({ \
+ tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/" subpath, path)); \
+ if (!tmp) { \
+ rc = ERROR_FAIL; \
+ goto out; \
+ } \
+ (char *)tmp; \
})
#define READ_SUBPATH_INT(path, subpath) ({ \
--
2.10.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-02-07 11:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 11:51 Juergen Gross [this message]
2017-02-07 18:36 ` [PATCH] libxl: don't segfault when creating domain with invalid pvusb device Ian Jackson
2017-02-08 6:41 ` Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170207115108.24592-1-jgross@suse.com \
--to=jgross@suse.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).