Skip to content

Commit

Permalink
fs, omfs: add NULL terminator in the end up the token list
Browse files Browse the repository at this point in the history
match_token() expects a NULL terminator at the end of the token list so
that it would know where to stop.  Not having one causes it to overrun
to invalid memory.

In practice, passing a mount option that omfs didn't recognize would
sometimes panic the system.

Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Bob Copeland <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
sashalevin authored and torvalds committed May 29, 2015
1 parent cd4e6c9 commit dcbff39
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/omfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static int omfs_get_imap(struct super_block *sb)
}

enum {
Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask
Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask, Opt_err
};

static const match_table_t tokens = {
Expand All @@ -368,6 +368,7 @@ static const match_table_t tokens = {
{Opt_umask, "umask=%o"},
{Opt_dmask, "dmask=%o"},
{Opt_fmask, "fmask=%o"},
{Opt_err, NULL},
};

static int parse_options(char *options, struct omfs_sb_info *sbi)
Expand Down

0 comments on commit dcbff39

Please sign in to comment.