mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
48559b4c30
commit
0aad37ef3d
2 changed files with 2 additions and 7 deletions
|
@ -411,14 +411,9 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
|
||||||
if (c->dotu)
|
if (c->dotu)
|
||||||
err = -ecode;
|
err = -ecode;
|
||||||
|
|
||||||
if (!err) {
|
if (!err || !IS_ERR_VALUE(err))
|
||||||
err = p9_errstr2errno(ename, strlen(ename));
|
err = p9_errstr2errno(ename, strlen(ename));
|
||||||
|
|
||||||
/* string match failed */
|
|
||||||
if (!err)
|
|
||||||
err = -ESERVERFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename);
|
P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename);
|
||||||
|
|
||||||
kfree(ename);
|
kfree(ename);
|
||||||
|
|
|
@ -239,7 +239,7 @@ int p9_errstr2errno(char *errstr, int len)
|
||||||
errstr[len] = 0;
|
errstr[len] = 0;
|
||||||
printk(KERN_ERR "%s: server reported unknown error %s\n",
|
printk(KERN_ERR "%s: server reported unknown error %s\n",
|
||||||
__func__, errstr);
|
__func__, errstr);
|
||||||
errno = 1;
|
errno = ESERVERFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
Loading…
Reference in a new issue