]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
mempolicy: fix refcount leak in mpol_set_shared_policy()
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Thu, 13 Sep 2012 00:58:34 +0000 (10:58 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 13 Sep 2012 07:27:48 +0000 (17:27 +1000)
commit660f28689df23e9a46ccbcd98f47b8b3eba9e727
tree6db4725e6fa3cb9abf70a9d8b5aba0ad3496925e
parent3a0411839cee145484744afb901e46f346e54048
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