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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070325143609.75165bf6.akpm@linux-foundation.org>
Date:	Sun, 25 Mar 2007 14:36:09 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	ecashin@...aid.com, linux-kernel@...r.kernel.org,
	kernel-janitors@...ts.osdl.org
Subject: Re: [PATCH] aoe, tb0219: fix late spin_lock_init() and friends

On Sun, 25 Mar 2007 23:02:21 +0400 Alexey Dobriyan <adobriyan@...il.com> wrote:

> Some drivers do register_chrdev() before lock or semaphore used in
> corresponding file_operations is initialized.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
> ---
> 
>  drivers/block/aoe/aoechr.c |    4 ++--
>  drivers/char/tb0219.c      |    4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> --- a/drivers/block/aoe/aoechr.c
> +++ b/drivers/block/aoe/aoechr.c
> @@ -246,13 +246,13 @@ aoechr_init(void)
>  {
>  	int n, i;
>  
> +	sema_init(&emsgs_sema, 0);
> +	spin_lock_init(&emsgs_lock);
>  	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
>  	if (n < 0) { 
>  		printk(KERN_ERR "aoe: can't register char device\n");
>  		return n;
>  	}
> -	sema_init(&emsgs_sema, 0);
> -	spin_lock_init(&emsgs_lock);
>  	aoe_class = class_create(THIS_MODULE, "aoe");
>  	if (IS_ERR(aoe_class)) {
>  		unregister_chrdev(AOE_MAJOR, "aoechr");
> --- a/drivers/char/tb0219.c
> +++ b/drivers/char/tb0219.c
> @@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
>  {
>  	int retval;
>  
> +	spin_lock_init(&tb0219_lock);
> +
>  	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") == NULL)
>  		return -EBUSY;
>  
> @@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
>  		return retval;
>  	}
>  
> -	spin_lock_init(&tb0219_lock);
> -
>  	old_machine_restart = _machine_restart;
>  	_machine_restart = tb0219_restart;
>  

These locks can and should be initialised at compile-time.
-
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