diff options
author | Abhishek Kulkarni <adkulkar@umail.iu.edu> | 2009-08-17 17:38:45 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2009-08-17 17:39:54 -0400 |
commit | 0aad37ef3deed118d3816e1d1a600eb2ec9dcb87 (patch) | |
tree | cbcfe9f449f57cd35d0ce262e5287da4f8476f30 /net/9p/client.c | |
parent | 48559b4c30708ebdc849483da9fb83ee08c6c908 (diff) |
net/9p: insulate the client against an invalid error code sent by a 9p server
A looney tunes server sending an invalid error code (which is !IS_ERR_VALUE)
can result in a client oops. So fix it by adding a check and converting unknown
or invalid error codes to -ESERVERFAULT.
Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/client.c')
-rw-r--r-- | net/9p/client.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 7bbd2d5ae8d3..5bf5f227dbe0 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -411,14 +411,9 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
411 | if (c->dotu) | 411 | if (c->dotu) |
412 | err = -ecode; | 412 | err = -ecode; |
413 | 413 | ||
414 | if (!err) { | 414 | if (!err || !IS_ERR_VALUE(err)) |
415 | err = p9_errstr2errno(ename, strlen(ename)); | 415 | err = p9_errstr2errno(ename, strlen(ename)); |
416 | 416 | ||
417 | /* string match failed */ | ||
418 | if (!err) | ||
419 | err = -ESERVERFAULT; | ||
420 | } | ||
421 | |||
422 | P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); | 417 | P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); |
423 | 418 | ||
424 | kfree(ename); | 419 | kfree(ename); |