aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-23 13:35:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-24 16:31:19 -0700
commite7bbcdf3747e3919c31cfa87853c69d178bce548 (patch)
tree42493b615337a170f3a019fc41dd90c4d4d9b342 /mm
parent9d34706f42f9b8c15185423d9af98d37ba21d011 (diff)
downloadkernel_samsung_smdk4412-e7bbcdf3747e3919c31cfa87853c69d178bce548.zip
kernel_samsung_smdk4412-e7bbcdf3747e3919c31cfa87853c69d178bce548.tar.gz
kernel_samsung_smdk4412-e7bbcdf3747e3919c31cfa87853c69d178bce548.tar.bz2
memcontrol: fix potential null deref
There was a potential null deref introduced in c62b1a3b31b5 ("memcg: use generic percpu instead of private implementation"). Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 00dda35..9ed760d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3691,8 +3691,10 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
else
mem = vmalloc(size);
- if (mem)
- memset(mem, 0, size);
+ if (!mem)
+ return NULL;
+
+ memset(mem, 0, size);
mem->stat = alloc_percpu(struct mem_cgroup_stat_cpu);
if (!mem->stat) {
if (size < PAGE_SIZE)