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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 4F3F2C4346E for ; Fri, 25 Sep 2020 03:07:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C49F621481 for ; Fri, 25 Sep 2020 03:06:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C49F621481 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 161578E0001; Thu, 24 Sep 2020 23:06:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EB9C6B005D; Thu, 24 Sep 2020 23:06:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF63C8E0001; Thu, 24 Sep 2020 23:06:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id D3E9C6B005C for ; Thu, 24 Sep 2020 23:06:58 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A357D45B3 for ; Fri, 25 Sep 2020 03:06:58 +0000 (UTC) X-FDA: 77300096916.12.doll74_4a0d50b27164 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 835111801CE08 for ; Fri, 25 Sep 2020 03:06:58 +0000 (UTC) X-HE-Tag: doll74_4a0d50b27164 X-Filterd-Recvd-Size: 3526 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 03:06:57 +0000 (UTC) IronPort-SDR: GL/Uv2xSAyO3+wCJTbIIKhEHPcbyUWAV89Hzpw+NlSgd01qu3YTCWLkn0n7nGVvlhNb+raV/To b8Ffk2yWmZug== X-IronPort-AV: E=McAfee;i="6000,8403,9754"; a="149169613" X-IronPort-AV: E=Sophos;i="5.77,300,1596524400"; d="scan'208";a="149169613" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2020 20:06:55 -0700 IronPort-SDR: yR0ZXUpAWSiGmfpVzBjaa8bbcbsTv8Ie0OCqvZQBUgJItTZ3vT7NtTV5Fbalt7gkcXchpZuP34 sTMgzGVfUWfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,300,1596524400"; d="scan'208";a="512524442" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.65]) by fmsmga005.fm.intel.com with ESMTP; 24 Sep 2020 20:06:54 -0700 From: "Huang\, Ying" To: Andrew Morton Cc: Rafael Aquini , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: swapfile: avoid split_swap_cluster() NULL pointer dereference References: <20200922184838.978540-1-aquini@redhat.com> <20200922124750.67a20d9764ec098b17705407@linux-foundation.org> <20200923134251.GN795820@optiplex-lnx> <20200924195914.d240877a10e22b457bd9b45d@linux-foundation.org> Date: Fri, 25 Sep 2020 11:06:53 +0800 In-Reply-To: <20200924195914.d240877a10e22b457bd9b45d@linux-foundation.org> (Andrew Morton's message of "Thu, 24 Sep 2020 19:59:14 -0700") Message-ID: <87v9g2blma.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii 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: Hi, Andrew, Andrew Morton writes: > On Wed, 23 Sep 2020 09:42:51 -0400 Rafael Aquini wrote: > >> On Tue, Sep 22, 2020 at 12:47:50PM -0700, Andrew Morton wrote: >> > On Tue, 22 Sep 2020 14:48:38 -0400 Rafael Aquini wrote: >> > >> > > The swap area descriptor only gets struct swap_cluster_info *cluster_info >> > > allocated if the swapfile is backed by non-rotational storage. >> > > When the swap area is laid on top of ordinary disk spindles, lock_cluster() >> > > will naturally return NULL. >> > > >> > > CONFIG_THP_SWAP exposes cluster_info infrastructure to a broader number of >> > > use cases, and split_swap_cluster(), which is the counterpart of split_huge_page() >> > > for the THPs in the swapcache, misses checking the return of lock_cluster before >> > > operating on the cluster_info pointer. >> > > >> > > This patch addresses that issue by adding a proper check for the pointer >> > > not being NULL in the wrappers cluster_{is,clear}_huge(), in order to avoid >> > > crashes similar to the one below: >> > > >> > > ... >> > > >> > > Fixes: 59807685a7e77 ("mm, THP, swap: support splitting THP for THP swap out") >> > > Signed-off-by: Rafael Aquini >> > >> > Did you consider cc:stable? >> > >> >> UGH! I missed adding it to my cc list. Shall I just forward it, now, or >> do you prefer a fresh repost? > > I added the cc:stable to my copy. Please don't merge this patch. This patch doesn't fix the bug, but hide the real bug. I will work with Rafael on root causing and fixing. Best Regards, Huang, Ying