lkml.org 
[lkml]   [2012]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch for-3.7] fs, xattr: fix bug when removing a name not in xattr list
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.


\
 
 \ /
  Last update: 2012-10-18 07:21    [W:0.059 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site