Re: [PATCH] mm/memcontrol: fix NULL pointer dereference when use_hierarchy is 0

From: Michal Hocko
Date: Tue Feb 17 2015 - 03:33:35 EST


On Tue 17-02-15 14:24:59, Joonsoo Kim wrote:
> It can be possible to return NULL in parent_mem_cgroup()
> if use_hierarchy is 0.

This alone is not sufficient because the low limit is present only in
the unified hierarchy API and there is no use_hierarchy there. The
primary issue here is that the memcg has 0 usage so the previous
check for usage will not stop us. And that is bug IMO.

I think that the following patch would be more correct from semantic
POV:
---