public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: 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:01:16 +0800	[thread overview]
Message-ID: <387168476.07132@ustc.edu.cn> (raw)
Message-ID: <20070815090116.GA19893@mail.ustc.edu.cn> (raw)
In-Reply-To: <20070815085637.GA19293@mail.ustc.edu.cn>

On Wed, Aug 15, 2007 at 04:56:37PM +0800, 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 weird it did not show up in real world.  Could I be wrong?

> --- 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/


  parent reply	other threads:[~2007-08-15  9:01 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
     [not found] ` <20070815090116.GA19893@mail.ustc.edu.cn>
2007-08-15  9:01   ` Fengguang Wu [this message]
     [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=387168476.07132@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --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