From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D8B5C4360C for ; Thu, 10 Oct 2019 07:33:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 47798218AC for ; Thu, 10 Oct 2019 07:33:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47798218AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D524F8E0005; Thu, 10 Oct 2019 03:33:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D03296B0006; Thu, 10 Oct 2019 03:33:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF25E8E0005; Thu, 10 Oct 2019 03:33:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id A1C2D6B0005 for ; Thu, 10 Oct 2019 03:33:58 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 0FA2263FA for ; Thu, 10 Oct 2019 07:33:58 +0000 (UTC) X-FDA: 76027060956.20.ghost04_79e6212d7dc62 X-HE-Tag: ghost04_79e6212d7dc62 X-Filterd-Recvd-Size: 1751 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Oct 2019 07:33:57 +0000 (UTC) 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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