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]
Date:	Mon, 12 Oct 2009 12:17:28 +0200
From:	Takashi Iwai <tiwai@...e.de>
To:	John Kacur <jkacur@...hat.com>
Cc:	Frederic Weisbecker <fweisbec@...il.com>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Jonathan Corbet <corbet@....net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Christoph Hellwig <hch@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Vincent^M^J Sanders <vince@...tec.co.uk>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] sound_core.c: Remove BKL from soundcore_open

At Mon, 12 Oct 2009 10:37:05 +0200 (CEST),
John Kacur wrote:
> 
> On Mon, 12 Oct 2009, Takashi Iwai wrote:
> 
> > At Sun, 11 Oct 2009 14:41:15 +0200 (CEST),
> > John Kacur wrote:
> > > 
> > > @@ -631,17 +629,17 @@ static int soundcore_open(struct inode *inode, struct file *file)
> > >  		file->f_op = new_fops;
> > >  		spin_unlock(&sound_loader_lock);
> > >  		if(file->f_op->open)
> > > +			lock_kernel();
> > >  			err = file->f_op->open(inode,file);
> > > +			unlock_kernel();
> > 
> > You certainly want braces around here, no?
> > 
> 
> Oh, I don't know, I was kinda hoping that the spaces would magically 
> impart bracketnishish to the whole thing. My God yes we want the brackets -
> Thank you Takashi!
> 
> What follows is version four.
> 
> >From 90f527d2ae660a3a0e712075479a4cc24504ad45 Mon Sep 17 00:00:00 2001
> From: John Kacur <jkacur@...hat.com>
> Date: Sun, 11 Oct 2009 14:25:46 +0200
> Subject: [PATCH] soundcore_open: Reduce the area BKL coverage in this function.
> 
> Most of this function is protected by the sound_loader_lock.
> We can push down the BKL to this call out err = file->f_op->open(inode,file);
> 
> Signed-off-by: John Kacur <jkacur@...hat.com>
> Acked-by: Alan Cox <alan@...ux.intel.com>
> ---
>  sound/sound_core.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/sound_core.c b/sound/sound_core.c
> index 49c9981..643a61f 100644
> --- a/sound/sound_core.c
> +++ b/sound/sound_core.c
> @@ -576,8 +576,6 @@ static int soundcore_open(struct inode *inode, struct file *file)
>  	struct sound_unit *s;
>  	const struct file_operations *new_fops = NULL;
>  
> -	lock_kernel ();
> -
>  	chain=unit&0x0F;
>  	if(chain==4 || chain==5)	/* dsp/audio/dsp16 */
>  	{
> @@ -630,18 +628,18 @@ static int soundcore_open(struct inode *inode, struct file *file)
>  		const struct file_operations *old_fops = file->f_op;
>  		file->f_op = new_fops;
>  		spin_unlock(&sound_loader_lock);
> -		if(file->f_op->open)
> +		if(file->f_op->open) {
> +			lock_kernel();
>  			err = file->f_op->open(inode,file);
> -		if (err) {
> +			unlock_kernel();
> +		} if (err) {

It's better to break the line after the closing brace here.


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