[PATCH 4/5] mempolicy: fix refcount leak in mpol_set_shared_policy()

2012-10-09 Thread Mel Gorman
From: KOSAKI Motohiro commit 63f74ca21f1fad36d075e063f06dcc6d39fe86b2 upstream. 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

Re: [PATCH 4/5] mempolicy: fix refcount leak in mpol_set_shared_policy()

2012-08-21 Thread Christoph Lameter
On Tue, 21 Aug 2012, Mel Gorman wrote: > On Mon, Aug 20, 2012 at 07:46:09PM +, Christoph Lameter wrote: > > On Mon, 20 Aug 2012, Mel Gorman wrote: > > > > > @@ -2318,9 +2323,7 @@ void mpol_free_shared_policy(struct shared_policy > > > *p) > > > while (next) { > > > n = rb_entry(ne

Re: [PATCH 4/5] mempolicy: fix refcount leak in mpol_set_shared_policy()

2012-08-21 Thread Mel Gorman
On Mon, Aug 20, 2012 at 07:46:09PM +, Christoph Lameter wrote: > On Mon, 20 Aug 2012, Mel Gorman wrote: > > > @@ -2318,9 +2323,7 @@ void mpol_free_shared_policy(struct shared_policy *p) > > while (next) { > > n = rb_entry(next, struct sp_node, nd); > > next = rb_nex

Re: [PATCH 4/5] mempolicy: fix refcount leak in mpol_set_shared_policy()

2012-08-20 Thread Christoph Lameter
On Mon, 20 Aug 2012, Mel Gorman wrote: > @@ -2318,9 +2323,7 @@ void mpol_free_shared_policy(struct shared_policy *p) > while (next) { > n = rb_entry(next, struct sp_node, nd); > next = rb_next(&n->nd); > - rb_erase(&n->nd, &p->root); Looks like we nee

[PATCH 4/5] mempolicy: fix refcount leak in mpol_set_shared_policy()

2012-08-20 Thread Mel Gorman
From: KOSAKI Motohiro 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 wra