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=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,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 C1348C433E7 for ; Sat, 10 Oct 2020 11:59:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F6DE2225D for ; Sat, 10 Oct 2020 11:59:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ujxPtAeg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F6DE2225D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 771EA6B0062; Sat, 10 Oct 2020 07:59:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 720C26B0068; Sat, 10 Oct 2020 07:59:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60FDE900002; Sat, 10 Oct 2020 07:59:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 342C86B0062 for ; Sat, 10 Oct 2020 07:59:02 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CE77E3629 for ; Sat, 10 Oct 2020 11:59:01 +0000 (UTC) X-FDA: 77355869682.15.crown69_07046ec271e9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id A88B31814B0C8 for ; Sat, 10 Oct 2020 11:59:01 +0000 (UTC) X-HE-Tag: crown69_07046ec271e9 X-Filterd-Recvd-Size: 2587 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Sat, 10 Oct 2020 11:59:01 +0000 (UTC) Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (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 DF36B2072D; Sat, 10 Oct 2020 11:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602331140; bh=KfphMgJoG+7J6N0lfM56ASmEua7G6nMhwmZkQcR67yw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ujxPtAegJyLlJHb2M/Dhl1WpztK8OJZ3Cki+li7y6CMEuE//CeTkx1fOIV6FgwnUL +eGcqdY9FT2DWvT2Xf0cRrtwcZPRAsmC4Igan0x93wJTvCOFBmAPaRTkYU95oOw7Ow ncNJH9J18pUjjQM6erd9lQu9pjqF4PHrUK9moiPk= Message-ID: <072facd74fafbd10901f43cde06abd13d15341ea.camel@kernel.org> Subject: Re: [PATCH] mm: validate inode in mapping_set_error From: Jeff Layton To: Minchan Kim , Andrew Morton Cc: Jan Kara , linux-mm , LKML Date: Sat, 10 Oct 2020 07:58:58 -0400 In-Reply-To: <20201010000650.750063-1-minchan@kernel.org> References: <20201010000650.750063-1-minchan@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 Fri, 2020-10-09 at 17:06 -0700, Minchan Kim wrote: > The swap address_space doesn't have host. Thus, it makes kernel crash once > swap write meets error. Fix it. > > [1] 735e4ae5ba28, vfs: track per-sb writeback errors and report them to syncfs > Signed-off-by: Minchan Kim > --- > include/linux/pagemap.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h > index 17ba0fe59290..9cf540447e73 100644 > --- a/include/linux/pagemap.h > +++ b/include/linux/pagemap.h > @@ -55,7 +55,8 @@ static inline void mapping_set_error(struct address_space *mapping, int error) > __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) Good catch. Acked-by: Jeff Layton