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>] [day] [month] [year] [list]
Date:   Mon, 20 Feb 2023 10:32:20 +0400
From:   Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
To:     <ntfs3@...ts.linux.dev>
CC:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        <linux-fsdevel@...r.kernel.org>, Dan Carpenter <error27@...il.com>
Subject: [PATCH] fs/ntfs3: Fix root inode checking

Separate checking inode->i_op and inode itself.

Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <error27@...il.com>
Link: https://lore.kernel.org/r/202302162319.bDJOuyfy-lkp@intel.com/
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
---
  fs/ntfs3/super.c | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index e0f78b306f15..5158dd31fd97 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1347,12 +1347,21 @@ static int ntfs_fill_super(struct super_block 
*sb, struct fs_context *fc)
      ref.low = cpu_to_le32(MFT_REC_ROOT);
      ref.seq = cpu_to_le16(MFT_REC_ROOT);
      inode = ntfs_iget5(sb, &ref, &NAME_ROOT);
-    if (IS_ERR(inode) || !inode->i_op) {
+    if (IS_ERR(inode)) {
          err = PTR_ERR(inode);
          ntfs_err(sb, "Failed to load root (%d).", err);
          goto out;
      }

+    /*
+     * Final check. Looks like this case should never occurs.
+     */
+    if (!inode->i_op) {
+        err = -EINVAL;
+        ntfs_err(sb, "Failed to load root (%d).", err);
+        goto put_inode_out;
+    }
+
      sb->s_root = d_make_root(inode);
      if (!sb->s_root) {
          err = -ENOMEM;
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ