From: Kingsley Cheung <kingsley@aurema.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] [PATCH] pfm_smpl_buffer_alloc needs to free vma on error
Date: Fri, 30 Aug 2002 01:33:17 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590701905999@msgid-missing> (raw)
Hi David,
In 2.4.19, arch/ia64/kernel/perfmon.c, I noticed that
pfm_smpl_buffer_alloc doesn't seem to be freeing the vma structure it
allocates if there's an error. Here's a trivial patch to fix it:
--- arch/ia64/kernel/perfmon.c 5 Jul 2002 06:17:29 -0000 1.1.7.1
+++ arch/ia64/kernel/perfmon.c 29 Aug 2002 23:29:06 -0000
@@ -647,15 +647,14 @@
psb = kmalloc(sizeof(*psb), GFP_KERNEL);
if (psb = NULL) {
DBprintk(("Can't allocate sampling buffer descriptor\n"));
- pfm_rvfree(smpl_buf, size);
- return -ENOMEM;
+ goto kmalloc_fail;
}
/* allocate vma */
vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!vma) {
DBprintk(("Cannot allocate vma\n"));
- goto error;
+ goto kmem_cache_alloc_fail;
}
/*
* partially initialize the vma for the sampling buffer
@@ -750,9 +749,12 @@
return 0;
-error:
- pfm_rvfree(smpl_buf, size);
+ error:
+ kmem_cache_free(vm_area_cachep, vma);
+ kmem_cache_alloc_fail:
kfree(psb);
+ kmalloc_fail:
+ pfm_rvfree(smpl_buf, size);
return -ENOMEM;
}
The patch compiles but it hasn't been tested.
Cheers,
Kingsley
next reply other threads:[~2002-08-30 1:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-30 1:33 Kingsley Cheung [this message]
2002-08-30 2:12 ` [Linux-ia64] [PATCH] pfm_smpl_buffer_alloc needs to free vma on error Stephane Eranian
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=marc-linux-ia64-105590701905999@msgid-missing \
--to=kingsley@aurema.com \
--cc=linux-ia64@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.