3.5.7.7 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Wei Liu <wei.l...@citrix.com>

commit e7e44e444876478d50630f57b0c31d29f6725020 upstream.

Signed-off-by: Wei Liu <wei.l...@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
Signed-off-by: Luis Henriques <luis.henriq...@canonical.com>
---
 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.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to