Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763619AbXHOJET (ORCPT ); Wed, 15 Aug 2007 05:04:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756674AbXHOJEJ (ORCPT ); Wed, 15 Aug 2007 05:04:09 -0400 Received: from wx-out-0506.google.com ([66.249.82.234]:1466 "EHLO wx-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754442AbXHOJEG (ORCPT ); Wed, 15 Aug 2007 05:04:06 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=W4TVcVHbdFCr8OJsHIH2TsseaPmuhZ148nTOmNVlovV4YJuQdzgFeLUZDKxG9OGIADD/vGT4L/Ci0hSTSbUIZF82T9Hx2W1TNctizNCebXnRuWRHdHhs3NROxTmR/bTJ84DdwMRKxZt4GjutJgcqX+irvnR4NDxjEZ9iviqHS+k= Message-ID: Date: Wed, 15 Aug 2007 13:04:05 +0400 From: "Alexey Dobriyan" To: "Fengguang Wu" Subject: Re: [PATCH] seqfile: fix uninitialized memory allocation in mounts_open() Cc: "Andrew Morton" , linux-kernel , "Al Viro" In-Reply-To: <387168197.02674@ustc.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <387168197.02674@ustc.edu.cn> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 829 Lines: 22 On 8/15/07, Fengguang Wu wrote: > proc_mounts.m.buf is not explicitly zeroed at allocation time, which > may later confuse the seqfile code and triggle an kfree(m->buf). It's cleared in seq_open(). > --- linux.orig/fs/proc/base.c > +++ linux/fs/proc/base.c > @@ -380,7 +380,7 @@ static int mounts_open(struct inode *ino > > if (ns) { > ret = -ENOMEM; > - p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL); > + p = kzalloc(sizeof(struct proc_mounts), GFP_KERNEL); > if (p) { > file->private_data = &p->m; > ret = seq_open(file, &mounts_op); - 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/