Commit cd39981f authored by Konstantin Komarov's avatar Konstantin Komarov

fs/ntfs3: Fix double free on remount

Pointer to options was freed twice on remount
Fixes xfstest generic/361
Fixes: 82cae269 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent b7b6160d
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/fs_context.h> #include <linux/fs_context.h>
#include <linux/fs_parser.h> #include <linux/fs_parser.h>
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/minmax.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/nls.h> #include <linux/nls.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
...@@ -390,7 +391,7 @@ static int ntfs_fs_reconfigure(struct fs_context *fc) ...@@ -390,7 +391,7 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
return -EINVAL; return -EINVAL;
} }
memcpy(sbi->options, new_opts, sizeof(*new_opts)); swap(sbi->options, fc->fs_private);
return 0; return 0;
} }
...@@ -897,6 +898,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) ...@@ -897,6 +898,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
ref.high = 0; ref.high = 0;
sbi->sb = sb; sbi->sb = sb;
sbi->options = fc->fs_private;
fc->fs_private = NULL;
sb->s_flags |= SB_NODIRATIME; sb->s_flags |= SB_NODIRATIME;
sb->s_magic = 0x7366746e; // "ntfs" sb->s_magic = 0x7366746e; // "ntfs"
sb->s_op = &ntfs_sops; sb->s_op = &ntfs_sops;
...@@ -1260,8 +1263,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) ...@@ -1260,8 +1263,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
goto put_inode_out; goto put_inode_out;
} }
fc->fs_private = NULL;
return 0; return 0;
put_inode_out: put_inode_out:
...@@ -1414,7 +1415,6 @@ static int ntfs_init_fs_context(struct fs_context *fc) ...@@ -1414,7 +1415,6 @@ static int ntfs_init_fs_context(struct fs_context *fc)
mutex_init(&sbi->compress.mtx_lzx); mutex_init(&sbi->compress.mtx_lzx);
#endif #endif
sbi->options = opts;
fc->s_fs_info = sbi; fc->s_fs_info = sbi;
ok: ok:
fc->fs_private = opts; fc->fs_private = opts;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment