lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8cb671f9-252b-443b-a903-ca62c9097533@paragon-software.com>
Date:   Wed, 6 Dec 2023 18:10:52 +0300
From:   Konstantin Komarovc <almaz.alexandrovich@...agon-software.com>
To:     <ntfs3@...ts.linux.dev>
CC:     <linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>
Subject: [PATCH 04/16] fs/ntfs3: Correct hard links updating when dealing with
 DOS neams


Signed-off-by: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
---
  fs/ntfs3/record.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index 53629b1f65e9..7b6423584eae 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -535,8 +535,20 @@ bool mi_remove_attr(struct ntfs_inode *ni, struct 
mft_inode *mi,
          return false;

      if (ni && is_attr_indexed(attr)) {
-        le16_add_cpu(&ni->mi.mrec->hard_links, -1);
-        ni->mi.dirty = true;
+        u16 links = le16_to_cpu(ni->mi.mrec->hard_links);
+        struct ATTR_FILE_NAME *fname =
+            attr->type != ATTR_NAME ?
+                NULL :
+                resident_data_ex(attr,
+                         SIZEOF_ATTRIBUTE_FILENAME);
+        if (fname && fname->type == FILE_NAME_DOS) {
+            /* Do not decrease links count deleting DOS name. */
+        } else if (!links) {
+            /* minor error. Not critical. */
+        } else {
+            ni->mi.mrec->hard_links = cpu_to_le16(links - 1);
+            ni->mi.dirty = true;
+        }
      }

      used -= asize;
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ