From: "Max Laier" <max@laiers.net>
To: linux-numa@vger.kernel.org
Subject: [PATCH] (theoretical) leak in do_mbind()
Date: Sun, 14 Jun 2009 19:40:33 +0200 [thread overview]
Message-ID: <c9bd1e7be043e6764ef3c1a342bfd2bc.squirrel@mlaier.homeunix.org> (raw)
Currently migrate_prep() can't return an error, but if it ever does we
should free the newly created policy again. Trivial patch, really.
In case my webmail trashes the patch:
http://mlaier.homeunix.org/~mlaier/mbind_leaklet.diff
Author: Max Laier <max@laiers.net>
Date: Sun Jun 14 07:35:57 2009 +0200
Plug a small leak in mbind in case migrate_prep() fails.
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 3eb4a6f..7169059 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -975,8 +975,10 @@ static long do_mbind(unsigned long start, unsigned
long len,
if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
err = migrate_prep();
- if (err)
+ if (err) {
+ mpol_put(new);
return err;
+ }
}
down_write(&mm->mmap_sem);
vma = check_range(mm, start, end, nmask,
--
/"\ Best regards, | mlaier@freebsd.org
\ / Max Laier | ICQ #67774661
X http://pf4freebsd.love2party.net/ | mlaier@EFnet
/ \ ASCII Ribbon Campaign | Against HTML Mail and News
reply other threads:[~2009-06-14 17:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c9bd1e7be043e6764ef3c1a342bfd2bc.squirrel@mlaier.homeunix.org \
--to=max@laiers.net \
--cc=linux-numa@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;
as well as URLs for NNTP newsgroup(s).