Skip to content

Commit

Permalink
9pnet_rdma: check token type before int conversion
Browse files Browse the repository at this point in the history
When parsing options, make sure we have found a proper token before
doing a numeric conversion.

Without this check, the current code will end up following random
pointers that just happened to be on the stack when this function was
called, because match_token() will not touch the 'args' list unless a
valid token is found.

Signed-off-by: Simon Derr <simon.derr@bull.net>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
  • Loading branch information
Simon Derr authored and Eric Van Hensbergen committed Mar 25, 2014
1 parent 263c582 commit 8a5daf1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/9p/trans_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
if (!*p)
continue;
token = match_token(p, tokens, args);
if (token == Opt_err)
continue;
r = match_int(&args[0], &option);
if (r < 0) {
p9_debug(P9_DEBUG_ERROR,
Expand Down

0 comments on commit 8a5daf1

Please sign in to comment.