]> 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>
Wed, 26 Sep 2012 01:33:17 +0000 (11:33 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 26 Sep 2012 05:41:32 +0000 (15:41 +1000)
commit8804737d689051c4425ee2a521046e658a379335
tree98fa5cc59ea86f6551737a117430d07f08fd2508
parent24babcecff44f1e6b36fe28678241309864b530a
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