From: Chen Gang <gang.chen.5i5j@gmail.com>
To: David Vrabel <david.vrabel@citrix.com>,
konrad.wilk@oracle.com, boris.ostrovsky@oracle.com
Cc: xen-devel@lists.xenproject.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] drivers/xen/evtchn.c: Check failure for evtchn_make_refcounted()
Date: Thu, 28 Aug 2014 23:13:06 +0800 [thread overview]
Message-ID: <53FF4702.9020509@gmail.com> (raw)
evtchn_make_refcounted() may return failure, so need process the failure
case. In failure case, it need call unbind_from_irqhandler() just like
evtchn_unbind_from_user() has done.
irq_from_evtchn() must be OK when bind_evtchn_to_irqhandler() succeed,
so need not check it again.
Also still need remain the closing port code, because when the failure
occurs, unbind_from_irqhandler() will not close port internally.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
drivers/xen/evtchn.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index 00f40f0..8a629d6 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -311,6 +311,11 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port)
goto err;
rc = evtchn_make_refcounted(port);
+ if (rc < 0) {
+ unbind_from_irqhandler(irq_from_evtchn(port), evtchn);
+ goto err;
+ }
+
return rc;
err:
--
1.7.11.7
next reply other threads:[~2014-08-28 15:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 15:13 Chen Gang [this message]
2014-08-28 15:49 ` [PATCH] drivers/xen/evtchn.c: Check failure for evtchn_make_refcounted() David Vrabel
2014-08-29 13:34 ` Chen Gang
2014-08-29 13:43 ` David Vrabel
2014-08-30 3:39 ` Chen Gang
2014-08-30 3:39 ` Chen Gang
2014-08-29 13:43 ` David Vrabel
2014-08-29 13:34 ` Chen Gang
2014-08-28 15:49 ` David Vrabel
-- strict thread matches above, loose matches on Subject: below --
2014-08-28 15:13 Chen Gang
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=53FF4702.9020509@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xenproject.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.