* [PATCH] (theoretical) leak in do_mbind()
@ 2009-06-14 17:40 Max Laier
0 siblings, 0 replies; only message in thread
From: Max Laier @ 2009-06-14 17:40 UTC (permalink / raw)
To: linux-numa
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-14 17:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-14 17:40 [PATCH] (theoretical) leak in do_mbind() Max Laier
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.