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:	Fri, 07 Jan 2011 14:50:12 +0800
From:	Joe Jin <joe.jin@...cle.com>
To:	jeremy@...p.org, ian.campbell@...rix.com,
	Andrew Morton <akpm@...ux-foundation.org>
CC:	linux-fbdev@...r.kernel.org, xen-devel@...ts.xensource.com,
	gurudas.pai@...cle.com, guru.anbalagane@...cle.com,
	greg.marsden@...cle.com, joe.jin@...cle.com,
	linux-kernel@...r.kernel.org
Subject: [patch] xen-event: validate irq before get evtchn by irq

Hi,

When get event channel by irq by irq, may irq is not a valid one under
some condition -- so far we found irq is -1 during suspend/resume, so
worth to validate it rather than return incorrect data.

Please review and comment.

Signed-off-by: Joe Jin <joe.jin@...cle.com>
Tested-by: Gurudas Pai <gurudas.pai@...cle.com>
Cc: Ian Campbell <ian.campbell@...rix.com>
Cc: Jeremy Fitzhardinge <jeremy@...p.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>

---
 events.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index ac7b42f..006dd7b 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -175,6 +175,9 @@ static struct irq_info *info_for_irq(unsigned irq)
 
 static unsigned int evtchn_from_irq(unsigned irq)
 {
+	if (WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq))
+		return 0;
+
 	return info_for_irq(irq)->evtchn;
 }
 

--
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