From patchwork Mon Jul 3 07:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 115208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp353105vqx; Mon, 3 Jul 2023 00:53:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4inj0/ZmDtTAknPx9Cp0mYEccog6mBKEP8KqQbJEo+R9XMQ/ZOG2jGkEa1+0mr/vsoaB2K X-Received: by 2002:a05:6a20:1446:b0:111:a0e5:d2b7 with SMTP id a6-20020a056a20144600b00111a0e5d2b7mr14386472pzi.4.1688370837404; Mon, 03 Jul 2023 00:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688370837; cv=none; d=google.com; s=arc-20160816; b=xooYDqHlLiVDDFEXHO4nnHU1U7yxJJYwAoTEPQrbAULU+iO8CeizIhd7xDLoPwmTGa 2m7VV2z+ptHHKHHBEloXaDinqGKlqErnHxjiXi38sKNrRnGpGdLuzIzvI4NI7RnWueYC RfwhUzxFIzDvhOtaBtrevXZZ55qqrwwUS42nq7DN9pOI3bSMbv5aj3hN+gL6AiOxFbA9 PwddUbLdACuLne0bGgZN+WFeALZxX0cRYL+Y8ejNDEBFI5A3F6U1FjXNAKf44/JPV0oc WFYvKlAh+p29QCSGEw5sX4tEJKby/D4OhhIP8vkB1L3Q6/b4WzHBvHckgAlORYgJWy9g TsHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=Rx//LO9/7IMTU2TX9c0DIpKI/VjGm4z0Maj34lCnuA8=; fh=+YFVdCJq57+piIgB3kUO3LUIuYykw/jnC0zhAUs0Z14=; b=FOlobfs790+BoBq/QcLIPdk9hE6xYebB6a2mLqcTEt/fjj/rq3YZ3y9lRht98F8QOn V4A8XM9c7UNF8TRNcfFofKzus1jKrRlgWgxR6JEEroz6QZFiyHKlol/ydVvVVCX7F3ha luJPCwsj/ML1R5tqUjZUq3kQh8fUOSFLpNCjIWrEUv/dxmZ3wIcvkwtaNNSdE1JP3LlJ 2VJH63LG4I2P9F9duESOnbg17Sr2B9221B7nGI3FAHiajHOx/KnLNf6dpI4NAOfC1YV4 6/uR426auphO79SV9BE2BtgljyjQb7OfEAUIIguVpi4kHD4R7+yadS6F+QSF2FugEAeo KxEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=mu+4Zi+t; dkim=pass header.i=@paragon-software.com header.s=mail header.b=mbEfFe+u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a056a00088800b00681c3725a98si9492781pfj.82.2023.07.03.00.53.41; Mon, 03 Jul 2023 00:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=mu+4Zi+t; dkim=pass header.i=@paragon-software.com header.s=mail header.b=mbEfFe+u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjGCHcn (ORCPT + 99 others); Mon, 3 Jul 2023 03:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjGCHcl (ORCPT ); Mon, 3 Jul 2023 03:32:41 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7603CC; Mon, 3 Jul 2023 00:32:40 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 6740A1D34; Mon, 3 Jul 2023 07:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1688368769; bh=Rx//LO9/7IMTU2TX9c0DIpKI/VjGm4z0Maj34lCnuA8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=mu+4Zi+tLFsNMkcxYwGJASldvxkMTPZFVITANt9PQgmJTIhNILUfanN8HReP5EGc5 xOzSWVLVzvh1CrbVPqqkTlw4n773/xN7s9TfM/EgnivaCCaitQa9SfuU+V/0/3DBz2 dDW1mRxHVXGxntNaJNTgR3OOLHnLFHs2erVFyFrA= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id D2AF71D1E; Mon, 3 Jul 2023 07:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1688369080; bh=Rx//LO9/7IMTU2TX9c0DIpKI/VjGm4z0Maj34lCnuA8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=mbEfFe+uruU4DDxz9aMUbl86vfw5tJv1u7XTjIXN0qGP4zWp5U6A3fp4GDW60Dn7J UGp9F/YD7nbSA6VuaVUG+ZYaiHAKVGP8dP0FW4Br07t8eQbXVIYmXOg5fktOTnf6Yf iHxMePOqIco19Sq1QD1Fk18NmNFsNhLx4EcS2G0k= Received: from [192.168.211.138] (192.168.211.138) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 3 Jul 2023 10:24:40 +0300 Message-ID: <379d007b-63d1-ab12-57aa-0ceee3d539a0@paragon-software.com> Date: Mon, 3 Jul 2023 11:24:39 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: [PATCH 1/8] fs/ntfs3: Add ckeck in ni_update_parent() Content-Language: en-US From: Konstantin Komarov To: CC: Linux Kernel Mailing List , References: In-Reply-To: X-Originating-IP: [192.168.211.138] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770385139126880818?= X-GMAIL-MSGID: =?utf-8?q?1770385139126880818?= Check simple case when parent inode equals current inode. Signed-off-by: Konstantin Komarov ---  fs/ntfs3/frecord.c | 6 ++++++  1 file changed, 6 insertions(+)          if (IS_ERR(dir)) { diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 16bd9faa2d28..8f34d6472ddb 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -3208,6 +3208,12 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup,          if (!fname || !memcmp(&fname->dup, dup, sizeof(fname->dup)))              continue; +        /* Check simple case when parent inode equals current inode. */ +        if (ino_get(&fname->home) == ni->vfs_inode.i_ino) { +            ntfs_set_state(sbi, NTFS_DIRTY_ERROR); +            continue; +        } +          /* ntfs_iget5 may sleep. */          dir = ntfs_iget5(sb, &fname->home, NULL);