'curr' pointer in task_in_mem_cgroup() can be NULL when we race with somebody clearing task->mm. Check for it before dereferencing the pointer. Coverity-id: 1198369 Signed-off-by: Jan Kara <jack@xxxxxxx> --- mm/memcontrol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 23976fd885fd..18ab127a0767 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1469,7 +1469,8 @@ bool task_in_mem_cgroup(struct task_struct *task, * hierarchy(even if use_hierarchy is disabled in "memcg"). */ ret = mem_cgroup_same_or_subtree(memcg, curr); - css_put(&curr->css); + if (curr) + css_put(&curr->css); return ret; } -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html