All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: Chandra Seetharaman <sekharan@us.ibm.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
	ckrm-tech@lists.sourceforge.net, mark.fasheh@oracle.com
Subject: Re: [PATCH 1/5] Fix a module count leak.
Date: Tue, 10 Oct 2006 15:17:32 -0700	[thread overview]
Message-ID: <20061010221732.GL7911@ca-server1.us.oracle.com> (raw)
In-Reply-To: <20061010182049.20990.84496.sendpatchset@localhost.localdomain>

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 <sekharan@us.ibm.com>
> --
> 
>  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....
>               - sekharan@us.ibm.com   |      .......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: joel.becker@oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2006-10-10 22:17 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10 18:20 [PATCH 0/5] Allow more than PAGESIZE data read in configfs Chandra Seetharaman
2006-10-10 18:20 ` [PATCH 1/5] Fix a module count leak Chandra Seetharaman
2006-10-10 22:17   ` Joel Becker [this message]
2006-10-10 18:20 ` [PATCH 2/5] Use seq_file for read side of operations Chandra Seetharaman
2006-10-11  9:12   ` Joel Becker
2006-10-10 18:21 ` [PATCH 3/5] Change configfs_example.c to use the new interface Chandra Seetharaman
2006-10-10 18:21 ` [PATCH 4/5] Change Documentation to reflect " Chandra Seetharaman
2006-10-10 18:21 ` [PATCH 5/5] Change the existing code to use " Chandra Seetharaman
2006-10-10 20:35 ` [PATCH 0/5] Allow more than PAGESIZE data read in configfs Joel Becker
2006-10-10 21:31   ` [ckrm-tech] " Paul Menage
2006-10-10 21:58     ` Joel Becker
2006-10-10 23:13       ` Chandra Seetharaman
2006-10-11  0:15         ` Joel Becker
2006-10-11  0:49       ` Matt Helsley
2006-10-11  1:28         ` Joel Becker
2006-10-11 22:39           ` Greg KH
2006-10-11 23:26             ` Chandra Seetharaman
2006-10-12  4:17               ` Paul Jackson
2006-10-12 23:51               ` Greg KH
2006-10-13  0:16                 ` Paul Jackson
2006-10-13 23:38                   ` Matt Helsley
2006-10-13 23:40                 ` Matt Helsley
2006-10-13 23:47                   ` Paul Menage
2006-10-14  6:17                   ` Greg KH
2006-10-14 23:14                     ` Matt Helsley
2006-10-16 19:10                 ` Chandra Seetharaman
2006-10-16 20:32                   ` Paul Jackson
2006-10-16 22:29                     ` Chandra Seetharaman
2006-10-17  2:59                       ` Paul Jackson
2006-10-12  2:17             ` Matt Helsley
2006-10-12 23:54               ` Greg KH
2006-10-13  3:22                 ` Matt Helsley
     [not found]           ` <20061011220619.GB7911@ca-server1.us.oracle.com>
     [not found]             ` <1160619516.18766.209.camel@localhost.localdomain>
2006-10-12  7:08               ` Joel Becker
2006-10-12 21:44                 ` Paul Jackson
2006-10-12 22:51                   ` Joel Becker
2006-10-13  0:01                     ` Paul Jackson
2006-10-14  4:40                       ` Greg KH
2006-10-13 23:37                 ` Matt Helsley
2006-10-14  0:09                   ` Joel Becker
2006-10-15  1:06                     ` Matt Helsley
2006-10-15 19:07                     ` Paul Jackson
2006-10-16 19:33                     ` Chandra Seetharaman
2006-10-16 23:07                       ` Joel Becker
2006-10-11 20:19   ` Andrew Morton
2006-10-11 21:41     ` Joel Becker
2006-10-11 22:18     ` Joel Becker
2006-10-11 22:48       ` Andrew Morton
2006-10-11 23:27         ` Chandra Seetharaman
2006-10-14  8:01           ` Greg KH
2006-10-14 19:43             ` Andrew Morton
2006-10-14 20:10               ` Joel Becker
2006-10-16 19:24                 ` Chandra Seetharaman
2006-10-16 23:09                   ` Joel Becker
2006-10-18  0:55                     ` Chandra Seetharaman
2006-10-19 18:42                       ` Joel Becker
2006-10-16 19:16             ` Chandra Seetharaman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061010221732.GL7911@ca-server1.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=akpm@osdl.org \
    --cc=ckrm-tech@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.fasheh@oracle.com \
    --cc=sekharan@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.