OSDN Git Service

affs: fix a memory leak in affs_remount
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Wed, 2 Oct 2019 21:52:37 +0000 (16:52 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 13:26:43 +0000 (14:26 +0100)
commit450c3d4166837c496ebce03650c08800991f2150
treee278f03b2091e8d80bba63be71df2cd0765e1a4f
parent6060c07d476ebb1f21d28db5ba852e911246ce79
affs: fix a memory leak in affs_remount

In affs_remount if data is provided it is duplicated into new_opts.  The
allocated memory for new_opts is only released if parse_options fails.

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.

Fixes: c8f33d0bec99 ("affs: kstrdup() memory handling")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/affs/super.c