Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp789687pxk; Thu, 24 Sep 2020 20:01:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJc1eMflnW+TggWLEEKUdAVZIQfzYn4lWiDrkpti+7Q5dq2LHNzN6mimXWxtBEIrB395Tx X-Received: by 2002:a17:906:14c9:: with SMTP id y9mr657478ejc.523.1601002885215; Thu, 24 Sep 2020 20:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601002885; cv=none; d=google.com; s=arc-20160816; b=gcWBcx40ifIsd6rvssEeF+mrS0XhZExk+fJuirakrPsLL2CnYunBR8U8xNj2/ub1FA +vLpa600oNA7J9ZWFfPJlr2hpRyNH2i4MooKvj3j9Zv2QHyH7FnhamprY1ATR5sgknpL 5InNwdDmSFnzVYAWd5ka8vHn4XEdqX1YOxC2N4fEjKEQUbCvYL+9G7dAhmzNrhfi6SZS M8GUZvwwkaPhT0txDASah3zMC86hHL32ggyG8gOZjFlp0QfJGh0nIKzouWi5Kv3l7z/m 62Fig5bOrblQ6hrsui+P+o58dial//Gsp3+CgBX/1eksL13QRlfLx0VjgUBry0Pv/hxR 16GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=rq3wYBngGMSBjWEeuxH6zZXJvbLYSGF6AoAcs9RpkfM=; b=LzZRMk4Pa/UY4aS7CAH7lGeb1zidj6Mf8GMUNrCsvmsocCq83Yd7OIsusyUrlcZrC9 UlrCPGlCYEuh4kFTdTT40tnNcHeaFwnGBkCPH1hhU5C3Ex+PvFej9fS1Zntj7c0uq3T5 +fhbKL4/1zhXdsFKHeEv0w+5XNrOIlIySSYMORnYKQX128CNyxA+TIG237WP9rYcbyql eKRF/DsJF+/4XLuM64JrLH/Nmv0f3TcYZHybz/0GXN/K9xVfqIeYSwD1fIvllu8cHyab ch0VC+PSdMjzLus2Sx34nIm4I+v2+Ug6PQOW+K1XmiaW78vIIeOGRUiGj02qwY5OREvE ywmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5JoiH8A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si930491ejv.425.2020.09.24.20.01.01; Thu, 24 Sep 2020 20:01:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5JoiH8A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbgIYC7R (ORCPT + 99 others); Thu, 24 Sep 2020 22:59:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:51300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726676AbgIYC7Q (ORCPT ); Thu, 24 Sep 2020 22:59:16 -0400 Received: from X1 (unknown [104.245.68.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D4DC620838; Fri, 25 Sep 2020 02:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601002755; bh=HlyAAdYR9wyHbMonermc2egT8gBMGqZa8uXyB8IhXjU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=F5JoiH8AKJ04sDI6xltJ+S5/vIuoZ5y0YVdFce44I1ipKaIvaAksqmplesJ3DHsNm orqNUbtTJo2z9rY2GduEN63JeYOl4xlHV09v4dEtYTK1TyEKk02AI8jKbNd9c7/E+V m6QdEhN2hXLtO9lQ9kYvbD2v1IVCtSvvSTKvU8go= Date: Thu, 24 Sep 2020 19:59:14 -0700 From: Andrew Morton To: Rafael Aquini 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: <20200924195914.d240877a10e22b457bd9b45d@linux-foundation.org> In-Reply-To: <20200923134251.GN795820@optiplex-lnx> References: <20200922184838.978540-1-aquini@redhat.com> <20200922124750.67a20d9764ec098b17705407@linux-foundation.org> <20200923134251.GN795820@optiplex-lnx> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.