[PATCH] (theoretical) leak in do_mbind()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
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@xxxxxxxxxxx
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux