public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org, stable@kernel.org
Subject: Re: sysfs: release mutex when kmalloc() failed in sysfs_open_file().
Date: Thu, 12 Jul 2007 22:24:52 -0700	[thread overview]
Message-ID: <20070712222452.8f14a7db.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070710.135646.84167888.yoshfuji@linux-ipv6.org>

On Tue, 10 Jul 2007 13:56:46 +0900 (JST) YOSHIFUJI Hideaki / 吉藤英明  <yoshfuji@linux-ipv6.org> wrote:

> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index b502c71..1f64ce5 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -283,6 +283,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
>  	mutex_lock(&inode->i_mutex);
>  	if (!(set = inode->i_private)) {
>  		if (!(set = inode->i_private = kmalloc(sizeof(struct sysfs_buffer_collection), GFP_KERNEL))) {
> +			mutex_unlock(&inode->i_mutex);
>  			error = -ENOMEM;
>  			goto Done;
>  		} else {

All this code is totally different in Greg's development tree, so this
fix really is only applicable to 2.6.22.x.

I suppose we could apply this to -stable, but given GFP_KERNEL's present behaviour
for small allocations it's pretty theoretical.

Unless you've enabled fault-injection in the page allocator, or if you get
oom-killed in that allocation.  In which case your kernel is dead.

So hm, perhaps you'd best send this to stable@kernel.org.

      parent reply	other threads:[~2007-07-13  5:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  4:56 sysfs: release mutex when kmalloc() failed in sysfs_open_file() YOSHIFUJI Hideaki / 吉藤英明
2007-07-10 11:55 ` Christoph Hellwig
2007-07-13  5:24 ` Andrew Morton [this message]

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=20070712222452.8f14a7db.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox