Skip to content

Commit

Permalink
net/9p: Fix crash due to bad mount parameters.
Browse files Browse the repository at this point in the history
It is not safe to use match_int without checking the token type returned
by match_token (especially when the token type returned is Opt_err and
args is empty). Fix it.

Signed-off-by: Abhishek Kulkarni <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Abhishek Kulkarni authored and davem330 committed Jul 2, 2009
1 parent 887b5ea commit 15da4b1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions net/9p/trans_fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,14 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
if (!*p)
continue;
token = match_token(p, tokens, args);
r = match_int(&args[0], &option);
if (r < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
ret = r;
continue;
if (token != Opt_err) {
r = match_int(&args[0], &option);
if (r < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
ret = r;
continue;
}
}
switch (token) {
case Opt_port:
Expand Down

0 comments on commit 15da4b1

Please sign in to comment.