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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1102211435320.2701@localhost6.localdomain6>
Date:	Mon, 21 Feb 2011 14:37:29 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Yinghai Lu <yinghai@...nel.org>
cc:	linux-kernel@...r.kernel.org, mingo@...hat.com, hpa@...or.com,
	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:irq/core] genirq: Make nr_irqs runtime expandable

On Sat, 19 Feb 2011, Yinghai Lu wrote:
> On 02/19/2011 04:15 AM, tip-bot for Thomas Gleixner wrote:
> [PATCH] genirq: use IRQ_BITMAP_BITS as search size
> 
> instead of nr_irqs.
> 
> Otherwise bitmap_find_next_area could exit with larger start and in extreme
> case we could fail to get wrong irqs return.
> 
> For example:
> IRQ_BITMAP_BITS=10240
> nr_irqs=8192
> cnt=2048
> 
> and bit 0 to bit 8190 are set already.
> 
> before patch start from bit_find_next_area() will be 8191+2048.
> later irq_expand_nr_irqs will set nr_irqs 10240.
> finally irq_alloc_descs will return [8191+2048, 8191+2048+2047] happily..
> 
> with this patch, will get correct [8191, 8191+2047]

What a horrible changelog.
 
> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
> 
> ---
>  kernel/irq/irqdesc.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/kernel/irq/irqdesc.c
> ===================================================================
> --- linux-2.6.orig/kernel/irq/irqdesc.c
> +++ linux-2.6/kernel/irq/irqdesc.c
> @@ -346,12 +346,13 @@ irq_alloc_descs(int irq, unsigned int fr
>  
>  	mutex_lock(&sparse_irq_lock);
>  
> -	start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0);
> +	start = bitmap_find_next_zero_area(allocated_irqs, IRQ_BITMAP_BITS,
> +						 from, cnt, 0);
>  	ret = -EEXIST;
>  	if (irq >=0 && start != irq)
>  		goto err;
>  
> -	if (start >= nr_irqs) {
> +	if (start + cnt > nr_irqs) {

One off. That needs to be  >= nr_irqs. Good catch otherwise.

Thanks,

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