mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Miklos Szeredi <mszeredi@redhat.com>,
	Yu Kuai <yukuai3@huawei.com>, Al Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: reiserfs: remove useless new_opts in reiserfs_remount
Date: Wed, 27 Oct 2021 16:45:38 +0200	[thread overview]
Message-ID: <20211027144538.GA19815@quack2.suse.cz> (raw)
In-Reply-To: <20211027143445.4156459-1-mudongliangabcd@gmail.com>

On Wed 27-10-21 22:34:41, Dongliang Mu wrote:
> Since the commit c3d98ea08291 ("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: c3d98ea08291 ("VFS: Don't use save/replace_mount_options if not using generic_show_options")
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>

Thanks. I've added the patch to my tree.

								Honza

> ---
>  fs/reiserfs/super.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
> index 58481f8d63d5..f7b05c6b3dcf 100644
> --- a/fs/reiserfs/super.c
> +++ b/fs/reiserfs/super.c
> @@ -1437,7 +1437,6 @@ 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;
> @@ -1445,10 +1444,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
>  	int i;
>  #endif
>  
> -	new_opts = kstrdup(arg, GFP_KERNEL);
> -	if (arg && !new_opts)
> -		return -ENOMEM;
> -
>  	sync_filesystem(s);
>  	reiserfs_write_lock(s);
>  
> @@ -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;
>  }
>  
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2021-10-27 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 14:34 Dongliang Mu
2021-10-27 14:45 ` Jan Kara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211027144538.GA19815@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=mudongliangabcd@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®