linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/affs: fix potential memory leak in option parsing
@ 2018-05-22  4:24 Chengguang Xu
  2018-05-28 10:35 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2018-05-22  4:24 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: dsterba, dhowells, jlayton, viro, linux-kernel, Chengguang Xu

When specifying option 'prefix' multiple times,
current option parsing will cause memory leak.
Hence, call kfree for previous one in this case.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/affs/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/affs/super.c b/fs/affs/super.c
index e602619..d1ad11a 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -241,6 +241,7 @@ enum {
 			affs_set_opt(*mount_opts, SF_NO_TRUNCATE);
 			break;
 		case Opt_prefix:
+			kfree(*prefix);
 			*prefix = match_strdup(&args[0]);
 			if (!*prefix)
 				return 0;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/affs: fix potential memory leak in option parsing
  2018-05-22  4:24 [PATCH] fs/affs: fix potential memory leak in option parsing Chengguang Xu
@ 2018-05-28 10:35 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2018-05-28 10:35 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: linux-fsdevel, dhowells, jlayton, linux-kernel, viro

On Tue, May 22, 2018 at 12:24:25PM +0800, Chengguang Xu wrote:
> When specifying option 'prefix' multiple times,
> current option parsing will cause memory leak.
> Hence, call kfree for previous one in this case.
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>

Thanks, the patch and others that may queue up will be in my git tree
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git in a
branch with 'affs' somewhere in the name.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-28 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22  4:24 [PATCH] fs/affs: fix potential memory leak in option parsing Chengguang Xu
2018-05-28 10:35 ` David Sterba

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).