Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2020613imu; Fri, 14 Dec 2018 04:37:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/WNV/cS4UCODLTmpYu2hxF+jy/fp+EuFY7ZoNNfP3hzFP1+yNHFBUV3keToT+o43zioej7A X-Received: by 2002:a63:b649:: with SMTP id v9mr2594996pgt.436.1544791048968; Fri, 14 Dec 2018 04:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544791048; cv=none; d=google.com; s=arc-20160816; b=iAcw1kgY6In5rUusBZuaBIvRisvUS8m8udFEdJuIj239iXmpiB7EwV58vSCa1aBeVk GZt1Bui+rEPUNMyV99DN/McijwIqGIjT7qdweGbJTv1RT+/r/6yjUdG5kwgV9lyeGWO8 1vkWBXi+AOAuKTnr1hsGMer+UenbpZzUNQfloLpiDOCDSkAc8ilYn2Sb9MFwzkby0IXN UWX19U/+s3UlOcbQWwY57KlHzRE1fXNbJHqqSmwZlgWgmM52PIaylhtXTb43oYwSpG64 0LAqM4YHzyOAy2b99XJytzMQ9ZEJLDQrKqlM5OHaJ7k3z+WQ0pw1o77/dLM8f5tKZvps fE2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TNUcnN+hQNar38WT+jR6Eee9j6IeiDMrDtrBXvlJ/vE=; b=Au8llOQe8MSTe2hrcQXSlCY8+ruf1wz0Rz3wTQv+pzf0AzNQM63o6DTtBHQWbNb84A 9MXPJY8zGakfgryPGdY/DzuH2pR0hMgDUKx9390xZYs3qwGnYVok4SZVNgsDHBoC4D+p n1Wu49INM1R7rF5l3nuo6TR2EtumOQBvIPDNgZehWZuKXwOgm//EEMHvj8Z+2w5BNclA 5Mik0fPFiGI6fvJzbkU9kwZfkm8M2dBpHF7gYEac6jc/f7yR+dr3KZOAtYHDxhQ7ALmL k+0pHrSrSFtLfnAJ/4kjVvA9qbpzkylopxsR6JSk9FQKDSTEFphhfxdBt7PnVU4qcuHL eFJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="lWbv/isS"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si1903207pgl.106.2018.12.14.04.37.14; Fri, 14 Dec 2018 04:37:28 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="lWbv/isS"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730632AbeLNMgY (ORCPT + 99 others); Fri, 14 Dec 2018 07:36:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:51836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730970AbeLNMGm (ORCPT ); Fri, 14 Dec 2018 07:06:42 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 783BA2147D; Fri, 14 Dec 2018 12:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789201; bh=q3VW0EhI6kg7jaxsPySNJnDmvdPTMn1yoijvbGTj1aU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWbv/isSKp3Upyef94HSo1c7vzAhXxYkPt2oIjkGJg7fJiktK0bkWzN4nlyFgvYxM 7a1bWLOZii0RGYc8SVj3uHZa/YyqAnfX0Y14Ao9GISACVJYxooInY7SopYlsoYeNT2 WqTVd09gA+Y9ARqz7vW5aK3CSfqncFA1nWzphJQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Matthew Wilcox , Johannes Thumshirn , Dan Williams Subject: [PATCH 4.19 134/142] dax: Check page->mapping isnt NULL Date: Fri, 14 Dec 2018 13:00:19 +0100 Message-Id: <20181214115752.395057974@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthew Wilcox commit c93db7bb6ef3251e0ea48ade311d3e9942748e1c upstream. If we race with inode destroy, it's possible for page->mapping to be NULL before we even enter this routine, as well as after having slept waiting for the dax entry to become unlocked. Fixes: c2a7d2a11552 ("filesystem-dax: Introduce dax_lock_mapping_entry()") Cc: Reported-by: Jan Kara Signed-off-by: Matthew Wilcox Reviewed-by: Johannes Thumshirn Reviewed-by: Jan Kara Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/dax.c +++ b/fs/dax.c @@ -423,7 +423,7 @@ bool dax_lock_mapping_entry(struct page for (;;) { mapping = READ_ONCE(page->mapping); - if (!dax_mapping(mapping)) + if (!mapping || !dax_mapping(mapping)) break; /*