Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2016724ybp; Thu, 10 Oct 2019 00:39:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdo8hcmV4smt7CA9pTtAGNP/WVx9MICzNsvEA7oBikqK8VfUDiRAgwOxSZ0vTDNHMu3z7v X-Received: by 2002:a05:6402:70c:: with SMTP id w12mr6744506edx.177.1570693173951; Thu, 10 Oct 2019 00:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570693173; cv=none; d=google.com; s=arc-20160816; b=PJTti2Zen4rR2Jl6R5PMV7358Zj6kYUlHnEAEhtRmQ3LXoj5YVnZ4uQQh+ogBucANQ Hpi0VqLN/gP1SE53t/L7otyeW8KzctX/yLcDVLlvdFLGW9+B2oOK7iQ+x3RO/XAkHeNf KZ3xwkGbG3tTfDeDKXWmkxyfQPo9Cxdbbvu2nMwU7eiTw+T5DhHtng4SJfE7ISCav3e4 Ql+IphTs/X4zB/72Dtkb8KQgiV1f/cJilDWwJ8G2W0pTgCDNFBTuT0m1mYyHwOUhVvDn Bg6Dyrkt3gQDkOjGB/FOvWBchuNVEscveo07WlOORNn4ef2xKlenzSr0c371RDjh57g7 Extg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mfGCNBS5bp4czJqMmQ8CYoap0rCRvVYCWpBJnfQrM7s=; b=rPqWRosyiiAIZb8NeisdmtEQm+GnD4yxlvo2k9JQliGY43B/kXFTwtegZcyfun+esM 24PW2aTlnnE/qgY0ZqbgU5qAtlLYqIbO9hAvNDcwdlKAJwEKCblWeVpqrjcaBur4GlOY 5os+oqIAZq6y9aqUglRxXvYd2GsQTKOOG+GOQaa1QvS1sb+a6ejHJnJ4OsM42/sPybQH t3oXVVbwrPx9r29rHlGAyXE85fWg8BOY934xPEqa/Kiwpd5+fl7sPBd6Wv2gPgDfutTA YLKvG3gLEBdoEUdjZCjzN6IseVrEwhfo3s3rlAexUFT1990stPUkuVv75o8pLGEIOalZ x+0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b16si2630746ejb.165.2019.10.10.00.39.10; Thu, 10 Oct 2019 00:39:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733302AbfJJHi3 (ORCPT + 99 others); Thu, 10 Oct 2019 03:38:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:46604 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733073AbfJJHd5 (ORCPT ); Thu, 10 Oct 2019 03:33:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A5BF1B169; Thu, 10 Oct 2019 07:33:54 +0000 (UTC) Date: Thu, 10 Oct 2019 09:19:37 +0200 From: Michal Hocko To: Yizhuo Zhai Cc: Johannes Weiner , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhiyun Qian , Chengyu Song Subject: Re: Potential NULL pointer deference in mm/memcontrol.c Message-ID: <20191010071937.GA18412@dhcp22.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 09-10-19 21:56:04, Yizhuo Zhai wrote: > Hi All: > mm/memcontrol.c: > The function mem_cgroup_from_css() could return NULL, but some callers This is the case only when the memory cgroup controller is disabled which is a boot time option. > in this file > checks the return value but directly dereference it, which seems > potentially unsafe. > Such callers include mem_cgroup_hierarchy_read(), > mem_cgroup_hierarchy_write(), mem_cgroup_read_u64(), > mem_cgroup_reset(), etc. And none of those should be ever called under that condition AFAICS. Thanks! -- Michal Hocko SUSE Labs