All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@amd.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH]: xl: catch invalid numeric domain ID
Date: Fri, 21 Jan 2011 17:16:02 +0100	[thread overview]
Message-ID: <4D39B142.90806@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

Hi,

if you run any domain specific xl command with an invalid (aka 
non-existing) numeric domain ID, the command does not abort, but 
proceeds with some bogus number:
# xl destroy 42
libxl: error: libxl.c:692:libxl_domain_destroy xc_domain_pause failed for 42
libxl: error: libxl_dm.c:705:libxl__destroy_device_model Couldn't find 
device model's pid: No such file or directory
libxl: error: libxl.c:696:libxl_domain_destroy 
libxl__destroy_device_model failed for 42
libxl: error: libxl_device.c:325:libxl__devices_destroy 
/local/domain/42/device is empty
libxl: error: libxl_dom.c:536:userdata_path unable to find domain info 
for domain 42: Success
libxl: error: libxl.c:713:libxl_domain_destroy xc_domain_destroy failed 
for 42

The attached patch catches a non-existing domain and returns early (as 
an invalid domain _name_ would do).
Please apply to Xen 4.1.0-rc.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany

[-- Attachment #2: xl_fix_invalid_numeric_id.patch --]
[-- Type: text/plain, Size: 440 bytes --]

diff -r 003acf02d416 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Jan 20 17:04:06 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c	Fri Jan 21 17:11:10 2011 +0100
@@ -170,6 +170,10 @@
         exit(2);
     }
     common_domname = was_name ? p : libxl_domid_to_name(&ctx, domid);
+    if (common_domname == NULL) {
+    	fprintf(stderr, "%d is not a valid domain\n", domid);
+    	exit(2);
+    }
 }
 
 static int acquire_lock(void)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2011-01-21 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 16:16 Andre Przywara [this message]
2011-01-21 19:03 ` [PATCH]: xl: catch invalid numeric domain ID Ian Jackson
2011-01-24 22:12   ` Andre Przywara

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=4D39B142.90806@amd.com \
    --to=andre.przywara@amd.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.