From: Rusty Russell Subject: Re: [PATCH] Remove uneeded 'else if' when closing event channels. Date: Sun, 04 Dec 2005 21:13:54 +1100 Message-ID: <1133691234.30188.12.camel@localhost.localdomain> References: <20051202050519.GB25348@bakeyournoodle.com> <6db9374a4edb3d812498d5c59d169e17@cl.cam.ac.uk> <1133566260.21941.5.camel@localhost.localdomain> <02e7fb23007beda611d99c3cedded97d@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <02e7fb23007beda611d99c3cedded97d@cl.cam.ac.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Xen-Devel , Tony Breeds List-Id: xen-devel@lists.xenproject.org On Sat, 2005-12-03 at 09:12 +0000, Keir Fraser wrote: > On 2 Dec 2005, at 23:31, Rusty Russell wrote: > > >> It can change, between lines 340 and 341 (where we have no locks > >> held). > > > > Hmm, you mean same domain makes another hypercall in parallel to close > > the event channel then rebind it to a different domain? > > Yes. That would be very stupid of the guest, but Xen needs to protect > itself. > > > In which case, close fails with EINVAL? > > I'm open to suggestions for a better error code. Technically, they've asked it to be closed, so we should close it. However, since they can't tell the difference between this case and the case where we hit it in ECS_FREE, which would also return -EINVAL. A comment could elucidate, perhaps? Rusty. Signed-off-by: Rusty Russell diff -r 4d4cb5e472af xen/common/event_channel.c --- a/xen/common/event_channel.c Thu Dec 1 07:26:33 2005 +++ b/xen/common/event_channel.c Sun Dec 4 21:10:17 2005 @@ -344,6 +344,7 @@ } else if ( d2 != chn1->u.interdomain.remote_dom ) { + /* current closed and rebound, between d1 unlock and d2 lock. */ rc = -EINVAL; goto out; } -- A bad analogy is like a leaky screwdriver -- Richard Braakman