From 18283ea7433c703d3fcce33d189b637a7aaf0a49 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 18 Feb 2013 14:57:59 +0000 Subject: xen-evtchn: correct comment and error output The evtchn device has been moved to /dev/xen. Also change log level to KERN_ERR as other xen drivers. Signed-off-by: Wei Liu Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/evtchn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/xen/evtchn.c') diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index b1f60a0c0bea..4ebd501f1f80 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -534,10 +534,10 @@ static int __init evtchn_init(void) spin_lock_init(&port_user_lock); - /* Create '/dev/misc/evtchn'. */ + /* Create '/dev/xen/evtchn'. */ err = misc_register(&evtchn_miscdev); if (err != 0) { - printk(KERN_ALERT "Could not register /dev/misc/evtchn\n"); + printk(KERN_ERR "Could not register /dev/xen/evtchn\n"); return err; } -- cgit v1.2.3 From e7e44e444876478d50630f57b0c31d29f6725020 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 18 Feb 2013 14:57:58 +0000 Subject: xen: close evtchn port if binding to irq fails CC: stable@vger.kernel.org Signed-off-by: Wei Liu Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/evtchn.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/xen/evtchn.c') diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 4ebd501f1f80..45c8efaa6b3e 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); -- cgit v1.2.3