From patchwork Sun Oct 11 03:36:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 270406 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,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, 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 933FDC433E7 for ; Sun, 11 Oct 2020 03:36:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55EB320874 for ; Sun, 11 Oct 2020 03:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602387390; bh=66FaKwXrf0aBug71opDfeWO0v0BrvsAwDj3jgDOe67g=; h=Date:From:To:Subject:List-ID:From; b=YgRVN3sAQOSWVMgth9ERecZj8PDH35Hl/VtolUe3OpkDuMvyECsGid2B8CX+BYvDq zOK9Fws0GBJ3rpitr6vZD2Q/5mHJg53vtqL01h/d9Xxi3wDOS5bvnW2FjlvUfQw16b ZH70aSOvlaN0Gzf1viI9YRktJYtO1GjK3pHUpDw8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728921AbgJKDg3 (ORCPT ); Sat, 10 Oct 2020 23:36:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:49858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728715AbgJKDg3 (ORCPT ); Sat, 10 Oct 2020 23:36:29 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 E31A320773; Sun, 11 Oct 2020 03:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602387388; bh=66FaKwXrf0aBug71opDfeWO0v0BrvsAwDj3jgDOe67g=; h=Date:From:To:Subject:From; b=rQyu6D+NqLG8viZysGe56g7a+l3d1PA+/zRSERthWkQyaWMnHl3ZBMcQ8EpeZZJFc MuXrQyoHJpekEWrYxYZ7/yn/9OSiRTddPAfg7Vvm4GncyJZnGOKtloSGZcRut5oLbI 6KEOzpNBrHI2Ko7vOUNLlkw23OyUuPvQBGU05bIk= Date: Sat, 10 Oct 2020 20:36:27 -0700 From: akpm@linux-foundation.org To: andres@anarazel.de, david@fromorbit.com, dhowells@redhat.com, hch@infradead.org, jack@suse.cz, jlayton@kernel.org, minchan@kernel.org, mm-commits@vger.kernel.org, stable@vger.kernel.org, viro@zeniv.linux.org.uk, willy@infradead.org Subject: + mm-validate-inode-in-mapping_set_error.patch added to -mm tree Message-ID: <20201011033627.VInQu4bdg%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: mm: validate inode in mapping_set_error() has been added to the -mm tree. Its filename is mm-validate-inode-in-mapping_set_error.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-validate-inode-in-mapping_set_error.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-validate-inode-in-mapping_set_error.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Minchan Kim Subject: mm: validate inode in mapping_set_error() The swap address_space doesn't have host. Thus, it makes kernel crash once swap write meets error. Fix it. Link: https://lkml.kernel.org/r/20201010000650.750063-1-minchan@kernel.org Fixes: 735e4ae5ba28 ("vfs: track per-sb writeback errors and report them to syncfs") Signed-off-by: Minchan Kim Acked-by: Jeff Layton Cc: Jan Kara Cc: Andres Freund Cc: Matthew Wilcox Cc: Al Viro Cc: Christoph Hellwig Cc: Dave Chinner Cc: David Howells Cc: Signed-off-by: Andrew Morton --- include/linux/pagemap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/include/linux/pagemap.h~mm-validate-inode-in-mapping_set_error +++ a/include/linux/pagemap.h @@ -54,7 +54,8 @@ static inline void mapping_set_error(str __filemap_set_wb_err(mapping, error); /* Record it in superblock */ - errseq_set(&mapping->host->i_sb->s_wb_err, error); + if (mapping->host) + errseq_set(&mapping->host->i_sb->s_wb_err, error); /* Record it in flags for now, for legacy callers */ if (error == -ENOSPC)