All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH 1/2] xen: close evtchn port if binding to irq fails
Date: Tue, 19 Feb 2013 09:32:26 -0500	[thread overview]
Message-ID: <20130219143225.GA7026@konrad-lan.dumpdata.com> (raw)
In-Reply-To: <1361199479-26059-2-git-send-email-wei.liu2@citrix.com>

On Mon, Feb 18, 2013 at 02:57:58PM +0000, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

I thought we had discussed doing this check in the user of
this as well?

> ---
>  drivers/xen/evtchn.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
> index b1f60a0..b2db77e 100644
> --- a/drivers/xen/evtchn.c
> +++ b/drivers/xen/evtchn.c
> @@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port)
>  				       u->name, (void *)(unsigned long)port);
>  	if (rc >= 0)
>  		rc = evtchn_make_refcounted(port);
> +	else {
> +		/* bind failed, should close the port now */
> +		struct evtchn_close close;
> +		close.port = port;
> +		if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
> +			BUG();
> +		set_port_user(port, NULL);
> +	}
>  
>  	return rc;
>  }
> @@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port)
>  {
>  	int irq = irq_from_evtchn(port);
>  
> +	BUG_ON(irq < 0);
> +
>  	unbind_from_irqhandler(irq, (void *)(unsigned long)port);
>  
>  	set_port_user(port, NULL);
> -- 
> 1.7.10.4
> 

  reply	other threads:[~2013-02-19 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 14:57 [PATCH 0/2] xen-evtchn misc fixes Wei Liu
2013-02-18 14:57 ` [PATCH 1/2] xen: close evtchn port if binding to irq fails Wei Liu
2013-02-19 14:32   ` Konrad Rzeszutek Wilk [this message]
2013-02-19 14:46     ` Wei Liu
2013-02-19 14:54       ` Konrad Rzeszutek Wilk
2013-02-19 14:50     ` Wei Liu
2013-02-18 14:57 ` [PATCH 2/2] xen-evtchn: correct comment and error output Wei Liu

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=20130219143225.GA7026@konrad-lan.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 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.