diff options
author | Abhishek Kulkarni <adkulkar@umail.iu.edu> | 2009-08-17 16:38:45 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2009-08-17 16:39:54 -0500 |
commit | 0aad37ef3deed118d3816e1d1a600eb2ec9dcb87 (patch) | |
tree | cbcfe9f449f57cd35d0ce262e5287da4f8476f30 /net | |
parent | 48559b4c30708ebdc849483da9fb83ee08c6c908 (diff) | |
download | kernel_samsung_crespo-0aad37ef3deed118d3816e1d1a600eb2ec9dcb87.zip kernel_samsung_crespo-0aad37ef3deed118d3816e1d1a600eb2ec9dcb87.tar.gz kernel_samsung_crespo-0aad37ef3deed118d3816e1d1a600eb2ec9dcb87.tar.bz2 |
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')
-rw-r--r-- | net/9p/client.c | 7 | ||||
-rw-r--r-- | net/9p/error.c | 2 |
2 files changed, 2 insertions, 7 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 7bbd2d5..5bf5f22 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) if (c->dotu) err = -ecode; - if (!err) { + if (!err || !IS_ERR_VALUE(err)) err = p9_errstr2errno(ename, strlen(ename)); - /* string match failed */ - if (!err) - err = -ESERVERFAULT; - } - P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); kfree(ename); diff --git a/net/9p/error.c b/net/9p/error.c index fdebe43..5251851 100644 --- a/net/9p/error.c +++ b/net/9p/error.c @@ -239,7 +239,7 @@ int p9_errstr2errno(char *errstr, int len) errstr[len] = 0; printk(KERN_ERR "%s: server reported unknown error %s\n", __func__, errstr); - errno = 1; + errno = ESERVERFAULT; } return -errno; |