]> 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>
Fri, 5 Oct 2012 04:00:48 +0000 (14:00 +1000)
commit160a84b8b59e4d89d278334697cc67eff3be5774
treefca32ee3722600626316bdc1eebf5e8f1638354a
parent03ecd247b194bf3b964e308fe5037af713e04443
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