Skip to content

Commit

Permalink
fs: reiserfs: remove useless new_opts in reiserfs_remount
Browse files Browse the repository at this point in the history
Since the commit c3d98ea ("VFS: Don't use save/replace_mount_options
if not using generic_show_options") eliminates replace_mount_options
in reiserfs_remount, but does not handle the allocated new_opts,
it will cause memory leak in the reiserfs_remount.

Because new_opts is useless in reiserfs_mount, so we fix this bug by
removing the useless new_opts in reiserfs_remount.

Fixes: c3d98ea ("VFS: Don't use save/replace_mount_options if not using generic_show_options")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dongliang Mu <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
mudongliang authored and jankara committed Oct 27, 2021
1 parent e96a186 commit 81dedaf
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions fs/reiserfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,18 +1437,13 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
unsigned long safe_mask = 0;
unsigned int commit_max_age = (unsigned int)-1;
struct reiserfs_journal *journal = SB_JOURNAL(s);
char *new_opts;
int err;
char *qf_names[REISERFS_MAXQUOTAS];
unsigned int qfmt = 0;
#ifdef CONFIG_QUOTA
int i;
#endif

new_opts = kstrdup(arg, GFP_KERNEL);
if (arg && !new_opts)
return -ENOMEM;

sync_filesystem(s);
reiserfs_write_lock(s);

Expand Down Expand Up @@ -1599,7 +1594,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
out_err_unlock:
reiserfs_write_unlock(s);
out_err:
kfree(new_opts);
return err;
}

Expand Down

0 comments on commit 81dedaf

Please sign in to comment.