Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4341605pxu; Mon, 12 Oct 2020 16:52:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2101fdiEVWRr81w04hQSaEFanJH2wxDMg9Jzm1diV4dDKTq6DODoVdmceQ39aUJiI8Qmv X-Received: by 2002:a17:906:2c41:: with SMTP id f1mr30072540ejh.524.1602546726610; Mon, 12 Oct 2020 16:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602546726; cv=none; d=google.com; s=arc-20160816; b=EYfOuMibe90eL2mhm7aMawRZXd1fFUXAXv1FGkS+oDBD/C1DfbkyGfeOQitLfZlFSD +Lk3JdFd4q3tMreMFgp2VoyNCPQZtXNB5oZN7zDvO4vV/zzPkiIrDomkhjZGJ0dzF5Hd pTw94yiyIFE79DmYg1L2x+biepi7O7M7vOIDQFxd73gY9EAh019N28mA6VKkFtahx3rt dh1xlty2zbm62ynNjhIqtur9ExYRYCr0UNSBtK8aHscO/LvntIMyvRG3c0kyrxZruuIw Cpm+3WeixaVfnfB+F9JMhUAtOfkY2WcvCSZQJQRdF0Bi73nm1OK6y9jRVNurAuRsv+Tv J4dQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1dfdg9GYPHWrGaygFGy2wx20i4yKVg7HeXcVjpwIPgc=; b=hrGsb/R9MoSr/Nt+0XiNP3Wsx81MJ0P7h6EmLS0jrUYt5kNEccto7qNrwWrLMpFqCP sClEO4EWgmnG1vL+Q/6G964sK7fLw7+TmOBKBZubSYJot35MczF2Uyw+3VgB0/n/NUVa AmyKdg1OFboeOHdu7zFO09eGhZXoEaP74QSMUnqS4aj2+SyQpnXBLsfwW8+ZhsPVC2+a P9vHzwje5h70jzJNLl8O425ZmDXZBv4Lk+7LzkA4PvlIQz3URNRT/qBaByte/S0Q0C70 JlCL9CJOsATWYOKdqS8lPQOzCKIuloLOxiCWbIs4gnTIO0Bcq2kHOKJEqojowV/MtN50 XyxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="IW0/2Ihp"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z30si13347767edi.478.2020.10.12.16.51.43; Mon, 12 Oct 2020 16:52:06 -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="IW0/2Ihp"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389745AbgJLNtc (ORCPT + 99 others); Mon, 12 Oct 2020 09:49:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:55744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731919AbgJLNsT (ORCPT ); Mon, 12 Oct 2020 09:48:19 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 F24A922266; Mon, 12 Oct 2020 13:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510466; bh=ByvkiNcjRBSEt3jkPzxUI6DAEmvBmxBKc8xsQN8Qfh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IW0/2IhpfD+toxywF60fSKQU0RIfMmiK89a4f0WmyqhllU9QrlTiILOe5OtLwVWxB MPEklbRubLpNajVtd7tP2XyTZIwqIqqioN5sECx5FDmQemp6lSGsP89pJvU0uwGf6K QPuZFzVQqYBaOyx9LKrXeCClc1aLE4l2HgmTSGF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minchan Kim , Andrew Morton , Jeff Layton , Jan Kara , Andres Freund , Matthew Wilcox , Al Viro , Christoph Hellwig , Dave Chinner , David Howells , Linus Torvalds Subject: [PATCH 5.8 111/124] mm: validate inode in mapping_set_error() Date: Mon, 12 Oct 2020 15:31:55 +0200 Message-Id: <20201012133152.226106025@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012133146.834528783@linuxfoundation.org> References: <20201012133146.834528783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minchan Kim commit 8b7b2eb131d3476062ffd34358785b44be25172f upstream. The swap address_space doesn't have host. Thus, it makes kernel crash once swap write meets error. Fix it. Fixes: 735e4ae5ba28 ("vfs: track per-sb writeback errors and report them to syncfs") Signed-off-by: Minchan Kim Signed-off-by: Andrew Morton 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: Link: https://lkml.kernel.org/r/20201010000650.750063-1-minchan@kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- include/linux/pagemap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/include/linux/pagemap.h +++ b/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)