From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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> In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: 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; /*