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]
Message-Id: <1631244372-1817960-1-git-send-email-jiasheng@iscas.ac.cn>
Date:   Fri, 10 Sep 2021 03:26:12 +0000
From:   Jiang Jiasheng <jiasheng@...as.ac.cn>
To:     tglx@...utronix.de
Cc:     linux-kernel@...r.kernel.org, Jiang Jiasheng <jiasheng@...as.ac.cn>
Subject: [PATCH 6/6] irq: Potentially 'offset out of size' bug

The find_next_bit() use nr_irqs as size, and using it without
any check might cause its returned value out of the size

Signed-off-by: Jiang Jiasheng <jiasheng@...as.ac.cn>
---
 kernel/irq/irqdesc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 4a617d73..5bb310a 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -820,7 +820,8 @@ EXPORT_SYMBOL_GPL(__irq_alloc_descs);
  */
 unsigned int irq_get_next_irq(unsigned int offset)
 {
-	return find_next_bit(allocated_irqs, nr_irqs, offset);
+	offset = find_next_bit(allocated_irqs, nr_irqs, offset);
+	return offset < nr_irqs ? offset : nr_irqs;
 }
 
 struct irq_desc *
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ