Obviously a bug.  I've pulled it into my tree and it should appear in
OCFS2's ALL branch very shortly.

Joel

On Tue, Oct 10, 2006 at 11:20:49AM -0700, Chandra Seetharaman wrote:
> check_perm() does not drop the reference to the module when kmalloc()
> failure occurs. This patch fixes the problem.
> 
> Signed-Off-By: Chandra Seetharaman <[EMAIL PROTECTED]>
> --
> 
>  fs/configfs/file.c |   16 +++++++++-------
>  1 files changed, 9 insertions(+), 7 deletions(-)
> 
> Index: linux-2.6.18/fs/configfs/file.c
> ===================================================================
> --- linux-2.6.18.orig/fs/configfs/file.c
> +++ linux-2.6.18/fs/configfs/file.c
> @@ -275,14 +275,15 @@ static int check_perm(struct inode * ino
>        * it in file->private_data for easy access.
>        */
>       buffer = kmalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
> -     if (buffer) {
> -             memset(buffer,0,sizeof(struct configfs_buffer));
> -             init_MUTEX(&buffer->sem);
> -             buffer->needs_read_fill = 1;
> -             buffer->ops = ops;
> -             file->private_data = buffer;
> -     } else
> +     if (!buffer) {
>               error = -ENOMEM;
> +             goto Enomem;
> +     }
> +     memset(buffer,0,sizeof(struct configfs_buffer));
> +     init_MUTEX(&buffer->sem);
> +     buffer->needs_read_fill = 1;
> +     buffer->ops = ops;
> +     file->private_data = buffer;
>       goto Done;
>  
>   Einval:
> @@ -290,6 +291,7 @@ static int check_perm(struct inode * ino
>       goto Done;
>   Eaccess:
>       error = -EACCES;
> + Enomem:
>       module_put(attr->ca_owner);
>   Done:
>       if (error && item)
> 
> -- 
> 
> ----------------------------------------------------------------------
>     Chandra Seetharaman               | Be careful what you choose....
>               - [EMAIL PROTECTED]   |      .......you may get it.
> ----------------------------------------------------------------------

-- 

"I almost ran over an angel
 He had a nice big fat cigar.
 'In a sense,' he said, 'You're alone here
 So if you jump, you'd best jump far.'"

Joel Becker
Principal Software Developer
Oracle
E-mail: [EMAIL PROTECTED]
Phone: (650) 506-8127

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech

Reply via email to