]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mempolicy: fix refcount leak in mpol_set_shared_policy()
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Fri, 28 Sep 2012 00:19:11 +0000 (10:19 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Oct 2012 05:03:13 +0000 (15:03 +1000)
commit239024453a2834a2307ef0ed9488346049f7acc1
tree1ef68c1c4e18d4e1ae091574d1680051976ed9e0
parent13efc289c88a19c98374197263e5b75b8a9616f1
mempolicy: fix refcount leak in mpol_set_shared_policy()

When shared_policy_replace() fails to allocate new->policy is not freed
correctly by mpol_set_shared_policy().  The problem is that shared
mempolicy code directly call kmem_cache_free() in multiple places where it
is easy to make a mistake.

This patch creates an sp_free wrapper function and uses it. The bug was
introduced pre-git age (IOW, before 2.6.12-rc2).

[mgorman@suse.de: Editted changelog]
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Christoph Lameter <cl@linux.com>
Cc: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mempolicy.c