Skip to contentSkip to conversation

fs, omfs: add NULL terminator in the end up the token list

PATCH In review Sasha Levin 2 participants 2 messages Mar 12, 2015 Omfs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs, omfs: add NULL terminator in the end up the token list

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.

---
 fs/omfs/inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/omfs/inode.c +2 -1
index 138321b..70d4191 100644
@@ -359,7 +359,7 @@ nomem:
 }
 
 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 = {
@@ -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)
Signature · 1 line
1.7.10.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Sasha Levin

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.

Yikes, thanks for the catch!

Quoted 1 line
Signature · 1 line
Bob Copeland %% http://bobcopeland.com/