Message ID | 20190930032200.30474-1-navid.emamdoost@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fs: affs: fix a memroy leak in affs_remount | expand |
* Please avoid typos in the commit message.
* I would prefer an other wording for the change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=97f9a3c4eee55b0178b518ae7114a6a53372913d#n151
> But this is not actually used later!
Can this information trigger the deletion of questionable source code
instead of adding a missing function call “kfree(new_opts)”?
How do you think about to add the tag “Fixes”?
Regards,
Markus
Fixed the issues in v2. Thanks, Navid. On Mon, Sep 30, 2019 at 1:03 AM Markus Elfring <Markus.Elfring@web.de> wrote: > > * Please avoid typos in the commit message. > > * I would prefer an other wording for the change description. > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=97f9a3c4eee55b0178b518ae7114a6a53372913d#n151 > > > > But this is not actually used later! > > Can this information trigger the deletion of questionable source code > instead of adding a missing function call “kfree(new_opts)”? > > > How do you think about to add the tag “Fixes”? > > Regards, > Markus
diff --git a/fs/affs/super.c b/fs/affs/super.c index cc463ae47c12..1d38fdbc5148 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -598,6 +598,8 @@ affs_remount(struct super_block *sb, int *flags, char *data) memcpy(sbi->s_volume, volume, 32); spin_unlock(&sbi->symlink_lock); + kfree(new_opts); + if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb)) return 0;
In affs_remount if data is provided it is duplicated into new_opts. But this is not actually used later! The allocated memory for new_opts is only released if pare_options fail. This commit adds release for new_opts. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> --- fs/affs/super.c | 2 ++ 1 file changed, 2 insertions(+)