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=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 143CCC2D0A8 for ; Wed, 23 Sep 2020 13:43:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5845C21BE5 for ; Wed, 23 Sep 2020 13:43:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cLiwIDQ0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5845C21BE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D3BB36B005D; Wed, 23 Sep 2020 09:43:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC3DA6B0062; Wed, 23 Sep 2020 09:43:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB6B46B0068; Wed, 23 Sep 2020 09:43:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id A269F6B005D for ; Wed, 23 Sep 2020 09:43:00 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 545838249980 for ; Wed, 23 Sep 2020 13:43:00 +0000 (UTC) X-FDA: 77294442120.22.actor06_1b04a8a27156 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 2E2BF18038E6B for ; Wed, 23 Sep 2020 13:43:00 +0000 (UTC) X-HE-Tag: actor06_1b04a8a27156 X-Filterd-Recvd-Size: 3352 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Sep 2020 13:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600868579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rcX1qrdKwUJLaB/VAH3GKYW4wyrkh2TnZ9mJwzftRZQ=; b=cLiwIDQ0n0dAaoEUSrviTZwe7TI16RP9bZZ40uNnWlS7/MdvS+rwV/NJi4y7S9yUykmwjB K+/MoyBzep7/fa/75FjLxhi4jEPO9+brOYeUb7UnvzKyjXwgcXdJ4+nnzaUmEq7HvqzA83 dX5za1x+fMWBh0GDIy7A/QNfDm7nybw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-143-OSEAoOHIO4OLe5nfUYTYlA-1; Wed, 23 Sep 2020 09:42:56 -0400 X-MC-Unique: OSEAoOHIO4OLe5nfUYTYlA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F2E0640A8; Wed, 23 Sep 2020 13:42:55 +0000 (UTC) Received: from optiplex-lnx (unknown [10.3.128.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67A3160BEC; Wed, 23 Sep 2020 13:42:54 +0000 (UTC) Date: Wed, 23 Sep 2020 09:42:51 -0400 From: Rafael Aquini To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ying.huang@intel.com Subject: Re: [PATCH] mm: swapfile: avoid split_swap_cluster() NULL pointer dereference Message-ID: <20200923134251.GN795820@optiplex-lnx> References: <20200922184838.978540-1-aquini@redhat.com> <20200922124750.67a20d9764ec098b17705407@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922124750.67a20d9764ec098b17705407@linux-foundation.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 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?