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: <d196d00e-1d08-36e5-a721-7b04614ec35a@paragon-software.com>
Date:   Fri, 27 May 2022 17:22:02 +0300
From:   Almaz Alexandrovich <almaz.alexandrovich@...agon-software.com>
To:     <ntfs3@...ts.linux.dev>
CC:     <linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>
Subject: [PATCH 2/3] fs/ntfs3: Fix double free on remount

Pointer to options was freed twice on remount
Fixes xfstest generic/361
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")

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

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index d41d76979e12..697a84ed395e 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -30,6 +30,7 @@
  #include <linux/fs_context.h>
  #include <linux/fs_parser.h>
  #include <linux/log2.h>
+#include <linux/minmax.h>
  #include <linux/module.h>
  #include <linux/nls.h>
  #include <linux/seq_file.h>
@@ -390,7 +391,7 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
  		return -EINVAL;
  	}
  
-	memcpy(sbi->options, new_opts, sizeof(*new_opts));
+	swap(sbi->options, fc->fs_private);
  
  	return 0;
  }
@@ -897,6 +898,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
  	ref.high = 0;
  
  	sbi->sb = sb;
+	sbi->options = fc->fs_private;
+	fc->fs_private = NULL;
  	sb->s_flags |= SB_NODIRATIME;
  	sb->s_magic = 0x7366746e; // "ntfs"
  	sb->s_op = &ntfs_sops;
@@ -1260,8 +1263,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
  		goto put_inode_out;
  	}
  
-	fc->fs_private = NULL;
-
  	return 0;
  
  put_inode_out:
@@ -1414,7 +1415,6 @@ static int ntfs_init_fs_context(struct fs_context *fc)
  	mutex_init(&sbi->compress.mtx_lzx);
  #endif
  
-	sbi->options = opts;
  	fc->s_fs_info = sbi;
  ok:
  	fc->fs_private = opts;
-- 
2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ