lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Aug 2014 23:13:06 +0800
From:	Chen Gang <gang.chen.5i5j@...il.com>
To:	David Vrabel <david.vrabel@...rix.com>, konrad.wilk@...cle.com,
	boris.ostrovsky@...cle.com
CC:	xen-devel@...ts.xenproject.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] drivers/xen/evtchn.c: Check failure for evtchn_make_refcounted()

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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ