Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751709Ab2JREd7 (ORCPT ); Thu, 18 Oct 2012 00:33:59 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:57700 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803Ab2JREd6 (ORCPT ); Thu, 18 Oct 2012 00:33:58 -0400 Date: Thu, 18 Oct 2012 05:33:33 +0100 From: Al Viro To: Hugh Dickins Cc: David Rientjes , Linus Torvalds , Fengguang Wu , Li Zefan , Aristeu Rozanski , Tejun Heo , Mimi Zohar , James Morris , Dmitry Kasatkin , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Rzeszutek Wilk Subject: Re: [patch for-3.7] fs, xattr: fix bug when removing a name not in xattr list Message-ID: <20121018043333.GF2616@ZenIV.linux.org.uk> References: <20121018024317.GA25407@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1232 Lines: 29 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 > > Signed-off-by: David Rientjes > > Acked-by: Hugh Dickins > > Thank you both: a fine example of the danger of uninitialized_var()! Applied. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/