Skip to content

Commit

Permalink
isofs: fix potential memory leak in mount option parsing
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
Chengguang Xu authored and jankara committed Apr 16, 2018
1 parent 96348e4 commit 4f34a51
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/isofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@ static int parse_options(char *options, struct iso9660_options *popt)
break;
#ifdef CONFIG_JOLIET
case Opt_iocharset:
kfree(popt->iocharset);
popt->iocharset = match_strdup(&args[0]);
if (!popt->iocharset)
return 0;
break;
#endif
case Opt_map_a:
Expand Down

0 comments on commit 4f34a51

Please sign in to comment.