public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Al Viro <viro@ftp.linux.org.uk>
Subject: Re: [PATCH] seqfile: fix uninitialized memory allocation in mounts_open()
Date: Wed, 15 Aug 2007 17:08:55 +0800	[thread overview]
Message-ID: <387168935.12266@ustc.edu.cn> (raw)
Message-ID: <20070815090855.GB19293@mail.ustc.edu.cn> (raw)
In-Reply-To: <b6fcc0a0708150204k16997328s9ff723b2a809be@mail.gmail.com>

On Wed, Aug 15, 2007 at 01:04:05PM +0400, Alexey Dobriyan wrote:
> On 8/15/07, Fengguang Wu <wfg@mail.ustc.edu.cn> 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().

So it is :)

> > --- 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);


  reply	other threads:[~2007-08-15  9:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070815085637.GA19293@mail.ustc.edu.cn>
2007-08-15  8:56 ` [PATCH] seqfile: fix uninitialized memory allocation in mounts_open() Fengguang Wu
2007-08-15  9:04   ` Alexey Dobriyan
     [not found]     ` <20070815090855.GB19293@mail.ustc.edu.cn>
2007-08-15  9:08       ` Fengguang Wu [this message]
     [not found] ` <20070815090116.GA19893@mail.ustc.edu.cn>
2007-08-15  9:01   ` Fengguang Wu
     [not found] ` <20070815090549.GB19893@mail.ustc.edu.cn>
2007-08-15  9:05   ` [PATCH] seqfile: merge duplite code to seq_open_private() Fengguang Wu

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=387168935.12266@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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