diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-01-25 18:07:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-25 19:50:01 -0500 |
commit | 8dba474f034c322d96ada39cb20cac711d80dcb2 (patch) | |
tree | ef007c5c3088b2ef83be074a7720892b6b8e5e4b | |
parent | 2ff754fa8f416e82327f2d8f1354a033b66286df (diff) |
mm/memcontrol.c: fix uninitialized variable use in mem_cgroup_move_parent()
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'). 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>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Pavel Emelianov <xemul@openvz.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/memcontrol.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index db76ef726293..4fcf47a62550 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2292,9 +2292,10 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc, | |||
2292 | ret = mem_cgroup_move_account(pc, child, parent, true, charge); | 2292 | ret = mem_cgroup_move_account(pc, child, parent, true, charge); |
2293 | if (ret) | 2293 | if (ret) |
2294 | mem_cgroup_cancel_charge(parent, charge); | 2294 | mem_cgroup_cancel_charge(parent, charge); |
2295 | put_back: | 2295 | |
2296 | if (charge > PAGE_SIZE) | 2296 | if (charge > PAGE_SIZE) |
2297 | compound_unlock_irqrestore(page, flags); | 2297 | compound_unlock_irqrestore(page, flags); |
2298 | put_back: | ||
2298 | putback_lru_page(page); | 2299 | putback_lru_page(page); |
2299 | put: | 2300 | put: |
2300 | put_page(page); | 2301 | put_page(page); |