提交 e7e44e44 编写于 作者: W Wei Liu 提交者: Konrad Rzeszutek Wilk

xen: close evtchn port if binding to irq fails

CC: stable@vger.kernel.org
Signed-off-by: NWei Liu <wei.liu2@citrix.com>
Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
上级 18283ea7
...@@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port) ...@@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port)
u->name, (void *)(unsigned long)port); u->name, (void *)(unsigned long)port);
if (rc >= 0) if (rc >= 0)
rc = evtchn_make_refcounted(port); 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; return rc;
} }
...@@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port) ...@@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port)
{ {
int irq = irq_from_evtchn(port); int irq = irq_from_evtchn(port);
BUG_ON(irq < 0);
unbind_from_irqhandler(irq, (void *)(unsigned long)port); unbind_from_irqhandler(irq, (void *)(unsigned long)port);
set_port_user(port, NULL); set_port_user(port, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册