diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-04-14 08:16:06 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2018-04-16 03:47:41 -0400 |
commit | 4f34a5130a471f32f2fe7750769ab4057dc3eaa0 (patch) | |
tree | e862b0c04f12b3b019f953bd216e8b8400617ec8 | |
parent | 96348e49366c6e2a5a2e62ba0350f66ef5d67ea7 (diff) |
isofs: fix potential memory leak in mount option parsing
When specifying string type mount option (e.g., iocharset)
several times in a mount, current option parsing may
cause memory leak. Hence, call kfree for previous one
in this case. Meanwhile, check memory allocation result
for it.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/isofs/inode.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index bc258a4402f6..ec3fba7d492f 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -394,7 +394,10 @@ static int parse_options(char *options, struct iso9660_options *popt) | |||
394 | break; | 394 | break; |
395 | #ifdef CONFIG_JOLIET | 395 | #ifdef CONFIG_JOLIET |
396 | case Opt_iocharset: | 396 | case Opt_iocharset: |
397 | kfree(popt->iocharset); | ||
397 | popt->iocharset = match_strdup(&args[0]); | 398 | popt->iocharset = match_strdup(&args[0]); |
399 | if (!popt->iocharset) | ||
400 | return 0; | ||
398 | break; | 401 | break; |
399 | #endif | 402 | #endif |
400 | case Opt_map_a: | 403 | case Opt_map_a: |