public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Scott <nathans@sgi.com>
To: alan@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: Memory leak in 2.4 vmalloc.c get_vm_area
Date: Tue, 19 Nov 2002 10:32:02 +1100	[thread overview]
Message-ID: <20021118233202.GB535@frodo.melbourne.sgi.com> (raw)

hi Alan,

I noticed you recently merged this patch with Marcelo in the
2.4 BK tree (lists you as author, and annotation says it came
from DaveM originally)...

        --- 1.10/mm/vmalloc.c   Tue Feb  5 06:10:20 2002
        +++ 1.11/mm/vmalloc.c   Thu Sep  5 05:22:42 2002
        @@ -177,6 +177,8 @@
                if (!area)
                        return NULL;
                size += PAGE_SIZE;
        +       if(!size)
        +               return NULL;
                addr = VMALLOC_START;
                write_lock(&vmlist_lock);
                for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {


This looks to me like it introduces a memory leak in the new !size
case - either the "size" bump and test needs to be moved before the
"area" kmalloc, or we need to kfree(area) before returning NULL.

If you like, I'll make a (trivial) patch to do one of these?

cheers.

-- 
Nathan

             reply	other threads:[~2002-11-18 23:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-18 23:32 Nathan Scott [this message]
2002-11-19 12:22 ` Memory leak in 2.4 vmalloc.c get_vm_area Dave Jones

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=20021118233202.GB535@frodo.melbourne.sgi.com \
    --to=nathans@sgi.com \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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