From patchwork Sat Oct 10 00:06:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minchan Kim X-Patchwork-Id: 11829771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F033A1580 for ; Sat, 10 Oct 2020 00:07:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E55522245 for ; Sat, 10 Oct 2020 00:07:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XqQMwS8B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E55522245 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 A2AF76B006E; Fri, 9 Oct 2020 20:07:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9DC0A6B0070; Fri, 9 Oct 2020 20:07:06 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CA426B0071; Fri, 9 Oct 2020 20:07:06 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id 61D5A6B006E for ; Fri, 9 Oct 2020 20:07:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 001521EF1 for ; Sat, 10 Oct 2020 00:07:05 +0000 (UTC) X-FDA: 77354075652.18.unit51_34120f1271e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id D71CE1018C2F6 for ; Sat, 10 Oct 2020 00:07:05 +0000 (UTC) X-Spam-Summary: 1,0,0,65f55fe6b5d58664,d41d8cd98f00b204,minchan.kim@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1437:1515:1534:1540:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3872:4321:5007:6261:6653:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14721:21080:21444:21451:21627:30054:30069:30070:30090,0,RBL:209.85.210.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04yfsdewx7bsf8mfw87o7xwx9b4muycmttrq47fhpi8mizr6dwtzikwgowtajp1.6cyqxxhwpqxxe7qite3wr8bcf39bran836msbjknqrqbn5aufffrix7h1ptzk8n.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: unit51_34120f1271e4 X-Filterd-Recvd-Size: 3905 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Sat, 10 Oct 2020 00:07:05 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id x13so5580458pfa.9 for ; Fri, 09 Oct 2020 17:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=f6Qtf4j20P32iYlPfJ3sCZa+aUx1EvEQCeg0osTASKs=; b=XqQMwS8BpFsahTRaQtKviHaG0jSx9C1YbCh6x388sVg+AgRGghxUOl18x8plMihboJ 5nCNaPFWT+ZPnlUhOdEU5TSqvLOLG8Bz/U2nAJVBIO0TdaBTbYRHAT8EanijQZ3q5k4p rJ/sUtVfJnucP1uCzevkO7VnvAeDaAao0K0+uSy8FFtdAy+7DgJ8JX/NL1di2j+YOm4S 5gn3JjzlsYuOUdOBJO0CAVl1plIeWkjetz2kf3QAF1DmYOA63cMt5sa6bqZ9yg9bxykh +gk7saRM1gmw2Z+1kn+BbL0pg/m7mdH2zH2xE4QGf3qBZJ6M0/5OEDQ0/EfAnozHn5Dj 6iDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=f6Qtf4j20P32iYlPfJ3sCZa+aUx1EvEQCeg0osTASKs=; b=fh9kvy8FBE6kbhSAMSALYntn/3vyJyoI67FvCvQ61CJ7FeLH/PeSaWakAAlM9Dy2dh oVAXS9jJoheqvbA+U9N63XTlr5qr6fLh+Iu+HIKt6fkh99oaagOpYkPyKelqtc0knl3e 4O6qjfs5Z9eeQwInsMNM2YY8xdnDA0KyinG4Ka7aM++R1GQ+frXIonS9R2nlzTGDmdPD bOaV4lkEpRhfAUfTR1PCRuPOLJ5JEPOoF8bk8Elji9OI7B8IyXZ889xp3tFJvGJF0d4T JUElFnvS/fvw2ftSeegO4YbDj9ltnJ7OahjC4/PZCH/z4V8/DqQfyw5a/xhuxBS+C5M5 hz2A== X-Gm-Message-State: AOAM533D8TEObpuoOVlryrRdbrGzvw85XdF2iSNNKhS+lT5JS0U/cXEe kDcGmCnVlW11x7iRw+NTAv2oyx2kDIM= X-Google-Smtp-Source: ABdhPJzYSEzFUlseh7Pf1nVEMKpq+FrIDqYKAHMGUgoolPbXZr0zjisss8GDc05ySTcOgLwYEObcEw== X-Received: by 2002:a62:7895:0:b029:152:2640:644f with SMTP id t143-20020a6278950000b02901522640644fmr14079663pfc.67.1602288424453; Fri, 09 Oct 2020 17:07:04 -0700 (PDT) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:1:7220:84ff:fe09:5e58]) by smtp.gmail.com with ESMTPSA id z12sm12307376pfr.197.2020.10.09.17.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 17:06:55 -0700 (PDT) From: Minchan Kim To: Andrew Morton Cc: Jeff Layton , Jan Kara , linux-mm , LKML , Minchan Kim Subject: [PATCH] mm: validate inode in mapping_set_error Date: Fri, 9 Oct 2020 17:06:50 -0700 Message-Id: <20201010000650.750063-1-minchan@kernel.org> X-Mailer: git-send-email 2.28.0.1011.ga647a8990f-goog MIME-Version: 1.0 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: 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 Acked-by: Jeff Layton --- 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)