diff options
author | Wei Liu <wei.liu2@citrix.com> | 2013-02-18 14:57:58 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-28 06:59:00 -0800 |
commit | 2199a6528ce9b299f3a3e2a6b50cfd197cbc135e (patch) | |
tree | 0c20d1cf584f4e7e74a7e6cb1159d351d1c34d92 | |
parent | 4f4eb62481b02ffec9edee9f109d22d6debe0281 (diff) | |
download | linux-3.10-2199a6528ce9b299f3a3e2a6b50cfd197cbc135e.tar.gz linux-3.10-2199a6528ce9b299f3a3e2a6b50cfd197cbc135e.tar.bz2 linux-3.10-2199a6528ce9b299f3a3e2a6b50cfd197cbc135e.zip |
xen: close evtchn port if binding to irq fails
commit e7e44e444876478d50630f57b0c31d29f6725020 upstream.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/xen/evtchn.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index b1f60a0c0be..b2db77e5a59 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); |