]> 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, 7 Sep 2012 00:23:13 +0000 (10:23 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 12 Sep 2012 07:08:25 +0000 (17:08 +1000)
commit4aac63b44ba11970f456c42173c4a32a6b76803e
tree12b50eb8731cdb12cd06c840d865fec566411a64
parent33273dbc0b4b01355a01397c85d054acbe2372b9
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mempolicy.c