Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5992056rdb; Sun, 17 Sep 2023 23:53:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqF8SzcLBUtEIRY7j7ZdY4EmoVjO2ZQ2ou00lpbFNiPKj/fDDi9uXRBvd0StV+14n8lXiJ X-Received: by 2002:a05:6808:182:b0:3a3:6e43:e681 with SMTP id w2-20020a056808018200b003a36e43e681mr9202173oic.58.1695019989021; Sun, 17 Sep 2023 23:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695019988; cv=none; d=google.com; s=arc-20160816; b=kr2La5zrhTtLRKfKGCt0GdMjr21jUjQ2j2B0cJHkHGuw2sA4D/cR/8cqZ5QLOK1tTC CAXmmZfMU0wn5JUGNwEzba/J+Xh82kEb16qfNOIoLJSFVoN0ZzJRQO3FUZTd8zR4mGcv vXIHJHAIRBwEuiOyrPXMdlMVUVM9XzoVAa4YYWu+i52gvc9k+BMqJNfNk9uqV4k3fhLd NeMT6TNS6ASRpFThlPOcgGNtSQXyjU/XG++rlVCKgW17lENQb4fszOG6SpOZEVK5JNqr l5OcrofrqlugCwvaMRpBoOXfb4DQLfe6ZtE8WuuSgQlYuGHUO+guiUBsR/94L867p9Iu P7cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=LqoXsNiOpdyqoLt2oqnGRfgdDfVauopGq4iP8BSAeZE=; fh=hFgfcaIVoyhXbF2UwJZsnqb6ugEoYRhxDBvi1f/p9Jo=; b=uffQrOxOavm439OOVCpf8QzxqmdtfMBs9QJWN0MyIOIkXrQn9cN8L67GbTpNAh6O8V y05j7Ez+y2s3Kk4ql9uW8oXW5rR7O9A6c7Ke3sUT4046RApduneEDarVBZCbEot6Uwk+ 9D6tL5RjjYrziWOFtVc92pmHAMhL3nh0lMkrqRRVVTZ4pQLOgV7F5gTbIIdvEL198g3G 6MlYcFxYYTPLvXdmqMP6m0tWIwReUOeSKuQ2iwORhP9uKlKySklVKKqYsOW/lAvyYlua 6qaeF3hhNxaBg5XCAy25ItKb7eSrrJyeAP3HepbOsVm7iIWg8HHsCR/oqNMjxa76guur OoLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id y123-20020a636481000000b00565dd91aa06si7393539pgb.244.2023.09.17.23.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 23:53:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B533C81F3701; Sun, 17 Sep 2023 23:53:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238361AbjIRGvx (ORCPT + 99 others); Mon, 18 Sep 2023 02:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239854AbjIRGvX (ORCPT ); Mon, 18 Sep 2023 02:51:23 -0400 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF2F12F; Sun, 17 Sep 2023 23:51:12 -0700 (PDT) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4RpwRv18VQz4xPYd; Mon, 18 Sep 2023 14:51:07 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 38I6omNN027269; Mon, 18 Sep 2023 14:50:48 +0800 (+08) (envelope-from cheng.lin130@zte.com.cn) Received: from mapi (szxlzmapp07[null]) by mapi (Zmail) with MAPI id mid14; Mon, 18 Sep 2023 14:50:50 +0800 (CST) Date: Mon, 18 Sep 2023 14:50:50 +0800 (CST) X-Zmail-TransId: 2b096507f34a368-08e64 X-Mailer: Zmail v1.0 Message-ID: <202309181450509388561@zte.com.cn> Mime-Version: 1.0 From: To: , Cc: , , , , Subject: =?UTF-8?B?W1BBVENIIHY0XSB4ZnM6IGludHJvZHVjZSBwcm90ZWN0aW9uIGZvciBkcm9wIG5saW5r?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 38I6omNN027269 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6507F35B.000/4RpwRv18VQz4xPYd X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 17 Sep 2023 23:53:06 -0700 (PDT) From: Cheng Lin When abnormal drop_nlink are detected on the inode, return error, to avoid corruption propagation. Signed-off-by: Cheng Lin --- fs/xfs/xfs_inode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 9e62cc500..d16cb62ce 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -919,6 +919,14 @@ xfs_droplink( xfs_trans_t *tp, xfs_inode_t *ip) { + + if (VFS_I(ip)->i_nlink == 0) { + xfs_alert(ip->i_mount, + "%s: Deleting inode %llu with no links.", + __func__, ip->i_ino); + return -EFSCORRUPTED; + } + xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); drop_nlink(VFS_I(ip)); -- 2.18.1