From patchwork Tue Sep 26 09:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1899716vqu; Tue, 26 Sep 2023 06:08:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeWWU0lt8q9+UVuK8BVMuRBpBzSJHMnckPrrMgR8y/+SD67+/sZK/RBuSClDk+rNp5mj02 X-Received: by 2002:a05:6a20:9148:b0:15e:dc75:66a7 with SMTP id x8-20020a056a20914800b0015edc7566a7mr5753005pzc.24.1695733739373; Tue, 26 Sep 2023 06:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695733739; cv=none; d=google.com; s=arc-20160816; b=f77MY06Px+5kstmaouvWmrQiQT+F/hOEN9VAlgBJW9ijLiiuH1prh6BDac1W+dxhw9 oRk2h3YTlbBcb5jAAMKo2GzirW7uYuNIQZ5ZGvO9p4LkpGUExvzz1YZTg5y1cbEPPIXl dyVEMDP1LZW+DIncH5cKMjh2kX0U1LpK0dCk38yK2p4J9B8UwFBsZz0pPBFnmWFC0Lhd 6uMz8ohYkX6gIx51PTdik9QMcRqOq78ReUZ85Dwoyai9HiLGPaltIlsqkzyyTFISwAaM ISK2GSU+qG7Xz4dd/xXyEZawbSUCdGGPqLUme6yOHHTYmw4h0ZA0e2HEiUZnZWU4lEVd G3ww== 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; bh=kAFpjOH/j+mFhP/dbJ+h064bbKIbyxWjdj14UYWkif4=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=OYFTSEF963XDzphWi/+4GGppekpouvlYvzWcBoEIygKl4DdDMkStChNTR6nTs4tFSA Pm9Nvf1oqK+3V5wKGVTDo6F/A3s0n10VsNwsBgUujdKXFuqtwj6Dbm3e4gC7NP5zGEmZ uXC7RVe+uATdrX2zS28fmwPOIhJ4KHB1LoCw3evQX699Jao/7rOECRtedSHvEZgzLh0Z GsveXBZnsT1Yk1MoWtRjuGQZMuNM8ViFRHFEZIaPBRXy0+9f1nTCyhsYZhxgaJ9rWGYD fbxj1XRvi3wU4sBUX5OZjpcGFqikUjqSt8RW/7rzwMPrTByIiNrfmrGulDS/urgkqlRy GlUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=sf7vwL7p; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id v17-20020a62c311000000b0068fb9c0bb07si12162165pfg.13.2023.09.26.06.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 06:08: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=@paragon-software.com header.s=mail header.b=sf7vwL7p; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8D991813CD91; Tue, 26 Sep 2023 03:03:51 -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 S234354AbjIZKDr (ORCPT + 27 others); Tue, 26 Sep 2023 06:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233494AbjIZKDk (ORCPT ); Tue, 26 Sep 2023 06:03:40 -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 CB2359D; Tue, 26 Sep 2023 03:03:33 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 2C14521B2; Tue, 26 Sep 2023 09:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721752; bh=kAFpjOH/j+mFhP/dbJ+h064bbKIbyxWjdj14UYWkif4=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=sf7vwL7pD4XmCvSSu1u+/Qs9dywy2OUuIS41mzq8+6cDl7HRW58DdJE/pGbXdxG7W 8esrH546aBgfPm0c16uslwljvDC00HdawiqaakDlhlt6Lk1gGiaAgMwwUPVFNVKE/I ePGBBbv0r3b4HuOvkrncANp+eXRa5IeymtUbLlmM= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:55:02 +0300 Message-ID: <48fb5955-7d88-4133-8c85-47eb53248825@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:02 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/8] fs/ntfs3: Use inode_set_ctime_to_ts instead of inode_set_ctime Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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,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]); Tue, 26 Sep 2023 03:03:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778105701554076662 X-GMAIL-MSGID: 1778105701554076662 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/inode.c | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index eb2ed0701495..2f76dc055c1f 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -170,8 +170,8 @@ static struct inode *ntfs_read_mft(struct inode *inode,          nt2kernel(std5->cr_time, &ni->i_crtime);  #endif          nt2kernel(std5->a_time, &inode->i_atime); -        ctime = inode_get_ctime(inode);          nt2kernel(std5->c_time, &ctime); +        inode_set_ctime_to_ts(inode, ctime);          nt2kernel(std5->m_time, &inode->i_mtime);          ni->std_fa = std5->fa; From patchwork Tue Sep 26 09:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1938979vqu; Tue, 26 Sep 2023 07:03:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9aM9TxxjaK0SWODXDEEGX7SYYIagHQaPeryJzwf3H1rojAfHi2oL7jq+9NuB5rM/PTrc6 X-Received: by 2002:a17:903:22d1:b0:1c0:93b6:2e4b with SMTP id y17-20020a17090322d100b001c093b62e4bmr8836936plg.33.1695737019106; Tue, 26 Sep 2023 07:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695737019; cv=none; d=google.com; s=arc-20160816; b=vmLRM/SMDHEMTr7VmWgUGj69DfjY+hE5FYeAs2UK0zFXwKonfVlsSNUR8VzrMcXaIE Q5e62SeA8JdBCnWOFLrFA76fk6dMZqOz2W4oF84Cl3oD14F03k2MRRJhKiD5IdMWFtzB 6nlPi0TVX/AkQF1iFqf0Kww4lMrV9rUdETo+sh53NJKdiwbIk/S00L49XaqK6qlByNRM 14QzTxM/p+BTssHBvxipCAIzjEKH19aAfBwrxmjxr6MwCQzk1EbaPRVCDv1xsEbjraif lku0Y9uGhK3Z6YhR1j9GPQvMV/y6T2P3FdcVRlm0GzhtJyIDEDxfbyGszw0tHNY4LH9e BVXw== 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=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=xUGA2ceqUD34bZaW2W3zWbi7VjsjornVoaJW6VEtrBsMXV5gfmFcoZbfWpB96Rqfro bH6QXbQW67kOKvfpUFqLdqS4mZ6Mw71/Aj3gOh2a2uWohJptRU1fKxya+xECJMEmDAvp 9XqGXXeoR9/gPvyheh//AclCwX3KxN03hyz8AGII0wRYmH9Aa3JPIJTVt+1NJyrsaz+L OgswaCYAWmMVHUhrSiW/Il2VQxcAVDcS60X7bNVrBiq7QRe1gwebJHf7VNLB4mJaG5Z/ 2Pzfc2tKt4JB7UkVL8CaiEPfLzeJO07O1NzX1zJu+4NoyDN8w+GTy1GkkZzGJAwPwk4g Ezrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=r2zvMgty; dkim=pass header.i=@paragon-software.com header.s=mail header.b=sGwkdNut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l12-20020a63da4c000000b00565f0e91894si12819584pgj.394.2023.09.26.07.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=r2zvMgty; dkim=pass header.i=@paragon-software.com header.s=mail header.b=sGwkdNut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 994E78082845; Tue, 26 Sep 2023 02:55:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234252AbjIZJzv (ORCPT + 27 others); Tue, 26 Sep 2023 05:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbjIZJzl (ORCPT ); Tue, 26 Sep 2023 05:55:41 -0400 X-Greylist: delayed 69 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 26 Sep 2023 02:55:33 PDT Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D00F3; Tue, 26 Sep 2023 02:55:32 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id AD98621BC; Tue, 26 Sep 2023 09:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721780; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=r2zvMgty3J9zp812qs5vRyTGyhzL4ji93J7KqP6mRh+wYZyf81AwZM3JekNdNREfc IbCdHVL/ZUFIjro0fgcAi47CjY+xbxSoMH9BlQlueLTJlDy3YBD16zx3D3LCgOobbz Tk8hyV0LgKJTIvDAXJkonFNTdH4mxk3CdDJLjZrg= 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 08C121D45; Tue, 26 Sep 2023 09:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722131; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=sGwkdNutAIoorXYu/T6+JY8sssgHV7lXRSTMrVQjslvRO+0aOJMbH4UQ9yBUZMGFk wHz1Z0bt62kPwnvZEKtzPbbRV33DUTwOT6hvkkRrW2nL6joHqFkhlCAAmTLa4N7Iy+ REc7lvXd35mxwZBaXLtqaAr86MbWhI1S4UW6HUgg= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:55:29 +0300 Message-ID: <18681891-e588-4745-8cfc-2fe5fc0eee54@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/8] fs/ntfs3: Allow repeated call to ntfs3_put_sbi Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:55:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778109140784002211 X-GMAIL-MSGID: 1778109140784002211 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/bitmap.c |  1 +  fs/ntfs3/super.c  | 21 ++++++++++++++++-----  2 files changed, 17 insertions(+), 5 deletions(-) @@ -1577,6 +1587,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)      iput(inode);  out:      kfree(boot2); +    ntfs3_put_sbi(sbi);      return err;  } diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index d66055e30aff..63f14a0232f6 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -125,6 +125,7 @@ void wnd_close(struct wnd_bitmap *wnd)      struct rb_node *node, *next;      kfree(wnd->free_bits); +    wnd->free_bits = NULL;      run_close(&wnd->run);      node = rb_first(&wnd->start_tree); diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index f78c67452b2a..71c80c578feb 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -576,20 +576,30 @@ static noinline void ntfs3_put_sbi(struct ntfs_sb_info *sbi)      wnd_close(&sbi->mft.bitmap);      wnd_close(&sbi->used.bitmap); -    if (sbi->mft.ni) +    if (sbi->mft.ni) {          iput(&sbi->mft.ni->vfs_inode); +        sbi->mft.ni = NULL; +    } -    if (sbi->security.ni) +    if (sbi->security.ni) {          iput(&sbi->security.ni->vfs_inode); +        sbi->security.ni = NULL; +    } -    if (sbi->reparse.ni) +    if (sbi->reparse.ni) {          iput(&sbi->reparse.ni->vfs_inode); +        sbi->reparse.ni = NULL; +    } -    if (sbi->objid.ni) +    if (sbi->objid.ni) {          iput(&sbi->objid.ni->vfs_inode); +        sbi->objid.ni = NULL; +    } -    if (sbi->volume.ni) +    if (sbi->volume.ni) {          iput(&sbi->volume.ni->vfs_inode); +        sbi->volume.ni = NULL; +    }      ntfs_update_mftmirr(sbi, 0); From patchwork Tue Sep 26 09:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1834482vqu; Tue, 26 Sep 2023 04:20:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIdkMIIvcmMN9+NVMvlZwTlUw6okjk/iTnsfrAZqXUiAh8cReSThvqnAqslrF/IEQa3yHx X-Received: by 2002:a25:d78d:0:b0:d84:e754:d541 with SMTP id o135-20020a25d78d000000b00d84e754d541mr8631940ybg.4.1695727234556; Tue, 26 Sep 2023 04:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695727234; cv=none; d=google.com; s=arc-20160816; b=hSDPum5P6GtyAh7cx5Jve+TEa97P4pLsrZ0vl+TW5sCGSRj3tGV1Z/o5dzAENtS04Z QJkw5sl3ivfDq8qoTLrnCVbDBUU70/OCpGOFCmJhBkQqQ0vv6gR9zKbZEyXOGb8hwNG+ 3lLVAr1fGQiv4jCnrB9GYpyT3WhYjYTfWgovVvsL26uvaPcvQZhblweQ8+wjxnAGm2Id IBrQXAerGkADxu+2i/MxlQ7CiskX9oNeh0+eKbadvfQNk7sopqt0tPmsOGVDg1/xpLsu ysX1vNughIAfmHFOPgsX+0buToXGv7Pj60dtANTXcqM2vcg9ApiU/8mcRabathyK5gPE hk1g== 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=Nf2tlL8ndkT5fumOF9aSaoVeSNGQzhIY6kDh91oVRUE=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=xEnmbgDwciCYV7sgIYGb+n4CCi3GbdEj5K3dijQsxBDdOQI6UPaOu+7s4ftWK+e1QR BBPywqU60QoeJz5t0NOMR9eFRb9Zktxp5dF5VcEFS1ZSEPHcfH6F39tFYfjSEpWawLEB FLkGugNWM/Eua13sQLEkYrpMzy5Zrp94W9vhMW6ioEJcKU9R6tzqwI/fN7vZ590UMaRf PmbBBcWLrlYHUXwQOSoTkbEonq6dSswMT+uYK/mQYglOxNMy8pSUPCwP0V9aCa3zZpN7 +b3Sujp4/OepbJowht0O+rVhu+gnmhKvkudPlqL8QAdeeFBuU14YoVaXgun7LizTk4js KOvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=ncv0G8ar; dkim=pass header.i=@paragon-software.com header.s=mail header.b=iiibi4AD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o66-20020a634145000000b005657ba564bdsi4841720pga.826.2023.09.26.04.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 04:20:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=ncv0G8ar; dkim=pass header.i=@paragon-software.com header.s=mail header.b=iiibi4AD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CF7D1808A8EE; Tue, 26 Sep 2023 02:56:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbjIZJ4R (ORCPT + 27 others); Tue, 26 Sep 2023 05:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233553AbjIZJ4J (ORCPT ); Tue, 26 Sep 2023 05:56:09 -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 99E5B1BB; Tue, 26 Sep 2023 02:55:55 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 6DAF221BC; Tue, 26 Sep 2023 09:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721803; bh=Nf2tlL8ndkT5fumOF9aSaoVeSNGQzhIY6kDh91oVRUE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=ncv0G8arOqm3X0jid+4L2MVE689rRbad7e+k+2BtujmZbDit/pHvyARgZuZx771R8 G/gat1h2aicoRanLAt5Kgn0z0Vtgcy1QHRdoGKO9Wev7FT3X2wi0O54CLxk46+waT6 tAL85kb0QqmYZYfglW65WrgRuZDzW3+v3hnWcVbg= 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 BC64A1D45; Tue, 26 Sep 2023 09:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722153; bh=Nf2tlL8ndkT5fumOF9aSaoVeSNGQzhIY6kDh91oVRUE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=iiibi4ADh06yd/BR2C+7DGZUaIaGB5nAQx2rdMPVvbAHFhoW2q0ApmU24dyT7+e/V SHf1Z9nkn0L5Y96wEVu+wEa/PxzC5SI8UzgatQ9S+FCm4geVL0Tip2yPrqTutDdc6E 0h4Ox3DQLEdMQEdWIIyfRU7i0lv4LVt9yMs00yDY= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:55:53 +0300 Message-ID: <1f95ab55-ce05-4c11-8c14-8df260514208@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/8] fs/ntfs3: Fix alternative boot searching Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:56:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778098880231111701 X-GMAIL-MSGID: 1778098880231111701 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/super.c | 10 +++++++---  1 file changed, 7 insertions(+), 3 deletions(-)      struct MFT_REC *rec; @@ -855,6 +855,9 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,      u32 boot_off = 0;      const char *hint = "Primary boot"; +    /* Save original dev_size. Used with alternative boot. */ +    dev_size0 = dev_size; +      sbi->volume.blocks = dev_size >> PAGE_SHIFT;      bh = ntfs_bread(sb, 0); @@ -1087,9 +1090,9 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,      }  out: -    if (err == -EINVAL && !bh->b_blocknr && dev_size > PAGE_SHIFT) { +    if (err == -EINVAL && !bh->b_blocknr && dev_size0 > PAGE_SHIFT) {          u32 block_size = min_t(u32, sector_size, PAGE_SIZE); -        u64 lbo = dev_size - sizeof(*boot); +        u64 lbo = dev_size0 - sizeof(*boot);          /*            * Try alternative boot (last sector) @@ -1103,6 +1106,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,          boot_off = lbo & (block_size - 1);          hint = "Alternative boot"; +        dev_size = dev_size0; /* restore original size. */          goto check_boot;      }      brelse(bh); diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 71c80c578feb..d2951b23f52a 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -846,7 +846,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,      struct ntfs_sb_info *sbi = sb->s_fs_info;      int err;      u32 mb, gb, boot_sector_size, sct_per_clst, record_size; -    u64 sectors, clusters, mlcn, mlcn2; +    u64 sectors, clusters, mlcn, mlcn2, dev_size0;      struct NTFS_BOOT *boot;      struct buffer_head *bh; From patchwork Tue Sep 26 09:56:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2005555vqu; Tue, 26 Sep 2023 08:35:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECDg5CHQEYXmRQakI2vua8nZMmq2ushRmED57irqPdZkgKU7G3ZerqeMoP83orIgbbI9Wu X-Received: by 2002:a17:903:246:b0:1c1:e7b2:27ad with SMTP id j6-20020a170903024600b001c1e7b227admr9208031plh.60.1695742510642; Tue, 26 Sep 2023 08:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695742510; cv=none; d=google.com; s=arc-20160816; b=wZBMUbZNIkIeBlZrfXSjjvmBpn/csugxP7LWd+ickMImlQIkc5aHonyzks8HPu0/HA MgfVUVJJCiODwemwm/BmBE/h53QW7kRknle9zv3vMmWRy8Uo0Mur8NeCdOM29VW5CvZz LtMkatHTq9f4hQMMZRDUE7s1YHbM2BVTsWPVMycqynt5aVWm1US+1eTpdYBM2BlkBDb9 UY4EiwswBMG/ScxhiORPklHgsaEoGL5jAZnm7Q3FDxeijErZPYRHbaduxPXUWSwnH54b dwj7fr+HOALphXxE/x1B4MN3Z5kqTCwymkAY433ZehDYXdL9yCDjKEBk3T4qq9GSXZuu ZM9A== 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=T9vkfkHcNvq5d6thJXCI0YPqyqz/uUcgdijYO65TaHI=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=dKU9OfE2luQldCyNTrcXQl3PBEI1kFwQ4vmPmOiqQE/viBbSue2H68J00jAwdfvKxg Y1eO+ALbrYbZ/3T5M6HE3z2HnGTSPJYNOgkhpXOwMZTV9caRwl4pLJj+YcpeO07cdE2B mXosswDteBfoo61WgM0utuQN/G8eMCz+mTZhcGdDm2ysF9rF5lbSBzPsjfTd3j6EI9wf DFwVrXv/TGGzUirraPMOz3SD3gp9uAgyosbwOcUSuk3DWiUXmBpL7DQPkSZ+Wa5Hupm+ LJCJExBCF8/N1neUc0wHTo/PlN/uFhHzPrusIZmtNcqt0HMOLDNY7fjfSC4c7sU/hfu9 oudg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=dNKcbWWY; dkim=pass header.i=@paragon-software.com header.s=mail header.b=DcUNAJbl; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cp1-20020a170902e78100b001bbac6722e6si12372472plb.371.2023.09.26.08.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 08:35:10 -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=@paragon-software.com header.s=mail header.b=dNKcbWWY; dkim=pass header.i=@paragon-software.com header.s=mail header.b=DcUNAJbl; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0348A801B3A6; Tue, 26 Sep 2023 02:56:48 -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 S233316AbjIZJ4i (ORCPT + 27 others); Tue, 26 Sep 2023 05:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231182AbjIZJ4Z (ORCPT ); Tue, 26 Sep 2023 05:56:25 -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 BDE5D136; Tue, 26 Sep 2023 02:56:18 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 85E7D21BC; Tue, 26 Sep 2023 09:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721826; bh=T9vkfkHcNvq5d6thJXCI0YPqyqz/uUcgdijYO65TaHI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=dNKcbWWY4JBplqmHwYV1MO3bNpKVXPJ6gu7Kq4kobN7Ue7QKfFrCtHszoJbQY2W9B wj4WQTHy9EJl7MTokBKsui/7JOZn6BU4bQNh3D5oKEqlHeZy9xS2M2g1Pw19OSnxPr 3nXnDyxOjxgsyIb2+jOuIUHSbHTwKyN/mklkX9ec= 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 CF4DB2196; Tue, 26 Sep 2023 09:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722176; bh=T9vkfkHcNvq5d6thJXCI0YPqyqz/uUcgdijYO65TaHI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=DcUNAJblr1CcjhmuYcHUghgHIbUu8CxaGNbF3lNDg/GZvhDdOLtng6d9QG580euDq 6fv+QREl/Gcd2yUE0uGTka6RDW54edlYTvctMbKKYg1Tfre0wYrBhOmY1f89CH1HUP kyezymUxjGGk9z+VwOthc36L0cDNBdz2C3aP24XA= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:16 +0300 Message-ID: <1c6bcea6-3d7a-4f01-ae67-fab917344a00@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/8] fs/ntfs3: Refactoring and comments Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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,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]); Tue, 26 Sep 2023 02:56:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778114898817953176 X-GMAIL-MSGID: 1778114898817953176 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/attrib.c  |  6 +++---  fs/ntfs3/file.c    |  4 ++--  fs/ntfs3/inode.c   |  3 ++-  fs/ntfs3/namei.c   |  6 +++---  fs/ntfs3/ntfs.h    |  2 +-  fs/ntfs3/ntfs_fs.h |  2 --  fs/ntfs3/record.c  |  6 ++++++  fs/ntfs3/super.c   | 19 ++++++++-----------  8 files changed, 25 insertions(+), 23 deletions(-) @@ -502,7 +501,7 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,      while (ret > 0 && label[ret - 1] == '\n')          ret -= 1; -    err = ntfs_set_label(sbi, label, ret); +    err = ntfs_set_label(sb->s_fs_info, label, ret);      if (err < 0) {          ntfs_err(sb, "failed (%d) to write label", err); @@ -1082,10 +1081,10 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,      if (bh->b_blocknr && !sb_rdonly(sb)) {          /* -         * Alternative boot is ok but primary is not ok. -         * Do not update primary boot here 'cause it may be faked boot. -         * Let ntfs to be mounted and update boot later. -         */ +          * Alternative boot is ok but primary is not ok. +          * Do not update primary boot here 'cause it may be faked boot. +          * Let ntfs to be mounted and update boot later. +         */          *boot2 = kmemdup(boot, sizeof(*boot), GFP_NOFS | __GFP_NOWARN);      } @@ -1549,9 +1548,9 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)      if (boot2) {          /* -         * Alternative boot is ok but primary is not ok. -         * Volume is recognized as NTFS. Update primary boot. -         */ +          * Alternative boot is ok but primary is not ok. +          * Volume is recognized as NTFS. Update primary boot. +         */          struct buffer_head *bh0 = sb_getblk(sb, 0);          if (bh0) {              if (buffer_locked(bh0)) @@ -1785,7 +1784,6 @@ static int __init init_ntfs_fs(void)      if (IS_ENABLED(CONFIG_NTFS3_LZX_XPRESS))          pr_info("ntfs3: Read-only LZX/Xpress compression included\n"); -  #ifdef CONFIG_PROC_FS      /* Create "/proc/fs/ntfs3" */      proc_info_root = proc_mkdir("fs/ntfs3", NULL); @@ -1827,7 +1825,6 @@ static void __exit exit_ntfs_fs(void)      if (proc_info_root)          remove_proc_entry("fs/ntfs3", NULL);  #endif -  }  MODULE_LICENSE("GPL"); diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index a9d82bbb4729..e16487764282 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1106,10 +1106,10 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,          }      } -    /* +    /*       * The code below may require additional cluster (to extend attribute list) -     * and / or one MFT record -     * It is too complex to undo operations if -ENOSPC occurs deep inside +     * and / or one MFT record +     * It is too complex to undo operations if -ENOSPC occurs deep inside       * in 'ni_insert_nonresident'.       * Return in advance -ENOSPC here if there are no free cluster and no free MFT.       */ diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 962f12ce6c0a..1f7a194983c5 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -745,8 +745,8 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)  }  static ssize_t ntfs_file_splice_read(struct file *in, loff_t *ppos, -                     struct pipe_inode_info *pipe, -                     size_t len, unsigned int flags) +                     struct pipe_inode_info *pipe, size_t len, +                     unsigned int flags)  {      struct inode *inode = in->f_mapping->host;      struct ntfs_inode *ni = ntfs_i(inode); diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 2f76dc055c1f..d6d021e19aaa 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1660,7 +1660,8 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,      d_instantiate(dentry, inode);      /* Set original time. inode times (i_ctime) may be changed in ntfs_init_acl. */ -    inode->i_atime = inode->i_mtime = inode_set_ctime_to_ts(inode, ni->i_crtime); +    inode->i_atime = inode->i_mtime = +        inode_set_ctime_to_ts(inode, ni->i_crtime);      dir->i_mtime = inode_set_ctime_to_ts(dir, ni->i_crtime);      mark_inode_dirty(dir); diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c index ad430d50bd79..eedacf94edd8 100644 --- a/fs/ntfs3/namei.c +++ b/fs/ntfs3/namei.c @@ -156,8 +156,8 @@ static int ntfs_link(struct dentry *ode, struct inode *dir, struct dentry *de)      err = ntfs_link_inode(inode, de);      if (!err) { -        dir->i_mtime = inode_set_ctime_to_ts(inode, -                             inode_set_ctime_current(dir)); +        dir->i_mtime = inode_set_ctime_to_ts( +            inode, inode_set_ctime_current(dir));          mark_inode_dirty(inode);          mark_inode_dirty(dir);          d_instantiate(de, inode); @@ -373,7 +373,7 @@ static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,  #ifdef CONFIG_NTFS3_FS_POSIX_ACL      if (IS_POSIXACL(dir)) { -        /* +        /*           * Load in cache current acl to avoid ni_lock(dir):           * ntfs_create_inode -> ntfs_init_acl -> posix_acl_create ->           * ntfs_get_acl -> ntfs_get_acl_ex -> ni_lock diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 98b76d1b09e7..86aecbb01a92 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -847,7 +847,7 @@ struct OBJECT_ID {      // Birth Volume Id is the Object Id of the Volume on.      // which the Object Id was allocated. It never changes.      struct GUID BirthVolumeId; //0x10: - +      // Birth Object Id is the first Object Id that was      // ever assigned to this MFT Record. I.e. If the Object Id      // is changed for some reason, this field will reflect the diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 788567d71d93..0e6a2777870c 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -497,8 +497,6 @@ int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path,           struct kstat *stat, u32 request_mask, u32 flags);  int ntfs3_setattr(struct mnt_idmap *idmap, struct dentry *dentry,            struct iattr *attr); -void ntfs_sparse_cluster(struct inode *inode, struct page *page0, CLST vcn, -             CLST len);  int ntfs_file_open(struct inode *inode, struct file *file);  int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,          __u64 start, __u64 len); diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index 02cc91ed8835..53629b1f65e9 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -189,6 +189,12 @@ int mi_read(struct mft_inode *mi, bool is_mft)      return err;  } +/* + * mi_enum_attr - start/continue attributes enumeration in record. + * + * NOTE: mi->mrec - memory of size sbi->record_size + * here we sure that mi->mrec->total == sbi->record_size (see mi_read) + */  struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)  {      const struct MFT_REC *rec = mi->mrec; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index d2951b23f52a..f9a214367113 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -488,7 +488,6 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,  {      int err;      struct super_block *sb = pde_data(file_inode(file)); -    struct ntfs_sb_info *sbi = sb->s_fs_info;      ssize_t ret = count;      u8 *label = kmalloc(count, GFP_NOFS); From patchwork Tue Sep 26 09:56:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1969218vqu; Tue, 26 Sep 2023 07:44:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDFY/CattNp8ErQv5pN8zIKRlhfQxlZ4vZ71gOrwaMSF7MXqVYIaEXlpUUOm2bchOzZAlK X-Received: by 2002:a17:902:d48f:b0:1c3:6d97:e89e with SMTP id c15-20020a170902d48f00b001c36d97e89emr11486764plg.58.1695739499296; Tue, 26 Sep 2023 07:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695739499; cv=none; d=google.com; s=arc-20160816; b=j1yKAiSi16/iUhX2K0o4xdmZI6n5lxvFvFEd0wOErmUZxND3cAwvqdTjqBvNQDapbv k/zIiF0nzAJQMpTyN8Mep45z3HsajcRwAzPz+Y0fIym/7o0hTh2GbMFTuOFHlXC8tVq7 O8ez95VVKSCqvoY3rzYkYWhyTz37mrcOvZnPus/CRhZmpb2RK9Wo8ftZfu+X4RRRPTwg I1PHwpucCfK6vVZ13eJvntJEUmu5eOsUNq0KECk1wsZOqqk0FtLrEfnfzYnSau65HtP6 0ArYKcL7/V3V0pHa+30RrFhPoVqwlJ4B+tK+SeBVUVE9PfryN1hcp/byxGo7xPC/6J26 gPjw== 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; bh=M2FK5gsLtmNBcSaysRw/Y++y3lLBnCCRyRI6dXE7TkE=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=tpWowWpakhLJ5lG5mCUZJzrvpdJ8dwcITRQ8NQdsWIs0vQrEz89YpDAV2sJK4sUt3H yNacYPaWIvcHJ+Xb1f9vEGPtZS0Q7e5yVM+q2pAX0lz/+RiJXM8ZSnkP22QyKSgTF4uq 9xBTTZxpafdA1MgFyBcgAtTagIph2eiWmcy7Js1e6DCg4bFvixF2Tmlm/CHZUVSdHKpJ k1peLJ+iqlxoKYk1Okb2xHVbejlCwFzQA1+NDO1943rAz+WncIbcnrRNnjbdwaXLplxG MqsS0GXnqwxKMFUVsHhWVt173tYDrZdgZCLiilXmxwRfqY/jMIGZBwi8M0vWT5MYTizP VqOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=XHUt8KfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a5-20020a170902ecc500b001c60ec1e662si6506656plh.29.2023.09.26.07.44.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:44:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=XHUt8KfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8677A80DF24A; Tue, 26 Sep 2023 02:56:52 -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 S234303AbjIZJ4v (ORCPT + 27 others); Tue, 26 Sep 2023 05:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbjIZJ4q (ORCPT ); Tue, 26 Sep 2023 05:56:46 -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 E31CBBE; Tue, 26 Sep 2023 02:56:39 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id BC5B521BC; Tue, 26 Sep 2023 09:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721847; bh=M2FK5gsLtmNBcSaysRw/Y++y3lLBnCCRyRI6dXE7TkE=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=XHUt8KfYdRnPQjP75T3mvqKkT0lKFp8HuLuslcCVkw0uxFL6JlAkifzksCkkJ+n6b fGCHjdm03L0Nyu6du7YjamOBFvCO3Xq2r9hGvMnVe3dtDl+oQDaQN6PD6h+sPHeEtO +153iHrxH+T8LNfgdd1PmaaaOziZj5/1Qrq1wvtA= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:37 +0300 Message-ID: <0b667ec4-8223-407b-9303-94b70dfa5101@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:37 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/8] fs/ntfs3: Add more info into /proc/fs/ntfs3//volinfo Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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,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]); Tue, 26 Sep 2023 02:56:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778111741355991366 X-GMAIL-MSGID: 1778111741355991366 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/super.c | 14 +++++++++++---  1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index f9a214367113..5811da7e9d45 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -453,15 +453,23 @@ static struct proc_dir_entry *proc_info_root;   * ntfs3.1   * cluster size   * number of clusters + * total number of mft records + * number of used mft records ~= number of files + folders + * real state of ntfs "dirty"/"clean" + * current state of ntfs "dirty"/"clean"  */  static int ntfs3_volinfo(struct seq_file *m, void *o)  {      struct super_block *sb = m->private;      struct ntfs_sb_info *sbi = sb->s_fs_info; -    seq_printf(m, "ntfs%d.%d\n%u\n%zu\n", sbi->volume.major_ver, -           sbi->volume.minor_ver, sbi->cluster_size, -           sbi->used.bitmap.nbits); +    seq_printf(m, "ntfs%d.%d\n%u\n%zu\n\%zu\n%zu\n%s\n%s\n", +           sbi->volume.major_ver, sbi->volume.minor_ver, +           sbi->cluster_size, sbi->used.bitmap.nbits, +           sbi->mft.bitmap.nbits, +           sbi->mft.bitmap.nbits - wnd_zeroes(&sbi->mft.bitmap), +           sbi->volume.real_dirty ? "dirty" : "clean", +           (sbi->volume.flags & VOLUME_FLAG_DIRTY) ? "dirty" : "clean");      return 0;  } From patchwork Tue Sep 26 09:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2045100vqu; Tue, 26 Sep 2023 09:32:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYDkI8CmF5iCaltOrSv5+KWeZN1csgeGvm2S3TiM82isG3vh0khW56XhSJ+bds3bHAC6Ix X-Received: by 2002:a17:902:aa8e:b0:1c5:b1a6:8118 with SMTP id d14-20020a170902aa8e00b001c5b1a68118mr8843847plr.42.1695745964315; Tue, 26 Sep 2023 09:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695745964; cv=none; d=google.com; s=arc-20160816; b=mi+nR6oE5v2OcKGsi+BC3ibbKRaqjAdG55PFgzDxtd8pUHjOyZ0gYqUGfLkCbpNWQt PF5udq9g4PSFRTjNmKLYJrc0Qh14iuayM5bb8V7mUPJPzM/sSjcpdZasinvSwL2zrUDI m66TIbHP6o9HHYxWjAGN0oQfT1B04uIYms0LbnSRjZ4xwg1h0BNUgSSzu46RrzKNBCfc 6MIRteceigl9TQ4EwO3hB2WrXQ4l6qlRW7ezm2pbFjPonGE2e+lhw/3K8gxBEyNZikI2 ucD8VLT9NMt/ze/Ba3SVaw7kGame42BOesHu/M+1G4kTKz2Cc2yRi/yEsNOh814XTvSS 8D7A== 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=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=ZYWmtRjE6i54rxsAY0y29oqa4MUIjyh8KZah2yIhY5VxGINQw3vYVyA1FOVFLkxv1c V/9jxlZwAfGM8cgGLw4gacVsRbxuJit2gi6QARd+GJGoxeQJXiIDTUHLEAAVGPJqWtOZ lgjWmsdGDwQUenCG1aBQ42A3m81XzOZMzWuXajTfe8aMXYmkJ4m+GmQ3fnJAmQyiOa0T 6fmG/QFnCanikQuaAw1UQ9FXN+fDEYWooh/Fd2my8VkO4jVFAqYGcISTcZd8O97vk16l fFqFfK0o1Im+Bj8XsQsOIGGKPgJHQkc6VzZ/lsGKdJ/Zj+TCxetA29LrdMZ9zBK/KuTI cAeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HIMyLl9r; dkim=pass header.i=@paragon-software.com header.s=mail header.b=QXyZoO1b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a17-20020a170902ecd100b001c62d5b4e00si2437102plh.508.2023.09.26.09.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 09:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=HIMyLl9r; dkim=pass header.i=@paragon-software.com header.s=mail header.b=QXyZoO1b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DFFDC8057DB4; Tue, 26 Sep 2023 02:57:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234318AbjIZJ5G (ORCPT + 27 others); Tue, 26 Sep 2023 05:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbjIZJ5E (ORCPT ); Tue, 26 Sep 2023 05:57:04 -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 08CA0FB; Tue, 26 Sep 2023 02:56:57 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id CB48421BC; Tue, 26 Sep 2023 09:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721865; bh=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=HIMyLl9rMNTvWGANMBZ7k7mSFx743msYy8g+KbPRc35kVUui5Qgd+JfssKRCUF0ui twFYLxmtFfDFAjRcjxfXt7yN2F40dZVbX0JZVnAdS7CdKYjqrjG57x/xHjmQyQ4UVE zk0O+hx243YtYUWyghzeculoR16Cnf+FVRwSwCzI= 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 2631B1D45; Tue, 26 Sep 2023 09:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722216; bh=OjduOup+un8qGaTqAgDN4qohzpVoBogSKK/pi3uPgl8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=QXyZoO1bXsfpERWazQ/dHI//s8xiRczuXczn4XUZ56rPoO9HfV38ePAekMdcfaUY/ OyxcUmV7lg8D7Gw1Pc4+Gy3RKFwS6bD/9xb0nDoIQSlMoF+6JWb0mRW1zu4YHVxG2f x3S2MWJGobvAR2nlXUBUY6T0kBtzEYQMktPSZHeo= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:56:55 +0300 Message-ID: <4fdb4c65-d6db-4a0c-b2cc-296646c1e1fe@paragon-software.com> Date: Tue, 26 Sep 2023 12:56:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/8] fs/ntfs3: Do not allow to change label if volume is read-only Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:57:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778118520110919504 X-GMAIL-MSGID: 1778118520110919504 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/super.c | 7 ++++++-  1 file changed, 6 insertions(+), 1 deletion(-)          return -ENOMEM; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 5811da7e9d45..cf0a720523f0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -497,7 +497,12 @@ static ssize_t ntfs3_label_write(struct file *file, const char __user *buffer,      int err;      struct super_block *sb = pde_data(file_inode(file));      ssize_t ret = count; -    u8 *label = kmalloc(count, GFP_NOFS); +    u8 *label; + +    if (sb_rdonly(sb)) +        return -EROFS; + +    label = kmalloc(count, GFP_NOFS);      if (!label) From patchwork Tue Sep 26 09:57:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1875690vqu; Tue, 26 Sep 2023 05:33:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4tgXpRYBfGjCQrAPvbaB2yPVzeW9BBAU48WYdaNHWFy45oIQzrtga3vLaukysCVsEJDfq X-Received: by 2002:a05:6358:798:b0:144:9cef:cd28 with SMTP id n24-20020a056358079800b001449cefcd28mr9300061rwj.7.1695731624713; Tue, 26 Sep 2023 05:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695731624; cv=none; d=google.com; s=arc-20160816; b=pwKywoSqRpM9S7ZYsOcXAY8DWEZYMCmNziXiL1kEePxGgDYE+6NuD25xU9cfRjJoMA 1r4MNn0zZCX9ZG4f8KZPAFDPULB3kFCW7O/VnjgqYuxA2t3jbvOBW9otbNKUltzEkGkb WQyU5qOTAy9oJpsUEZA15DuTPAFeJctNCXxaOCQB4ldCLtOnFiTb1ecvvRhh0JrPsYVG PXdzGoKgzVfpSPWtVonoeQn8qcxa65SddG+S70HdlmD94M3mMpUfY19ZHQvvVTIRZ8F2 pD6Ase0QUQp3ip2orBg+rVvSyBIstMb7t/F0EwFO75UusTLMLKGH+iqkBpGtPxujfzmH mUmg== 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; bh=bm/OuTb2k1SKktIcvNOfnXcU6zkoYgiSC7bYVh+F8wM=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=cuX13L3R8WehqzoVQ+LnTkWC4w8JmmLhKSlWK1qrSbdnjsC+T2ry50ZePcv1AyhQ2W 9ZqYClNi9I7qPGDfhx/9ur/41g5oAB9+PH/Sgca3CAfO7ZyxP9bp33jc7ihEiVnw4S+k sfAvleluqvhBrnIuFpN9LXMPxCbf1QUWaAl6ahrY6T8BJj0pNkhfu1xZ6Msc1buQhmmw eXuwN45pFDFIQB5cwwxW5laFLC/ssC1QvU+kZ/3MK5H14N9ogAUX3lcsSq+F/ZslQaL+ InaCJkbO/K4wF4uT8fpJ2v0Zo0WK7h1oWWqOnzB8AaKFLraXeaZjDVzEDItBWTtWTdnP xG/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=LFKbUDez; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g37-20020a631125000000b00578e7a37c45si12511436pgl.10.2023.09.26.05.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 05:33:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=LFKbUDez; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 69D6C8056982; Tue, 26 Sep 2023 02:57:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234340AbjIZJ51 (ORCPT + 27 others); Tue, 26 Sep 2023 05:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbjIZJ5X (ORCPT ); Tue, 26 Sep 2023 05:57:23 -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 7055E180; Tue, 26 Sep 2023 02:57:16 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id D74CD21BC; Tue, 26 Sep 2023 09:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721883; bh=bm/OuTb2k1SKktIcvNOfnXcU6zkoYgiSC7bYVh+F8wM=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=LFKbUDezPewix3D97fm/Cu+G0YjuJU15KhAJ0g5GOkGfyPwZk35Rq51MGSp46698H ftYL9HxtU9bsc6ixQLJ/8BR9nwgZ0+V1O/VHVo5M65Vh4B2dDDGK0CXf+oaBCqT5dx E8AN+uc2Kx/Hz5PGxBz1iEuf606qJPfzRRHM2PT0= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:57:13 +0300 Message-ID: Date: Tue, 26 Sep 2023 12:57:13 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 7/8] fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr() Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:57:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778103484184872024 X-GMAIL-MSGID: 1778103484184872024 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/frecord.c | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-)          put_page(pg); diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index d49fbb22bd5e..dad976a68985 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2148,7 +2148,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)      for (i = 0; i < pages_per_frame; i++) {          pg = pages[i]; -        if (i == idx) +        if (i == idx || !pg)              continue;          unlock_page(pg); From patchwork Tue Sep 26 09:57: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: 144897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1933820vqu; Tue, 26 Sep 2023 06:57:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT/+z2zfPcTUIBPxsNGwz+SacyjqbhWpYWlY1slGh5MVWcrlkwn/HtVcUDqZSwUDwVrDdH X-Received: by 2002:a05:6a20:9756:b0:154:d3ac:2050 with SMTP id hs22-20020a056a20975600b00154d3ac2050mr9687942pzc.33.1695736654048; Tue, 26 Sep 2023 06:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695736654; cv=none; d=google.com; s=arc-20160816; b=Ha8EYJCyw47SSkuPrpcCuAzXz9PB92/ew6mbx+by8bgdlqmnF6x1uHBWhGSZBCMlcl z6GBly3CNnmPd8HJYILMAtFiv1ndEkspO0eouQkyEdVz3hXJp2inN77ShMzZaEH66pX7 OZU+cYn4Yc17DVtGlWmDNh9TF7i1XJ2tHOEEXZ6yfMvAuy+bwMwTFQfP9qbE5ZH2DdFo iATTzbZVDaHUv55B89BzfhzeyIsMn88UjdoOJcTJYXFaT0cIKI4BJLpfwEuLC2qRFsjT qc0SWX46pWGoUM8xKUSXNvBfTiFAA+5aVOTdrFLm5jjUdsNHHeddMI8w3JLpe2modGOX 2L3g== 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=s8rZE6xcXKLHN8Ppy7AnwtG+R/usQmbqqKjeBuQwDZY=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=KGsB6NtMHdlznUaiw+b0OKx6KakHsllmAxkZEfTXo/YJloUPs/kMwArKTtZacLX98k ZDhr7/a9LTGCECi2GgVsdQL2BNiG4Ts5yTdFEPvI3YgKdoRfRkQsrT07T7hmQoNzZmuj 1zJO12WSYB36CtzXlvs1XeGQuOQXkWKTgvZ+lnx62F92vpbmpVwzDZf9FLxrMg/a7ShH HIzgPbR8v9nXqjEu6dlan7lyqKo3PxGO9HwYOGNdZekHTJR7l/gER8wUMYk6oslKDH0U 6FlM8yaCSXzyf6oRP3T6ybN79lhIG9JDsVeIGg0QWG4tV6F2MnFcS45nca8w3lVmr0rx 8ozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=MHDIJ4At; dkim=pass header.i=@paragon-software.com header.s=mail header.b=k2j+Lznp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b005774aba519dsi14392967pgu.298.2023.09.26.06.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 06:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=MHDIJ4At; dkim=pass header.i=@paragon-software.com header.s=mail header.b=k2j+Lznp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id AA6D88091C75; Tue, 26 Sep 2023 02:58:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234282AbjIZJ55 (ORCPT + 27 others); Tue, 26 Sep 2023 05:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbjIZJ5r (ORCPT ); Tue, 26 Sep 2023 05:57:47 -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 A43C112A; Tue, 26 Sep 2023 02:57:41 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 5441221BC; Tue, 26 Sep 2023 09:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721909; bh=s8rZE6xcXKLHN8Ppy7AnwtG+R/usQmbqqKjeBuQwDZY=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=MHDIJ4AtXPOYLBeeoxB4jBb4KS/F5sja/tP5M1Rk6+iGEasCpT2S+bzvb0xAzDAtq Nq3ZKXuwHJeXFcd9dzFSFbPoD+f5kINThcXzrnnA5rKEKnYxeTiIgUR4Hv2Omp6rWr jvJ3sFLzT7cAF5kYDQtBdiF+K/JU4AYeFJ9Q8XRo= 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 9B4441D45; Tue, 26 Sep 2023 09:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722259; bh=s8rZE6xcXKLHN8Ppy7AnwtG+R/usQmbqqKjeBuQwDZY=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=k2j+Lznppxo8BnNnw8gXtJjteGBTL1nm9pTMCmJptbhGLpSsJj26Gx+TzdfQrC9RI eOS0UGpEdLfWQJC9SluMmDby71fahpUEX9I3L7zWFCsep/GTylbiwKZSYvrfuwW1Pl Yy1CN7MyAIBSIbAbhHgBZzpi17B4YQdBFf14nOQI= Received: from [172.16.192.129] (192.168.211.137) 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; Tue, 26 Sep 2023 12:57:39 +0300 Message-ID: Date: Tue, 26 Sep 2023 12:57:39 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 8/8] fs/ntfs3: Fix NULL pointer dereference on error in attr_allocate_frame() Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] 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,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 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:58:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778108757822116569 X-GMAIL-MSGID: 1778108757822116569 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/attrib.c | 6 ++----  1 file changed, 2 insertions(+), 4 deletions(-)              le = le_b; diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index e16487764282..63f70259edc0 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1736,10 +1736,8 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size,              le_b = NULL;              attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL,                            0, NULL, &mi_b); -            if (!attr_b) { -                err = -ENOENT; -                goto out; -            } +            if (!attr_b) +                return -ENOENT;              attr = attr_b;