* [patch] memcontrol: fix potential null deref
@ 2010-03-13 14:56 Dan Carpenter
2010-03-15 0:04 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-13 14:56 UTC (permalink / raw)
To: kamezawa.hiroyu
Cc: Daisuke Nishimura, Andrew Morton, Kirill A. Shutemov, linux-mm,
linux-kernel, kernel-janitors, Balbir Singh
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>
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7973b52..e1e0996 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)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] memcontrol: fix potential null deref
2010-03-13 14:56 [patch] memcontrol: fix potential null deref Dan Carpenter
@ 2010-03-15 0:04 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-03-15 0:04 UTC (permalink / raw)
To: Dan Carpenter
Cc: Daisuke Nishimura, Andrew Morton, Kirill A. Shutemov, linux-mm,
linux-kernel, kernel-janitors, Balbir Singh
On Sat, 13 Mar 2010 17:56:21 +0300
Dan Carpenter <error27@gmail.com> wrote:
> 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>
Thanks.
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 7973b52..e1e0996 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)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-15 0:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-13 14:56 [patch] memcontrol: fix potential null deref Dan Carpenter
2010-03-15 0:04 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox