linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Navid Emamdoost <navid.emamdoost@gmail.com>
Cc: Markus.Elfring@web.de,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Deepa Dinamani <deepa.kernel@gmail.com>,
	Jeff Layton <jlayton@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	David Sterba <dsterba@suse.com>,
	emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v2] fs: affs: fix a memory leak in affs_remount
Date: Wed, 2 Oct 2019 11:22:21 +0200	[thread overview]
Message-ID: <20191002092221.GJ2751@suse.cz> (raw)
In-Reply-To: <20190930210114.6557-1-navid.emamdoost@gmail.com>

On Mon, Sep 30, 2019 at 04:01:10PM -0500, Navid Emamdoost wrote:
> In affs_remount if data is provided it is duplicated into new_opts.
> The allocated memory for new_opts is only released if pare_options fail.
> The release for new_opts is added.

A variable that is allocated and freed without use should ring a bell to
look closer at the code. There's a bit of history behind new_options,
originally there was save/replace options on the VFS layer so the 'data'
passed must not change (thus strdup), this got cleaned up in later
patches. But not completely.

There's no reason to do the strdup in cases where the filesystem does
not need to reuse the 'data' again, because strsep would modify it
directly.

So new_opts should be removed. 

  parent reply	other threads:[~2019-10-02  9:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30  3:21 [PATCH] fs: affs: fix a memroy leak in affs_remount Navid Emamdoost
2019-09-30  6:02 ` [PATCH] fs: affs: fix a memory " Markus Elfring
2019-09-30 21:01   ` [PATCH v2] " Navid Emamdoost
2019-10-01  8:30     ` Markus Elfring
2019-10-01 17:34       ` Navid Emamdoost
2019-10-02  5:09         ` [v2] " Markus Elfring
2019-10-02  5:09         ` Markus Elfring
2019-10-02  9:22     ` David Sterba [this message]
2019-10-02 16:59       ` [PATCH v2] " Navid Emamdoost
2019-10-02 21:52       ` [PATCH v3] " Navid Emamdoost
2019-10-30 11:44         ` David Sterba
2019-09-30 21:01   ` [PATCH] " Navid Emamdoost

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=20191002092221.GJ2751@suse.cz \
    --to=dsterba@suse.cz \
    --cc=Markus.Elfring@web.de \
    --cc=deepa.kernel@gmail.com \
    --cc=dsterba@suse.com \
    --cc=emamd001@umn.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=jlayton@kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    --cc=smccaman@umn.edu \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).