Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422057rdh; Sun, 29 Oct 2023 15:54:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgPepbxeTFcNphFy4wAMl8fsg/PttWEAm+BRMSLHIj75HXdxARGr9Xx7HkJA6dGdCWhgX6 X-Received: by 2002:a05:6808:10c4:b0:3b2:9d31:9d25 with SMTP id s4-20020a05680810c400b003b29d319d25mr11821830ois.31.1698620099376; Sun, 29 Oct 2023 15:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620099; cv=none; d=google.com; s=arc-20160816; b=qVlTZcZBn8CmC0g4AoAmpeUZBXNRUVNiQr2oTTdNvLR9rrA1mwHXV+vgrhbqUstmLS qttjkWa2otqnbdfkXrYUnsxGzE11/gW1DmvoLmrWl28cnWW2RRqLeDszF9IP3Jo1EGKy bbbdxd1oivn7wnUqHX9e5PSNDBsim9pvDUjDPwoUKCSkou/HGXjsgMhevcDJCD8ZGpJd uBDa8yV6q2Y//W0clikQIziY6r8X7AI0VOu6+vHE0+y7yXJjja3cgipLaM7E0hcZ7/th yHMAUqjuNdxGQqlhyvCF4TfEqVXYJDsGKXdukvQTCjfu/XPqd/j0BxNhdYt0bUWU0P0P GC4g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LQDUoivsYWfNbuhtD/3r5UN6Qj7llPRGgWtstEvTRsY=; fh=IVcZYgopwke+Bc9cmwdOT5yAIhnLPNAsBqE9TuY8J+c=; b=i/N5T9kkwfdEXAn0iVpKPN+3ifT/YHQT6rntr6VlX7Y2B1OzFF+YnlfxiNr82tzF0s WJMSiCO6tg4bpH+sUdJc+oAIQbOFdu4u2tOREdLOqkadIruEp/PmZwMpgQvL2rU5r3SU rdLYzTSprnYpx1hczT0g9M7d7loUhaqkFpSVpuKqEgLYpb97lt72+IFdcdqT2JtiU/t9 2rL2AM0Xc+b7psjBnWjc465FbpAC24ThspUZ7g3fJ1zf50+655lkpFwnWeyOsS8gi/zr pR+acT3xdwsN7IUqNb3WXukw+q/WXOj7f7TjyOVnXtTeP6D57TIvl/ff9wJjgX2rPXuE ev/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HvlthHcQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c5-20020a633505000000b005b8edc8ad3asi4130029pga.370.2023.10.29.15.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:54:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HvlthHcQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1732180AB1FA; Sun, 29 Oct 2023 15:54:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbjJ2Wyt (ORCPT + 99 others); Sun, 29 Oct 2023 18:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbjJ2Wys (ORCPT ); Sun, 29 Oct 2023 18:54:48 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 597B8BC; Sun, 29 Oct 2023 15:54:46 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D97FC433C7; Sun, 29 Oct 2023 22:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620086; bh=8jwIhSJNERUS2JXUA+b4m7u2invwoqI91nbQ4OlFJNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvlthHcQ7ham7V7mBZwpARv++2o/2vCidZrzMQn2wrXdu/L/4fVj4E59kt2+IXFUU wqUBJU5fFNqLLfCHAkm9qYzrYnV5HDdUMx9QTS9LeyYLKEyn/kvVPLMhAUFL/BBoDk 0zVzNAkJdyrfu1QbiqCij0yDnzrJXnI2CnC1fg54lMG4c66wKxNXJxH5pS/8eXIRtP CiNWeKUussp4tNljj6uDOiYhDTCfaGJ1SrpB3ktBrn0lsPG+ZZz8Bfhjpqtdy9fmI0 B0d5IBp4hVuwETLYxJisAt1yEq/QiLm1uoIIPm2x+D0yCs1nEXuMP7JBRUEUF4sXKk vizR1x4WNmVQQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konstantin Komarov , Sasha Levin , ntfs3@lists.linux.dev Subject: [PATCH AUTOSEL 6.5 02/52] fs/ntfs3: Add ckeck in ni_update_parent() Date: Sun, 29 Oct 2023 18:52:49 -0400 Message-ID: <20231029225441.789781-2-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.9 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:54:58 -0700 (PDT) From: Konstantin Komarov [ Upstream commit 87d1888aa40f25773fa0b948bcb2545f97e2cb15 ] Check simple case when parent inode equals current inode. Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/frecord.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 16bd9faa2d28b..8f34d6472ddbd 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); if (IS_ERR(dir)) { -- 2.42.0