From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: [PATCH 2/2]xl: Check invalid domid in find_domain() Date: Mon, 17 May 2010 16:27:45 -0700 Message-ID: <4BF1D0F1.9020302@goop.org> References: <4BEBC822.6080009@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4BEBC822.6080009@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Yang Hongyang Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 05/13/2010 02:36 AM, Yang Hongyang wrote: > If domain id is invalid, find_domain should return error because > the specified domain does not exist. > I think this patch is causing some regressions. For example, I can no longer rename dom0: sh-4.0# xl list 0 Name ID Mem VCPUs State Time(s) (null) 0 3321 4 r-- 741.7 sh-4.0# xl rename 0 dom0 0 is an invalid domain identifier. I haven't specifically worked out what's failing here... J > Signed-off-by: Yang Hongyang > > diff -r a49dfaa986b0 tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c Fri May 14 01:27:26 2010 +0800 > +++ b/tools/libxl/xl_cmdimpl.c Fri May 14 01:29:36 2010 +0800 > @@ -137,7 +137,11 @@ > fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc); > exit(2); > } > - common_domname = was_name ? p : 0; > + common_domname = was_name ? p : libxl_domid_to_name(&ctx, domid); > + if (!common_domname) { > + fprintf(stderr, "%s is an invalid domain identifier.\n", p); > + exit(2); > + } > } > > #define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a) > >