public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Hugh Dickins <hughd@google.com>
Cc: David Rientjes <rientjes@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Li Zefan <lizefan@huawei.com>, Aristeu Rozanski <aris@redhat.com>,
	Tejun Heo <tj@kernel.org>, Mimi Zohar <zohar@linux.vnet.ibm.com>,
	James Morris <jmorris@namei.org>,
	Dmitry Kasatkin <dmitry.kasatkin@intel.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [patch for-3.7] fs, xattr: fix bug when removing a name not in xattr list
Date: Thu, 18 Oct 2012 05:33:33 +0100	[thread overview]
Message-ID: <20121018043333.GF2616@ZenIV.linux.org.uk> (raw)
In-Reply-To: <alpine.LSU.2.00.1210172052420.20979@eggly.anvils>

On Wed, Oct 17, 2012 at 08:55:49PM -0700, Hugh Dickins wrote:
> On Wed, 17 Oct 2012, David Rientjes wrote:
> 
> > Commit 38f38657444d ("xattr: extract simple_xattr code from tmpfs") moved
> > some code from tmpfs but introduced a subtle bug along the way.
> > 
> > If the name passed to simple_xattr_remove() does not exist in the list of
> > xattrs, then it is possible to call kfree(new_xattr) when new_xattr is
> > actually initialized to itself on the stack via uninitialized_var().
> > 
> > This causes a BUG() since the memory was not allocated via the slab
> > allocator and was not bypassed through to the page allocator because it
> > was too large.
> > 
> > Initialize the local variable to NULL so the kfree() never takes place.
> > 
> > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > Signed-off-by: David Rientjes <rientjes@google.com>
> 
> Acked-by: Hugh Dickins <hughd@google.com>
> 
> Thank you both: a fine example of the danger of uninitialized_var()!

Applied.

  reply	other threads:[~2012-10-18  4:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18  2:43 [ima_inode_post_setattr] kernel BUG at mm/slub.c:3479! Fengguang Wu
2012-10-18  3:07 ` Mimi Zohar
2012-10-18  3:07 ` David Rientjes
2012-10-18  3:41   ` [patch for-3.7] fs, xattr: fix bug when removing a name not in xattr list David Rientjes
2012-10-18  3:55     ` Hugh Dickins
2012-10-18  4:33       ` Al Viro [this message]
2012-10-18 12:43     ` Hillf Danton
2012-10-18 13:43     ` Aristeu Rozanski

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=20121018043333.GF2616@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=aris@redhat.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=hughd@google.com \
    --cc=jmorris@namei.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=rientjes@google.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zohar@linux.vnet.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox