]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit8ed1510a2e770b95887d4061f972dcd3d42d1782
treee278f03b2091e8d80bba63be71df2cd0765e1a4f
parent0b5f4bd2e19f949dda9a92362416c2acb9769f68
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: 21addb607b99 ("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