LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Fix uninitialized variable use in mm/memcontrol.c::mem_cgroup_move_parent()
@ 2011-01-22 19:51 Jesper Juhl
  2011-01-24  0:08 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-01-22 19:51 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Balbir Singh, Daisuke Nishimura, KAMEZAWA Hiroyuki,
	Pavel Emelianov, Kirill A. Shutemov

In mm/memcontrol.c::mem_cgroup_move_parent() there's a path that jumps to 
the 'put_back' label
  	ret = __mem_cgroup_try_charge(NULL, gfp_mask, &parent, false, charge);
  	if (ret || !parent)
  		goto put_back;
 where we'll 
  	if (charge > PAGE_SIZE)
  		compound_unlock_irqrestore(page, flags);
but, we have not assigned anything to 'flags' at this point, nor have we 
called 'compound_lock_irqsave()' (which is what sets 'flags').
So, I believe the 'put_back' label should be moved below the call to 
compound_unlock_irqrestore() as per this patch. 

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 memcontrol.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

  compile tested only.

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index db76ef7..4fcf47a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2292,9 +2292,10 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
 	ret = mem_cgroup_move_account(pc, child, parent, true, charge);
 	if (ret)
 		mem_cgroup_cancel_charge(parent, charge);
-put_back:
+
 	if (charge > PAGE_SIZE)
 		compound_unlock_irqrestore(page, flags);
+put_back:
 	putback_lru_page(page);
 put:
 	put_page(page);


-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix uninitialized variable use in mm/memcontrol.c::mem_cgroup_move_parent()
  2011-01-22 19:51 [PATCH] Fix uninitialized variable use in mm/memcontrol.c::mem_cgroup_move_parent() Jesper Juhl
@ 2011-01-24  0:08 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-01-24  0:08 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-mm, linux-kernel, Balbir Singh, Daisuke Nishimura,
	Pavel Emelianov, Kirill A. Shutemov

On Sat, 22 Jan 2011 20:51:32 +0100 (CET)
Jesper Juhl <jj@chaosbits.net> wrote:

> In mm/memcontrol.c::mem_cgroup_move_parent() there's a path that jumps to 
> the 'put_back' label
>   	ret = __mem_cgroup_try_charge(NULL, gfp_mask, &parent, false, charge);
>   	if (ret || !parent)
>   		goto put_back;
>  where we'll 
>   	if (charge > PAGE_SIZE)
>   		compound_unlock_irqrestore(page, flags);
> but, we have not assigned anything to 'flags' at this point, nor have we 
> called 'compound_lock_irqsave()' (which is what sets 'flags').
> So, I believe the 'put_back' label should be moved below the call to 
> compound_unlock_irqrestore() as per this patch. 
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Thank you.

Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Andrew, I'll move my new patces onto this. So, please pick this one 1st.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24  0:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-22 19:51 [PATCH] Fix uninitialized variable use in mm/memcontrol.c::mem_cgroup_move_parent() Jesper Juhl
2011-01-24  0:08 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).