From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCHv3 1/6] evtchn: clear xen_consumer when clearing state Date: Wed, 17 Jun 2015 13:02:58 +0100 Message-ID: <1434542583-28073-2-git-send-email-david.vrabel@citrix.com> References: <1434542583-28073-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z5C40-0001Wr-R7 for xen-devel@lists.xenproject.org; Wed, 17 Jun 2015 12:03:28 +0000 In-Reply-To: <1434542583-28073-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Keir Fraser , Tim Deegan , David Vrabel , Jan Beulich , Ian Campbell List-Id: xen-devel@lists.xenproject.org Freeing a xen event channel would clear xen_consumer before clearing the channel state, leaving a window where the channel is in a funny state (still bound but no consumer). Move the clear of xen_consumer into free_evtchn() where the state is also cleared. Signed-off-by: David Vrabel --- xen/common/event_channel.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 947880f..90e3121 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -200,6 +200,7 @@ static void free_evtchn(struct domain *d, struct evtchn *chn) /* Reset binding to vcpu0 when the channel is freed. */ chn->state = ECS_FREE; chn->notify_vcpu_id = 0; + chn->xen_consumer = 0; xsm_evtchn_close_post(chn); } @@ -1187,7 +1188,6 @@ void free_xen_event_channel(struct domain *d, int port) BUG_ON(!port_is_valid(d, port)); chn = evtchn_from_port(d, port); BUG_ON(!consumer_is_xen(chn)); - chn->xen_consumer = 0; spin_unlock(&d->event_lock); @@ -1287,10 +1287,7 @@ void evtchn_destroy(struct domain *d) /* Close all existing event channels. */ for ( i = 0; port_is_valid(d, i); i++ ) - { - evtchn_from_port(d, i)->xen_consumer = 0; (void)__evtchn_close(d, i); - } /* Free all event-channel buckets. */ spin_lock(&d->event_lock); -- 1.7.10.4